mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(web): shared link key auth (#3855)
This commit is contained in:
parent
10c2bda3a9
commit
9bbef4a97b
21 changed files with 115 additions and 108 deletions
|
|
@ -6,7 +6,6 @@
|
|||
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
||||
|
||||
export let filename = 'immich.zip';
|
||||
export let sharedLinkKey: string | undefined = undefined;
|
||||
export let menuItem = false;
|
||||
|
||||
const { getAssets, clearSelect } = getAssetControlContext();
|
||||
|
|
@ -15,12 +14,12 @@
|
|||
const assets = Array.from(getAssets());
|
||||
if (assets.length === 1) {
|
||||
clearSelect();
|
||||
await downloadFile(assets[0], sharedLinkKey);
|
||||
await downloadFile(assets[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
clearSelect();
|
||||
await downloadArchive(filename, { assetIds: assets.map((asset) => asset.id) }, sharedLinkKey);
|
||||
await downloadArchive(filename, { assetIds: assets.map((asset) => asset.id) });
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
assetIdsDto: {
|
||||
assetIds: Array.from(getAssets()).map((asset) => asset.id),
|
||||
},
|
||||
key: sharedLink.key,
|
||||
key: api.getKey(),
|
||||
});
|
||||
|
||||
for (const result of results) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
export let isSelectionMode = false;
|
||||
export let viewport: Viewport;
|
||||
export let singleSelect = false;
|
||||
export let publicSharedKey: string | undefined = undefined;
|
||||
|
||||
export let assetStore: AssetStore;
|
||||
export let assetInteractionStore: AssetInteractionStore;
|
||||
|
|
@ -96,7 +95,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
assetViewingStore.setAssetId(asset.id, publicSharedKey);
|
||||
assetViewingStore.setAssetId(asset.id);
|
||||
};
|
||||
|
||||
const handleSelectGroup = (title: string, assets: AssetResponseDto[]) => dispatch('select', { title, assets });
|
||||
|
|
@ -189,7 +188,6 @@
|
|||
disabled={$assetStore.albumAssets.has(asset.id)}
|
||||
thumbnailWidth={box.width}
|
||||
thumbnailHeight={box.height}
|
||||
{publicSharedKey}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
export let assetStore: AssetStore;
|
||||
export let assetInteractionStore: AssetInteractionStore;
|
||||
export let removeAction: AssetAction | null = null;
|
||||
export let publicSharedKey: string | undefined = undefined;
|
||||
|
||||
const { assetSelectionCandidates, assetSelectionStart, selectedGroup, selectedAssets, isMultiSelectState } =
|
||||
assetInteractionStore;
|
||||
const viewport: Viewport = { width: 0, height: 0 };
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
const handlePrevious = async () => {
|
||||
const previousAsset = await assetStore.getPreviousAssetId($viewingAsset.id);
|
||||
if (previousAsset) {
|
||||
assetViewingStore.setAssetId(previousAsset, publicSharedKey);
|
||||
assetViewingStore.setAssetId(previousAsset);
|
||||
}
|
||||
|
||||
return !!previousAsset;
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
const handleNext = async () => {
|
||||
const nextAsset = await assetStore.getNextAssetId($viewingAsset.id);
|
||||
if (nextAsset) {
|
||||
assetViewingStore.setAssetId(nextAsset, publicSharedKey);
|
||||
assetViewingStore.setAssetId(nextAsset);
|
||||
}
|
||||
|
||||
return !!nextAsset;
|
||||
|
|
@ -349,7 +349,6 @@
|
|||
bucketDate={bucket.bucketDate}
|
||||
bucketHeight={bucket.bucketHeight}
|
||||
{viewport}
|
||||
{publicSharedKey}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
@ -371,7 +370,6 @@
|
|||
on:unarchived={({ detail: asset }) => handleAction(asset, AssetAction.UNARCHIVE)}
|
||||
on:favorite={({ detail: asset }) => handleAction(asset, AssetAction.FAVORITE)}
|
||||
on:unfavorite={({ detail: asset }) => handleAction(asset, AssetAction.UNFAVORITE)}
|
||||
{publicSharedKey}
|
||||
/>
|
||||
{/if}
|
||||
</Portal>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue