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

@@ -4,6 +4,9 @@ import express from "express";
import Matchmaking from "../../data/live/base.ts";
import Presence from "../../data/live/presence.ts";
import { AuthType } from "../../data/users.ts";
import Logging from "@proxnet/undead-logging";
const log = new Logging("MatchPlayerRoute");
export const route = APIUtils.createRouter('/player');
@@ -28,4 +31,33 @@ route.router.post('/login',
rs.sendStatus(200);
},
)
);
route.router.post('/logout',
APIUtils.Authentication,
APIUtils.AuthenticationType(AuthType.Game),
express.urlencoded({extended: true}),
APIUtils.validateRequestBody(LoginSchema),
(rq, rs) => {
Matchmaking.deleteLoginLock(rs.locals.profile);
}
)
route.router.post('/heartbeat',
APIUtils.Authentication,
APIUtils.AuthenticationType(AuthType.Game),
express.urlencoded({extended: true}),
APIUtils.validateRequestBody(LoginSchema),
APIUtils.LoginLock,
async (_rq, rs) => {
const pres = await Presence.get(rs.locals.profile);
log.d(`pres heartbeat for ${rs.locals.profile.getId()}: ${JSON.stringify(await pres.export())}`);
rs.json(await pres.export());
}
);