From 020da3cca07ae5d878642e6ba07725e8ff2ab7d9 Mon Sep 17 00:00:00 2001 From: Owais Jamil Date: Tue, 16 Jun 2026 23:26:05 -0500 Subject: [PATCH] feat: MIME type images --- .changeset/config.json | 5 +- src/lib/atproto/blobs.svelte.ts | 11 +- src/lib/atproto/types.ts | 4 +- src/lib/components/CollectionBrowser.svelte | 2 +- src/lib/components/EyeOfGnome.svelte | 2 +- src/lib/components/IdentityInspector.svelte | 23 +++- src/routes/+layout.svelte | 13 +-- .../icons/humanity/mimes/image-x-generic.svg | 38 +++++++ .../icons/humanity/mimes/video-x-generic.svg | 103 ++++++++++++++++++ .../icons/humanity/status/image-missing.svg | 66 +++++++++++ 10 files changed, 241 insertions(+), 26 deletions(-) create mode 100644 static/icons/humanity/mimes/image-x-generic.svg create mode 100644 static/icons/humanity/mimes/video-x-generic.svg create mode 100644 static/icons/humanity/status/image-missing.svg diff --git a/.changeset/config.json b/.changeset/config.json index c2e48e5..026cedb 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -8,8 +8,5 @@ "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [], - "privatePackages": { - "version": true, - "tag": true - } + "privatePackages": { "version": true, "tag": true } } diff --git a/src/lib/atproto/blobs.svelte.ts b/src/lib/atproto/blobs.svelte.ts index 7138336..7aa3046 100644 --- a/src/lib/atproto/blobs.svelte.ts +++ b/src/lib/atproto/blobs.svelte.ts @@ -81,7 +81,7 @@ class RepoBlobState { openMedia(identity: AccountIdentity, media: BlobReference) { this.loadedDid = identity.did; - const summary = blobSummary(identity, media.cid, media.sourceUri); + const summary = blobSummary(identity, media.cid, media.sourceUri, media.sourceIcon); if (!this.blobs.some((blob) => blob.cid === media.cid)) { this.blobs = [summary, ...this.blobs]; @@ -138,8 +138,13 @@ async function listBlobPage(identity: AccountIdentity, cursor?: string | null) { ); } -function blobSummary(identity: AccountIdentity, cid: string, sourceUri: string | null): RepoBlobSummary { - return { cid, sourceUri, rawUrl: rawBlobUrl(identity, cid) }; +function blobSummary( + identity: AccountIdentity, + cid: string, + sourceUri: string | null, + sourceIcon?: string +): RepoBlobSummary { + return { cid, sourceUri, sourceIcon, rawUrl: rawBlobUrl(identity, cid) }; } function rawBlobUrl(identity: AccountIdentity, cid: string) { diff --git a/src/lib/atproto/types.ts b/src/lib/atproto/types.ts index 4f894f4..d547dc5 100644 --- a/src/lib/atproto/types.ts +++ b/src/lib/atproto/types.ts @@ -38,9 +38,9 @@ export type RepoRecordSummary = { appLabel: string | null; }; -export type BlobReference = { cid: string; sourceUri: string | null }; +export type BlobReference = { cid: string; sourceUri: string | null; sourceIcon?: string }; -export type RepoBlobSummary = { cid: string; rawUrl: string; sourceUri: string | null }; +export type RepoBlobSummary = { cid: string; rawUrl: string; sourceUri: string | null; sourceIcon?: string }; export type RecordRouteParams = { did: string; collection: string; rkey: string }; diff --git a/src/lib/components/CollectionBrowser.svelte b/src/lib/components/CollectionBrowser.svelte index c8dc0f6..b142055 100644 --- a/src/lib/components/CollectionBrowser.svelte +++ b/src/lib/components/CollectionBrowser.svelte @@ -48,7 +48,7 @@ if (identity && blob) { repoBrowser.selectedRecord = record; - repoBlobs.openMedia(identity, blob); + repoBlobs.openMedia(identity, { ...blob, sourceIcon: record.icon }); windowManager.setTitle('eog', `${blob.cid} - Eye of GNOME`, '/icons/humanity/apps/eog.svg'); windowManager.open('eog'); void goto(blobPath(identity.did, blob.cid), { keepFocus: true, noScroll: true }); diff --git a/src/lib/components/EyeOfGnome.svelte b/src/lib/components/EyeOfGnome.svelte index ba3adf8..093413d 100644 --- a/src/lib/components/EyeOfGnome.svelte +++ b/src/lib/components/EyeOfGnome.svelte @@ -76,7 +76,7 @@ class:active={blob.cid === repoBlobs.selectedCid} aria-current={blob.cid === repoBlobs.selectedCid ? 'true' : undefined} onclick={() => selectBlob(blob.cid)}> - + {blob.cid} {/each} diff --git a/src/lib/components/IdentityInspector.svelte b/src/lib/components/IdentityInspector.svelte index a7e135b..f3ff93e 100644 --- a/src/lib/components/IdentityInspector.svelte +++ b/src/lib/components/IdentityInspector.svelte @@ -16,7 +16,12 @@ return [ { id: 'overview', label: 'Identity', icon: '/icons/humanity/status/network-wireless-encrypted.svg', count: 1 }, - { id: 'aliases', label: 'Handle aliases', icon: '/icons/humanity/places/user-home.svg', count: inspection.aliases.length }, + { + id: 'aliases', + label: 'Handle aliases', + icon: '/icons/humanity/places/user-home.svg', + count: inspection.aliases.length + }, { id: 'services', label: 'Services', @@ -136,7 +141,11 @@ {:else}
- +

