fedimbed: fix media from quoted
This commit is contained in:
		
							parent
							
								
									727af991ce
								
							
						
					
					
						commit
						d1d14f8fd4
					
				
					 1 changed files with 8 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -677,39 +677,31 @@ async function bluesky(msg, url, spoiler = false) {
 | 
			
		|||
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      /*case "app.bsky.embed.recordWithMedia#view": {
 | 
			
		||||
        hasQuote = true;
 | 
			
		||||
      case "app.bsky.embed.recordWithMedia#view": {
 | 
			
		||||
        //hasQuote = true;
 | 
			
		||||
 | 
			
		||||
        if (post.embed.media.$type === "app.bsky.embed.images#view") {
 | 
			
		||||
          images.push(post.embed.media.images.map((image) => ({media:{url: image.fullsize}, description: image.alt})));
 | 
			
		||||
          images.push(post.embed.media.images.map((image) => ({media: {url: image.fullsize}, description: image.alt})));
 | 
			
		||||
        } else if (post.embed.media.$type === "app.bsky.embed.video#view") {
 | 
			
		||||
          const lookup = await fetch(`https://plc.directory/${post.author.did}`).then((res) => res.json());
 | 
			
		||||
          const domain = lookup.service.find((service) => service.id === "#atproto_pds").serviceEndpoint;
 | 
			
		||||
          const videoUrl = `${domain}/xrpc/com.atproto.sync.getBlob?did=${post.author.did}&cid=${post.embed.media.cid}`;
 | 
			
		||||
 | 
			
		||||
          const contentType = await fetch(videoUrl, {
 | 
			
		||||
            method: "HEAD",
 | 
			
		||||
          }).then((res) => res.headers.get("Content-Type"));
 | 
			
		||||
          videos.push({media: {url: videoUrl}, description: post.embed.alt});
 | 
			
		||||
 | 
			
		||||
          videos.push({url: videoUrl, desc: post.embed.alt, type: contentType});
 | 
			
		||||
 | 
			
		||||
          embeds.push({...mainEmbed, fields: [{name: "\u200b", value: `[Video Link](${videoUrl})`}]});
 | 
			
		||||
          //embeds.push({...mainEmbed, fields: [{name: "\u200b", value: `[Video Link](${videoUrl})`}]});
 | 
			
		||||
        } else if (post.embed.media.$type === "app.bsky.embed.external#view") {
 | 
			
		||||
          if (post.embed.media.external.uri.includes("tenor.com")) {
 | 
			
		||||
            const url = new URL(post.embed.media.external.uri);
 | 
			
		||||
            url.searchParams.delete("hh");
 | 
			
		||||
            url.searchParams.delete("ww");
 | 
			
		||||
            embeds.push({...mainEmbed, image: {url: url.toString()}});
 | 
			
		||||
          } else {
 | 
			
		||||
            embeds.push(mainEmbed);
 | 
			
		||||
            //embeds.push({...mainEmbed, image: {url: url.toString()}});
 | 
			
		||||
          }
 | 
			
		||||
        } else {
 | 
			
		||||
          embeds.push(mainEmbed);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const quoteData = await blueskyQuoteEmbed(post.embed.record.record);
 | 
			
		||||
        if (quoteData.videos.length > 0) videos.push(...quoteData.videos);
 | 
			
		||||
        embeds.push(...quoteData.embeds);
 | 
			
		||||
        //embeds.push(...quoteData.embeds);
 | 
			
		||||
 | 
			
		||||
        if (quoteData.adult) adult = true;
 | 
			
		||||
        if (quoteData.hidden) hidden = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -717,7 +709,7 @@ async function bluesky(msg, url, spoiler = false) {
 | 
			
		|||
        if (quoteData.tags.length > 0) tags.push(...quoteData.tags);
 | 
			
		||||
 | 
			
		||||
        break;
 | 
			
		||||
      }*/
 | 
			
		||||
      }
 | 
			
		||||
      case "app.bsky.embed.external#view": {
 | 
			
		||||
        if (post.embed.external.uri.includes("tenor.com")) {
 | 
			
		||||
          const url = new URL(post.embed.external.uri);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue