Refactor demo login as an authentication method

Use the authentication method system for the demo login and the
generated accounts.  This makes it possible to toggle it off on
production systems as these shouldn't have it enabled at all.
This commit is contained in:
Hornwitser 2025-07-09 17:57:49 +02:00
parent a33c8e9dac
commit 0d0e38e4b6
14 changed files with 212 additions and 141 deletions

View file

@ -14,7 +14,7 @@ import {
writeSubscriptions
} from "~/server/database";
import { broadcastEvent } from "../streams";
import type { ApiSession } from "~/shared/types/api";
import type { ApiAuthenticationProvider, ApiSession } from "~/shared/types/api";
async function removeSessionSubscription(sessionId: number) {
const subscriptions = await readSubscriptions();
@ -54,7 +54,7 @@ export async function clearServerSession(event: H3Event) {
export async function setServerSession(
event: H3Event,
account: ServerUser | undefined,
authenticationProvider?: "telegram",
authenticationProvider?: ApiAuthenticationProvider,
authenticationSlug?: string,
authenticationName?: string,
) {