You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-24 04:46:50 +02:00
refactor(web): shared link key auth (#3855)
This commit is contained in:
@ -26,7 +26,6 @@
|
||||
|
||||
export let assetStore: AssetStore | null = null;
|
||||
export let asset: AssetResponseDto;
|
||||
export let publicSharedKey = '';
|
||||
export let showNavigation = true;
|
||||
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
|
||||
|
||||
@ -72,6 +71,10 @@
|
||||
$: asset.id && !sharedLink && getAllAlbums(); // Update the album information when the asset ID changes
|
||||
|
||||
const getAllAlbums = async () => {
|
||||
if (api.isSharedLink) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { data } = await api.albumApi.getAllAlbums({ assetId: asset.id });
|
||||
appearsInAlbums = data;
|
||||
@ -84,7 +87,9 @@
|
||||
switch (key) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (shiftKey) toggleArchive();
|
||||
if (shiftKey) {
|
||||
toggleArchive();
|
||||
}
|
||||
return;
|
||||
case 'ArrowLeft':
|
||||
navigateAssetBackward();
|
||||
@ -94,7 +99,9 @@
|
||||
return;
|
||||
case 'd':
|
||||
case 'D':
|
||||
if (shiftKey) downloadFile(asset, publicSharedKey);
|
||||
if (shiftKey) {
|
||||
downloadFile(asset);
|
||||
}
|
||||
return;
|
||||
case 'Delete':
|
||||
isShowDeleteConfirmation = true;
|
||||
@ -272,7 +279,7 @@
|
||||
showDownloadButton={shouldShowDownloadButton}
|
||||
on:goBack={closeViewer}
|
||||
on:showDetail={showDetailInfoHandler}
|
||||
on:download={() => downloadFile(asset, publicSharedKey)}
|
||||
on:download={() => downloadFile(asset)}
|
||||
on:delete={() => (isShowDeleteConfirmation = true)}
|
||||
on:favorite={toggleFavorite}
|
||||
on:addToAlbum={() => openAlbumPicker(false)}
|
||||
@ -304,7 +311,6 @@
|
||||
{:else if asset.type === AssetTypeEnum.Image}
|
||||
{#if shouldPlayMotionPhoto && asset.livePhotoVideoId}
|
||||
<VideoViewer
|
||||
{publicSharedKey}
|
||||
assetId={asset.livePhotoVideoId}
|
||||
on:close={closeViewer}
|
||||
on:onVideoEnded={() => (shouldPlayMotionPhoto = false)}
|
||||
@ -312,12 +318,12 @@
|
||||
{:else if asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR || asset.originalPath
|
||||
.toLowerCase()
|
||||
.endsWith('.insp')}
|
||||
<PanoramaViewer {publicSharedKey} {asset} />
|
||||
<PanoramaViewer {asset} />
|
||||
{:else}
|
||||
<PhotoViewer {publicSharedKey} {asset} on:close={closeViewer} />
|
||||
<PhotoViewer {asset} on:close={closeViewer} />
|
||||
{/if}
|
||||
{:else}
|
||||
<VideoViewer {publicSharedKey} assetId={asset.id} on:close={closeViewer} />
|
||||
<VideoViewer assetId={asset.id} on:close={closeViewer} />
|
||||
{/if}
|
||||
{/key}
|
||||
</div>
|
||||
@ -338,7 +344,6 @@
|
||||
<DetailPanel
|
||||
{asset}
|
||||
albums={appearsInAlbums}
|
||||
{sharedLink}
|
||||
on:close={() => ($isShowDetail = false)}
|
||||
on:close-viewer={handleCloseViewer}
|
||||
on:description-focus-in={disableKeyDownEvent}
|
||||
|
Reference in New Issue
Block a user