Further login process

* APIUtils addition: query validation
* Coach and Server accounts are now properly created if they do not exist
* Profiles now cannot be IDs 1 or 2 (reservedIds)
* Fixed profile username exists bug
* Added relationship manager
* Started relationship management
* DeviceClass and VRMovementMode enum defaults for reserved profiles
* Presence update simplification
* Progression fixes
* Relationship query and object fixes
* Base configuration is now rate limited
* Progression route no longer requires authentication, instead is rate limited
* Base relationships with reserved profiles (Coach and Server)
* DeviceClass required for login
* Get presence route
* Socket route no longer logs
* Socket target base finished
This commit is contained in:
2025-03-30 19:29:57 -04:00
parent 026f9c8bd8
commit 639e809a20
19 changed files with 270 additions and 81 deletions

View File

@@ -3,7 +3,9 @@ import { GameConfigs } from "../../data/config.ts";
export const route = APIUtils.createRouter("/config");
route.router.get("/v2", (_rq, rs) => {
const rateLimit = new APIUtils.RateLimiter(60, 2);
route.router.get("/v2", rateLimit.middle(), (_rq, rs) => {
const config = GameConfigs.getConfig();
if (config == null) rs.sendStatus(500);
else rs.json(config);
@@ -11,6 +13,7 @@ route.router.get("/v2", (_rq, rs) => {
route.router.get('/v1/amplitude',
APIUtils.setCacheAllowed,
rateLimit.middle(),
(_rq, rs) => {
rs.json({AmplitudeKey: ""});
}

View File

@@ -10,7 +10,7 @@ route.router.get('/v1/:id',
APIUtils.Authentication,
APIUtils.AuthenticationType(AuthType.Game),
(rq: express.Request<{ id: string }>, rs) => {
async (rq: express.Request<{ id: string }>, rs) => {
const unparsedPlayerId = rq.params.id;
const parsedPlayerId = parseInt(unparsedPlayerId);
if (isNaN(parsedPlayerId)) {
@@ -18,7 +18,7 @@ route.router.get('/v1/:id',
return;
}
rs.json(UnifiedProfile.get(parsedPlayerId).Reputation.getReputation());
rs.json(await UnifiedProfile.get(parsedPlayerId).Reputation.getReputation());
}
);

View File

@@ -5,11 +5,13 @@ import UnifiedProfile from "../../data/profiles.ts";
const log = new Logging("ProgressionRoute");
const rateLimit = new APIUtils.RateLimiter(60, 2);
export const route = APIUtils.createRouter("/players");
route.router.get('/v1/progression/:id',
APIUtils.Authentication,
rateLimit.middle(),
async (rq: express.Request<{ id: string }>, rs) => {
const unparsedPlayerId = rq.params.id;

View File

@@ -9,7 +9,7 @@ route.router.get('/v2/get',
APIUtils.AuthenticationType(AuthType.Game),
(_rq, rs) => {
rs.json([]); // temporary
rs.json(rs.locals.profile.Relationships.getRelationships());
}
);