Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
getConfig was requiring authentication. using already initiated global stores instead
  • Loading branch information
eleith committed Jul 14, 2024
1 parent 3999c54 commit 000c46c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
import { authenticate } from '$lib/utils/auth';
import { getFormatter } from '$lib/utils/i18n';
import { getAssetInfoFromParam } from '$lib/utils/navigation';
import { getConfig, getMySharedLink, isHttpError } from '@immich/sdk';
import { getMySharedLink, isHttpError } from '@immich/sdk';
import type { PageLoad } from './$types';

export const load = (async ({ params }) => {
Expand All @@ -12,15 +12,12 @@ export const load = (async ({ params }) => {
try {
const getSharedLinkPromise = getMySharedLink({ key });
const getAssetPromise = getAssetInfoFromParam(params);
const getConfigPromise = getConfig();

const [sharedLink, asset, config] = await Promise.all([getSharedLinkPromise, getAssetPromise, getConfigPromise]);
const [sharedLink, asset] = await Promise.all([getSharedLinkPromise, getAssetPromise]);

setSharedLink(sharedLink);
const assetCount = sharedLink.assets.length;
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
const assetPath = assetId ? getAssetThumbnailUrl(assetId) : '/feature-panel.png';
const domain = config.server.externalDomain;

const $t = await getFormatter();

Expand All @@ -31,7 +28,7 @@ export const load = (async ({ params }) => {
meta: {
title: sharedLink.album ? sharedLink.album.albumName : $t('public_share'),
description: sharedLink.description || $t('shared_photos_and_videos_count', { values: { assetCount } }),
imageUrl: `${domain}${assetPath}`,
imageUrl: assetPath,
},
};
} catch (error) {
Expand Down
6 changes: 3 additions & 3 deletions web/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import VersionAnnouncementBox from '$lib/components/shared-components/version-announcement-box.svelte';
import { Theme } from '$lib/constants';
import { colorTheme, handleToggleTheme, type ThemeSetting } from '$lib/stores/preferences.store';
import { loadConfig } from '$lib/stores/server-config.store';
import { loadConfig, serverConfig } from '$lib/stores/server-config.store';
import { user } from '$lib/stores/user.store';
import { closeWebsocketConnection, openWebsocketConnection } from '$lib/stores/websocket';
import { setKey } from '$lib/utils';
Expand Down Expand Up @@ -96,13 +96,13 @@
<meta property="og:type" content="website" />
<meta property="og:title" content={$page.data.meta.title} />
<meta property="og:description" content={$page.data.meta.description} />
<meta property="og:image" content={$page.data.meta.imageUrl} />
<meta property="og:image" content={$serverConfig.externalDomain + $page.data.meta.imageUrl} />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={$page.data.meta.title} />
<meta name="twitter:description" content={$page.data.meta.description} />
<meta name="twitter:image" content={$page.data.meta.imageUrl} />
<meta name="twitter:image" content={$serverConfig.externalDomain + $page.data.meta.imageUrl} />
{/if}
</svelte:head>

Expand Down

0 comments on commit 000c46c

Please sign in to comment.