let native app fetch imgbb full images from non-direct links

This commit is contained in:
Tom (plebeius.eth)
2024-10-15 17:51:01 +02:00
parent 6f8a6e38d4
commit 5739f413a9
+6
View File
@@ -81,6 +81,12 @@ export const getLinkMediaInfo = memoize(
return { url: link, type: 'image' };
}
// Non-direct imgbb links can return lower res thumbnails on web. On native, the full image can be fetched later.
if (url.host === 'ibb.co' && !Capacitor.isNativePlatform()) {
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) {