fedimbed: new limit fixes
This commit is contained in:
		
							parent
							
								
									a82fa92bed
								
							
						
					
					
						commit
						79041eee98
					
				
					 1 changed files with 14 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1456,15 +1456,25 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
 | 
			
		|||
    },
 | 
			
		||||
  };
 | 
			
		||||
  if (images.length > 0) {
 | 
			
		||||
    const overMax = images.length + videos.length > 40;
 | 
			
		||||
    if (images.length > 10) {
 | 
			
		||||
      let i = 0;
 | 
			
		||||
      while (images.length > 10) {
 | 
			
		||||
        let max = 10;
 | 
			
		||||
        if (i == 3 && overMax) {
 | 
			
		||||
          if (videos.length > 0) max -= videos.length;
 | 
			
		||||
        }
 | 
			
		||||
        if (i == 4) break;
 | 
			
		||||
 | 
			
		||||
        container.components.push({
 | 
			
		||||
          type: 12,
 | 
			
		||||
          items: images.splice(0, 10),
 | 
			
		||||
          items: images.splice(0, max),
 | 
			
		||||
        });
 | 
			
		||||
        i++;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // FIXME: guhhhhhh math
 | 
			
		||||
    container.components.push({
 | 
			
		||||
      type: 12,
 | 
			
		||||
      items: images,
 | 
			
		||||
| 
						 | 
				
			
			@ -1478,7 +1488,8 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
 | 
			
		|||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (audios.length > 0) {
 | 
			
		||||
  // FIXME: splitting if >5
 | 
			
		||||
  if (audios.length > 0 && audios.length < 6) {
 | 
			
		||||
    container.components.push(
 | 
			
		||||
      {
 | 
			
		||||
        type: 10,
 | 
			
		||||
| 
						 | 
				
			
			@ -1512,12 +1523,8 @@ async function processUrl(msg, url, spoiler = false, command = false, inQuote =
 | 
			
		|||
    } else {
 | 
			
		||||
      quoteComponents.splice(0, 0, {type: 10, content: quoteContext});
 | 
			
		||||
    }
 | 
			
		||||
    if (container.components.length + quoteComponents.length + 1 > 10) {
 | 
			
		||||
      components.push(quoteComponents);
 | 
			
		||||
    } else {
 | 
			
		||||
    container.components.push({type: 14}, ...quoteComponents);
 | 
			
		||||
  }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    response: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue