返回提交历史
Modified
.eslintrc
+1
-1
Modified
src/controllers/api/addFriendImageController.ts
+1
-1
Modified
src/controllers/api/claimCompletedRecipeController.ts
+1
-1
Modified
src/controllers/api/createGuildController.ts
+1
-1
Modified
src/controllers/api/evolveWeaponController.ts
+1
-1
Modified
src/controllers/api/findSessionsController.ts
+5
-5
Modified
src/controllers/api/focusController.ts
+6
-6
Modified
src/controllers/api/genericUpdateController.ts
+2
-1
Modified
src/controllers/api/infestedFoundryController.ts
+7
-3
Modified
src/controllers/api/joinSessionController.ts
+3
-3
Modified
src/controllers/api/modularWeaponCraftingController.ts
+1
-1
Modified
src/controllers/api/nameWeaponController.ts
+1
-1
Modified
src/controllers/api/sellController.ts
+1
-1
Modified
src/controllers/api/setWeaponSkillTreeController.ts
+1
-1
Modified
src/controllers/api/startDojoRecipeController.ts
+1
-1
Modified
src/controllers/api/startRecipeController.ts
+1
-1
Modified
src/controllers/api/stepSequencersController.ts
+1
-1
Modified
src/controllers/api/syndicateSacrificeController.ts
+1
-2
Modified
src/controllers/api/trainingResultController.ts
+1
-1
Modified
src/controllers/api/updateChallengeProgressController.ts
+1
-1
Modified
src/controllers/api/updateSessionController.ts
+2
-2
Modified
src/controllers/api/upgradesController.ts
+1
-1
Modified
src/controllers/custom/updateConfigDataController.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
fix: Convert all Body to String Before Use (#382)
ac6eaa2f
代码差异
23 个文件
+42
-38
@@ -19,7 +19,7 @@
19
19
"@typescript-eslint/no-unsafe-member-access": "warn",
20
20
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
21
21
"@typescript-eslint/no-misused-promises": "warn",
22
"@typescript-eslint/no-unsafe-argument": "warn",
22
"@typescript-eslint/no-unsafe-argument": "error",
23
23
"@typescript-eslint/no-unsafe-call": "warn",
24
24
"@typescript-eslint/no-unsafe-assignment": "warn",
25
25
"@typescript-eslint/no-explicit-any": "warn",
@@ -7,7 +7,7 @@ import { getInventory } from "@/src/services/inventoryService";
7
7
// eslint-disable-next-line @typescript-eslint/no-misused-promises
8
8
const addFriendImageController: RequestHandler = async (req, res) => {
9
9
const accountId = await getAccountIdForRequest(req);
10
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest;
10
const json = getJSONfromString(String(req.body)) as IUpdateGlyphRequest;
11
11
const inventory = await getInventory(accountId);
12
12
inventory.ActiveAvatarImageType = json.AvatarImageType;
13
13
await inventory.save();
@@ -15,7 +15,7 @@ export interface IClaimCompletedRecipeRequest {
15
15
16
16
// eslint-disable-next-line @typescript-eslint/no-misused-promises
17
17
export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
18
const claimCompletedRecipeRequest = getJSONfromString(req.body.toString()) as IClaimCompletedRecipeRequest;
18
const claimCompletedRecipeRequest = getJSONfromString(String(req.body)) as IClaimCompletedRecipeRequest;
19
19
const accountId = await getAccountIdForRequest(req);
20
20
if (!accountId) throw new Error("no account id");
21
21
@@ -8,7 +8,7 @@ import { ICreateGuildRequest } from "@/src/types/guildTypes";
8
8
// eslint-disable-next-line @typescript-eslint/no-misused-promises
9
9
const createGuildController: RequestHandler = async (req, res) => {
10
10
const accountId = await getAccountIdForRequest(req);
11
const payload: ICreateGuildRequest = getJSONfromString(req.body.toString());
11
const payload = getJSONfromString(String(req.body)) as ICreateGuildRequest;
12
12
13
13
// Create guild on database
14
14
const guild = new Guild({
@@ -9,7 +9,7 @@ import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTyp
9
9
export const evolveWeaponController: RequestHandler = async (req, res) => {
10
10
const accountId = await getAccountIdForRequest(req);
11
11
const inventory = await getInventory(accountId);
12
const payload = getJSONfromString(req.body.toString()) as IEvolveWeaponRequest;
12
const payload = getJSONfromString(String(req.body)) as IEvolveWeaponRequest;
13
13
console.assert(payload.Action == "EWA_INSTALL");
14
14
15
15
// TODO: We should remove the Genesis item & its resources, but currently we don't know these "recipes".
@@ -4,25 +4,25 @@ import { logger } from "@/src/utils/logger";
4
4
5
5
//TODO: cleanup
6
6
const findSessionsController: RequestHandler = (_req, res) => {
7
const reqBody = JSON.parse(_req.body);
7
const reqBody = JSON.parse(String(_req.body));
8
8
logger.debug("FindSession Request ", { reqBody });
9
const req = JSON.parse(_req.body);
9
const req = JSON.parse(String(_req.body));
10
10
if (req.id != undefined) {
11
11
logger.debug("Found ID");
12
const session = getSession(req.id);
12
const session = getSession(req.id as string);
13
13
14
14
if (session) res.json({ queryId: req.queryId, Sessions: session });
15
15
else res.json({});
16
16
} else if (req.originalSessionId != undefined) {
17
17
logger.debug("Found OriginalSessionID");
18
18
19
const session = getSession(req.originalSessionId);
19
const session = getSession(req.originalSessionId as string);
20
20
if (session) res.json({ queryId: req.queryId, Sessions: session });
21
21
else res.json({});
22
22
} else {
23
23
logger.debug("Found SessionRequest");
24
24
25
const session = getSession(_req.body);
25
const session = getSession(String(_req.body));
26
26
if (session) res.json({ queryId: req.queryId, Sessions: session });
27
27
else res.json({});
28
28
}
@@ -15,7 +15,7 @@ export const focusController: RequestHandler = async (req, res) => {
15
15
res.end();
16
16
break;
17
17
case FocusOperation.UnlockWay: {
18
const focusType = (JSON.parse(req.body.toString()) as IWayRequest).FocusType;
18
const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
19
19
const focusPolarity = focusTypeToPolarity(focusType);
20
20
const inventory = await getInventory(accountId);
21
21
const cost = inventory.FocusAbility ? 50_000 : 0;
@@ -32,7 +32,7 @@ export const focusController: RequestHandler = async (req, res) => {
32
32
break;
33
33
}
34
34
case FocusOperation.ActivateWay: {
35
const focusType = (JSON.parse(req.body.toString()) as IWayRequest).FocusType;
35
const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
36
36
const inventory = await getInventory(accountId);
37
37
inventory.FocusAbility = focusType;
38
38
await inventory.save();
@@ -40,7 +40,7 @@ export const focusController: RequestHandler = async (req, res) => {
40
40
break;
41
41
}
42
42
case FocusOperation.UnlockUpgrade: {
43
const request = JSON.parse(req.body.toString()) as IUnlockUpgradeRequest;
43
const request = JSON.parse(String(req.body)) as IUnlockUpgradeRequest;
44
44
const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]);
45
45
const inventory = await getInventory(accountId);
46
46
let cost = 0;
@@ -57,7 +57,7 @@ export const focusController: RequestHandler = async (req, res) => {
57
57
break;
58
58
}
59
59
case FocusOperation.LevelUpUpgrade: {
60
const request = JSON.parse(req.body.toString()) as ILevelUpUpgradeRequest;
60
const request = JSON.parse(String(req.body)) as ILevelUpUpgradeRequest;
61
61
const focusPolarity = focusTypeToPolarity(request.FocusInfos[0].ItemType);
62
62
const inventory = await getInventory(accountId);
63
63
let cost = 0;
@@ -75,7 +75,7 @@ export const focusController: RequestHandler = async (req, res) => {
75
75
break;
76
76
}
77
77
case FocusOperation.UnbindUpgrade: {
78
const request = JSON.parse(req.body.toString()) as IUnbindUpgradeRequest;
78
const request = JSON.parse(String(req.body)) as IUnbindUpgradeRequest;
79
79
const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]);
80
80
const inventory = await getInventory(accountId);
81
81
inventory.FocusXP[focusPolarity] -= 750_000 * request.FocusTypes.length;
@@ -105,7 +105,7 @@ export const focusController: RequestHandler = async (req, res) => {
105
105
break;
106
106
}
107
107
case FocusOperation.ConvertShard: {
108
const request = JSON.parse(req.body.toString()) as IConvertShardRequest;
108
const request = JSON.parse(String(req.body)) as IConvertShardRequest;
109
109
// Tally XP
110
110
let xp = 0;
111
111
for (const shard of request.Shards) {
@@ -2,11 +2,12 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
2
2
import { updateGeneric } from "@/src/services/inventoryService";
3
3
import { RequestHandler } from "express";
4
4
import { getJSONfromString } from "@/src/helpers/stringHelpers";
5
import { IGenericUpdate } from "@/src/types/genericUpdate";
5
6
6
7
// eslint-disable-next-line @typescript-eslint/no-misused-promises
7
8
const genericUpdateController: RequestHandler = async (request, response) => {
8
9
const accountId = await getAccountIdForRequest(request);
9
const update = getJSONfromString(request.body.toString());
10
const update = getJSONfromString(String(request.body)) as IGenericUpdate;
10
11
response.json(await updateGeneric(update, accountId));
11
12
};
12
13
@@ -7,11 +7,10 @@ import { IOid } from "@/src/types/commonTypes";
7
7
// eslint-disable-next-line @typescript-eslint/no-misused-promises
8
8
export const infestedFoundryController: RequestHandler = async (req, res) => {
9
9
const accountId = await getAccountIdForRequest(req);
10
const payload = getJSONfromString(req.body.toString());
11
10
switch (req.query.mode) {
12
11
case "s": {
13
12
// shard installation
14
const request = payload as IShardInstallRequest;
13
const request = getJSONfromString(String(req.body)) as IShardInstallRequest;
15
14
const inventory = await getInventory(accountId);
16
15
const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!;
17
16
if (
@@ -42,9 +41,10 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
42
41
43
42
case "n": {
44
43
// name the beast
44
const request = getJSONfromString(String(req.body)) as IHelminthNameRequest;
45
45
const inventory = await getInventory(accountId);
46
46
inventory.InfestedFoundry ??= {};
47
inventory.InfestedFoundry.Name = payload.newName as string;
47
inventory.InfestedFoundry.Name = request.newName;
48
48
await inventory.save();
49
49
res.json({
50
50
InventoryChanges: {
@@ -73,6 +73,10 @@ interface IShardInstallRequest {
73
73
Color: string;
74
74
}
75
75
76
interface IHelminthNameRequest {
77
newName: string;
78
}
79
76
80
const colorToShard: Record<string, string> = {
77
81
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
78
82
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",
@@ -3,10 +3,10 @@ import { getSessionByID } from "@/src/managers/sessionManager";
3
3
import { logger } from "@/src/utils/logger";
4
4
5
5
const joinSessionController: RequestHandler = (_req, res) => {
6
const reqBody = JSON.parse(_req.body);
6
const reqBody = JSON.parse(String(_req.body));
7
7
logger.debug(`JoinSession Request`, { reqBody });
8
const req = JSON.parse(_req.body);
9
const session = getSessionByID(req.sessionIds[0]);
8
const req = JSON.parse(String(_req.body));
9
const session = getSessionByID(req.sessionIds[0] as string);
10
10
res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } });
11
11
};
12
12
@@ -22,7 +22,7 @@ interface IModularCraftRequest {
22
22
// eslint-disable-next-line @typescript-eslint/no-misused-promises
23
23
export const modularWeaponCraftingController: RequestHandler = async (req, res) => {
24
24
const accountId = await getAccountIdForRequest(req);
25
const data: IModularCraftRequest = getJSONfromString(req.body.toString());
25
const data = getJSONfromString(String(req.body)) as IModularCraftRequest;
26
26
if (!(data.WeaponType in modularWeaponTypes)) {
27
27
throw new Error(`unknown modular weapon type: ${data.WeaponType}`);
28
28
}
@@ -12,7 +12,7 @@ interface INameWeaponRequest {
12
12
export const nameWeaponController: RequestHandler = async (req, res) => {
13
13
const accountId = await getAccountIdForRequest(req);
14
14
const inventory = await getInventory(accountId);
15
const body = getJSONfromString(req.body.toString()) as INameWeaponRequest;
15
const body = getJSONfromString(String(req.body)) as INameWeaponRequest;
16
16
const item = inventory[req.query.Category as string as TEquipmentKey].find(
17
17
item => item._id.toString() == (req.query.ItemId as string)
18
18
)!;