High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(web): redirect to login (#25254)
Jason Rasmussen38f01a6b7d94
diff --git a/web/src/lib/utils/auth.ts b/web/src/lib/utils/auth.tsindex 99935b8938..62ae3ee9dd 100644--- a/web/src/lib/utils/auth.ts+++ b/web/src/lib/utils/auth.ts@@ -11,7 +11,7 @@ import { AppRoute } from '../constants';export interface AuthOptions {admin?: true;- public?: true;+ public?: boolean;}export const loadUser = async () => {diff --git a/web/src/routes/(user)/+layout.ts b/web/src/routes/(user)/+layout.tsindex 1fa655774f..c61b1ca5ce 100644--- a/web/src/routes/(user)/+layout.ts+++ b/web/src/routes/(user)/+layout.ts@@ -1,7 +1,9 @@-import { getAssetInfoFromParam } from '$lib/utils/navigation';+import { authenticate } from '$lib/utils/auth';+import { getAssetInfoFromParam, isSharedLinkRoute } from '$lib/utils/navigation';import type { LayoutLoad } from './$types';-export const load = (async ({ params }) => {+export const load = (async ({ url, params, route }) => {+ await authenticate(url, { public: isSharedLinkRoute(route.id) });const asset = await getAssetInfoFromParam(params);return {diff --git a/web/src/routes/admin/+layout.ts b/web/src/routes/admin/+layout.tsindex 778e5f182f..64356d82a4 100644--- a/web/src/routes/admin/+layout.ts+++ b/web/src/routes/admin/+layout.ts@@ -1,6 +1,8 @@import { systemConfigManager } from '$lib/managers/system-config-manager.svelte';+import { authenticate } from '$lib/utils/auth';import type { LayoutLoad } from './$types';-export const load = (async () => {+export const load = (async ({ url }) => {+ await authenticate(url, { admin: true });await systemConfigManager.init();}) satisfies LayoutLoad;