fedimbed: fix emotes for platforms that dont use it, limmy old. redirect
This commit is contained in:
		
							parent
							
								
									a0c037b6e9
								
							
						
					
					
						commit
						784f2d9c20
					
				
					 1 changed files with 13 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -105,6 +105,14 @@ async function signedFetch(url, options) {
 | 
			
		|||
 | 
			
		||||
async function processUrl(msg, url, spoiler = false) {
 | 
			
		||||
  let urlObj = new URL(url);
 | 
			
		||||
 | 
			
		||||
  // some limmy instances have old reddit frontend subdomains
 | 
			
		||||
  // but these frontends are just frontends and dont actually expose the API
 | 
			
		||||
  if (urlObj.hostname.startsWith("old.")) {
 | 
			
		||||
    urlObj.hostname = urlObj.hostname.replace("old.", "");
 | 
			
		||||
    url = urlObj.href;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let platform = await resolvePlatform(url);
 | 
			
		||||
  let color = PLATFORM_COLORS[platform];
 | 
			
		||||
  let platformName = platform
 | 
			
		||||
| 
						 | 
				
			
			@ -364,9 +372,11 @@ async function processUrl(msg, url, spoiler = false) {
 | 
			
		|||
    if (!spoiler && postData.sensitive) {
 | 
			
		||||
      spoiler = true;
 | 
			
		||||
    }
 | 
			
		||||
    emotes = postData.tag
 | 
			
		||||
      .filter((x) => !!x.icon)
 | 
			
		||||
      .map((x) => ({name: x.name, url: x.icon.url}));
 | 
			
		||||
 | 
			
		||||
    if (postData.tag)
 | 
			
		||||
      emotes = postData.tag
 | 
			
		||||
        .filter((x) => !!x.icon)
 | 
			
		||||
        .map((x) => ({name: x.name, url: x.icon.url}));
 | 
			
		||||
 | 
			
		||||
    // NB: gts doesnt send singular attachments as areay
 | 
			
		||||
    const attachments = Array.isArray(postData.attachment)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue