b
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
18
src/routes/api/routes/PlayerReporting.ts
Normal file
18
src/routes/api/routes/PlayerReporting.ts
Normal 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
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
7
src/routes/api/routes/players.ts
Normal file
7
src/routes/api/routes/players.ts
Normal 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
|
||||
});
|
||||
7
src/routes/api/routes/relationships.ts
Normal file
7
src/routes/api/routes/relationships.ts
Normal 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([]);
|
||||
});
|
||||
@@ -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)),
|
||||
|
||||
@@ -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 || []);
|
||||
});
|
||||
@@ -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
7
src/routes/match/root.ts
Normal 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'
|
||||
]);
|
||||
10
src/routes/match/routes/player.ts
Normal file
10
src/routes/match/routes/player.ts
Normal 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);
|
||||
});
|
||||
Reference in New Issue
Block a user