fedimbed: mastodon makes every attachment Document smh
This commit is contained in:
		
							parent
							
								
									6f8596a55f
								
							
						
					
					
						commit
						3e574fd637
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1167,7 +1167,8 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
      const attachments = Array.isArray(postData.attachment) ? postData.attachment : [postData.attachment];
 | 
			
		||||
      for (const attachment of attachments) {
 | 
			
		||||
        if (attachment.url) {
 | 
			
		||||
          const type = attachment.type?.toLowerCase();
 | 
			
		||||
          const type = attachment.type?.toLowerCase() ?? "";
 | 
			
		||||
          const mediaType = attachment.mediaType ?? "";
 | 
			
		||||
 | 
			
		||||
          let attUrl = attachment.url;
 | 
			
		||||
          if (Array.isArray(attachment.url)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1188,17 +1189,17 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
          }
 | 
			
		||||
 | 
			
		||||
          const attDesc = attachment.name ?? attachment.description ?? attachment.comment;
 | 
			
		||||
          if (type.startsWith("image")) {
 | 
			
		||||
          if (type.startsWith("image") || mediaType.startsWith("image")) {
 | 
			
		||||
            images.push({
 | 
			
		||||
              media: {url: attUrl},
 | 
			
		||||
              description: attDesc?.length > 0 ? attDesc : null,
 | 
			
		||||
            });
 | 
			
		||||
          } else if (type.startsWith("video")) {
 | 
			
		||||
          } else if (type.startsWith("video") || mediaType.startsWith("video")) {
 | 
			
		||||
            videos.push({
 | 
			
		||||
              media: {url: attUrl},
 | 
			
		||||
              description: attDesc?.length > 0 ? attDesc : null,
 | 
			
		||||
            });
 | 
			
		||||
          } else if (type.startsWith("audio")) {
 | 
			
		||||
          } else if (type.startsWith("audio") || mediaType.startsWith("audio")) {
 | 
			
		||||
            audios.push({
 | 
			
		||||
              url: attUrl,
 | 
			
		||||
              description: attDesc?.length > 0 ? attDesc : null,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue