feat(web): permanent url in shared link (#9083)
This commit is contained in:
+4
@@ -1,11 +1,13 @@
|
||||
import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getAssetInfoFromParam } from '$lib/utils/navigation';
|
||||
import { ThumbnailFormat, getMySharedLink, isHttpError } from '@immich/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ params }) => {
|
||||
const { key } = params;
|
||||
await authenticate({ public: true });
|
||||
const asset = await getAssetInfoFromParam(params);
|
||||
|
||||
try {
|
||||
const sharedLink = await getMySharedLink({ key });
|
||||
@@ -15,6 +17,8 @@ export const load = (async ({ params }) => {
|
||||
|
||||
return {
|
||||
sharedLink,
|
||||
asset,
|
||||
key,
|
||||
meta: {
|
||||
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share',
|
||||
description: sharedLink.description || `${assetCount} shared photos & videos.`,
|
||||
@@ -1,17 +0,0 @@
|
||||
<script lang="ts">
|
||||
import AssetViewer from '$lib/components/asset-viewer/asset-viewer.svelte';
|
||||
import type { PageData } from './$types';
|
||||
import { goto } from '$app/navigation';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
{#if data.asset && data.key}
|
||||
<AssetViewer
|
||||
asset={data.asset}
|
||||
showNavigation={false}
|
||||
on:previous={() => null}
|
||||
on:next={() => null}
|
||||
on:close={() => goto(`${AppRoute.SHARE}/${data.key}`)}
|
||||
/>
|
||||
{/if}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { getAssetInfo } from '@immich/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ params }) => {
|
||||
const { key, assetId } = params;
|
||||
const asset = await getAssetInfo({ id: assetId, key });
|
||||
|
||||
return {
|
||||
asset,
|
||||
key,
|
||||
meta: {
|
||||
title: 'Public Share',
|
||||
},
|
||||
};
|
||||
}) satisfies PageLoad;
|
||||
Reference in New Issue
Block a user