XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix: changeDojoRoot for older versions (#3606)

Closes #3604 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3606 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

6074a89f
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +6 -6
Modified src/controllers/api/changeDojoRootController.ts +6 -6
@@ -9,20 +9,20 @@ import { logger } from "../../utils/logger.ts";
9 9 import type { IDojoComponentDatabase } from "../../types/guildTypes.ts";
10 10 import { GuildPermission } from "../../types/guildTypes.ts";
11 11 import { Types } from "mongoose";
12 import { getAccountIdForRequest } from "../../services/loginService.ts";
12 import { getAccountForRequest } from "../../services/loginService.ts";
13 13 import { getInventory } from "../../services/inventoryService.ts";
14 14
15 15 export const changeDojoRootController: RequestHandler = async (req, res) => {
16 const accountId = await getAccountIdForRequest(req);
17 const inventory = await getInventory(accountId, "GuildId LevelKeys");
16 const account = await getAccountForRequest(req);
17 const inventory = await getInventory(account._id, "GuildId LevelKeys");
18 18 const guild = await getGuildForRequestEx(req, inventory);
19 if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
19 if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, account._id, GuildPermission.Architect))) {
20 20 res.json({ DojoRequestStatus: -1 });
21 21 return;
22 22 }
23 23
24 24 // Example POST body: {"pivot":[0, 0, -64],"components":"{\"670429301ca0a63848ccc467\":{\"R\":[0,0,0],\"P\":[0,3,32]},\"6704254a1ca0a63848ccb33c\":{\"R\":[0,0,0],\"P\":[0,9.25,-32]},\"670429461ca0a63848ccc731\":{\"R\":[-90,0,0],\"P\":[-47.999992370605,3,16]}}"}
25 if (req.body) {
25 if (req.body && req.body != "") {
26 26 logger.debug(`data provided to ${req.path}: ${String(req.body)}`);
27 27 throw new Error("dojo reparent operation should not need deco repositioning"); // because we always provide SortId
28 28 }
@@ -67,7 +67,7 @@ export const changeDojoRootController: RequestHandler = async (req, res) => {
67 67
68 68 await guild.save();
69 69
70 res.json(await getDojoClient(guild, 0));
70 res.json(await getDojoClient(guild, 0, undefined, account.BuildLabel));
71 71 };
72 72
73 73 interface INode {