This commit is contained in:
2025-07-27 19:49:35 -04:00
parent 2302290d34
commit 941c8400c0
23 changed files with 293 additions and 50 deletions

View File

@@ -3,9 +3,6 @@ import { authenticate } from "../../../util/api.ts";
import Server from "../../../server/server.ts";
import z from "zod";
import { typedZValidator } from "../../../util/validators.ts";
import Logging from "@proxnet/undead-logging";
const log = new Logging("AccountDebug");
export const route = createHonoRoute('/account');

View File

@@ -0,0 +1,18 @@
import { authenticate } from "../../../util/api.ts";
import { createHonoRoute } from "../../../util/import.ts";
export const route = createHonoRoute('/PlayerReporting');
route.app.use(authenticate);
route.app.get('/v1/moderationBlockDetails', c => {
return c.json({
ReportCategory: 0,
Duration: 0,
GameSessionId: 0,
IsHostKick: false,
VoteKickReason: "",
Message: "",
IsBan: false
});
});

View File

@@ -1,7 +1,27 @@
import { profileAvatarSchema } from "../../../server/profiles/content/Avatar.ts";
import Server from "../../../server/server.ts";
import { authenticate } from "../../../util/api.ts";
import { createHonoRoute } from "../../../util/import.ts";
import { typedZValidator } from "../../../util/validators.ts";
export const route = createHonoRoute("/avatar");
route.app.get('/v1/defaultunlocked', c => {
return c.json([]);
return c.json(Server.Avatars.getAllPossibleCombinations());
});
route.app.get('/v4/items', c => {
return c.json(Server.Avatars.getAllPossibleCombinations());
});
route.app.use(authenticate);
route.app.get('/v2', async c => {
const outfit = await c.get('profile').Avatar.getAvatar();
return c.json(outfit);
});
route.app.post('/v2/set', typedZValidator('json', profileAvatarSchema), async c => {
const outfit = c.req.valid('json');
await c.get('profile').Avatar.setAvatar(outfit);
return c.status(200);
});

View File

@@ -0,0 +1,7 @@
import { createHonoRoute } from "../../../util/import.ts";
export const route = createHonoRoute("/players");
route.app.get('/v2/progression/bulk', c => {
return c.json([]); // todo: progression
});

View File

@@ -0,0 +1,7 @@
import { createHonoRoute } from "../../../util/import.ts";
export const route = createHonoRoute('/relationships');
route.app.get('/v2/get', c => {
return c.json([]);
});

View File

@@ -3,17 +3,20 @@ import { authenticate, genericResponse } from "../../../util/api.ts";
import { createHonoRoute } from "../../../util/import.ts";
import { transformStringToEnum, typedZValidator } from "../../../util/validators.ts";
import { ProfileSetting } from "../../../server/profiles/content/Settings.ts";
import { trimTrailingSlash } from "@hono/hono/trailing-slash";
import { HonoEnv } from "../../../util/types.ts";
import { Context } from "@hono/hono";
export const route = createHonoRoute('/settings');
route.app.use(authenticate, trimTrailingSlash());
route.app.use(authenticate);
route.app.get('/v2', async c => {
const getSettingsMiddleware = async (c: Context<HonoEnv>) => {
const profile = c.get('profile');
const settings = await profile.Settings.getAllSettings();
c.json(settings);
});
return c.json(settings);
};
route.app.get('/v2/', getSettingsMiddleware);
route.app.get('/v2', getSettingsMiddleware);
const settingsSetSchema = z.object({
Key: z.string().transform(transformStringToEnum<ProfileSetting>(ProfileSetting, true)),

View File

@@ -3,6 +3,10 @@ import { createHonoRoute } from "../../../util/import.ts";
import { transformStringToEnum, typedZValidator } from "../../../util/validators.ts";
import { PlatformType } from "../../../server/platforms/base.ts";
import Server from "../../../server/server.ts";
import { authenticate } from "../../../util/api.ts";
import Logging from "@proxnet/undead-logging";
const log = new Logging("CachedLoginDebug");
export const route = createHonoRoute("/cachedlogin");
@@ -15,4 +19,15 @@ route.app.get('/forplatformid/:platformType/:platformId', typedZValidator('param
const { platformType, platformId } = c.req.valid('param');
return c.json((await Server.Platforms.getCachedLogins(platformType || PlatformType.Steam, platformId, true)) || []);
});
route.app.use(authenticate);
const forPlatformIdsReqSchema = z.object({
id: z.string()
});
route.app.post('/forplatformids', typedZValidator('form', forPlatformIdsReqSchema), async c => {
const { id } = c.req.valid('form');
const ids = await Server.Platforms.getCachedLogins(PlatformType.Steam, id, true);
return c.json(ids || []);
});

View File

@@ -117,6 +117,7 @@ route.app.post('/token', typedZValidator('form', tokenGrantSchema), async c => {
if (logins && logins.find(login => login.accountId === form.account_id)) {
const profile = await Server.Profiles.get(form.account_id);
if (!profile) return error(TokenRequestError.InvalidRequest, "No such profile");
await Server.Platforms.updateLastLoginTime(form.platform, form.platform_id, form.account_id);
const token = await Server.Platforms.getToken(profile.getId(), await profile.getRole() || 'user');
return c.json({

7
src/routes/match/root.ts Normal file
View File

@@ -0,0 +1,7 @@
import { createHonoRoute, routeImporter } from "../../util/import.ts";
export const route = createHonoRoute('/match');
await routeImporter(route.app, 'src/routes/match/', [
'routes'
]);

View File

@@ -0,0 +1,10 @@
import { authenticate } from "../../../util/api.ts";
import { createHonoRoute } from "../../../util/import.ts";
export const route = createHonoRoute("/player");
route.app.use(authenticate);
route.app.post('/login', async c => {
return c.status(200);
});