fedimbed: new limit fixes

This commit is contained in:
Cynthia Foxwell 2025-04-30 12:35:28 -06:00
parent a82fa92bed
commit 79041eee98
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -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: {