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:
@@ -1,4 +1,9 @@
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import { APIUtils } from "../../apiutils.ts";
|
||||
import express from "express";
|
||||
import UnifiedProfile from "../../data/profiles.ts";
|
||||
|
||||
const log = new Logging("ProgressionRoute");
|
||||
|
||||
export const route = APIUtils.createRouter("/players");
|
||||
|
||||
@@ -6,12 +11,22 @@ route.router.get('/v1/progression/:id',
|
||||
|
||||
APIUtils.Authentication,
|
||||
|
||||
async (_rq, rs) => {
|
||||
rs.json({
|
||||
PlayerId: rs.locals.profile.getId(),
|
||||
Level: await rs.locals.profile.Progression.getLevel(), // await is temporary
|
||||
Xp: await rs.locals.profile.Progression.getXp()
|
||||
});
|
||||
async (rq: express.Request<{ id: string }>, rs) => {
|
||||
const unparsedPlayerId = rq.params.id;
|
||||
const parsedPlayerId = parseInt(unparsedPlayerId);
|
||||
if (isNaN(parsedPlayerId)) {
|
||||
rs.json(APIUtils.genericResponseFormat(true, 'The player ID was invalid.'));
|
||||
return;
|
||||
}
|
||||
|
||||
const profile = UnifiedProfile.get(parsedPlayerId);
|
||||
const res = {
|
||||
PlayerId: profile.getId(),
|
||||
Level: await profile.Progression.getLevel(),
|
||||
XP: await profile.Progression.getXp()
|
||||
};
|
||||
log.d(`prog res: ${JSON.stringify(res)}`);
|
||||
rs.json(res);
|
||||
}
|
||||
|
||||
);
|
||||
Reference in New Issue
Block a user