chore(server): optional originalMimeType in asset response payload (#10272)

* chore(server): optional originalMimeType in asset response payload

* lint

* Update web/src/lib/utils/asset-utils.ts

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>

* fix permission of shared link

* test

* test

* test

* test server

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Alex
2024-06-13 09:21:47 -05:00
committed by GitHub
parent df31eb1214
commit e2a2c86a31
12 changed files with 126 additions and 14 deletions

View File

@@ -9,7 +9,7 @@
import { isWebCompatibleImage } from '$lib/utils/asset-utils';
import { getBoundingBox } from '$lib/utils/people-utils';
import { getAltText } from '$lib/utils/thumbnail-util';
import { AssetTypeEnum, type AssetResponseDto, AssetMediaSize } from '@immich/sdk';
import { AssetTypeEnum, type AssetResponseDto, AssetMediaSize, type SharedLinkResponseDto } from '@immich/sdk';
import { zoomImageAction, zoomed } from '$lib/actions/zoom-image';
import { canCopyImagesToClipboard, copyImageToClipboard } from 'copy-image-clipboard';
import { onDestroy } from 'svelte';
@@ -23,7 +23,7 @@
export let preloadAssets: AssetResponseDto[] | undefined = undefined;
export let element: HTMLDivElement | undefined = undefined;
export let haveFadeTransition = true;
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
export let copyImage: (() => Promise<void>) | null = null;
export let zoomToggle: (() => void) | null = null;
@@ -67,6 +67,10 @@
};
const getAssetUrl = (id: string, useOriginal: boolean, checksum: string) => {
if (sharedLink && (!sharedLink.allowDownload || !sharedLink.showMetadata)) {
return getAssetThumbnailUrl({ id, size: AssetMediaSize.Preview, checksum });
}
return useOriginal
? getAssetOriginalUrl({ id, checksum })
: getAssetThumbnailUrl({ id, size: AssetMediaSize.Preview, checksum });