From 25ea717bd43ab7691a81d7393c228b3b5dc69e95 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sat, 14 Feb 2026 17:29:43 +1300 Subject: [PATCH] Minor fixes --- materialious/src/lib/server/misc.ts | 2 +- materialious/src/routes/+layout.ts | 32 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/materialious/src/lib/server/misc.ts b/materialious/src/lib/server/misc.ts index 54f4346f..48fb3ed6 100644 --- a/materialious/src/lib/server/misc.ts +++ b/materialious/src/lib/server/misc.ts @@ -3,7 +3,7 @@ import { sign } from 'cookie-signature'; import { env } from '$env/dynamic/private'; export function setAuthCookie(id: string, cookies: Cookies) { - cookies.set('userid', sign(id, env.COOKIE_SECRET), { + cookies.set('userid', sign(id, env.COOKIE_SECRET as string), { httpOnly: true, path: '/api', maxAge: 60 * 60 * 24 * 60 // 60 days diff --git a/materialious/src/routes/+layout.ts b/materialious/src/routes/+layout.ts index 718f305c..ef9b4932 100644 --- a/materialious/src/routes/+layout.ts +++ b/materialious/src/routes/+layout.ts @@ -61,25 +61,25 @@ export async function load({ url }) { } } - const defaultPage = get(interfaceDefaultPage); - - if ( - defaultPage && - defaultPage !== '/' && - defaultPage.startsWith('/') && - url.pathname === resolvedRoot && - window.history.length < 3 - ) { - getPages().forEach((page) => { - if (page.href === defaultPage && (!page.requiresAuth || get(authStore))) { - goto(resolve(defaultPage, {})); - } - }); - } - const isLoginPage = url.pathname.endsWith('/internal/login'); if (!isLoginPage) { + const defaultPage = get(interfaceDefaultPage); + + if ( + defaultPage && + defaultPage !== '/' && + defaultPage.startsWith('/') && + url.pathname === resolvedRoot && + window.history.length < 3 + ) { + getPages().forEach((page) => { + if (page.href === defaultPage && (!page.requiresAuth || get(authStore))) { + goto(resolve(defaultPage, {})); + } + }); + } + if (isOwnBackend()?.requireAuth && !get(rawMasterKeyStore)) { goto(resolve('/internal/login', {}), { replaceState: true }); } else if (!get(instanceStore) && !isYTBackend() && !url.pathname.endsWith('/setup')) {