Implemented invitation logic. Implemented play list method. Mild refactoring.

This commit is contained in:
jd
2026-02-20 23:51:16 +00:00
parent 5742214115
commit 335f1821cd
24 changed files with 1118 additions and 166 deletions

View File

@@ -10,7 +10,7 @@ async function login(request: UnwrappedRequest<LoginRequest>): Promise<Response>
const verify: {
userId: SecureId;
refreshCount: string;
} | null = await orm.users.verifyCredentials(request.body.username, request.body.password);
} | null = await orm.users.verifyCredentials(request.body.email, request.body.password);
if (!verify) {
return new UnauthorizedResponse('Invalid credentials');
}
@@ -32,6 +32,7 @@ async function login(request: UnwrappedRequest<LoginRequest>): Promise<Response>
httpOnly: true,
secure: true,
maxAge: tokenLifeSpanInDays * 24 * 60 * 60,
path: '/api/auth/token'
});
return new OkResponse();
} catch (error: any) {
@@ -60,7 +61,9 @@ async function token(request: UnwrappedRequest): Promise<Response> {
const claims: Claims | null = await orm.claims.getByUserId(refreshToken.u);
const token = jwt.sign({ ...claims }, process.env.JWT_SECRET_KEY as string, { expiresIn: '1h' });
const token = jwt.sign({ ...claims }, process.env.JWT_SECRET_KEY as string, {
expiresIn: process.env.JWT_LIFESPAN as any,
});
return new OkResponse({ token });
} catch (error: any) {
return new ErrorResponse(error as Error);