From 68c7c094ae0347c189c12c90999f7310a9ec9cb7 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 15 Feb 2026 02:36:07 +1300 Subject: [PATCH] Update +layout.ts --- materialious/src/routes/+layout.ts | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/materialious/src/routes/+layout.ts b/materialious/src/routes/+layout.ts index a67b4515..4bb7c72a 100644 --- a/materialious/src/routes/+layout.ts +++ b/materialious/src/routes/+layout.ts @@ -61,27 +61,26 @@ 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(invidiousAuthStore))) { + goto(resolve(defaultPage, {})); + } + }); + } + const isLoginPage = url.pathname.endsWith('/internal/login'); const isSetupPage = url.pathname.endsWith('/setup'); if (!isLoginPage) { - const defaultPage = get(interfaceDefaultPage); - - if ( - defaultPage && - defaultPage !== '/' && - defaultPage.startsWith('/') && - url.pathname === resolvedRoot && - window.history.length < 3 && - !isSetupPage - ) { - getPages().forEach((page) => { - if (page.href === defaultPage && (!page.requiresAuth || get(invidiousAuthStore))) { - goto(resolve(defaultPage, {})); - } - }); - } - if (isOwnBackend()?.requireAuth && !get(rawMasterKeyStore)) { goto(resolve('/internal/login', {}), { replaceState: true }); } else if (!get(invidiousInstanceStore) && !isYTBackend() && !isSetupPage) {