From 7add754fc31757e6a49f7be9bb65543d68c6aa07 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 10 Jan 2023 10:03:15 -0600 Subject: [PATCH] fix(web) show exif info in public shared (#1283) * fix(web) show exif in public share page * Added exif info to return payload' --- .../apps/immich/src/api-v1/share/share.core.ts | 2 +- .../src/api-v1/share/shared-link.repository.ts | 8 ++++++-- .../components/asset-viewer/asset-viewer.svelte | 17 ++++++++--------- .../components/asset-viewer/detail-panel.svelte | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/server/apps/immich/src/api-v1/share/share.core.ts b/server/apps/immich/src/api-v1/share/share.core.ts index c65008eb40..97828747cb 100644 --- a/server/apps/immich/src/api-v1/share/share.core.ts +++ b/server/apps/immich/src/api-v1/share/share.core.ts @@ -48,7 +48,7 @@ export class ShareCore { async getSharedLinkById(id: string): Promise { const link = await this.sharedLinkRepository.getById(id); - + console.log(link); if (!link) { throw new BadRequestException('Shared link not found'); } diff --git a/server/apps/immich/src/api-v1/share/shared-link.repository.ts b/server/apps/immich/src/api-v1/share/shared-link.repository.ts index c7335124cb..48ce80de09 100644 --- a/server/apps/immich/src/api-v1/share/shared-link.repository.ts +++ b/server/apps/immich/src/api-v1/share/shared-link.repository.ts @@ -57,10 +57,14 @@ export class SharedLinkRepository implements ISharedLinkRepository { id: id, }, relations: { - assets: true, + assets: { + exifInfo: true, + }, album: { assets: { - assetInfo: true, + assetInfo: { + exifInfo: true, + }, }, }, }, diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 2c963f6115..da6156e3c5 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -23,14 +23,6 @@ export let publicSharedKey = ''; export let showNavigation = true; - $: { - appearsInAlbums = []; - - api.albumApi.getAllAlbums(undefined, asset.id).then((result) => { - appearsInAlbums = result.data; - }); - } - const dispatch = createEventDispatcher(); let halfLeftHover = false; let halfRightHover = false; @@ -41,8 +33,15 @@ let shouldPlayMotionPhoto = false; const onKeyboardPress = (keyInfo: KeyboardEvent) => handleKeyboardPress(keyInfo.key); - onMount(() => { + onMount(async () => { document.addEventListener('keydown', onKeyboardPress); + + try { + const { data } = await api.albumApi.getAllAlbums(undefined, asset.id); + appearsInAlbums = data; + } catch (e) { + console.error('Error getting album that asset belong to', e); + } }); onDestroy(() => { diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index ba606915a2..56262fb73f 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -23,7 +23,7 @@ drawMap(asset.exifInfo.latitude, asset.exifInfo.longitude); } - export let albums: AlbumResponseDto[]; + export let albums: AlbumResponseDto[] = []; onMount(async () => { if (browser) {