feat(post): support thumbnails from non-direct imgbb links

This commit is contained in:
Tom (plebeius.eth)
2024-10-14 15:28:30 +02:00
parent 3918d231c6
commit 9e24ae0aed
+6
View File
@@ -79,6 +79,12 @@ export const getLinkMediaInfo = memoize(
return { url: link, type: 'image' };
}
// non-direct imgbb links can return lower res thumbnails
if (url.host === 'ibb.co') {
const imageId = url.pathname.split('/')[1];
return { url: link, type: 'webpage', thumbnail: `https://i.ibb.co/${imageId}/thumbnail.jpg` };
}
try {
mime = extName(new URL(link).pathname.toLowerCase().replace('/', ''))[0]?.mime;
if (mime) {