Further the login process

* Matchmaking login locks (created and checked only in memory for now)
* Profile reputation temporary implementation
* Profiles now no longer initialize if a user with the same username is found
* vrMovementMode in presence is now required, falls back to 'Teleport'
* Progression implementation began
* API routes: Settings, player subscriptions, reputation, progression
* cropSquare in image query is not a boolean, rather a number representing a boolean
* Hile reporting uses forms, not json
* Presence heartbeat and logout
* Socket changes: Close event listener (destroy), send message function, targets further started
This commit is contained in:
2025-03-29 23:09:40 -04:00
parent 1af0206b6a
commit 026f9c8bd8
22 changed files with 294 additions and 56 deletions

View File

@@ -6,6 +6,7 @@ import { Config } from "./config.ts";
import { AuthType, User, UserTokenFormat } from "./data/users.ts";
import UnifiedProfile, { ProfileTokenFormat } from "./data/profiles.ts";
import z from "zod";
import Matchmaking from "./data/live/base.ts";
const config = Config.getConfig();
@@ -311,6 +312,21 @@ export function AuthenticationType(type: AuthType) {
}
}
export function LoginLock(rq: express.Request<NoBody, NoBody, { LoginLock: string }>, rs: express.Response, nxt: express.NextFunction) {
log.d(`LoginLock for ${rs.locals.profile.getId()}: ${rq.body.LoginLock}`);
const matches = Matchmaking.lockMatches(rs.locals.profile, rq.body.LoginLock);
if (matches == null) {
rs.json(genericResponseFormat(true, "Login Lock failure"));
return;
} else {
if (matches) nxt();
else {
rs.json(genericResponseFormat(true, "Login Lock failure"));
return;
}
}
}
export type NoBody = Record<string | number | symbol, never>;
export * as APIUtils from "./apiutils.ts";