mirror of
https://git.coom.tech/fuckjannies/lolipiss.git
synced 2024-06-26 12:42:38 +00:00
Working: ordinary embeds, third-eye. [Not Tested]: pomf.
Merge branch 'feat-black-posts' into 中出し
This commit is contained in:
commit
add0d7bb19
|
@ -44,16 +44,18 @@
|
||||||
if (settled) return
|
if (settled) return
|
||||||
settled = true
|
settled = true
|
||||||
|
|
||||||
if(file.thumbnail == null) return
|
// media is to be either thumbnail or data
|
||||||
const thumb = typeof file.thumbnail === 'function' ? (await file.thumbnail()) : file.data;
|
|
||||||
// const thumb = file.thumbnail || file.data
|
// const thumb = file.thumbnail || file.data
|
||||||
|
const media = typeof file.thumbnail === 'function' ? (await file.thumbnail()) : file.data;
|
||||||
|
if(media == null) return
|
||||||
|
|
||||||
let type: FileTypeResult | undefined
|
let type: FileTypeResult | undefined
|
||||||
if (thumb instanceof Buffer) {
|
if (media instanceof ArrayBuffer || media instanceof Uint8Array) {
|
||||||
type = await fileTypeFromBuffer(thumb);
|
type = await fileTypeFromBuffer(media);
|
||||||
url = URL.createObjectURL(new Blob([thumb], { type: type?.mime }))
|
url = URL.createObjectURL(new Blob([media], { type: type?.mime }))
|
||||||
// if (!type) return; // extracted out below for TypeScript
|
// if (!type) return; // extracted out below for TypeScript
|
||||||
} else if (typeof thumb === 'string'){
|
} else if (typeof media === 'string'){
|
||||||
let head = headerStringToObject(await GM_head(thumb, undefined))
|
let head = headerStringToObject(await GM_head(media, undefined))
|
||||||
// TODO write a proper getExt() and getMime()
|
// TODO write a proper getExt() and getMime()
|
||||||
type = { ext: '' as any, mime: head['content-type'].split(';')[0].trim() }
|
type = { ext: '' as any, mime: head['content-type'].split(';')[0].trim() }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user