Default public keyring

{inspection.handle ? `@${inspection.handle}` : inspection.did}

@@ -167,7 +176,10 @@ {#if inspection.handleValidation}
{#each [inspection.handleValidation.resolveHandle, inspection.handleValidation.wellKnown, inspection.handleValidation.dnsTxt] as check (check.label)} -
+
{service.id ?? 'Unnamed service'}

{service.type ?? 'Unknown service type'}

- {typeof service.serviceEndpoint === 'string' ? service.serviceEndpoint : JSON.stringify(service.serviceEndpoint)} + {typeof service.serviceEndpoint === 'string' + ? service.serviceEndpoint + : JSON.stringify(service.serviceEndpoint)}
{:else} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e8d282d..d2f6954 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -217,13 +217,7 @@ accountSetup.load(); } - async function openRepoRoute(route: { - did: string; - app?: string; - collection?: string; - rkey?: string; - cid?: string; - }) { + async function openRepoRoute(route: { did: string; app?: string; collection?: string; rkey?: string; cid?: string }) { try { const { hydratePublicIdentity } = await import('$lib/atproto/identity'); const identity = await hydratePublicIdentity(route.did); @@ -241,10 +235,7 @@ if (route.app === 'blobs') { await repoBrowser.load(identity); await repoBlobs.load(identity, route.cid); - windowManager.setTitle( - 'eog', - route.cid ? `${route.cid} - Eye of GNOME` : `${identity.handle} - Eye of GNOME` - ); + windowManager.setTitle('eog', route.cid ? `${route.cid} - Eye of GNOME` : `${identity.handle} - Eye of GNOME`); windowManager.open('eog'); return; } diff --git a/static/icons/humanity/mimes/image-x-generic.svg b/static/icons/humanity/mimes/image-x-generic.svg new file mode 100644 index 0000000..cda8293 --- /dev/null +++ b/static/icons/humanity/mimes/image-x-generic.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/icons/humanity/mimes/video-x-generic.svg b/static/icons/humanity/mimes/video-x-generic.svg new file mode 100644 index 0000000..92f1d7e --- /dev/null +++ b/static/icons/humanity/mimes/video-x-generic.svg @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/icons/humanity/status/image-missing.svg b/static/icons/humanity/status/image-missing.svg new file mode 100644 index 0000000..bf6a7eb --- /dev/null +++ b/static/icons/humanity/status/image-missing.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.51.2