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:
@@ -6,6 +6,7 @@ import { Config } from "../../config.ts";
|
||||
import Logging from "@proxnet/undead-logging";
|
||||
import { z } from "zod";
|
||||
import { AuthType } from "../../data/users.ts";
|
||||
import { Redis } from "../../db.ts";
|
||||
|
||||
const config = Config.getConfig();
|
||||
|
||||
@@ -75,6 +76,7 @@ interface TokenResponseBody {
|
||||
|
||||
route.router.post("/token",
|
||||
|
||||
APIUtils.startTimer,
|
||||
APIUtils.Authentication,
|
||||
APIUtils.AuthenticationType(AuthType.Web),
|
||||
express.urlencoded({ extended: true }),
|
||||
@@ -83,6 +85,7 @@ route.router.post("/token",
|
||||
async (
|
||||
rq: express.Request<NoBody, NoBody, TokenRequestBody>,
|
||||
rs: express.Response<TokenResponseBody>,
|
||||
nxt: express.NextFunction
|
||||
) => {
|
||||
|
||||
function requestFailed(msg: string = "invalid_request") {
|
||||
@@ -146,6 +149,7 @@ route.router.post("/token",
|
||||
|
||||
rs.locals.user.addAssociatedDeviceId(rq.body.device_id);
|
||||
rs.locals.user.addAssociatedPlatformId(rq.body.platform_id);
|
||||
Redis.Database.sadd(Redis.buildKey(Redis.KeyGroups.PlatformAssociations, rq.body.platform_id), targetAccount);
|
||||
|
||||
const profile = UnifiedProfile.get(targetAccount);
|
||||
if (!(await Profile.exists(profile.getId()))) {
|
||||
@@ -163,5 +167,9 @@ route.router.post("/token",
|
||||
});
|
||||
|
||||
await profile.setKnownDeviceClass(Number(rq.body.device_class));
|
||||
|
||||
nxt();
|
||||
},
|
||||
|
||||
APIUtils.stopTimer
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user