webcompile/src/hooks.server.ts
2023-01-03 11:38:55 +02:00

27 lines
574 B
TypeScript

import { SvelteKitAuth } from "@auth/sveltekit"
import Authentik from '@auth/core/providers/authentik';
import { env } from "$env/dynamic/private";
import statusData from "$lib/statusData";
import map from "$lib/map";
export const handle = SvelteKitAuth({
providers: [
//@ts-ignore
Authentik({
clientId: env.AUTH_CLIENT_ID,
clientSecret: env.AUTH_CLIENT_SECRET,
issuer: env.AUTH_ISSUER
})
]
})
const updateMap = () => {
map.set("data", {
status: statusData,
updated: Math.floor(Date.now() / 1000)
});
};
updateMap();
setInterval(updateMap, 30000);