mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(post): support thumbnails from non-direct imgbb links
This commit is contained in:
@@ -79,6 +79,12 @@ export const getLinkMediaInfo = memoize(
|
|||||||
return { url: link, type: 'image' };
|
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 {
|
try {
|
||||||
mime = extName(new URL(link).pathname.toLowerCase().replace('/', ''))[0]?.mime;
|
mime = extName(new URL(link).pathname.toLowerCase().replace('/', ''))[0]?.mime;
|
||||||
if (mime) {
|
if (mime) {
|
||||||
|
|||||||
Reference in New Issue
Block a user