forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
15a5254380
commit
9d7e0e2f9e
71 files changed
+3490
-81
No files matched your search
@@ -311,6 +311,8 @@ export function createGameServer(options = {}) {
|
||||
period: url.searchParams.get("period") ?? "30d",
|
||||
dungeonId: url.searchParams.get("dungeon") || null,
|
||||
bossId: url.searchParams.get("boss") || null,
|
||||
spotId: url.searchParams.get("spot") || null,
|
||||
spotRevision: url.searchParams.get("spotRevision"),
|
||||
limit: Number(url.searchParams.get("limit") ?? 20),
|
||||
offset: Number(url.searchParams.get("offset") ?? 0),
|
||||
}));
|
||||
@@ -365,6 +367,7 @@ export function createGameServer(options = {}) {
|
||||
json(response, 200, gameDatabase.listDungeonLeaderboard({ dungeonId: url.searchParams.get("dungeon"),
|
||||
difficultyId: url.searchParams.get("difficulty"), clear: url.searchParams.get("clear"),
|
||||
bossId: url.searchParams.get("boss"),
|
||||
spotId: url.searchParams.get("spot"), spotRevision: url.searchParams.get("spotRevision"),
|
||||
bossDifficulty: url.searchParams.has("bossDifficulty") ? Number(url.searchParams.get("bossDifficulty")) : undefined,
|
||||
offset: url.searchParams.get("offset"), limit: url.searchParams.get("limit") }));
|
||||
return;
|
||||
@@ -537,6 +540,25 @@ export function createGameServer(options = {}) {
|
||||
json(response, 201, arenaService.socketTicket(account.id));
|
||||
return;
|
||||
}
|
||||
if (["/api/bite-sized-layouts", "/api/gm/bite-sized-layouts"].includes(url.pathname)) {
|
||||
const privileged = url.pathname.startsWith("/api/gm/");
|
||||
let account = null;
|
||||
if (privileged) {
|
||||
account = gameDatabase.authenticate(bearerToken(request));
|
||||
if (!gameDatabase.isGameMaster(account)) throw new GameDatabaseError("Game Master access is required.", 403, "gm_required");
|
||||
}
|
||||
if (request.method === "GET") {
|
||||
const spotId = url.searchParams.get("spotId");
|
||||
json(response, 200, spotId ? gameDatabase.getBiteSizedSpotRevision(spotId, Number(url.searchParams.get("revision")))
|
||||
: url.searchParams.get("history") === "1" ? gameDatabase.listBiteSizedSpotRevisions() : gameDatabase.getBiteSizedLayouts());
|
||||
return;
|
||||
}
|
||||
if (privileged && request.method === "PUT") {
|
||||
const body = await readJson(request, bodyLimit);
|
||||
json(response, 200, gameDatabase.putBiteSizedLayouts(account, body.expectedRevision, body.config));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (url.pathname === "/api/manastorm-config" && request.method === "GET") {
|
||||
const current = gameDatabase.getManastormConfig();
|
||||
json(response, 200, {
|
||||
|
||||
Reference in new issue
Block a user