Shit ton of changes in changing and upgrading to use svk's modern features (observability, remote functions)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { UserRoleMap } from "@pkg/logic/domains/user/data";
|
||||
import { user } from "@pkg/db/schema/better.auth.schema";
|
||||
import type { RequestHandler } from "./$types";
|
||||
import { env } from "$env/dynamic/private";
|
||||
import { settings } from "@pkg/settings";
|
||||
import { logger } from "@pkg/logger";
|
||||
import { db, eq } from "@pkg/db";
|
||||
import { nanoid } from "nanoid";
|
||||
@@ -10,7 +10,7 @@ import * as v from "valibot";
|
||||
function isAuthorized(authHeader?: string | null) {
|
||||
if (!authHeader) return false;
|
||||
const authToken = authHeader.toString().replace("Bearer ", "");
|
||||
return authToken === env.DEBUG_API_KEY;
|
||||
return authToken === settings.debugKey;
|
||||
}
|
||||
|
||||
export const GET: RequestHandler = async ({ request }) => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import { auth } from "@pkg/logic/domains/auth/config.base";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
|
||||
export const load = (async (c) => {
|
||||
const sess = await auth.api.getSession({
|
||||
headers: c.request.headers,
|
||||
});
|
||||
const sess = await auth.api.getSession({
|
||||
headers: c.request.headers,
|
||||
});
|
||||
|
||||
if (!!sess && !!sess.user && !!sess.session) {
|
||||
return redirect(302, "/");
|
||||
}
|
||||
if (!!sess && !!sess.user && !!sess.session) {
|
||||
return redirect(302, "/");
|
||||
}
|
||||
}) satisfies PageServerLoad;
|
||||
|
||||
Reference in New Issue
Block a user