fix: audio detection of .oggs

feat/type-attributes
Tomáš Mládek 2022-10-23 11:24:47 +02:00
parent 23b3388ea5
commit e21c29cb02
2 changed files with 6 additions and 5 deletions

View File

@ -91,8 +91,6 @@
/>
{:else if types.fragment}
<FragmentViewer {address} detail={false} />
{:else if types.video}
<VideoViewer {address} detail={false} />
{:else if types.audio}
<div class="audiopreview image">
{#if handled && imageLoaded != address}
@ -101,7 +99,7 @@
</div>
{/if}
<img
src="{API_URL}/thumb/{address}"
src="{API_URL}/thumb/{address}?mime=audio"
alt="Thumbnail for {address}..."
on:load={() => (imageLoaded = address)}
on:error={() => (handled = false)}
@ -112,6 +110,8 @@
</div>
{/if}
</div>
{:else if types.video}
<VideoViewer {address} detail={false} />
{:else}
<div class="image" class:loaded={imageLoaded == address || !handled}>
{#if handled && imageLoaded != address}

View File

@ -9,8 +9,9 @@ export function getTypes(entity: UpObject, entityInfo: EntityInfo) {
["video", "application/x-matroska"].some((p) => mimeType.startsWith(p)) ||
entity?.identify().some((l) => l.endsWith(".avi"));
const audio =
["audio", "application/x-riff"].some((p) => mimeType.startsWith(p)) &&
!video;
(["audio", "application/x-riff"].some((p) => mimeType.startsWith(p)) &&
!video) ||
entity?.identify().some((l) => l.endsWith(".ogg"));
const image = mimeType.startsWith("image");
const text = mimeType.startsWith("text");
const pdf = mimeType.startsWith("application/pdf");