fedimbed: make iceshrimp fallback normal mastoapi api call, copypaste moment
This commit is contained in:
		
							parent
							
								
									134f417b91
								
							
						
					
					
						commit
						ac11f3a46b
					
				
					 1 changed files with 12 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -661,10 +661,17 @@ async function fetchPost(url, platform, forceMastoAPI = false) {
 | 
			
		|||
        noteId = noteId.split("#")[0];
 | 
			
		||||
      }
 | 
			
		||||
      logger.verbose("fedimbed", "Misskey post ID: " + noteId);
 | 
			
		||||
      redirUrl = urlObj.origin + "/api/notes/show/";
 | 
			
		||||
      options.method = "POST";
 | 
			
		||||
      options.body = JSON.stringify({noteId});
 | 
			
		||||
      headers["Content-Type"] = "application/json";
 | 
			
		||||
 | 
			
		||||
      // iceshrimp has an entire .NET rewrite and only supports MastoAPI it seems
 | 
			
		||||
      // *should* be fine for older iceshrimp-js instances
 | 
			
		||||
      if (platform == "iceshrimp") {
 | 
			
		||||
        redirUrl = urlObj.origin + "/api/v1/statuses/" + noteId;
 | 
			
		||||
      } else {
 | 
			
		||||
        redirUrl = urlObj.origin + "/api/notes/show/";
 | 
			
		||||
        options.method = "POST";
 | 
			
		||||
        options.body = JSON.stringify({noteId});
 | 
			
		||||
        headers["Content-Type"] = "application/json";
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      logger.error("fedimbed", `Missing MastoAPI replacement for "${platform}"`);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -951,7 +958,7 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
            replyData.account?.fqn ?? `${replyData.account?.username ?? replyData.user?.username}@${urlObj.hostname}`
 | 
			
		||||
          })`;
 | 
			
		||||
        } else {
 | 
			
		||||
          const authorData = await signedFetch(postData.actor ?? postData.attributedTo, {
 | 
			
		||||
          const authorData = await signedFetch(replyData.actor ?? replyData.attributedTo, {
 | 
			
		||||
            headers: {
 | 
			
		||||
              "User-Agent": FRIENDLY_USERAGENT,
 | 
			
		||||
              Accept: "application/activity+json",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue