Minor fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')) {
|
||||
|
||||
Reference in New Issue
Block a user