@xmobitea/gn-server 2.6.13 → 2.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,7 @@ export declare class ApiMiddleware {
19
19
  private headerIP;
20
20
  private dauLast30Min;
21
21
  private maxCCU;
22
+ private gameIds;
22
23
  setSecretInfoCollection(secretInfoCollection: mongoDB.Collection<mongoDB.Document>): void;
23
24
  setAuthInfoCollection(authInfoCollection: mongoDB.Collection<mongoDB.Document>): void;
24
25
  setPlayerGameCollection(playerGameCollection: mongoDB.Collection<mongoDB.Document>): void;
@@ -26,6 +27,7 @@ export declare class ApiMiddleware {
26
27
  setPrivateKeyToken(privateKeyToken: string): void;
27
28
  setHeaderIP(headerIP: string): void;
28
29
  getHeaderIP(): string;
30
+ setGameIds(gameIds: string[]): void;
29
31
  run(): void;
30
32
  private getDAULast30Min;
31
33
  private checkAndRemoveDict;
package/dist/index.js CHANGED
@@ -15037,6 +15037,7 @@ class ApiMiddleware {
15037
15037
  headerIP;
15038
15038
  dauLast30Min;
15039
15039
  maxCCU;
15040
+ gameIds;
15040
15041
  setSecretInfoCollection(secretInfoCollection) {
15041
15042
  this.secretInfoCollection = secretInfoCollection;
15042
15043
  }
@@ -15058,6 +15059,9 @@ class ApiMiddleware {
15058
15059
  getHeaderIP() {
15059
15060
  return this.headerIP;
15060
15061
  }
15062
+ setGameIds(gameIds) {
15063
+ this.gameIds = gameIds;
15064
+ }
15061
15065
  run() {
15062
15066
  this.dauLast30Min = [];
15063
15067
  this.maxCCU = -1;
@@ -15360,6 +15364,10 @@ class ApiMiddleware {
15360
15364
  let gameId = req.header(Commands.RequestGameIdCmd);
15361
15365
  if (!gameId)
15362
15366
  gameId = ApiMiddleware.DEFAULT_GAME_ID;
15367
+ else {
15368
+ if (!this.gameIds.includes(gameId))
15369
+ return ReturnCode.SecretInvalid;
15370
+ }
15363
15371
  let secretInfoAny = structuredClone(secretInfo);
15364
15372
  secretInfoAny.getGameId = secretInfo.getGameId;
15365
15373
  secretInfoAny.getPermission = secretInfo.getPermission;
@@ -15441,6 +15449,10 @@ class ApiMiddleware {
15441
15449
  let gameId = socket.data.gameId;
15442
15450
  if (!gameId)
15443
15451
  gameId = ApiMiddleware.DEFAULT_GAME_ID;
15452
+ else {
15453
+ if (!this.gameIds.includes(gameId))
15454
+ return next(ReturnCode.SecretInvalid);
15455
+ }
15444
15456
  let secretInfoAny = structuredClone(secretInfo);
15445
15457
  secretInfoAny.getGameId = secretInfo.getGameId;
15446
15458
  secretInfoAny.getPermission = secretInfo.getPermission;
@@ -15815,6 +15827,7 @@ class HttpAppHandler {
15815
15827
  return next(err);
15816
15828
  }
15817
15829
  });
15830
+ return;
15818
15831
  }
15819
15832
  return next();
15820
15833
  }, wrap((req, res, next) => {
@@ -86373,6 +86386,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
86373
86386
  this.antiDdosMiddleware.run();
86374
86387
  this.gnServer = this.newGNServer();
86375
86388
  this.gnServer.setApiMiddleware(this.apiMiddleware);
86389
+ this.apiMiddleware.setGameIds(this.gnServer.getGameIds());
86376
86390
  this.httpApp = this.newHttpApp();
86377
86391
  this.httpApp.setApiMiddleware(this.apiMiddleware);
86378
86392
  this.httpApp.setUploadFileMiddleware(this.uploadFileMiddleware);
package/gn.sh CHANGED
@@ -485,10 +485,10 @@ init_create_packageJson() {
485
485
  "author": "GN-Server-author",
486
486
  "license": "ISC",
487
487
  "devDependencies": {
488
- "typescript": "^5.7.2"
489
488
  },
490
489
  "dependencies": {
491
- "@xmobitea/gn-server": "*"
490
+ "@xmobitea/gn-server": "*",
491
+ "typescript": "^5.8.3"
492
492
  }
493
493
  }' > package.json
494
494
  echo 'create package.json file success'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmobitea/gn-server",
3
- "version": "2.6.13",
3
+ "version": "2.6.14",
4
4
  "description": "GearN Server by XmobiTea (Pro)",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "@types/nodemailer": "^7.0.5",
25
25
  "terser-webpack-plugin": "^5.3.10",
26
26
  "ts-loader": "^9.5.1",
27
- "typescript": "^5.7.2",
27
+ "typescript": "^5.8.3",
28
28
  "webpack": "^5.97.1",
29
29
  "webpack-cli": "^5.1.4",
30
30
  "webpack-node-externals": "^3.0.0"