make session cookie name a variable
All checks were successful
delpoy / build-and-deploy (push) Successful in 27s
All checks were successful
delpoy / build-and-deploy (push) Successful in 27s
This commit is contained in:
@ -3,6 +3,8 @@ import type { Cookies } from '@sveltejs/kit';
|
||||
import * as crypto from 'crypto';
|
||||
import type { Admin } from '$lib/server/database';
|
||||
|
||||
export const sessionCookieName = 'craftattack_sess';
|
||||
|
||||
export interface Session {
|
||||
sessionId: string;
|
||||
userId: number;
|
||||
@ -17,7 +19,7 @@ function sessionFromId(sessionId: string | Cookies): Session | null {
|
||||
}
|
||||
|
||||
function sessionIdFromStringOrCookies(input: string | Cookies): string | null {
|
||||
return typeof input == 'string' ? input : input.get('session') || null;
|
||||
return typeof input == 'string' ? input : input.get(sessionCookieName) || null;
|
||||
}
|
||||
|
||||
export function addSession(user: { id: number; permissions: Permissions } | Admin): string {
|
||||
|
Reference in New Issue
Block a user