forked from Kieran/snort
feat: expect webp from void.cat
This commit is contained in:
parent
e21494cc2d
commit
0a6339ddf1
@ -28,8 +28,11 @@ export default async function VoidUpload(file: File | Blob, filename: string): P
|
|||||||
let rsp: VoidUploadResponse = await req.json();
|
let rsp: VoidUploadResponse = await req.json();
|
||||||
if (rsp.ok) {
|
if (rsp.ok) {
|
||||||
let ext = filename.match(FileExtensionRegex);
|
let ext = filename.match(FileExtensionRegex);
|
||||||
|
if(rsp.file?.metadata?.mimeType === "image/webp") {
|
||||||
|
ext = ["", "webp"];
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
url: rsp.file?.meta?.url ?? `${VoidCatHost}/d/${rsp.file?.id}${ext ? `.${ext[1]}` : ""}`
|
url: rsp.file?.metadata?.url ?? `${VoidCatHost}/d/${rsp.file?.id}${ext ? `.${ext[1]}` : ""}`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
@ -50,7 +53,7 @@ export type VoidUploadResponse = {
|
|||||||
|
|
||||||
export type VoidFile = {
|
export type VoidFile = {
|
||||||
id: string,
|
id: string,
|
||||||
meta?: VoidFileMeta
|
metadata?: VoidFileMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
export type VoidFileMeta = {
|
export type VoidFileMeta = {
|
||||||
|
Loading…
Reference in New Issue
Block a user