From 91adb5ec98be800b550f7dd1b727f64f845c9037 Mon Sep 17 00:00:00 2001 From: Christian Risi <75698846+CnF-Gris@users.noreply.github.com> Date: Mon, 30 Jun 2025 11:53:53 +0000 Subject: [PATCH] Initialize app --- src/hooks.server.ts | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/hooks.server.ts b/src/hooks.server.ts index d3d57e6..0ba0e24 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,7 +1,35 @@ import type { ServerInit } from '@sveltejs/kit'; +import { handles } from './handles/handle'; +import { SSLSnifferApp } from '$lib/db-utils/sqlite'; +import { UserApp } from '$lib/classes/users'; +import { UserDBBroker } from '$lib/db-utils/Users'; +import { SessionApp } from '$lib/classes/sessions'; +import { SessionDBBroker } from '$lib/db-utils/Sessions'; +import { AppData } from '$lib/classes/app-sessions'; +import { logger } from '$lib/utils/logger'; + +let initOnce = false export const init: ServerInit = async () => { + + if (initOnce) { + logger.debug("Already Started, avoiding reinitializing", "App Init") + return + } + + logger.debug("Starting app", "App Init") - // TODO: initialize db + SSLSnifferApp.init() + UserApp.init( + new UserDBBroker() + ) + SessionApp.init( + new SessionDBBroker() + ) -}; \ No newline at end of file + initOnce = true + logger.debug("Init run successfully", "App Init") + +}; + +export const handle = handles \ No newline at end of file