Changes (/shrug)

* Added middleware timer for performance debugging
* Relationships and avatar database keys
* CDN
* Profiles are SelfAccounts in most cases, rather than Accounts
* Simplified profile content management
* Progression fixes
* Relationships (favorites not yet implemented)
* Relationship backend
* Relationship and avatar routes
This commit is contained in:
2025-03-31 01:48:46 -04:00
parent 639e809a20
commit 638c0fbf1f
19 changed files with 999 additions and 65 deletions

15
src/routes/api/avatar.ts Normal file
View File

@@ -0,0 +1,15 @@
import { APIUtils } from "../../apiutils.ts";
import { AuthType } from "../../data/users.ts";
export const route = APIUtils.createRouter("/avatar");
route.router.get('/v2',
APIUtils.Authentication,
APIUtils.AuthenticationType(AuthType.Game),
async (_rq, rs) => {
rs.json(await rs.locals.profile.Avatar.getAvatar());
},
);

View File

@@ -1,5 +1,7 @@
import { APIUtils } from "../../apiutils.ts";
import { z } from "zod";
import { APIUtils, NoBody } from "../../apiutils.ts";
import { AuthType } from "../../data/users.ts";
import express from "express";
export const route = APIUtils.createRouter("/relationships");
@@ -12,4 +14,28 @@ route.router.get('/v2/get',
rs.json(rs.locals.profile.Relationships.getRelationships());
}
);
interface BulkIngorePlatformBody {
Platform: string,
PlatformIds: string[]
}
const bulkIgnorePlatformSchema = z.object({
Platform: z.number(),
PlatformIds: z.array(z.string())
});
route.router.post('/v1/bulkignoreplatformusers',
APIUtils.Authentication,
APIUtils.AuthenticationType(AuthType.Game),
express.json(),
APIUtils.validateRequestBody(bulkIgnorePlatformSchema),
(rq: express.Request<NoBody, NoBody, BulkIngorePlatformBody>, rs: express.Response) => {
for (const id of rq.body.PlatformIds) rs.locals.profile.Relationships.ignoreAllAssociatedPlatformUsers(id);
rs.sendStatus(200);
},
);