Skip to content

Commit

Permalink
feat(web): permanent url in shared link (#9083)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 committed Apr 25, 2024
1 parent adb607c commit 912d0c4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 34 deletions.
4 changes: 2 additions & 2 deletions web/src/lib/utils/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const isPeopleRoute = (route?: string | null) => !!route?.startsWith('/(u
export const isAssetViewerRoute = (target?: NavigationTarget | null) =>
!!(target?.route.id?.endsWith('/[[assetId=id]]') && 'assetId' in (target?.params || {}));

export function getAssetInfoFromParam({ assetId }: { assetId?: string }) {
return assetId && getAssetInfo({ id: assetId });
export function getAssetInfoFromParam({ assetId, key }: { assetId?: string; key?: string }) {
return assetId && getAssetInfo({ id: assetId, key });
}

function currentUrlWithoutAsset() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 });
Expand All @@ -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.`,
Expand Down
17 changes: 0 additions & 17 deletions web/src/routes/(user)/share/[key]/photos/[assetId]/+page.svelte

This file was deleted.

15 changes: 0 additions & 15 deletions web/src/routes/(user)/share/[key]/photos/[assetId]/+page.ts

This file was deleted.

0 comments on commit 912d0c4

Please sign in to comment.