mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-04-26 00:33:48 +00:00
fix(web): layout nesting (#1881)
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
36
web/src/routes/(user)/share/[key]/+page.server.ts
Normal file
36
web/src/routes/(user)/share/[key]/+page.server.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export const prerender = false;
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
import { getThumbnailUrl } from '$lib/utils/asset-utils';
|
||||
import { ThumbnailFormat } from '@api';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import featurePanelUrl from '$lib/assets/feature-panel.png';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, parent, locals: { api } }) => {
|
||||
const { user } = await parent();
|
||||
|
||||
const { key } = params;
|
||||
|
||||
try {
|
||||
const { data: sharedLink } = await api.shareApi.getMySharedLink(key);
|
||||
|
||||
const assetCount = sharedLink.assets.length;
|
||||
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
|
||||
|
||||
return {
|
||||
sharedLink,
|
||||
meta: {
|
||||
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share',
|
||||
description: sharedLink.description || `${assetCount} shared photos & videos.`,
|
||||
imageUrl: assetId
|
||||
? getThumbnailUrl(assetId, ThumbnailFormat.Webp, sharedLink.key)
|
||||
: featurePanelUrl
|
||||
},
|
||||
user
|
||||
};
|
||||
} catch (e) {
|
||||
throw error(404, {
|
||||
message: 'Invalid shared link'
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user