mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-14 22:08:45 +00:00
23 lines
743 B
TypeScript
23 lines
743 B
TypeScript
import type { ServerInit } from "@sveltejs/kit";
|
|
import { sequence } from "@sveltejs/kit/hooks";
|
|
import schedule from "node-schedule";
|
|
import { cleanupExpiredUserClientChallenges } from "$lib/server/db/client";
|
|
import { migrateDB } from "$lib/server/db/kysely";
|
|
import {
|
|
cleanupExpiredSessions,
|
|
cleanupExpiredSessionUpgradeChallenges,
|
|
} from "$lib/server/db/session";
|
|
import { authenticate, setAgentInfo } from "$lib/server/middlewares";
|
|
|
|
export const init: ServerInit = async () => {
|
|
await migrateDB();
|
|
|
|
schedule.scheduleJob("0 * * * *", () => {
|
|
cleanupExpiredUserClientChallenges();
|
|
cleanupExpiredSessions();
|
|
cleanupExpiredSessionUpgradeChallenges();
|
|
});
|
|
};
|
|
|
|
export const handle = sequence(setAgentInfo, authenticate);
|