返回提交历史
Modified
src/app.ts
+6
-6
Modified
src/controllers/api/getGuildController.ts
+1
-5
Modified
src/controllers/api/inventoryController.ts
+4
-8
Modified
src/controllers/api/loginController.ts
+2
-2
Modified
src/controllers/api/tauntHistoryController.ts
+2
-4
Modified
src/controllers/api/updateInventoryController.ts
+4
-9
Modified
src/helpers/loginHelpers.ts
+2
-5
Modified
src/models/inventoryModels/inventoryModel.ts
+1
-123
Modified
src/routes/api.ts
+7
-7
Modified
src/routes/cache.ts
+0
-1
XFEstudio/XFESpaceNinjaServer
fix lint
3403d496
代码差异
10 个文件
+29
-170
@@ -15,7 +15,7 @@ import { statsRouter } from "@/src/routes/stats";
15
15
import { webuiRouter } from "@/src/routes/webui";
16
16
import { connectDatabase } from "@/src/services/mongoService";
17
17
import { registerLogFileCreationListener } from "@/src/utils/logger";
18
import * as zlib from 'zlib';
18
import * as zlib from "zlib";
19
19
20
20
void registerLogFileCreationListener();
21
21
void connectDatabase();
@@ -23,17 +23,17 @@ void connectDatabase();
23
23
const app = express();
24
24
25
25
app.use(function (req, _res, next) {
26
var buffer: Buffer[] = []
27
req.on('data', function (chunk: Buffer) {
26
const buffer: Buffer[] = [];
27
req.on("data", function (chunk: Buffer) {
28
28
if (chunk !== undefined && chunk.length > 2 && chunk[0] == 0x1f && chunk[1] == 0x8b) {
29
29
buffer.push(Buffer.from(chunk));
30
30
}
31
31
});
32
32
33
req.on('end', function () {
33
req.on("end", function () {
34
34
zlib.gunzip(Buffer.concat(buffer), function (_err, dezipped) {
35
if (typeof dezipped != 'undefined') {
36
req.body = dezipped.toString('utf-8');
35
if (typeof dezipped != "undefined") {
36
req.body = dezipped.toString("utf-8");
37
37
}
38
38
39
39
next();
@@ -1,10 +1,6 @@
1
1
import { RequestHandler } from "express";
2
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
3
import { Guild } from "@/src/models/guildModel";
4
import { getAccountIdForRequest } from "@/src/services/loginService";
5
import { toOid } from "@/src/helpers/inventoryHelpers";
6
2
7
const getGuildController: RequestHandler = async (_, res) => {
3
const getGuildController: RequestHandler = (_, res) => {
8
4
res.json({});
9
5
};
10
6
@@ -3,13 +3,8 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
3
3
import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
4
4
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
5
5
import { config } from "@/src/services/configService";
6
import allDialogue from "@/static/fixed_responses/allDialogue.json";
7
import allMissions from "@/static/fixed_responses/allMissions.json";
8
import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
9
import { IInventoryDatabase, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes";
10
import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
11
import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus";
12
import { IFlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
6
import { IInventoryDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
7
import { ExportCustoms, ExportFlavour } from "warframe-public-export-plus";
13
8
14
9
// eslint-disable-next-line @typescript-eslint/no-misused-promises
15
10
const inventoryController: RequestHandler = async (request, response) => {
@@ -90,11 +85,12 @@ const inventoryController: RequestHandler = async (request, response) => {
90
85
response.json(inventoryResponse);
91
86
};
92
87
88
/*
93
89
const addString = (arr: string[], str: string): void => {
94
90
if (!arr.find(x => x == str)) {
95
91
arr.push(str);
96
92
}
97
};
93
};*/
98
94
99
95
const getExpRequiredForMr = (rank: number): number => {
100
96
if (rank <= 30) {
@@ -25,7 +25,7 @@ const loginController: RequestHandler = async (request, response) => {
25
25
email: loginRequest.email,
26
26
password: loginRequest.password,
27
27
DisplayName: loginRequest.email.substring(0, loginRequest.email.indexOf("@")),
28
Nonce: nonce,
28
Nonce: nonce
29
29
});
30
30
logger.debug("created new account");
31
31
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -55,7 +55,7 @@ const loginController: RequestHandler = async (request, response) => {
55
55
if (account.Nonce == 0 || loginRequest.ClientType != "webui") {
56
56
account.Nonce = nonce;
57
57
}
58
58
59
59
await account.save();
60
60
61
61
const { email, password, ...databaseAccount } = account.toJSON();
@@ -8,8 +8,7 @@ import { logger } from "@/src/utils/logger";
8
8
export const tauntHistoryController: RequestHandler = async (req, res) => {
9
9
const accountId = await getAccountIdForRequest(req);
10
10
const inventory = await getInventory(accountId);
11
if(req.body !== undefined)
12
{
11
if (req.body !== undefined) {
13
12
const clientTaunt = JSON.parse(String(req.body)) as ITaunt;
14
13
logger.debug(`updating taunt ${clientTaunt.node} to state ${clientTaunt.state}`);
15
14
inventory.TauntHistory ??= [];
@@ -21,8 +20,7 @@ export const tauntHistoryController: RequestHandler = async (req, res) => {
21
20
}
22
21
await inventory.save();
23
22
res.end();
24
}else
25
{
23
} else {
26
24
res.json({});
27
25
}
28
26
};
@@ -1,25 +1,20 @@
1
1
import { getAccountIdForRequest } from "@/src/services/loginService";
2
import { getJSONfromString } from "@/src/helpers/stringHelpers";
3
import { startRecipe } from "@/src/services/recipeService";
4
import { logger } from "@/src/utils/logger";
5
2
import { RequestHandler } from "express";
6
3
import { getInventory } from "@/src/services/inventoryService";
7
4
8
9
5
// eslint-disable-next-line @typescript-eslint/no-misused-promises
10
6
export const updateInventoryController: RequestHandler = async (req, res) => {
11
7
const accountId = await getAccountIdForRequest(req);
12
const body = JSON.parse(req.body);
8
const body: any = JSON.parse(req.body as string);
13
9
14
10
const inventory = await getInventory(accountId);
15
inventory.Missions.push({Tag: body.Missions.Tag, Completes: body.Missions.Completes, BestRating: 0.2 })
11
inventory.Missions.push({ Tag: body.Missions.Tag, Completes: body.Missions.Completes, BestRating: 0.2 });
16
12
17
13
await inventory.save();
18
14
console.log(body);
19
res.json({})
15
res.json({});
20
16
};
21
17
22
23
18
/*
24
19
{
25
20
"LongGuns" : [
@@ -148,4 +143,4 @@ export const updateInventoryController: RequestHandler = async (req, res) => {
148
143
}
149
144
}
150
145
}
151
*/
146
*/
@@ -1,5 +1,5 @@
1
1
import { ILoginRequest } from "@/src/types/loginTypes";
2
import { parseEmail, parseNumber, parseString } from "./general";
2
import { parseEmail, parseString } from "./general";
3
3
4
4
const toLoginRequest = (loginRequest: unknown): ILoginRequest => {
5
5
if (!loginRequest || typeof loginRequest !== "object") {
@@ -7,10 +7,7 @@ const toLoginRequest = (loginRequest: unknown): ILoginRequest => {
7
7
}
8
8
9
9
// TODO: function that checks whether every field of interface is in object
10
if (
11
"email" in loginRequest &&
12
"password" in loginRequest
13
) {
10
if ("email" in loginRequest && "password" in loginRequest) {
14
11
return {
15
12
email: parseEmail(loginRequest.email),
16
13
password: parseString(loginRequest.password)
@@ -13,30 +13,18 @@ import {
13
13
IPendingRecipe as IPendingRecipeDatabase,
14
14
IPendingRecipeResponse,
15
15
ITypeCount,
16
IFocusXP,
17
IFocusUpgrades,
18
16
ITypeXPItem,
19
17
IChallengeProgress,
20
18
IStepSequencer,
21
IAffiliation,
22
19
INotePacks,
23
ICompletedJobChain,
24
ISeasonChallenge,
25
20
IPlayerSkills,
26
21
ISettings,
27
IInfestedFoundry,
28
IConsumedSuit,
29
22
IQuestProgress,
30
23
IQuestKeyDatabase,
31
24
IQuestKeyResponse,
32
IFusionTreasure,
33
ISpectreLoadout,
34
25
IWeaponSkinDatabase,
35
ITaunt,
36
26
IPeriodicMissionCompletionDatabase,
37
IPeriodicMissionCompletionResponse,
38
ILoreFragmentScan,
39
IEvolutionProgress
27
IPeriodicMissionCompletionResponse
40
28
} from "../../types/inventoryTypes/inventoryTypes";
41
29
import { IOid } from "../../types/commonTypes";
42
30
import {
@@ -53,26 +41,6 @@ import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
53
41
54
42
const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
55
43
56
const focusXPSchema = new Schema<IFocusXP>(
57
{
58
AP_POWER: Number,
59
AP_TACTIC: Number,
60
AP_DEFENSE: Number,
61
AP_ATTACK: Number,
62
AP_WARD: Number
63
},
64
{ _id: false }
65
);
66
67
const focusUpgradesSchema = new Schema<IFocusUpgrades>(
68
{
69
ItemType: String,
70
Level: Number,
71
IsUniversal: Boolean
72
},
73
{ _id: false }
74
);
75
76
44
const pendingRecipeSchema = new Schema<IPendingRecipeDatabase>(
77
45
{
78
46
ItemType: String,
@@ -394,34 +362,6 @@ StepSequencersSchema.set("toJSON", {
394
362
}
395
363
});
396
364
397
const affiliationsSchema = new Schema<IAffiliation>(
398
{
399
Initiated: Boolean,
400
Standing: Number,
401
Title: Number,
402
FreeFavorsEarned: { type: [Number], default: undefined },
403
FreeFavorsUsed: { type: [Number], default: undefined },
404
Tag: String
405
},
406
{ _id: false }
407
);
408
409
const completedJobChainsSchema = new Schema<ICompletedJobChain>(
410
{
411
LocationTag: String,
412
Jobs: [String]
413
},
414
{ _id: false }
415
);
416
417
const seasonChallengeHistorySchema = new Schema<ISeasonChallenge>(
418
{
419
challenge: String,
420
id: String
421
},
422
{ _id: false }
423
);
424
425
365
//TODO: check whether this is complete
426
366
const playerSkillsSchema = new Schema<IPlayerSkills>(
427
367
{
@@ -449,25 +389,6 @@ const settingsSchema = new Schema<ISettings>({
449
389
TradingRulesConfirmed: Boolean
450
390
});
451
391
452
const consumedSchuitsSchema = new Schema<IConsumedSuit>({
453
s: String,
454
c: colorSchema
455
});
456
457
const infestedFoundrySchema = new Schema<IInfestedFoundry>(
458
{
459
Name: String,
460
Resources: { type: [typeCountSchema], default: undefined },
461
Slots: Number,
462
XP: Number,
463
ConsumedSuits: { type: [consumedSchuitsSchema], default: undefined },
464
InvigorationIndex: Number,
465
InvigorationSuitOfferings: { type: [String], default: undefined },
466
InvigorationsApplied: Number
467
},
468
{ _id: false }
469
);
470
471
392
const questProgressSchema = new Schema<IQuestProgress>({
472
393
c: Number,
473
394
i: Boolean,
@@ -499,21 +420,6 @@ questKeysSchema.set("toJSON", {
499
420
}
500
421
});
501
422
502
const fusionTreasuresSchema = new Schema<IFusionTreasure>().add(typeCountSchema).add({ Sockets: Number });
503
504
const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
505
{
506
LongGuns: String,
507
Melee: String,
508
Pistols: String,
509
PistolsFeatures: Number,
510
PistolsModularParts: [String],
511
Suits: String,
512
ItemType: String
513
},
514
{ _id: false }
515
);
516
517
423
const weaponSkinsSchema = new Schema<IWeaponSkinDatabase>(
518
424
{
519
425
ItemType: String
@@ -533,14 +439,6 @@ weaponSkinsSchema.set("toJSON", {
533
439
}
534
440
});
535
441
536
const tauntSchema = new Schema<ITaunt>(
537
{
538
node: String,
539
state: String
540
},
541
{ _id: false }
542
);
543
544
442
const periodicMissionCompletionsSchema = new Schema<IPeriodicMissionCompletionDatabase>(
545
443
{
546
444
date: Date,
@@ -560,24 +458,6 @@ periodicMissionCompletionsSchema.set("toJSON", {
560
458
}
561
459
});
562
460
563
const loreFragmentScansSchema = new Schema<ILoreFragmentScan>(
564
{
565
Progress: Number,
566
Region: String,
567
ItemType: String
568
},
569
{ _id: false }
570
);
571
572
const evolutionProgressSchema = new Schema<IEvolutionProgress>(
573
{
574
Progress: Number,
575
Rank: Number,
576
ItemType: String
577
},
578
{ _id: false }
579
);
580
581
461
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
582
462
{
583
463
accountOwnerId: Schema.Types.ObjectId,
@@ -656,7 +536,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
656
536
//Id CompletedAlerts
657
537
CompletedAlerts: [String],
658
538
659
660
539
//Resource,Credit,Affinity etc or Bless any boosters
661
540
Boosters: [boosterSchema],
662
541
@@ -687,7 +566,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
687
566
//TradeBannedUntil data
688
567
TradeBannedUntil: Schema.Types.Mixed,
689
568
690
691
569
//Unknown and system
692
570
Mailbox: MailboxSchema,
693
571
HandlerPoints: Number,
@@ -101,16 +101,16 @@ apiRouter.get("/setSupportedSyndicate.php", setSupportedSyndicateController);
101
101
apiRouter.get("/surveys.php", surveysController);
102
102
apiRouter.get("/updateSession.php", updateSessionGetController);
103
103
104
apiRouter.get('/getMessages.php', (_, response) => {
104
apiRouter.get("/getMessages.php", (_, response) => {
105
105
response.json({});
106
})
107
apiRouter.get('/trainingResult.php', (_, response) => {
106
});
107
apiRouter.get("/trainingResult.php", (_, response) => {
108
108
response.status(200);
109
})
110
apiRouter.get('/giveStartingGear.php', (_, response) => {
109
});
110
apiRouter.get("/giveStartingGear.php", (_, response) => {
111
111
response.status(200);
112
})
113
apiRouter.get('/worldState.php', worldStateController);
112
});
113
apiRouter.get("/worldState.php", worldStateController);
114
114
// post
115
115
apiRouter.post("/addFriendImage.php", addFriendImageController);
116
116
apiRouter.post("/artifacts.php", artifactsController);
@@ -12,7 +12,6 @@ cacheRouter.get("/B.Cache.Windows_en.bin*", (_req, res) => {
12
12
res.sendFile("static/data/B.Cache.Windows_en_33.0.10.bin", { root: "./" });
13
13
});
14
14
15
16
15
cacheRouter.get("/H.Cache.bin!03_---------------------w", (_req, res) => {
17
16
res.sendFile(`static/data/H.Cache.bin`, { root: "./" });
18
17
});