diff --git a/webui/src/components/display/BlobPreview.svelte b/webui/src/components/display/BlobPreview.svelte index 7a3cd13..0fa383e 100644 --- a/webui/src/components/display/BlobPreview.svelte +++ b/webui/src/components/display/BlobPreview.svelte @@ -8,26 +8,32 @@ $: ({ entity } = useEntity(address)); $: mimeType = String($entity?.get("FILE_MIME")); - $: handled = - Boolean(mimeType) && - ["audio", "video", "image", "model", "text", "application/pdf"].some( - (prefix) => mimeType.startsWith(prefix) - ); + + $: audio = mimeType.startsWith("audio"); + $: video = ["video", "application/x-matroska"].some((p) => + mimeType.startsWith(p) + ); + $: image = mimeType.startsWith("image"); + $: text = mimeType.startsWith("text"); + $: pdf = mimeType.startsWith("pdf"); + $: model = mimeType?.startsWith("model"); + + $: handled = audio || video || image || text || pdf || model; let imageLoaded = null; {#if handled}
- {#if mimeType?.startsWith("text")} + {#if text}
{/if} - {#if mimeType?.startsWith("audio")} + {#if audio}