Release 0.7.0
This commit is contained in:
1 parent
d586fbd8ce
commit
6d96900d81
27 files changed
+2060
-25
No files matched your search
@@ -2,6 +2,7 @@ import { randomBytes } from 'node:crypto';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { Handle } from '@sveltejs/kit/hooks';
|
||||
import { deleteSession, getSessionUser, hasUsers, SESSION_COOKIE } from '#lib/server/auth.js';
|
||||
import { startFeedScheduler } from '#lib/server/feeds.js';
|
||||
|
||||
const publicPaths = new Set([
|
||||
'/',
|
||||
@@ -14,9 +15,11 @@ const publicPaths = new Set([
|
||||
]);
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
startFeedScheduler();
|
||||
const presentationPath = event.url.pathname.startsWith('/heinzlive/');
|
||||
const sharePath = event.url.pathname.startsWith('/freigabe/');
|
||||
const shareMediaPath = /^\/freigabe\/[^/]+\/media\/[^/]+$/.test(event.url.pathname);
|
||||
const apiPath = event.url.pathname.startsWith('/api/v1/');
|
||||
const presentationTestPath = /^\/fundus\/[^/]+\/praesentation(?:\/|$)/.test(event.url.pathname);
|
||||
const token = event.cookies.get(SESSION_COOKIE);
|
||||
event.locals.user = getSessionUser(token);
|
||||
@@ -26,6 +29,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
||||
!presentationPath &&
|
||||
!sharePath &&
|
||||
!publicPaths.has(event.url.pathname) &&
|
||||
!apiPath &&
|
||||
!event.locals.user
|
||||
) {
|
||||
redirect(303, hasUsers() ? '/login' : '/setup');
|
||||
|
||||
Reference in new issue
Block a user