@xmobitea/gn-server 2.5.1 → 2.6.1

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.
Files changed (27) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +3 -0
  3. package/THIRD_PARTY_LICENSES +97 -0
  4. package/dist/GN-app-api/handler/controller/handler/dashboard/SetSecretInfoInformationRequestHandler.d.ts +1 -0
  5. package/dist/GN-app-api/handler/controller/handler/dashboard/model/EmailSettingsParam.d.ts +5 -1
  6. package/dist/GN-app-api/service/EmailService.d.ts +9 -4
  7. package/dist/GN-app-api/service/IEmailService.d.ts +2 -2
  8. package/dist/GN-app-api/service/IPlayStationNetworkService.d.ts +5 -0
  9. package/dist/GN-app-api/service/ISteamService.d.ts +5 -0
  10. package/dist/GN-app-api/service/PlayStationNetworkService.d.ts +14 -0
  11. package/dist/GN-app-api/service/SteamService.d.ts +12 -0
  12. package/dist/GN-common/constant/parameterCode/GNParameterCode.d.ts +6 -0
  13. package/dist/GN-common/entity/SecretInfo.d.ts +4 -0
  14. package/dist/GN-library/xdatabase/lib/entity/pro/masterAdmin/SecretInfoItem.d.ts +4 -0
  15. package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +15 -8
  16. package/dist/GN-library/xsettings/lib/entity/xEmailSettings.d.ts +5 -1
  17. package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +1 -1
  18. package/dist/GN-startup/middleware/AntiDdosMiddleware.d.ts +1 -0
  19. package/dist/GN-startup/routes/SocketAppHandler.d.ts +7 -8
  20. package/dist/GN-startup/routes/utils/wrap.d.ts +2 -0
  21. package/dist/GNServer.d.ts +6 -5
  22. package/dist/index.d.ts +0 -4
  23. package/dist/index.js +841 -460
  24. package/gn.sh +1 -1
  25. package/package.json +9 -21
  26. package/dist/GN-app-api/service/ILockService.d.ts +0 -4
  27. package/dist/GN-app-api/service/LockService.d.ts +0 -5
package/dist/index.js CHANGED
@@ -138,7 +138,6 @@ __webpack_require__.d(__webpack_exports__, {
138
138
  ItemDataParam: () => (/* reexport */ ItemDataParam),
139
139
  ItemStatisticsParam: () => (/* reexport */ ItemStatisticsParam),
140
140
  ItemType: () => (/* reexport */ ItemType),
141
- LockService: () => (/* reexport */ LockService),
142
141
  LogSettings: () => (/* reexport */ LogSettings),
143
142
  MasterAdminMongoObject: () => (/* reexport */ MasterAdminMongoObject),
144
143
  MasterAdminPermissionRulesParam: () => (/* reexport */ MasterAdminPermissionRulesParam),
@@ -1750,6 +1749,15 @@ class AppleService {
1750
1749
  else if (answer.aud !== this.appleClientId) {
1751
1750
  answer["error"] = "unexpected audience (aud claim): " + answer.aud;
1752
1751
  }
1752
+ else {
1753
+ let now = Math.floor(Date.now() / 1000); // thời gian hiện tại (epoch seconds)
1754
+ if (answer.exp && answer.exp < now) {
1755
+ answer["error"] = "token expired at " + new Date(answer.exp * 1000).toISOString();
1756
+ }
1757
+ else if (answer.iat && answer.iat > now + 10) {
1758
+ answer["error"] = "token issued in the future: " + new Date(answer.iat * 1000).toISOString();
1759
+ }
1760
+ }
1753
1761
  return answer;
1754
1762
  }
1755
1763
  catch (error) {
@@ -1774,7 +1782,7 @@ class AppleService {
1774
1782
  signedTransactionInfoPayload = external_jsonwebtoken_default().decode(transactionInfoResponse.data.signedTransactionInfo);
1775
1783
  }
1776
1784
  catch (err) {
1777
- Debug.log("[GN] error while validate apple receipt " + err.toString());
1785
+ Debug.log("[GearN] error while validate apple receipt " + err.toString());
1778
1786
  }
1779
1787
  return {
1780
1788
  success: true,
@@ -1826,7 +1834,7 @@ class AppleService {
1826
1834
  // try {
1827
1835
  // let result = await axios.post(AppleService.MAIN_verifyAppleAppStoreAPIUrl, { "receipt-data": payload }, {
1828
1836
  // headers: {
1829
- // 'Content-Type': 'application/x-www-form-urlencoded'
1837
+ // "Content-Type": "application/x-www-form-urlencoded"
1830
1838
  // },
1831
1839
  // });
1832
1840
  // answer = result.data;
@@ -1840,7 +1848,7 @@ class AppleService {
1840
1848
  // try {
1841
1849
  // let result = await axios.post(AppleService.MAIN_verifySandboxAppleAppStoreAPIUrl, { "receipt-data": payload }, {
1842
1850
  // headers: {
1843
- // 'Content-Type': 'application/x-www-form-urlencoded'
1851
+ // "Content-Type": "application/x-www-form-urlencoded"
1844
1852
  // },
1845
1853
  // });
1846
1854
  // answer = result.data;
@@ -1856,8 +1864,8 @@ class AppleService {
1856
1864
  try {
1857
1865
  let result = await external_axios_default().get(url, {
1858
1866
  headers: {
1859
- 'Content-Type': 'application/json',
1860
- 'Authorization': 'Bearer ' + token
1867
+ "Content-Type": "application/json",
1868
+ "Authorization": "Bearer " + token
1861
1869
  },
1862
1870
  });
1863
1871
  return {
@@ -1879,18 +1887,18 @@ class AppleService {
1879
1887
  iss: this.issuerId,
1880
1888
  iat: now,
1881
1889
  exp: now + 30 * 60,
1882
- aud: 'appstoreconnect-v1',
1890
+ aud: "appstoreconnect-v1",
1883
1891
  bid: this.appleClientId,
1884
1892
  };
1885
1893
  // Create the header
1886
1894
  let header = {
1887
- alg: 'ES256',
1895
+ alg: "ES256",
1888
1896
  kid: this.keyId,
1889
- typ: 'JWT',
1897
+ typ: "JWT",
1890
1898
  };
1891
1899
  // Generate the token
1892
1900
  const token = external_jsonwebtoken_default().sign(payload, this.p8Content, {
1893
- algorithm: 'ES256',
1901
+ algorithm: "ES256",
1894
1902
  header: header,
1895
1903
  });
1896
1904
  return token;
@@ -2533,6 +2541,9 @@ class GNParameterCode {
2533
2541
  static PushNotificationSettings = "pushNotificationSettings";
2534
2542
  static SendFrom = "sendFrom";
2535
2543
  static SendGridApiKey = "sendGridApiKey";
2544
+ static Host = "host";
2545
+ static Port = "port";
2546
+ static Secure = "secure";
2536
2547
  static Subject = "subject";
2537
2548
  static ContentHtml = "contentHtml";
2538
2549
  static PushNotifications = "pushNotifications";
@@ -2574,6 +2585,9 @@ class GNParameterCode {
2574
2585
  static OwnerIds = "ownerIds";
2575
2586
  static GetStoreUsed = "getStoreUsed";
2576
2587
  static RemoveStoreUsed = "removeStoreUsed";
2588
+ static AdminSecretKeys = "adminSecretKeys";
2589
+ static ServerSecretKeys = "serverSecretKeys";
2590
+ static PlayerSecretKeys = "playerSecretKeys";
2577
2591
  }
2578
2592
 
2579
2593
  ;// ./src/GN-app-api/service/EventCallbackService.ts
@@ -2680,15 +2694,15 @@ class EventCallbackCloudScriptService {
2680
2694
  async executeSystem(eventName) {
2681
2695
  let cloudFunction = this.cloudScriptFunctionDict.get("system");
2682
2696
  if (cloudFunction == null) {
2683
- Debug.logError("[GN] [SystemEventCallback] system not found");
2697
+ Debug.logError("[GearN] [SystemEventCallback] system not found");
2684
2698
  return;
2685
2699
  }
2686
2700
  let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(cloudFunction.type, eventName);
2687
2701
  if (cloudScriptWorker == null) {
2688
- Debug.logError("[GN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2702
+ Debug.logError("[GearN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2689
2703
  return;
2690
2704
  }
2691
- Debug.log("[GN] [SystemEventCallback] auto call " + eventName);
2705
+ Debug.log("[GearN] [SystemEventCallback] auto call " + eventName);
2692
2706
  let requestId = StringUtility.generateRandomString(10, 0);
2693
2707
  let cloudScriptRequest = {
2694
2708
  requestId: requestId,
@@ -2730,22 +2744,22 @@ class EventCallbackCloudScriptService {
2730
2744
  if (cloudScriptResponse.logs.length != 0)
2731
2745
  Debug.log(JSON.stringify(cloudScriptResponse.logs));
2732
2746
  if (cloudScriptResponse.response.status == ExecuteResponseStatus.Ok) {
2733
- Debug.log("[GN] [SystemEventCallback] auto call success " + eventName);
2747
+ Debug.log("[GearN] [SystemEventCallback] auto call success " + eventName);
2734
2748
  }
2735
2749
  else {
2736
- Debug.log("[GN] [SystemEventCallback] auto call failed " + eventName + " " + cloudScriptResponse.response.errorMessage);
2750
+ Debug.log("[GearN] [SystemEventCallback] auto call failed " + eventName + " " + cloudScriptResponse.response.errorMessage);
2737
2751
  }
2738
2752
  }
2739
2753
  async executeRequestServerDetailSystem(gameId, matchmakingTicketCanMatch) {
2740
2754
  let cloudFunction = this.cloudScriptFunctionDict.get("system");
2741
2755
  if (cloudFunction == null) {
2742
- Debug.logError("[GN] [SystemEventCallback] system not found");
2756
+ Debug.logError("[GearN] [SystemEventCallback] system not found");
2743
2757
  return { success: false };
2744
2758
  }
2745
2759
  let eventName = "system_RequestServerDetail";
2746
2760
  let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(cloudFunction.type, eventName);
2747
2761
  if (cloudScriptWorker == null) {
2748
- Debug.logError("[GN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2762
+ Debug.logError("[GearN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2749
2763
  return { success: false };
2750
2764
  }
2751
2765
  let requestId = StringUtility.generateRandomString(10, 0);
@@ -2803,12 +2817,12 @@ class EventCallbackCloudScriptService {
2803
2817
  async executeEvent(eventName, request, operationEvent) {
2804
2818
  let cloudFunction = this.cloudScriptFunctionDict.get("system");
2805
2819
  if (cloudFunction == null) {
2806
- Debug.logError("[GN] [SystemEventCallback] system not found");
2820
+ Debug.logError("[GearN] [SystemEventCallback] system not found");
2807
2821
  return;
2808
2822
  }
2809
2823
  let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(cloudFunction.type, eventName);
2810
2824
  if (cloudScriptWorker == null) {
2811
- Debug.logError("[GN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2825
+ Debug.logError("[GearN] [SystemEventCallback] worker not found at " + cloudFunction.type);
2812
2826
  return;
2813
2827
  }
2814
2828
  let requestId = StringUtility.generateRandomString(10, 0);
@@ -3180,7 +3194,7 @@ class EventCallbackCloudScriptService {
3180
3194
  loadCloudScriptWorker(type, version) {
3181
3195
  let finalVersion = type + "_" + version;
3182
3196
  let filePath = __dirname + "/./GN-startup/cloudScript/" + finalVersion + ".js";
3183
- Debug.log("[GN] [EventCallback] run cloudScript " + finalVersion);
3197
+ Debug.log("[GearN] [EventCallback] run cloudScript " + finalVersion);
3184
3198
  let cloudScriptWorker = (0,external_child_process_namespaceObject.fork)(filePath, {
3185
3199
  env: {
3186
3200
  gnServerSettingsOptions: JSON.stringify(this.gnServerSettingsOptions),
@@ -3245,7 +3259,7 @@ class EventCallbackCloudScriptService {
3245
3259
  }
3246
3260
  });
3247
3261
  cloudScriptWorker.on("exit", (code) => {
3248
- Debug.log("[GN] [EventCallback] terminal cloudScript " + finalVersion + " with code " + code);
3262
+ Debug.log("[GearN] [EventCallback] terminal cloudScript " + finalVersion + " with code " + code);
3249
3263
  thiz.cloudScriptWorkerDict.delete(finalVersion);
3250
3264
  });
3251
3265
  this.cloudScriptWorkerDict.set(finalVersion, cloudScriptWorker);
@@ -3345,8 +3359,9 @@ class PreEventCallbackService {
3345
3359
  }
3346
3360
  }
3347
3361
 
3348
- ;// external "crypto-js"
3349
- const external_crypto_js_namespaceObject = require("crypto-js");
3362
+ ;// external "crypto"
3363
+ const external_crypto_namespaceObject = require("crypto");
3364
+ var external_crypto_default = /*#__PURE__*/__webpack_require__.n(external_crypto_namespaceObject);
3350
3365
  ;// ./src/GN-app-api/service/FacebookService.ts
3351
3366
 
3352
3367
 
@@ -3412,10 +3427,23 @@ class FacebookService {
3412
3427
  let signedRequest = payloadJson["json"]["signedRequest"];
3413
3428
  let appId = payloadJson["json"]["appId"];
3414
3429
  if (this.facebookValidationReceipt(signedRequest)) {
3415
- let json = external_crypto_js_namespaceObject.enc.Base64.parse(signedRequest.split('.')[1]).toString(external_crypto_js_namespaceObject.enc.Utf8);
3416
- let gsJson = JSON.parse(json);
3417
- if (appId == this.facebookAppId) {
3418
- let product_id = gsJson["product_id"];
3430
+ // let json = CryptoJS.enc.Base64.parse(signedRequest.split(".")[1]).toString(CryptoJS.enc.Utf8);
3431
+ // let gsJson = JSON.parse(json);
3432
+ // if (appId == this.facebookAppId) {
3433
+ // let product_id = gsJson["product_id"];
3434
+ // return {
3435
+ // success: true,
3436
+ // productId: product_id,
3437
+ // };
3438
+ // }
3439
+ const base64Payload = signedRequest.split(".")[1]
3440
+ .replace(/-/g, "+")
3441
+ .replace(/_/g, "/");
3442
+ const payloadBuffer = Buffer.from(base64Payload, "base64");
3443
+ const jsonStr = payloadBuffer.toString("utf8");
3444
+ const gsJson = JSON.parse(jsonStr);
3445
+ if (appId === this.facebookAppId) {
3446
+ const product_id = gsJson["product_id"];
3419
3447
  return {
3420
3448
  success: true,
3421
3449
  productId: product_id,
@@ -3427,11 +3455,21 @@ class FacebookService {
3427
3455
  };
3428
3456
  }
3429
3457
  facebookValidationReceipt(signedRequest) {
3430
- let firstpart = signedRequest.split('.')[0];
3431
- firstpart = firstpart.replace(/-/g, '+').replace(/_/g, '/');
3432
- let signature = external_crypto_js_namespaceObject.enc.Base64.parse(firstpart).toString();
3433
- let dataHash = external_crypto_js_namespaceObject.HmacSHA256(signedRequest.split('.')[1], this.facebookInappSecret).toString();
3434
- let isValid = signature === dataHash;
3458
+ // let [encodedSig, encodedPayload] = signedRequest.split(".");
3459
+ // let base64Sig = encodedSig.replace(/-/g, "+").replace(/_/g, "/");
3460
+ // let signature = CryptoJS.enc.Base64.parse(base64Sig).toString();
3461
+ // let dataHash = CryptoJS.HmacSHA256(encodedPayload, this.facebookInappSecret).toString();
3462
+ // let isValid = signature === dataHash;
3463
+ // return isValid;
3464
+ const [encodedSig, encodedPayload] = signedRequest.split(".");
3465
+ const base64Sig = encodedSig
3466
+ .replace(/-/g, "+")
3467
+ .replace(/_/g, "/");
3468
+ const signatureBuffer = Buffer.from(base64Sig, "base64");
3469
+ const hmac = (0,external_crypto_namespaceObject.createHmac)("sha256", this.facebookInappSecret);
3470
+ hmac.update(encodedPayload);
3471
+ const dataHashBuffer = hmac.digest();
3472
+ const isValid = signatureBuffer.equals(dataHashBuffer);
3435
3473
  return isValid;
3436
3474
  }
3437
3475
  ;
@@ -3468,9 +3506,6 @@ class GenericService {
3468
3506
  }
3469
3507
  }
3470
3508
 
3471
- ;// external "crypto"
3472
- const external_crypto_namespaceObject = require("crypto");
3473
- var external_crypto_default = /*#__PURE__*/__webpack_require__.n(external_crypto_namespaceObject);
3474
3509
  ;// ./src/GN-app-api/service/GoogleService.ts
3475
3510
 
3476
3511
 
@@ -3558,16 +3593,16 @@ class GoogleService {
3558
3593
  androidValidationReceipt(signature, signedData) {
3559
3594
  if (!this.publicKeyString)
3560
3595
  return false;
3561
- let verifier = external_crypto_default().createVerify('RSA-SHA1');
3596
+ let verifier = external_crypto_default().createVerify("RSA-SHA1");
3562
3597
  verifier.update(signedData);
3563
- return verifier.verify(this.publicKeyString, signature, 'base64');
3598
+ return verifier.verify(this.publicKeyString, signature, "base64");
3564
3599
  }
3565
3600
  ;
3566
3601
  // gotta give credit to nothing2lose for this function
3567
3602
  generateFormattedPublickey(publicKeyStr) {
3568
3603
  var KEY_PREFIX, KEY_SUFFIX, chunkSize, chunks, str;
3569
3604
  KEY_PREFIX = "-----BEGIN PUBLIC KEY-----\n";
3570
- KEY_SUFFIX = '\n-----END PUBLIC KEY-----';
3605
+ KEY_SUFFIX = "\n-----END PUBLIC KEY-----";
3571
3606
  str = publicKeyStr;
3572
3607
  chunks = [];
3573
3608
  chunkSize = 64;
@@ -3625,7 +3660,7 @@ class PushNotificationService {
3625
3660
  credential: external_firebase_admin_default().credential.cert({
3626
3661
  projectId: this.projectId,
3627
3662
  clientEmail: this.clientEmail,
3628
- privateKey: this.privateKey.replace(/\\n/g, '\n'),
3663
+ privateKey: this.privateKey.replace(/\\n/g, "\n"),
3629
3664
  }),
3630
3665
  });
3631
3666
  this.messaging = external_firebase_admin_default().messaging();
@@ -5628,34 +5663,61 @@ class RequestConverterService {
5628
5663
  }
5629
5664
  }
5630
5665
 
5631
- ;// external "@sendgrid/mail"
5632
- const mail_namespaceObject = require("@sendgrid/mail");
5633
- var mail_default = /*#__PURE__*/__webpack_require__.n(mail_namespaceObject);
5666
+ ;// external "nodemailer"
5667
+ const external_nodemailer_namespaceObject = require("nodemailer");
5668
+ var external_nodemailer_default = /*#__PURE__*/__webpack_require__.n(external_nodemailer_namespaceObject);
5634
5669
  ;// ./src/GN-app-api/service/EmailService.ts
5635
5670
 
5636
5671
  class EmailService {
5637
5672
  isInit = false;
5638
- sendGridApiKey;
5673
+ host;
5674
+ port;
5675
+ secure;
5676
+ username;
5677
+ password;
5639
5678
  fromEmail;
5640
5679
  needSetup = false;
5641
- init(sendGridApiKey, fromEmail) {
5680
+ transporter;
5681
+ init(host, port, secure, username, password, fromEmail) {
5642
5682
  this.isInit = false;
5643
- let oldSendGridApiKey = this.sendGridApiKey;
5644
- this.sendGridApiKey = sendGridApiKey;
5683
+ let oldHost = this.host;
5684
+ let oldPort = this.port;
5685
+ let oldSecure = this.secure;
5686
+ let oldUsername = this.username;
5687
+ let oldPassword = this.password;
5688
+ this.host = host;
5689
+ this.port = port;
5690
+ this.secure = secure;
5691
+ this.username = username;
5692
+ this.password = password;
5645
5693
  this.fromEmail = fromEmail;
5646
- if (oldSendGridApiKey != sendGridApiKey) {
5694
+ if (oldHost != host || oldPort != port || oldSecure != secure || oldUsername != username || oldPassword != password) {
5647
5695
  this.needSetup = true;
5648
5696
  }
5649
5697
  }
5650
5698
  run() {
5651
- if (!this.sendGridApiKey)
5699
+ if (!this.host)
5700
+ return;
5701
+ if (!this.port)
5702
+ return;
5703
+ if (!this.username)
5704
+ return;
5705
+ if (!this.password)
5652
5706
  return;
5653
5707
  if (!this.needSetup)
5654
5708
  return;
5655
- mail_default().setApiKey(this.sendGridApiKey);
5709
+ this.transporter = external_nodemailer_default().createTransport({
5710
+ host: this.host,
5711
+ port: this.port,
5712
+ secure: this.secure,
5713
+ auth: {
5714
+ user: this.username,
5715
+ pass: this.password,
5716
+ }
5717
+ });
5656
5718
  this.isInit = true;
5657
5719
  }
5658
- async sendMail(toEmail, subject, contentHtml, onSendMailSuccess, onSendMailError) {
5720
+ sendMail(toEmail, subject, contentHtml, onSendMailSuccess, onSendMailError) {
5659
5721
  if (!this.isInit)
5660
5722
  return;
5661
5723
  let msg = {
@@ -5664,24 +5726,18 @@ class EmailService {
5664
5726
  subject: subject,
5665
5727
  html: contentHtml,
5666
5728
  };
5667
- try {
5668
- let response = await mail_default().send(msg);
5669
- let statusCode = response;
5670
- if (statusCode > 399) {
5729
+ this.transporter.sendMail(msg, (error, info) => {
5730
+ if (error) {
5671
5731
  if (onSendMailError != null)
5672
- onSendMailError(response.toString());
5732
+ onSendMailError(error.message);
5673
5733
  }
5674
5734
  else {
5675
5735
  if (onSendMailSuccess != null)
5676
5736
  onSendMailSuccess();
5677
5737
  }
5678
- }
5679
- catch (err) {
5680
- if (onSendMailError != null)
5681
- onSendMailError(err.message);
5682
- }
5738
+ });
5683
5739
  }
5684
- async sendMailToMore(toEmails, subject, contentHtml, onSendMailSuccess, onSendMailError) {
5740
+ sendMailToMore(toEmails, subject, contentHtml, onSendMailSuccess, onSendMailError) {
5685
5741
  if (!this.isInit)
5686
5742
  return;
5687
5743
  let msg = {
@@ -5690,22 +5746,16 @@ class EmailService {
5690
5746
  subject: subject,
5691
5747
  html: contentHtml,
5692
5748
  };
5693
- try {
5694
- let response = await mail_default().send(msg);
5695
- let statusCode = response;
5696
- if (statusCode > 399) {
5749
+ this.transporter.sendMail(msg, (error, info) => {
5750
+ if (error) {
5697
5751
  if (onSendMailError != null)
5698
- onSendMailError(response.toString());
5752
+ onSendMailError(error.message);
5699
5753
  }
5700
5754
  else {
5701
5755
  if (onSendMailSuccess != null)
5702
5756
  onSendMailSuccess();
5703
5757
  }
5704
- }
5705
- catch (err) {
5706
- if (onSendMailError != null)
5707
- onSendMailError(err.message);
5708
- }
5758
+ });
5709
5759
  }
5710
5760
  }
5711
5761
 
@@ -5957,21 +6007,6 @@ class ConfigService {
5957
6007
  }
5958
6008
  }
5959
6009
 
5960
- ;// external "async-lock"
5961
- const external_async_lock_namespaceObject = require("async-lock");
5962
- var external_async_lock_default = /*#__PURE__*/__webpack_require__.n(external_async_lock_namespaceObject);
5963
- ;// ./src/GN-app-api/service/LockService.ts
5964
-
5965
- const asyncLock = new (external_async_lock_default())();
5966
- class LockService {
5967
- async handle(key, fn) {
5968
- return await asyncLock.acquire(key, fn);
5969
- }
5970
- isBusy(key) {
5971
- return asyncLock.isBusy(key);
5972
- }
5973
- }
5974
-
5975
6010
  ;// ./src/GN-app-api/service/TimerService.ts
5976
6011
 
5977
6012
 
@@ -6473,6 +6508,7 @@ class SecretInfo_BuilderBase {
6473
6508
  role;
6474
6509
  remove;
6475
6510
  tsExpire;
6511
+ displayName;
6476
6512
  permission;
6477
6513
  gameId;
6478
6514
  isDefault;
@@ -6492,6 +6528,9 @@ class SecretInfo_BuilderBase {
6492
6528
  getTsExpire() {
6493
6529
  return this.tsExpire;
6494
6530
  }
6531
+ getDisplayName() {
6532
+ return this.displayName;
6533
+ }
6495
6534
  getGameId() {
6496
6535
  return this.gameId;
6497
6536
  }
@@ -6529,6 +6568,9 @@ class SecretInfo_BuilderBase {
6529
6568
  //this.tsExpire = tsExpire;
6530
6569
  return this;
6531
6570
  }
6571
+ setDisplayName(displayName) {
6572
+ return this;
6573
+ }
6532
6574
  build() {
6533
6575
  return null;
6534
6576
  }
@@ -6548,6 +6590,10 @@ class SecretInfo_Builder extends SecretInfo_BuilderBase {
6548
6590
  this.tsExpire = tsExpire;
6549
6591
  return this;
6550
6592
  }
6593
+ setDisplayName(displayName) {
6594
+ this.displayName = displayName;
6595
+ return this;
6596
+ }
6551
6597
  setPermission(permission) {
6552
6598
  this.permission = permission;
6553
6599
  return this;
@@ -6570,6 +6616,7 @@ class SecretInfo extends SecretInfo_BuilderBase {
6570
6616
  this.role = builder.getRole();
6571
6617
  this.remove = builder.isRemove();
6572
6618
  this.tsExpire = builder.getTsExpire();
6619
+ this.displayName = builder.getDisplayName();
6573
6620
  this.permission = builder.getPermission();
6574
6621
  this.gameId = builder.getGameId();
6575
6622
  this.isDefault = builder.getIsDefault();
@@ -6585,6 +6632,7 @@ class SecretInfo extends SecretInfo_BuilderBase {
6585
6632
  "role": this.role,
6586
6633
  "isRemove": this.remove,
6587
6634
  "tsExpire": this.tsExpire,
6635
+ "displayName": this.displayName,
6588
6636
  "permission": this.permission,
6589
6637
  "gameId": this.gameId,
6590
6638
  };
@@ -6710,19 +6758,27 @@ class DisplayNameUtility {
6710
6758
  inputReturn += "y";
6711
6759
  else if (char == "z")
6712
6760
  inputReturn += "z";
6761
+ else if (char == "0" ||
6762
+ char == "1" ||
6763
+ char == "2" ||
6764
+ char == "3" ||
6765
+ char == "4" ||
6766
+ char == "5" ||
6767
+ char == "6" ||
6768
+ char == "7" ||
6769
+ char == "8" ||
6770
+ char == "9")
6771
+ inputReturn += char;
6713
6772
  }
6714
6773
  return inputReturn;
6715
6774
  }
6716
6775
  }
6717
6776
 
6718
- ;// external "md5"
6719
- const external_md5_namespaceObject = require("md5");
6720
- var external_md5_default = /*#__PURE__*/__webpack_require__.n(external_md5_namespaceObject);
6721
6777
  ;// ./src/GN-common/helper/Md5Generate.ts
6722
6778
 
6723
6779
  class Md5Generate {
6724
6780
  static getMd5(input) {
6725
- return external_md5_default()(input);
6781
+ return (0,external_crypto_namespaceObject.createHash)("md5").update(input).digest("hex");
6726
6782
  }
6727
6783
  }
6728
6784
 
@@ -7042,6 +7098,7 @@ class SecretInfoItem extends MasterAdminMongoObject {
7042
7098
  static _tsExpire = "tsExpire";
7043
7099
  static _permission = "permission";
7044
7100
  static _tsCreate = "tsCreate";
7101
+ static _displayName = "displayName";
7045
7102
  static _creatorId = "creatorId";
7046
7103
  gameId;
7047
7104
  secretKey;
@@ -7050,6 +7107,7 @@ class SecretInfoItem extends MasterAdminMongoObject {
7050
7107
  creatorId;
7051
7108
  remove;
7052
7109
  tsExpire;
7110
+ displayName;
7053
7111
  permission;
7054
7112
  constructor(result, collection) {
7055
7113
  super(result, collection);
@@ -7063,6 +7121,7 @@ class SecretInfoItem extends MasterAdminMongoObject {
7063
7121
  setDocumentMasterSecretInfoItem(result) {
7064
7122
  this.remove = result[SecretInfoItem._remove];
7065
7123
  this.tsExpire = result[SecretInfoItem._tsExpire];
7124
+ this.displayName = result[SecretInfoItem._displayName];
7066
7125
  this.permission = result[SecretInfoItem._permission];
7067
7126
  }
7068
7127
  getGameId() {
@@ -7094,6 +7153,13 @@ class SecretInfoItem extends MasterAdminMongoObject {
7094
7153
  this.tsExpire = tsExpire;
7095
7154
  this.set(SecretInfoItem._tsExpire, this.tsExpire);
7096
7155
  }
7156
+ getDisplayName() {
7157
+ return this.displayName;
7158
+ }
7159
+ setDisplayName(displayName) {
7160
+ this.displayName = displayName;
7161
+ this.set(SecretInfoItem._displayName, this.displayName);
7162
+ }
7097
7163
  getPermission() {
7098
7164
  return this.permission;
7099
7165
  }
@@ -8907,14 +8973,16 @@ class xDatabase {
8907
8973
  }).skip(skip).limit(limit);
8908
8974
  return this.convertToMasterPlayers(results, collection);
8909
8975
  }
8910
- async loadMasterPlayersWithDisplayNameAsync(keyword, skip, limit, masterPlayerFindOptions) {
8976
+ async loadMasterPlayerWithDisplayNameAsync(displayName, masterPlayerFindOptions) {
8911
8977
  let collection = this.systemCollection("MasterPlayer");
8912
- let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
8978
+ let result = await collection.findOne({ displayName: displayName }, {
8913
8979
  projection: this.getFindOptions(masterPlayerFindOptions)
8914
- }).skip(skip).limit(limit);
8915
- return this.convertToMasterPlayers(results, collection);
8980
+ });
8981
+ if (!result)
8982
+ return null;
8983
+ return new MasterPlayer(result, collection);
8916
8984
  }
8917
- async loadMasterPlayerWithDisplayNameAsync(displayNameNormalize, masterPlayerFindOptions) {
8985
+ async loadMasterPlayerWithDisplayNameNormalizeAsync(displayNameNormalize, masterPlayerFindOptions) {
8918
8986
  let collection = this.systemCollection("MasterPlayer");
8919
8987
  let result = await collection.findOne({ displayNameNormalize: displayNameNormalize }, {
8920
8988
  projection: this.getFindOptions(masterPlayerFindOptions)
@@ -8923,6 +8991,13 @@ class xDatabase {
8923
8991
  return null;
8924
8992
  return new MasterPlayer(result, collection);
8925
8993
  }
8994
+ async loadMasterPlayersWithDisplayNameNormalizeRegexAsync(keyword, skip, limit, masterPlayerFindOptions) {
8995
+ let collection = this.systemCollection("MasterPlayer");
8996
+ let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
8997
+ projection: this.getFindOptions(masterPlayerFindOptions)
8998
+ }).skip(skip).limit(limit);
8999
+ return this.convertToMasterPlayers(results, collection);
9000
+ }
8926
9001
  async loadMasterPlayersLeaderboardWithStatisticsAsync(key, skip, limit, direction, masterPlayerFindOptions) {
8927
9002
  let collection = this.systemCollection("MasterPlayer");
8928
9003
  let $sort = {};
@@ -9228,14 +9303,16 @@ class xDatabase {
9228
9303
  }).skip(skip).limit(limit);
9229
9304
  return this.convertToGamePlayers(results, collection);
9230
9305
  }
9231
- async loadGamePlayersWithDisplayNameAsync(keyword, skip, limit, gameId, gamePlayerFindOptions) {
9232
- let collection = this.systemGameCollection("GamePlayer", gameId);
9233
- let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9306
+ async loadGamePlayerWithDisplayNameAsync(displayName, gamePlayerFindOptions) {
9307
+ let collection = this.systemCollection("GamePlayer");
9308
+ let result = await collection.findOne({ displayName: displayName }, {
9234
9309
  projection: this.getFindOptions(gamePlayerFindOptions)
9235
- }).skip(skip).limit(limit);
9236
- return this.convertToGamePlayers(results, collection);
9310
+ });
9311
+ if (!result)
9312
+ return null;
9313
+ return new GamePlayer(result, collection);
9237
9314
  }
9238
- async loadGamePlayerWithDisplayNameAsync(displayNameNormalize, gamePlayerFindOptions) {
9315
+ async loadGamePlayerWithDisplayNameNormalizeAsync(displayNameNormalize, gamePlayerFindOptions) {
9239
9316
  let collection = this.systemCollection("GamePlayer");
9240
9317
  let result = await collection.findOne({ displayNameNormalize: displayNameNormalize }, {
9241
9318
  projection: this.getFindOptions(gamePlayerFindOptions)
@@ -9244,6 +9321,13 @@ class xDatabase {
9244
9321
  return null;
9245
9322
  return new GamePlayer(result, collection);
9246
9323
  }
9324
+ async loadGamePlayersWithDisplayNameNormalizeRegexAsync(keyword, skip, limit, gameId, gamePlayerFindOptions) {
9325
+ let collection = this.systemGameCollection("GamePlayer", gameId);
9326
+ let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9327
+ projection: this.getFindOptions(gamePlayerFindOptions)
9328
+ }).skip(skip).limit(limit);
9329
+ return this.convertToGamePlayers(results, collection);
9330
+ }
9247
9331
  async loadGamePlayersLeaderboardWithStatisticsAsync(key, skip, limit, gameId, direction, gamePlayerFindOptions) {
9248
9332
  let collection = this.systemGameCollection("GamePlayer", gameId);
9249
9333
  let $sort = {};
@@ -9470,20 +9554,31 @@ class xDatabase {
9470
9554
  }).skip(skip).limit(limit);
9471
9555
  return this.convertToCharacterPlayers(results, collection);
9472
9556
  }
9473
- async loadCharacterPlayersWithDisplayNameAsync(keyword, skip, limit, gameId, characterPlayerFindOptions) {
9557
+ async loadCharacterPlayerWithDisplayNameAsync(displayName, gameId, characterPlayerFindOptions) {
9474
9558
  let collection = this.systemGameCollection("CharacterPlayer", gameId);
9475
- let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9559
+ let result = await collection.findOne({ displayName: displayName }, {
9476
9560
  projection: this.getFindOptions(characterPlayerFindOptions)
9477
- }).skip(skip).limit(limit);
9478
- return this.convertToCharacterPlayers(results, collection);
9561
+ });
9562
+ if (!result)
9563
+ return null;
9564
+ return new CharacterPlayer(result, collection);
9479
9565
  }
9480
- async loadCharacterPlayerWithDisplayNameAsync(displayNameNormalize, gameId, characterPlayerFindOptions) {
9566
+ async loadCharacterPlayerWithDisplayNameNormalizeAsync(displayNameNormalize, gameId, characterPlayerFindOptions) {
9481
9567
  let collection = this.systemGameCollection("CharacterPlayer", gameId);
9482
9568
  let result = await collection.findOne({ displayNameNormalize: displayNameNormalize }, {
9483
9569
  projection: this.getFindOptions(characterPlayerFindOptions)
9484
9570
  });
9571
+ if (!result)
9572
+ return null;
9485
9573
  return new CharacterPlayer(result, collection);
9486
9574
  }
9575
+ async loadCharacterPlayersWithDisplayNameNormalizeRegexAsync(keyword, skip, limit, gameId, characterPlayerFindOptions) {
9576
+ let collection = this.systemGameCollection("CharacterPlayer", gameId);
9577
+ let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9578
+ projection: this.getFindOptions(characterPlayerFindOptions)
9579
+ }).skip(skip).limit(limit);
9580
+ return this.convertToCharacterPlayers(results, collection);
9581
+ }
9487
9582
  async loadCharacterPlayersLeaderboardWithStatisticsAsync(key, skip, limit, catalogId, gameId, direction, characterPlayerFindOptions) {
9488
9583
  let collection = this.systemGameCollection("CharacterPlayer", gameId);
9489
9584
  let $sort = {};
@@ -9716,7 +9811,25 @@ class xDatabase {
9716
9811
  }).skip(skip).limit(limit);
9717
9812
  return this.convertToGroups(results, collection);
9718
9813
  }
9719
- async loadGroupsWithDisplayNameAsync(keyword, skip, limit, gameId, groupFindOptions) {
9814
+ async loadGroupWithDisplayNameAsync(displayName, gameId, groupFindOptions) {
9815
+ let collection = this.systemGameCollection("Group", gameId);
9816
+ let result = await collection.findOne({ displayName: displayName }, {
9817
+ projection: this.getFindOptions(groupFindOptions)
9818
+ });
9819
+ if (!result)
9820
+ return null;
9821
+ return new Group(result, collection);
9822
+ }
9823
+ async loadGroupWithDisplayNameNormalizeAsync(displayNameNormalize, gameId, groupFindOptions) {
9824
+ let collection = this.systemGameCollection("Group", gameId);
9825
+ let result = await collection.findOne({ displayNameNormalize: displayNameNormalize }, {
9826
+ projection: this.getFindOptions(groupFindOptions)
9827
+ });
9828
+ if (!result)
9829
+ return null;
9830
+ return new Group(result, collection);
9831
+ }
9832
+ async loadGroupsWithDisplayNameNormalizeRegexAsync(keyword, skip, limit, gameId, groupFindOptions) {
9720
9833
  let collection = this.systemGameCollection("Group", gameId);
9721
9834
  let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9722
9835
  projection: this.getFindOptions(groupFindOptions)
@@ -9869,7 +9982,25 @@ class xDatabase {
9869
9982
  }).skip(skip).limit(limit);
9870
9983
  return this.convertToInventories(results, collection);
9871
9984
  }
9872
- async loadInventoriesWithDisplayNameAsync(keyword, skip, limit, gameId, inventoryFindOptions) {
9985
+ async loadInventoryWithDisplayNameAsync(displayName, gameId, inventoryFindOptions) {
9986
+ let collection = this.systemGameCollection("Inventory", gameId);
9987
+ let result = await collection.findOne({ displayName: displayName }, {
9988
+ projection: this.getFindOptions(inventoryFindOptions)
9989
+ });
9990
+ if (!result)
9991
+ null;
9992
+ return new Inventory(result, collection);
9993
+ }
9994
+ async loadInventoryWithDisplayNameNormalizeAsync(displayNameNormalize, gameId, inventoryFindOptions) {
9995
+ let collection = this.systemGameCollection("Inventory", gameId);
9996
+ let result = await collection.findOne({ displayNameNormalize: displayNameNormalize }, {
9997
+ projection: this.getFindOptions(inventoryFindOptions)
9998
+ });
9999
+ if (!result)
10000
+ null;
10001
+ return new Inventory(result, collection);
10002
+ }
10003
+ async loadInventoriesWithDisplayNameNormalizeRegexAsync(keyword, skip, limit, gameId, inventoryFindOptions) {
9873
10004
  let collection = this.systemGameCollection("Inventory", gameId);
9874
10005
  let results = await collection.find({ displayNameNormalize: { $regex: keyword } }, {
9875
10006
  projection: this.getFindOptions(inventoryFindOptions)
@@ -10285,6 +10416,7 @@ const msgpack_namespaceObject = require("@msgpack/msgpack");
10285
10416
 
10286
10417
 
10287
10418
 
10419
+
10288
10420
  var AntiDdosMiddleware_RequestType;
10289
10421
  (function (RequestType) {
10290
10422
  RequestType[RequestType["HTTP"] = 0] = "HTTP";
@@ -10297,6 +10429,7 @@ var BanType;
10297
10429
  })(BanType || (BanType = {}));
10298
10430
  class AntiDdosMiddleware {
10299
10431
  static FIVE_MINUTE_TS = 5 * 60 * 1000;
10432
+ static K_MULTIPLE_ADMIN = 500;
10300
10433
  static K_MULTIPLE_WHITE_LIST = 100;
10301
10434
  static K_MULTIPLE_BLACK_LIST = 5;
10302
10435
  socketRequestPerIPDic;
@@ -10397,12 +10530,19 @@ class AntiDdosMiddleware {
10397
10530
  || url == "/167/11/1") {
10398
10531
  return ReturnCode.Ok;
10399
10532
  }
10400
- let contentLengthStr = req.headers['content-length'];
10533
+ let contentLengthStr = req.header("content-length");
10401
10534
  if (contentLengthStr) {
10402
10535
  let ip = req.xip;
10403
10536
  let httpMaxRequestSize = this.httpMaxRequestSize;
10404
10537
  if (this.ipWhiteLst.includes(ip))
10405
10538
  httpMaxRequestSize = httpMaxRequestSize * AntiDdosMiddleware.K_MULTIPLE_WHITE_LIST;
10539
+ else {
10540
+ let role = Number.parseInt(req.params.role);
10541
+ if (!Number.isNaN(role)) {
10542
+ if (role == RequestRole.Admin || role == RequestRole.Server)
10543
+ httpMaxRequestSize = httpMaxRequestSize * AntiDdosMiddleware.K_MULTIPLE_ADMIN;
10544
+ }
10545
+ }
10406
10546
  let contentLength = parseInt(contentLengthStr);
10407
10547
  if (contentLength > httpMaxRequestSize) {
10408
10548
  this.reportDdosCollection.insertOne({
@@ -10572,6 +10712,13 @@ class AntiDdosMiddleware {
10572
10712
  httpMaxRequestPerSecondPerIp = httpMaxRequestPerSecondPerIp / AntiDdosMiddleware.K_MULTIPLE_BLACK_LIST;
10573
10713
  else if (this.ipWhiteLst.includes(ip))
10574
10714
  httpMaxRequestPerSecondPerIp = httpMaxRequestPerSecondPerIp * AntiDdosMiddleware.K_MULTIPLE_WHITE_LIST;
10715
+ else {
10716
+ let role = Number.parseInt(req.params.role);
10717
+ if (!Number.isNaN(role)) {
10718
+ if (role == RequestRole.Admin || role == RequestRole.Server)
10719
+ httpMaxRequestPerSecondPerIp = httpMaxRequestPerSecondPerIp * AntiDdosMiddleware.K_MULTIPLE_ADMIN;
10720
+ }
10721
+ }
10575
10722
  if (httpRequestPerIPItem.count > httpMaxRequestPerSecondPerIp) {
10576
10723
  this.reportDdosCollection.insertOne({
10577
10724
  returnCode: ReturnCode.MaxRequestReject,
@@ -10634,6 +10781,13 @@ class AntiDdosMiddleware {
10634
10781
  httpMaxRequestPerSecondPerPeer = httpMaxRequestPerSecondPerPeer / AntiDdosMiddleware.K_MULTIPLE_BLACK_LIST;
10635
10782
  else if (this.ipWhiteLst.includes(ip))
10636
10783
  httpMaxRequestPerSecondPerPeer = httpMaxRequestPerSecondPerPeer * AntiDdosMiddleware.K_MULTIPLE_WHITE_LIST;
10784
+ else {
10785
+ let role = Number.parseInt(req.params.role);
10786
+ if (!Number.isNaN(role)) {
10787
+ if (role == RequestRole.Admin || role == RequestRole.Server)
10788
+ httpMaxRequestPerSecondPerPeer = httpMaxRequestPerSecondPerPeer * AntiDdosMiddleware.K_MULTIPLE_ADMIN;
10789
+ }
10790
+ }
10637
10791
  httpRequestPerPeerItem.count++;
10638
10792
  if (httpRequestPerPeerItem.count > httpMaxRequestPerSecondPerPeer) {
10639
10793
  this.reportDdosCollection.insertOne({
@@ -10673,6 +10827,13 @@ class AntiDdosMiddleware {
10673
10827
  httpMaxPendingRequest = httpMaxPendingRequest / AntiDdosMiddleware.K_MULTIPLE_BLACK_LIST;
10674
10828
  else if (this.ipWhiteLst.includes(ip))
10675
10829
  httpMaxPendingRequest = httpMaxPendingRequest * AntiDdosMiddleware.K_MULTIPLE_WHITE_LIST;
10830
+ else {
10831
+ let role = Number.parseInt(req.params.role);
10832
+ if (!Number.isNaN(role)) {
10833
+ if (role == RequestRole.Admin || role == RequestRole.Server)
10834
+ httpMaxPendingRequest = httpMaxPendingRequest * AntiDdosMiddleware.K_MULTIPLE_ADMIN;
10835
+ }
10836
+ }
10676
10837
  if (this.currentHttpRequestCount > httpMaxPendingRequest) {
10677
10838
  this.reportDdosCollection.insertOne({
10678
10839
  returnCode: ReturnCode.MaxRequestReject,
@@ -14597,7 +14758,7 @@ class ApiMiddleware {
14597
14758
  for (let key of keysNeedRemove) {
14598
14759
  this.authInfoDict.delete(key);
14599
14760
  }
14600
- Debug.log("[GN] ApiMiddleware remove " + removeCount + "/" + startSize);
14761
+ Debug.log("[GearN] ApiMiddleware remove " + removeCount + "/" + startSize);
14601
14762
  }
14602
14763
  catch (err) {
14603
14764
  Debug.logException(err);
@@ -14767,8 +14928,7 @@ class ApiMiddleware {
14767
14928
  return next();
14768
14929
  }
14769
14930
  async getReturnCodeAuthenticate(req) {
14770
- let headers = req.headers;
14771
- let authToken = headers[Commands.RequestAuthTokenCmd];
14931
+ let authToken = req.header(Commands.RequestAuthTokenCmd);
14772
14932
  let currentMilliseconds = xDatetime.getCurrentMilliseconds();
14773
14933
  if (!authToken) {
14774
14934
  req.isAuthenticated = false;
@@ -14811,7 +14971,7 @@ class ApiMiddleware {
14811
14971
  }
14812
14972
  }
14813
14973
  }
14814
- let secretKey = headers[Commands.RequestSecretCmd];
14974
+ let secretKey = req.header(Commands.RequestSecretCmd);
14815
14975
  if (!secretKey) {
14816
14976
  if (!req.isAuthenticated) {
14817
14977
  if (req.url != "/-1/9/3") {
@@ -14836,7 +14996,7 @@ class ApiMiddleware {
14836
14996
  return ReturnCode.SecretInvalid;
14837
14997
  }
14838
14998
  if (!secretInfo.getGameId()) {
14839
- let gameId = headers[Commands.RequestGameIdCmd];
14999
+ let gameId = req.header(Commands.RequestGameIdCmd);
14840
15000
  if (!gameId)
14841
15001
  gameId = ApiMiddleware.DEFAULT_GAME_ID;
14842
15002
  let secretInfoAny = structuredClone(secretInfo);
@@ -15040,14 +15200,16 @@ class UploadFileMiddleware {
15040
15200
  }
15041
15201
  }
15042
15202
 
15043
- ;// external "async-middleware"
15044
- const external_async_middleware_namespaceObject = require("async-middleware");
15203
+ ;// ./src/GN-startup/routes/utils/wrap.ts
15204
+ function wrap(fn) {
15205
+ return (req, res, next) => {
15206
+ Promise.resolve(fn(req, res, next)).catch(next);
15207
+ };
15208
+ }
15209
+
15045
15210
  ;// external "express"
15046
15211
  const external_express_namespaceObject = require("express");
15047
15212
  var external_express_default = /*#__PURE__*/__webpack_require__.n(external_express_namespaceObject);
15048
- ;// external "express-msgpack"
15049
- const external_express_msgpack_namespaceObject = require("express-msgpack");
15050
- var external_express_msgpack_default = /*#__PURE__*/__webpack_require__.n(external_express_msgpack_namespaceObject);
15051
15213
  ;// ./src/GN-startup/routes/HttpAppHandler.ts
15052
15214
 
15053
15215
 
@@ -15059,7 +15221,6 @@ var external_express_msgpack_default = /*#__PURE__*/__webpack_require__.n(extern
15059
15221
 
15060
15222
 
15061
15223
 
15062
-
15063
15224
  class HttpAppHandler {
15064
15225
  _onRequestCb;
15065
15226
  apiMiddleware;
@@ -15180,17 +15341,17 @@ class HttpAppHandler {
15180
15341
  this.router.use("/api", apiRouter);
15181
15342
  if (this.enablePostViaJson) {
15182
15343
  this.apiJsonRouter = external_express_default().Router();
15183
- apiRouter.use("/" + Commands.RequestCmd_Json, (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15344
+ apiRouter.use("/" + Commands.RequestCmd_Json, wrap((req, res, next) => {
15184
15345
  return this.apiMiddleware.getIP(req, res, next);
15185
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15346
+ }), wrap((req, res, next) => {
15186
15347
  return this.antiDdosMiddleware.checkMaxRequestPerSecondPerIpViaJson(req, res, next);
15187
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15348
+ }), wrap((req, res, next) => {
15188
15349
  return this.antiDdosMiddleware.checkRequestSizeBodyViaJson(req, res, next);
15189
- }), external_express_default().json({ limit: "10mb" }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15350
+ }), wrap((req, res, next) => {
15190
15351
  return this.apiMiddleware.authenticateTokenViaJson(req, res, next);
15191
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15352
+ }), wrap((req, res, next) => {
15192
15353
  return this.antiDdosMiddleware.checkMaxRequestPerSecondPerPeerViaJson(req, res, next);
15193
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15354
+ }), external_express_default().json({ limit: "10mb" }), wrap((req, res, next) => {
15194
15355
  return this.antiDdosMiddleware.addPendingRequestViaJson(req, res, next);
15195
15356
  }), this.apiJsonRouter);
15196
15357
  this.apiJsonRouter.post("/:code/:type/:role", async (req, res) => {
@@ -15202,15 +15363,10 @@ class HttpAppHandler {
15202
15363
  Debug.log("[HTTP SEND] %O", JSON.stringify(httpData));
15203
15364
  }
15204
15365
  if (operationResponse.isEncrypted()) {
15205
- let content = Buffer.from((0,msgpack_namespaceObject.encode)(httpData));
15206
- res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
15207
- res.setHeader(Commands.CONTENT_LENGTH, content.length);
15208
- return res.send(content);
15209
- }
15210
- else {
15211
- res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
15212
- return res.send(httpData);
15366
+ // TODO Encrypt data here
15213
15367
  }
15368
+ res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
15369
+ return res.send(httpData);
15214
15370
  }
15215
15371
  res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
15216
15372
  return res.send([ReturnCode.OperationInvalid]);
@@ -15218,17 +15374,33 @@ class HttpAppHandler {
15218
15374
  }
15219
15375
  if (this.enablePostViaMsgPack) {
15220
15376
  this.apiMsgPackRouter = external_express_default().Router();
15221
- apiRouter.use("/" + Commands.RequestCmd_MsgPack, (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15377
+ apiRouter.use("/" + Commands.RequestCmd_MsgPack, wrap((req, res, next) => {
15222
15378
  return this.apiMiddleware.getIP(req, res, next);
15223
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15379
+ }), wrap((req, res, next) => {
15224
15380
  return this.antiDdosMiddleware.checkMaxRequestPerSecondPerIpViaMsgPack(req, res, next);
15225
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15381
+ }), wrap((req, res, next) => {
15226
15382
  return this.antiDdosMiddleware.checkRequestSizeBodyViaMsgPack(req, res, next);
15227
- }), external_express_msgpack_default()(), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15383
+ }), wrap((req, res, next) => {
15228
15384
  return this.apiMiddleware.authenticateTokenViaMsgPack(req, res, next);
15229
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15385
+ }), wrap((req, res, next) => {
15230
15386
  return this.antiDdosMiddleware.checkMaxRequestPerSecondPerPeerViaMsgPack(req, res, next);
15231
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15387
+ }), (req, res, next) => {
15388
+ if (req.header(Commands.CONTENT_TYPE) === Commands.APPLICATION_MSGPACK) {
15389
+ let buffer = [];
15390
+ req.on("data", chunk => buffer.push(chunk));
15391
+ req.on("end", () => {
15392
+ try {
15393
+ const raw = Buffer.concat(buffer);
15394
+ req.body = (0,msgpack_namespaceObject.decode)(raw);
15395
+ return next();
15396
+ }
15397
+ catch (err) {
15398
+ return next(err);
15399
+ }
15400
+ });
15401
+ }
15402
+ return next();
15403
+ }, wrap((req, res, next) => {
15232
15404
  return this.antiDdosMiddleware.addPendingRequestViaMsgPack(req, res, next);
15233
15405
  }), this.apiMsgPackRouter);
15234
15406
  this.apiMsgPackRouter.post("/:code/:type/:role", async (req, res) => {
@@ -15240,16 +15412,12 @@ class HttpAppHandler {
15240
15412
  Debug.log("[HTTP SEND] %O", JSON.stringify(httpData));
15241
15413
  }
15242
15414
  if (operationResponse.isEncrypted()) {
15243
- let content = Buffer.from((0,msgpack_namespaceObject.encode)(httpData));
15244
- res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
15245
- res.setHeader(Commands.CONTENT_LENGTH, content.length);
15246
- return res.send(content);
15247
- }
15248
- else {
15249
- let content = httpData;
15250
- res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_JSON);
15251
- return res.send(content);
15415
+ // TODO Encrypt data here
15252
15416
  }
15417
+ let content = Buffer.from((0,msgpack_namespaceObject.encode)(httpData));
15418
+ res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
15419
+ res.setHeader(Commands.CONTENT_LENGTH, content.length);
15420
+ return res.send(content);
15253
15421
  }
15254
15422
  let content = Buffer.from((0,msgpack_namespaceObject.encode)([ReturnCode.OperationInvalid]));
15255
15423
  res.setHeader(Commands.CONTENT_TYPE, Commands.APPLICATION_MSGPACK);
@@ -15368,7 +15536,7 @@ class SocketAppHandler {
15368
15536
  this.apiMiddleware.socketAuthenticateToken(socket, async (returnCode) => {
15369
15537
  let operationResponse = await this.onSocketRequestMsgPack(socket, data, returnCode);
15370
15538
  if (operationResponse != null) {
15371
- this.sendResponseForSocket(socket, operationResponse);
15539
+ this.sendResponseForSocket(socket, operationResponse, true);
15372
15540
  }
15373
15541
  this.antiDdosMiddleware.removePendingRequestViaSocket(socket, data);
15374
15542
  });
@@ -15387,7 +15555,7 @@ class SocketAppHandler {
15387
15555
  this.apiMiddleware.socketAuthenticateToken(socket, async (returnCode) => {
15388
15556
  let operationResponse = await this.onSocketRequestJson(socket, data, returnCode);
15389
15557
  if (operationResponse != null) {
15390
- this.sendResponseForSocket(socket, operationResponse);
15558
+ this.sendResponseForSocket(socket, operationResponse, false);
15391
15559
  }
15392
15560
  this.antiDdosMiddleware.removePendingRequestViaSocket(socket, data);
15393
15561
  });
@@ -15570,11 +15738,14 @@ class SocketAppHandler {
15570
15738
  if (this._onDisconnectCb != null)
15571
15739
  this._onDisconnectCb(socket, data);
15572
15740
  }
15573
- sendResponseForSocket(socket, operationResponse) {
15741
+ sendResponseForSocket(socket, operationResponse, useMsgPack) {
15574
15742
  let socketData = OperationHelper.toResponseSocketData(operationResponse);
15575
15743
  if (this.enableSendAndReceiveDebug)
15576
15744
  Debug.log("[SOCKET SEND] %O", JSON.stringify(socketData));
15577
15745
  if (operationResponse.isEncrypted()) {
15746
+ // TODO Encrypt data
15747
+ }
15748
+ if (useMsgPack) {
15578
15749
  let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15579
15750
  socket.emit(Commands.ResponseCmd_MsgPack, socketDataMsgPack);
15580
15751
  }
@@ -15582,28 +15753,32 @@ class SocketAppHandler {
15582
15753
  socket.emit(Commands.ResponseCmd_Json, socketData);
15583
15754
  }
15584
15755
  }
15585
- sendEventForSocket(socket, operationEvent) {
15586
- let socketData = OperationHelper.toEventSocketData(operationEvent);
15587
- if (this.enableSendAndReceiveDebug)
15588
- Debug.log("[EVENT SEND] %O", JSON.stringify(socketData));
15589
- if (operationEvent.isEncrypted()) {
15590
- let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15591
- socket.emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15592
- }
15593
- else {
15594
- socket.emit(Commands.EventCmd_Json, socketData);
15595
- }
15596
- }
15597
- async sendEventTo(userId, operationEvent) {
15756
+ // private sendEventForSocket(socket: Socket, operationEvent: OperationEvent) {
15757
+ // let socketData = OperationHelper.toEventSocketData(operationEvent);
15758
+ // if (this.enableSendAndReceiveDebug) Debug.log("[EVENT SEND] %O", JSON.stringify(socketData));
15759
+ // if (operationEvent.isEncrypted())
15760
+ // {
15761
+ // let socketDataMsgPack = encode(socketData);
15762
+ // socket.emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15763
+ // }
15764
+ // else
15765
+ // {
15766
+ // socket.emit(Commands.EventCmd_Json, socketData);
15767
+ // }
15768
+ // }
15769
+ sendEventTo(userId, operationEvent, useMsgPack = true) {
15598
15770
  let socketData = OperationHelper.toEventSocketData(operationEvent);
15599
15771
  if (this.enableSendAndReceiveDebug)
15600
15772
  Debug.log("[EVENT SEND EVENT TO] " + userId + " %O", JSON.stringify(socketData));
15601
15773
  if (operationEvent.isEncrypted()) {
15774
+ // TODO Encrypt data
15775
+ }
15776
+ if (useMsgPack) {
15602
15777
  let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15603
15778
  if (this.emitter != null)
15604
15779
  this.emitter.to(userId).emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15605
15780
  else
15606
- this.server.to(userId).emit(Commands.EventCmd_MsgPack, (0,msgpack_namespaceObject.encode)(socketData));
15781
+ this.server.to(userId).emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15607
15782
  }
15608
15783
  else {
15609
15784
  if (this.emitter != null)
@@ -15612,16 +15787,19 @@ class SocketAppHandler {
15612
15787
  this.server.to(userId).emit(Commands.EventCmd_Json, socketData);
15613
15788
  }
15614
15789
  }
15615
- async sendEventToRoom(roomId, operationEvent) {
15790
+ sendEventToRoom(roomId, operationEvent, useMsgPack = true) {
15616
15791
  let socketData = OperationHelper.toEventSocketData(operationEvent);
15617
15792
  if (this.enableSendAndReceiveDebug)
15618
15793
  Debug.log("[EVENT SEND EVENT TO ROOM] " + roomId + " %O", JSON.stringify(socketData));
15619
15794
  if (operationEvent.isEncrypted()) {
15795
+ // TODO Encrypt data
15796
+ }
15797
+ if (useMsgPack) {
15620
15798
  let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15621
15799
  if (this.emitter != null)
15622
15800
  this.emitter.to(roomId).emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15623
15801
  else
15624
- this.server.to(roomId).emit(Commands.EventCmd_MsgPack, (0,msgpack_namespaceObject.encode)(socketData));
15802
+ this.server.to(roomId).emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
15625
15803
  }
15626
15804
  else {
15627
15805
  if (this.emitter != null)
@@ -15630,11 +15808,14 @@ class SocketAppHandler {
15630
15808
  this.server.to(roomId).emit(Commands.EventCmd_Json, socketData);
15631
15809
  }
15632
15810
  }
15633
- async sendEventToMoreUser(userIds, operationEvent) {
15811
+ sendEventToMoreUser(userIds, operationEvent, useMsgPack = true) {
15634
15812
  let socketData = OperationHelper.toEventSocketData(operationEvent);
15635
15813
  if (this.enableSendAndReceiveDebug)
15636
15814
  Debug.log("[EVENT SEND EVENT TO MORE USER] %O", JSON.stringify(socketData));
15637
15815
  if (operationEvent.isEncrypted()) {
15816
+ // TODO Encrypt data
15817
+ }
15818
+ if (useMsgPack) {
15638
15819
  let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15639
15820
  if (this.emitter != null)
15640
15821
  this.emitter.to(userIds).emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
@@ -15648,11 +15829,14 @@ class SocketAppHandler {
15648
15829
  this.server.to(userIds).emit(Commands.EventCmd_Json, socketData);
15649
15830
  }
15650
15831
  }
15651
- async sendEventToAllPlayer(operationEvent) {
15832
+ sendEventToAllPlayer(operationEvent, useMsgPack = true) {
15652
15833
  let socketData = OperationHelper.toEventSocketData(operationEvent);
15653
15834
  if (this.enableSendAndReceiveDebug)
15654
15835
  Debug.log("[EVENT SEND EVENT TO ALL PLAYER] %O", JSON.stringify(socketData));
15655
15836
  if (operationEvent.isEncrypted()) {
15837
+ // TODO Encrypt data
15838
+ }
15839
+ if (useMsgPack) {
15656
15840
  let socketDataMsgPack = (0,msgpack_namespaceObject.encode)(socketData);
15657
15841
  if (this.emitter != null)
15658
15842
  this.emitter.emit(Commands.EventCmd_MsgPack, socketDataMsgPack);
@@ -15666,7 +15850,7 @@ class SocketAppHandler {
15666
15850
  this.server.emit(Commands.EventCmd_Json, socketData);
15667
15851
  }
15668
15852
  }
15669
- async sendEventToNamespace(namespace, operationEvent) {
15853
+ sendEventToNamespace(namespace, operationEvent) {
15670
15854
  let socketData = OperationHelper.toEventSocketData(operationEvent);
15671
15855
  if (this.enableSendAndReceiveDebug)
15672
15856
  Debug.log("[EVENT SEND EVENT TO NAME SPACE] %O", JSON.stringify(socketData));
@@ -15690,10 +15874,10 @@ class SocketAppHandler {
15690
15874
  getSockets(userId) {
15691
15875
  return this.server.in(userId);
15692
15876
  }
15693
- async joinRoom(userId, roomId) {
15877
+ joinRoom(userId, roomId) {
15694
15878
  this.getSockets(userId).socketsJoin(roomId);
15695
15879
  }
15696
- async leaveRoom(userId, roomId) {
15880
+ leaveRoom(userId, roomId) {
15697
15881
  this.getSockets(userId).socketsLeave(roomId);
15698
15882
  }
15699
15883
  async getRooms(userId) {
@@ -15749,21 +15933,21 @@ class UploadFileHandler {
15749
15933
  }
15750
15934
  init() {
15751
15935
  this.uploadRouter = external_express_default().Router();
15752
- this.router.use("/upload", (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15936
+ this.router.use("/upload", wrap((req, res, next) => {
15753
15937
  return this.apiMiddleware.getIP(req, res, next);
15754
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15938
+ }), wrap((req, res, next) => {
15755
15939
  return this.antiDdosMiddleware.checkMaxUploadRequestPerSecondPerIp(req, res, next);
15756
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15940
+ }), wrap((req, res, next) => {
15757
15941
  return this.apiMiddleware.authenticateUploadToken(req, res, next);
15758
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15942
+ }), wrap((req, res, next) => {
15759
15943
  return this.antiDdosMiddleware.checkMaxUploadRequestPerSecondPerPeer(req, res, next);
15760
15944
  }), this.uploadRouter);
15761
15945
  let downloadRouter = external_express_default().Router();
15762
- this.router.use("/download", (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15946
+ this.router.use("/download", wrap((req, res, next) => {
15763
15947
  return this.apiMiddleware.getIP(req, res, next);
15764
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15948
+ }), wrap((req, res, next) => {
15765
15949
  return this.antiDdosMiddleware.checkMaxUploadRequestPerSecondPerIp(req, res, next);
15766
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
15950
+ }), wrap((req, res, next) => {
15767
15951
  return this.antiDdosMiddleware.checkMaxUploadRequestPerSecondPerPeer(req, res, next);
15768
15952
  }), downloadRouter);
15769
15953
  downloadRouter.get("/:downloadToken",
@@ -15819,11 +16003,11 @@ class UploadFileHandler {
15819
16003
  if (!external_fs_default().existsSync(uploadPath)) {
15820
16004
  external_fs_default().mkdirSync(uploadPath, { mode: "0775" });
15821
16005
  }
15822
- this.uploadRouter.post("/:fileId", (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
16006
+ this.uploadRouter.post("/:fileId", wrap((req, res, next) => {
15823
16007
  return this.antiDdosMiddleware.addPendingUploadRequest(req, res, next);
15824
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
16008
+ }), wrap((req, res, next) => {
15825
16009
  return this.uploadFileMiddleware.checkFileUploadInvalid(req, res, next);
15826
- }), (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
16010
+ }), wrap((req, res, next) => {
15827
16011
  return this.uploadFileMiddleware.handleUpload().single(Commands.File)(req, res, next);
15828
16012
  }), async (req, res) => {
15829
16013
  this.antiDdosMiddleware.removePendingUploadRequest(req, res);
@@ -15849,7 +16033,7 @@ class UploadFileHandler {
15849
16033
  }
15850
16034
  removeFile(fullPath) {
15851
16035
  external_fs_default().rm(fullPath, err => {
15852
- Debug.logError("[GN] remove file at path " + fullPath + ", error " + err);
16036
+ Debug.logError("[GearN] remove file at path " + fullPath + ", error " + err);
15853
16037
  });
15854
16038
  }
15855
16039
  }
@@ -16657,11 +16841,11 @@ class ClusterHandler {
16657
16841
  }
16658
16842
  init() {
16659
16843
  this.clusterRouter = external_express_default().Router();
16660
- this.router.use("/cluster", (0,external_async_middleware_namespaceObject.wrap)((req, res, next) => {
16661
- // let pkt = req.header("privateKeyToken");
16662
- // if (!pkt || pkt != this.privateKeyToken) {
16663
- // return res.sendStatus(401);
16664
- // }
16844
+ this.router.use("/cluster", wrap((req, res, next) => {
16845
+ let pkt = req.header("privateKeyToken");
16846
+ if (!pkt || pkt != this.privateKeyToken) {
16847
+ return res.sendStatus(401);
16848
+ }
16665
16849
  return next();
16666
16850
  }), this.clusterRouter);
16667
16851
  }
@@ -16712,7 +16896,7 @@ class ClusterHandler {
16712
16896
  callback(data);
16713
16897
  }
16714
16898
  catch (err) {
16715
- Debug.logError("[GN] ClusterHandler receive event failed " + err.message);
16899
+ Debug.logError("[GearN] ClusterHandler receive event failed " + err.message);
16716
16900
  }
16717
16901
  }
16718
16902
  async update() {
@@ -16840,10 +17024,10 @@ class ClusterHandler {
16840
17024
  if (nodeInfo.instanceId != this.instanceId)
16841
17025
  external_axios_default().post(nodeInfo.fullUrl + "/cluster/sendEvent/" + name, data, { headers: { "pkt": this.privateKeyToken, "Content-Type": "application/json" } }).then(response => {
16842
17026
  if (response.status != 200) {
16843
- Debug.logError("[GN] ClusterHandler sendEvent failed with status " + response.status + ", instanceId: " + nodeInfo.instanceId);
17027
+ Debug.logError("[GearN] ClusterHandler sendEvent failed with status " + response.status + ", instanceId: " + nodeInfo.instanceId);
16844
17028
  }
16845
17029
  }).catch(err => {
16846
- Debug.logError("[GN] ClusterHandler sendEvent failed " + err.message + ", instanceId: " + nodeInfo.instanceId);
17030
+ Debug.logError("[GearN] ClusterHandler sendEvent failed " + err.message + ", instanceId: " + nodeInfo.instanceId);
16847
17031
  });
16848
17032
  }
16849
17033
  if (includeMe) {
@@ -26551,7 +26735,6 @@ var SetDisplayNameRequestHandler_metadata = (undefined && undefined.__metadata)
26551
26735
 
26552
26736
 
26553
26737
 
26554
-
26555
26738
  class SetDisplayNameOperationRequest extends OperationRequest {
26556
26739
  userId;
26557
26740
  displayName;
@@ -26665,7 +26848,7 @@ class SetDisplayNameRequestHandler extends MasterPlayerBaseRequestHandler {
26665
26848
  displayName: true,
26666
26849
  };
26667
26850
  if (request.uniqueDisplayName) {
26668
- let masterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadMasterPlayerWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.displayName), masterPlayerFindOptions);
26851
+ let masterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadMasterPlayerWithDisplayNameAsync(request.displayName, masterPlayerFindOptions);
26669
26852
  if (masterPlayerWithThisDisplayName != null) {
26670
26853
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.DisplayNameHasUse);
26671
26854
  return operationResponse;
@@ -31761,7 +31944,7 @@ class GetPlayersWithDisplayNameRequestHandler extends MasterPlayerBaseRequestHan
31761
31944
  operationResponse.setReturnCode(ReturnCode.Ok);
31762
31945
  let masterPlayerFindOptions = this.convertToMasterPlayerFindOptions(request.infoRequestParam);
31763
31946
  let gnResults = new GNArray();
31764
- let masterPlayers = await this.gnServer.getDatabase().loadMasterPlayersWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, masterPlayerFindOptions);
31947
+ let masterPlayers = await this.gnServer.getDatabase().loadMasterPlayersWithDisplayNameNormalizeRegexAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, masterPlayerFindOptions);
31765
31948
  for (let i = 0; i < masterPlayers.length; i++) {
31766
31949
  let masterPlayer = masterPlayers[i];
31767
31950
  let gnResult = new GNHashtable();
@@ -35298,7 +35481,6 @@ var characterPlayer_SetDisplayNameRequestHandler_metadata = (undefined && undefi
35298
35481
 
35299
35482
 
35300
35483
 
35301
-
35302
35484
  class SetDisplayNameRequestHandler_SetDisplayNameOperationRequest extends OperationRequest {
35303
35485
  characterId;
35304
35486
  displayName;
@@ -35396,7 +35578,7 @@ class SetDisplayNameRequestHandler_SetDisplayNameRequestHandler extends Characte
35396
35578
  displayName: true,
35397
35579
  };
35398
35580
  if (request.uniqueDisplayName) {
35399
- let characterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadCharacterPlayerWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.displayName), secretInfo.getGameId(), characterPlayerFindOptions);
35581
+ let characterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadCharacterPlayerWithDisplayNameAsync(request.displayName, secretInfo.getGameId(), characterPlayerFindOptions);
35400
35582
  if (characterPlayerWithThisDisplayName != null) {
35401
35583
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.DisplayNameHasUse);
35402
35584
  return operationResponse;
@@ -41288,7 +41470,7 @@ class GetPlayersWithDisplayNameRequestHandler_GetPlayersWithDisplayNameRequestHa
41288
41470
  operationResponse.setReturnCode(ReturnCode.Ok);
41289
41471
  let characterPlayerFindOptions = this.convertToCharacterPlayerFindOptions(request.infoRequestParam);
41290
41472
  let gnResults = new GNArray();
41291
- let characterPlayers = await this.gnServer.getDatabase().loadCharacterPlayersWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), characterPlayerFindOptions);
41473
+ let characterPlayers = await this.gnServer.getDatabase().loadCharacterPlayersWithDisplayNameNormalizeRegexAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), characterPlayerFindOptions);
41292
41474
  for (let i = 0; i < characterPlayers.length; i++) {
41293
41475
  let characterPlayer = characterPlayers[i];
41294
41476
  let gnResult = new GNHashtable();
@@ -44332,7 +44514,6 @@ var gamePlayer_SetDisplayNameRequestHandler_metadata = (undefined && undefined._
44332
44514
 
44333
44515
 
44334
44516
 
44335
-
44336
44517
  class gamePlayer_SetDisplayNameRequestHandler_SetDisplayNameOperationRequest extends OperationRequest {
44337
44518
  userId;
44338
44519
  displayName;
@@ -44446,7 +44627,7 @@ class gamePlayer_SetDisplayNameRequestHandler_SetDisplayNameRequestHandler exten
44446
44627
  displayName: true,
44447
44628
  };
44448
44629
  if (request.uniqueDisplayName) {
44449
- let gamePlayerWithThisDisplayName = await this.gnServer.getDatabase().loadGamePlayerWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.displayName), gamePlayerFindOptions);
44630
+ let gamePlayerWithThisDisplayName = await this.gnServer.getDatabase().loadGamePlayerWithDisplayNameAsync(request.displayName, gamePlayerFindOptions);
44450
44631
  if (gamePlayerWithThisDisplayName != null) {
44451
44632
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.DisplayNameHasUse);
44452
44633
  return operationResponse;
@@ -49640,7 +49821,7 @@ class GrantPlayerCharacterRequestHandler extends GamePlayerBaseRequestHandler {
49640
49821
  return operationResponse;
49641
49822
  }
49642
49823
  if (request.uniqueDisplayName && request.displayName) {
49643
- let characterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadCharacterPlayerWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.displayName), secretInfo.getGameId(), { displayName: true });
49824
+ let characterPlayerWithThisDisplayName = await this.gnServer.getDatabase().loadCharacterPlayerWithDisplayNameAsync(request.displayName, secretInfo.getGameId(), { displayName: true });
49644
49825
  if (characterPlayerWithThisDisplayName != null) {
49645
49826
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.DisplayNameHasUse);
49646
49827
  return operationResponse;
@@ -50926,7 +51107,7 @@ class gamePlayer_GetPlayersWithDisplayNameRequestHandler_GetPlayersWithDisplayNa
50926
51107
  operationResponse.setReturnCode(ReturnCode.Ok);
50927
51108
  let gamePlayerFindOptions = this.convertToGamePlayerFindOptions(request.infoRequestParam);
50928
51109
  let gnResults = new GNArray();
50929
- let gamePlayers = await this.gnServer.getDatabase().loadGamePlayersWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), gamePlayerFindOptions);
51110
+ let gamePlayers = await this.gnServer.getDatabase().loadGamePlayersWithDisplayNameNormalizeRegexAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), gamePlayerFindOptions);
50930
51111
  for (let i = 0; i < gamePlayers.length; i++) {
50931
51112
  let gamePlayer = gamePlayers[i];
50932
51113
  let gnResult = new GNHashtable();
@@ -53381,6 +53562,39 @@ class GroupBaseRequestHandler extends RequestHandler {
53381
53562
  answer = true;
53382
53563
  }
53383
53564
  if (!answer && permissionRules.selfEnable) {
53565
+ let group = await this.gnServer.getDatabase().loadGroupAsync(groupId, gameId, {
53566
+ members: true,
53567
+ groupType: true,
53568
+ });
53569
+ if (group != null) {
53570
+ let groupType = group.getGroupType();
53571
+ if (groupType == OwnerType.GamePlayer) {
53572
+ let memberItem = group.getMember(userId);
53573
+ if (memberItem != null) {
53574
+ if (memberItem.status == GroupStatus.Member) {
53575
+ answer = true;
53576
+ }
53577
+ }
53578
+ }
53579
+ else if (groupType == OwnerType.CharacterPlayer) {
53580
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(userId, gameId, { playerCharacters: true });
53581
+ if (gamePlayer != null) {
53582
+ let characterPlayers = gamePlayer.getAllPlayerCharacters();
53583
+ if (characterPlayers != null) {
53584
+ for (let i = 0; i < characterPlayers.length; i++) {
53585
+ let characterPlayer = characterPlayers[i];
53586
+ let memberItem = group.getMember(characterPlayer.characterId);
53587
+ if (memberItem != null) {
53588
+ if (memberItem.status == GroupStatus.Member) {
53589
+ answer = true;
53590
+ break;
53591
+ }
53592
+ }
53593
+ }
53594
+ }
53595
+ }
53596
+ }
53597
+ }
53384
53598
  let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(userId, gameId, { playerGroups: true });
53385
53599
  if (gamePlayer != null) {
53386
53600
  let playerGroup = gamePlayer.getPlayerGroup(groupId);
@@ -57073,6 +57287,7 @@ var GetGroupInformationRequestHandler_metadata = (undefined && undefined.__metad
57073
57287
 
57074
57288
 
57075
57289
 
57290
+
57076
57291
  class GetGroupInformationOperationRequest extends OperationRequest {
57077
57292
  groupId;
57078
57293
  infoRequestParam;
@@ -57125,12 +57340,39 @@ class GetGroupInformationRequestHandler extends GroupBaseRequestHandler {
57125
57340
  allowMethod = true;
57126
57341
  }
57127
57342
  if (secretInfo.getPermission().group.getGroupInformation.selfEnable) {
57128
- let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(authInfo.getUserId(), secretInfo.getGameId(), { playerGroups: true });
57129
- if (gamePlayer != null) {
57130
- let playerGroup = gamePlayer.getPlayerGroup(request.groupId);
57131
- if (playerGroup != null && playerGroup.status == GroupStatus.Member) {
57132
- allowMethod = true;
57133
- owned = true;
57343
+ let group = await this.gnServer.getDatabase().loadGroupAsync(request.groupId, secretInfo.getGameId(), {
57344
+ members: true,
57345
+ groupType: true,
57346
+ });
57347
+ if (group != null) {
57348
+ let groupType = group.getGroupType();
57349
+ if (groupType == OwnerType.GamePlayer) {
57350
+ let memberItem = group.getMember(authInfo.getUserId());
57351
+ if (memberItem != null) {
57352
+ if (memberItem.status == GroupStatus.Member) {
57353
+ allowMethod = true;
57354
+ owned = true;
57355
+ }
57356
+ }
57357
+ }
57358
+ else if (groupType == OwnerType.CharacterPlayer) {
57359
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(authInfo.getUserId(), secretInfo.getGameId(), { playerCharacters: true });
57360
+ if (gamePlayer != null) {
57361
+ let characterPlayers = gamePlayer.getAllPlayerCharacters();
57362
+ if (characterPlayers != null) {
57363
+ for (let i = 0; i < characterPlayers.length; i++) {
57364
+ let characterPlayer = characterPlayers[i];
57365
+ let memberItem = group.getMember(characterPlayer.characterId);
57366
+ if (memberItem != null) {
57367
+ if (memberItem.status == GroupStatus.Member) {
57368
+ allowMethod = true;
57369
+ owned = true;
57370
+ break;
57371
+ }
57372
+ }
57373
+ }
57374
+ }
57375
+ }
57134
57376
  }
57135
57377
  }
57136
57378
  }
@@ -59502,7 +59744,7 @@ class GetGroupsWithDisplayNameRequestHandler extends GroupBaseRequestHandler {
59502
59744
  operationResponse.setReturnCode(ReturnCode.Ok);
59503
59745
  let groupFindOptions = this.convertToGroupFindOptions(request.infoRequestParam);
59504
59746
  let gnResults = new GNArray();
59505
- let groups = await this.gnServer.getDatabase().loadGroupsWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), groupFindOptions);
59747
+ let groups = await this.gnServer.getDatabase().loadGroupsWithDisplayNameNormalizeRegexAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), groupFindOptions);
59506
59748
  for (let i = 0; i < groups.length; i++) {
59507
59749
  let group = groups[i];
59508
59750
  let gnResult = new GNHashtable();
@@ -60048,6 +60290,7 @@ class group_GetCurrencyLogRequestHandler_GetCurrencyLogRequestHandler extends Re
60048
60290
 
60049
60291
 
60050
60292
 
60293
+
60051
60294
  class ItemBaseRequestHandler extends RequestHandler {
60052
60295
  isGetAll(infoRequestParam) {
60053
60296
  return infoRequestParam.catalogId
@@ -60107,10 +60350,33 @@ class ItemBaseRequestHandler extends RequestHandler {
60107
60350
  answer = true;
60108
60351
  }
60109
60352
  if (!answer && permissionRules.selfEnable) {
60110
- let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(userId, gameId, { playerInventories: true });
60111
- if (gamePlayer != null) {
60112
- if (gamePlayer.hasPlayerInventory(itemId))
60113
- answer = true;
60353
+ let inventory = await this.gnServer.getDatabase().loadInventoryAsync(itemId, gameId, { owner: true });
60354
+ if (inventory != null) {
60355
+ let owner = inventory.getOwner();
60356
+ if (owner != null) {
60357
+ if (owner.type == OwnerType.GamePlayer) {
60358
+ if (owner.id == userId) {
60359
+ answer = true;
60360
+ }
60361
+ }
60362
+ else if (owner.type == OwnerType.CharacterPlayer) {
60363
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(userId, gameId, { playerCharacters: true });
60364
+ if (gamePlayer != null) {
60365
+ if (gamePlayer.hasPlayerCharacter(owner.id)) {
60366
+ answer = true;
60367
+ }
60368
+ }
60369
+ }
60370
+ else if (owner.type == OwnerType.Group) {
60371
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(userId, gameId, { playerGroups: true });
60372
+ if (gamePlayer != null) {
60373
+ let playerGroup = gamePlayer.getPlayerGroup(owner.id);
60374
+ if (playerGroup != null && playerGroup.status == GroupStatus.Member) {
60375
+ answer = true;
60376
+ }
60377
+ }
60378
+ }
60379
+ }
60114
60380
  }
60115
60381
  }
60116
60382
  return answer;
@@ -63390,6 +63656,8 @@ var GetItemInformationRequestHandler_metadata = (undefined && undefined.__metada
63390
63656
 
63391
63657
 
63392
63658
 
63659
+
63660
+
63393
63661
  class GetItemInformationOperationRequest extends OperationRequest {
63394
63662
  itemId;
63395
63663
  infoRequestParam;
@@ -63442,11 +63710,35 @@ class GetItemInformationRequestHandler extends ItemBaseRequestHandler {
63442
63710
  allowMethod = true;
63443
63711
  }
63444
63712
  if (secretInfo.getPermission().inventory.getItemInformation.selfEnable) {
63445
- let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(authInfo.getUserId(), secretInfo.getGameId(), { playerInventories: true });
63446
- if (gamePlayer != null) {
63447
- if (gamePlayer.hasPlayerCharacter(request.itemId)) {
63448
- allowMethod = true;
63449
- owned = true;
63713
+ let inventory = await this.gnServer.getDatabase().loadInventoryAsync(request.itemId, secretInfo.getGameId(), { owner: true });
63714
+ if (inventory != null) {
63715
+ let owner = inventory.getOwner();
63716
+ if (owner != null) {
63717
+ if (owner.type == OwnerType.GamePlayer) {
63718
+ if (owner.id == authInfo.getUserId()) {
63719
+ allowMethod = true;
63720
+ owned = true;
63721
+ }
63722
+ }
63723
+ else if (owner.type == OwnerType.CharacterPlayer) {
63724
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(authInfo.getUserId(), secretInfo.getGameId(), { playerCharacters: true });
63725
+ if (gamePlayer != null) {
63726
+ if (gamePlayer.hasPlayerCharacter(owner.id)) {
63727
+ allowMethod = true;
63728
+ owned = true;
63729
+ }
63730
+ }
63731
+ }
63732
+ else if (owner.type == OwnerType.Group) {
63733
+ let gamePlayer = await this.gnServer.getDatabase().loadGamePlayerAsync(authInfo.getUserId(), secretInfo.getGameId(), { playerGroups: true });
63734
+ if (gamePlayer != null) {
63735
+ let playerGroup = gamePlayer.getPlayerGroup(owner.id);
63736
+ if (playerGroup != null && playerGroup.status == GroupStatus.Member) {
63737
+ allowMethod = true;
63738
+ owned = true;
63739
+ }
63740
+ }
63741
+ }
63450
63742
  }
63451
63743
  }
63452
63744
  }
@@ -65161,7 +65453,7 @@ class GetItemsWithDisplayNameRequestHandler extends ItemBaseRequestHandler {
65161
65453
  operationResponse.setReturnCode(ReturnCode.Ok);
65162
65454
  let inventoryFindOptions = this.convertToInventoryFindOptions(request.infoRequestParam);
65163
65455
  let gnResults = new GNArray();
65164
- let inventorys = await this.gnServer.getDatabase().loadInventoriesWithDisplayNameAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), inventoryFindOptions);
65456
+ let inventorys = await this.gnServer.getDatabase().loadInventoriesWithDisplayNameNormalizeRegexAsync(DisplayNameUtility.normalizeString(request.keyword), request.skip, request.limit, secretInfo.getGameId(), inventoryFindOptions);
65165
65457
  for (let i = 0; i < inventorys.length; i++) {
65166
65458
  let inventory = inventorys[i];
65167
65459
  let gnResult = new GNHashtable();
@@ -70335,16 +70627,36 @@ var EmailSettingsParam_metadata = (undefined && undefined.__metadata) || functio
70335
70627
 
70336
70628
  class EmailSettingsParam {
70337
70629
  sendFrom;
70338
- sendGridApiKey;
70630
+ secure;
70631
+ host;
70632
+ port;
70633
+ username;
70634
+ password;
70339
70635
  }
70340
70636
  EmailSettingsParam_decorate([
70341
70637
  StringDataMember({ code: GNParameterCode.SendFrom }),
70342
70638
  EmailSettingsParam_metadata("design:type", String)
70343
70639
  ], EmailSettingsParam.prototype, "sendFrom", void 0);
70344
70640
  EmailSettingsParam_decorate([
70345
- StringDataMember({ code: GNParameterCode.SendGridApiKey }),
70641
+ BooleanDataMember({ code: GNParameterCode.Secure }),
70642
+ EmailSettingsParam_metadata("design:type", Boolean)
70643
+ ], EmailSettingsParam.prototype, "secure", void 0);
70644
+ EmailSettingsParam_decorate([
70645
+ StringDataMember({ code: GNParameterCode.Host }),
70646
+ EmailSettingsParam_metadata("design:type", String)
70647
+ ], EmailSettingsParam.prototype, "host", void 0);
70648
+ EmailSettingsParam_decorate([
70649
+ NumberDataMember({ code: GNParameterCode.Port }),
70650
+ EmailSettingsParam_metadata("design:type", Number)
70651
+ ], EmailSettingsParam.prototype, "port", void 0);
70652
+ EmailSettingsParam_decorate([
70653
+ StringDataMember({ code: GNParameterCode.Username }),
70654
+ EmailSettingsParam_metadata("design:type", String)
70655
+ ], EmailSettingsParam.prototype, "username", void 0);
70656
+ EmailSettingsParam_decorate([
70657
+ StringDataMember({ code: GNParameterCode.Password }),
70346
70658
  EmailSettingsParam_metadata("design:type", String)
70347
- ], EmailSettingsParam.prototype, "sendGridApiKey", void 0);
70659
+ ], EmailSettingsParam.prototype, "password", void 0);
70348
70660
 
70349
70661
  ;// ./src/GN-app-api/handler/controller/handler/dashboard/model/PushNotificationSettingsParam.ts
70350
70662
  var PushNotificationSettingsParam_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -70616,7 +70928,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70616
70928
  let key = removeKeyLst[i];
70617
70929
  let indexName = "playerCurrencies." + key + ".value_-1";
70618
70930
  masterPlayerCollection.dropIndex(indexName);
70619
- Debug.log("[GN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70931
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70620
70932
  }
70621
70933
  for (let i = 0; i < addKeyLst.length; i++) {
70622
70934
  let key = addKeyLst[i];
@@ -70624,7 +70936,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70624
70936
  indexDoc["playerCurrencies." + key + ".value"] = -1;
70625
70937
  let indexName = "playerCurrencies." + key + ".value_-1";
70626
70938
  masterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
70627
- Debug.log("[GN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
70939
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
70628
70940
  }
70629
70941
  }
70630
70942
  masterPlayerSettings.playerCurrencySettings = playerCurrencySettings;
@@ -70678,7 +70990,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70678
70990
  let key = removeKeyLst[i];
70679
70991
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
70680
70992
  masterPlayerCollection.dropIndex(indexName);
70681
- Debug.log("[GN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70993
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70682
70994
  }
70683
70995
  for (let i = 0; i < addKeyLst.length; i++) {
70684
70996
  let key = addKeyLst[i];
@@ -70687,7 +70999,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70687
70999
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
70688
71000
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
70689
71001
  masterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
70690
- Debug.log("[GN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
71002
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
70691
71003
  }
70692
71004
  }
70693
71005
  }
@@ -70706,7 +71018,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70706
71018
  let key = removeKeyAscLst[i];
70707
71019
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
70708
71020
  masterPlayerCollection.dropIndex(indexName);
70709
- Debug.log("[GN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
71021
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70710
71022
  }
70711
71023
  for (let i = 0; i < addKeyAscLst.length; i++) {
70712
71024
  let key = addKeyAscLst[i];
@@ -70715,7 +71027,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70715
71027
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
70716
71028
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
70717
71029
  masterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
70718
- Debug.log("[GN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
71030
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
70719
71031
  }
70720
71032
  }
70721
71033
  }
@@ -70781,7 +71093,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70781
71093
  let key = removeKeyLst[i];
70782
71094
  let indexName = "tags." + key + "_1";
70783
71095
  masterPlayerCollection.dropIndex(indexName);
70784
- Debug.log("[GN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
71096
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + masterPlayerCollection.collectionName);
70785
71097
  }
70786
71098
  for (let i = 0; i < addKeyLst.length; i++) {
70787
71099
  let key = addKeyLst[i];
@@ -70789,7 +71101,7 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70789
71101
  indexDoc["tags." + key] = 1;
70790
71102
  let indexName = "tags." + key + "_1";
70791
71103
  masterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
70792
- Debug.log("[GN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
71104
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + masterPlayerCollection.collectionName);
70793
71105
  }
70794
71106
  }
70795
71107
  masterPlayerSettings.tagsSettings = tagsSettings;
@@ -70800,9 +71112,17 @@ class SetMasterGameSettingsRequestHandler extends RequestHandler {
70800
71112
  let emailSettings = masterGameSettings.getEmailSettings();
70801
71113
  if (request.emailSettings.sendFrom)
70802
71114
  emailSettings.sendFrom = request.emailSettings.sendFrom;
70803
- if (request.emailSettings.sendGridApiKey)
70804
- emailSettings.sendGridApiKey = request.emailSettings.sendGridApiKey;
70805
- this.gnServer.getEmailService().init(emailSettings.sendGridApiKey, emailSettings.sendFrom);
71115
+ if (request.emailSettings.secure != null)
71116
+ emailSettings.secure = request.emailSettings.secure;
71117
+ if (request.emailSettings.host)
71118
+ emailSettings.host = request.emailSettings.host;
71119
+ if (request.emailSettings.port)
71120
+ emailSettings.port = request.emailSettings.port;
71121
+ if (request.emailSettings.username)
71122
+ emailSettings.username = request.emailSettings.username;
71123
+ if (request.emailSettings.password)
71124
+ emailSettings.password = request.emailSettings.password;
71125
+ this.gnServer.getEmailService().init(emailSettings.host, emailSettings.port, emailSettings.secure, emailSettings.username, emailSettings.password, emailSettings.sendFrom);
70806
71126
  this.gnServer.getEmailService().run();
70807
71127
  masterGameSettings.setEmailSettings(emailSettings);
70808
71128
  }
@@ -72201,12 +72521,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72201
72521
  {
72202
72522
  let indexName = "playerCurrencies." + key + ".value_-1";
72203
72523
  characterPlayerCollection.dropIndex(indexName);
72204
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72524
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72205
72525
  }
72206
72526
  {
72207
72527
  let indexName = "catalogId_1_" + "playerCurrencies." + key + ".value_-1";
72208
72528
  characterPlayerCollection.dropIndex(indexName);
72209
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72529
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72210
72530
  }
72211
72531
  }
72212
72532
  for (let i = 0; i < addKeyLst.length; i++) {
@@ -72216,7 +72536,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72216
72536
  indexDoc["playerCurrencies." + key + ".value"] = -1;
72217
72537
  let indexName = "playerCurrencies." + key + ".value_-1";
72218
72538
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72219
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72539
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72220
72540
  }
72221
72541
  {
72222
72542
  let indexDoc = {};
@@ -72224,7 +72544,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72224
72544
  indexDoc["playerCurrencies." + key + ".value"] = -1;
72225
72545
  let indexName = "catalogId_1_" + "playerCurrencies." + key + ".value_-1";
72226
72546
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72227
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72547
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72228
72548
  }
72229
72549
  }
72230
72550
  }
@@ -72278,12 +72598,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72278
72598
  {
72279
72599
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72280
72600
  characterPlayerCollection.dropIndex(indexName);
72281
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72601
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72282
72602
  }
72283
72603
  {
72284
72604
  let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72285
72605
  characterPlayerCollection.dropIndex(indexName);
72286
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72606
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72287
72607
  }
72288
72608
  }
72289
72609
  for (let i = 0; i < addKeyLst.length; i++) {
@@ -72294,7 +72614,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72294
72614
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72295
72615
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72296
72616
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72297
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72617
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72298
72618
  }
72299
72619
  {
72300
72620
  let indexDoc = {};
@@ -72303,7 +72623,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72303
72623
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72304
72624
  let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72305
72625
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72306
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72626
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72307
72627
  }
72308
72628
  }
72309
72629
  }
@@ -72322,12 +72642,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72322
72642
  {
72323
72643
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72324
72644
  characterPlayerCollection.dropIndex(indexName);
72325
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72645
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72326
72646
  }
72327
72647
  {
72328
72648
  let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72329
72649
  characterPlayerCollection.dropIndex(indexName);
72330
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72650
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72331
72651
  }
72332
72652
  }
72333
72653
  for (let i = 0; i < addKeyAscLst.length; i++) {
@@ -72338,7 +72658,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72338
72658
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72339
72659
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72340
72660
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72341
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72661
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72342
72662
  }
72343
72663
  {
72344
72664
  let indexDoc = {};
@@ -72347,7 +72667,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72347
72667
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72348
72668
  let indexName = "catalogId_1_" + "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72349
72669
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72350
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72670
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72351
72671
  }
72352
72672
  }
72353
72673
  }
@@ -72411,7 +72731,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72411
72731
  let key = removeKeyLst[i];
72412
72732
  let indexName = "tags." + key + "_1";
72413
72733
  characterPlayerCollection.dropIndex(indexName);
72414
- Debug.log("[GN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72734
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + characterPlayerCollection.collectionName);
72415
72735
  }
72416
72736
  for (let i = 0; i < addKeyLst.length; i++) {
72417
72737
  let key = addKeyLst[i];
@@ -72419,7 +72739,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72419
72739
  indexDoc["tags." + key] = 1;
72420
72740
  let indexName = "tags." + key + "_1";
72421
72741
  characterPlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72422
- Debug.log("[GN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72742
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + characterPlayerCollection.collectionName);
72423
72743
  }
72424
72744
  }
72425
72745
  if (request.gameSettings.characterPlayerSettings.playerGroupCatalogSettings != null) {
@@ -72499,7 +72819,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72499
72819
  let key = removeKeyLst[i];
72500
72820
  let indexName = "playerCurrencies." + key + ".value_-1";
72501
72821
  gamePlayerCollection.dropIndex(indexName);
72502
- Debug.log("[GN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72822
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72503
72823
  }
72504
72824
  for (let i = 0; i < addKeyLst.length; i++) {
72505
72825
  let key = addKeyLst[i];
@@ -72507,7 +72827,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72507
72827
  indexDoc["playerCurrencies." + key + ".value"] = -1;
72508
72828
  let indexName = "playerCurrencies." + key + ".value_-1";
72509
72829
  gamePlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72510
- Debug.log("[GN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72830
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72511
72831
  }
72512
72832
  }
72513
72833
  if (request.gameSettings.gamePlayerSettings.playerStatisticsSettings != null) {
@@ -72559,7 +72879,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72559
72879
  let key = removeKeyLst[i];
72560
72880
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72561
72881
  gamePlayerCollection.dropIndex(indexName);
72562
- Debug.log("[GN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72882
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72563
72883
  }
72564
72884
  for (let i = 0; i < addKeyLst.length; i++) {
72565
72885
  let key = addKeyLst[i];
@@ -72568,7 +72888,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72568
72888
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72569
72889
  let indexName = "playerStatistics." + key + ".value_-1_playerStatistics." + key + ".tsLastUpdate_1";
72570
72890
  gamePlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72571
- Debug.log("[GN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72891
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72572
72892
  }
72573
72893
  }
72574
72894
  {
@@ -72585,7 +72905,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72585
72905
  let key = removeKeyAscLst[i];
72586
72906
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72587
72907
  gamePlayerCollection.dropIndex(indexName);
72588
- Debug.log("[GN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72908
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72589
72909
  }
72590
72910
  for (let i = 0; i < addKeyAscLst.length; i++) {
72591
72911
  let key = addKeyAscLst[i];
@@ -72594,7 +72914,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72594
72914
  indexDoc["playerStatistics." + key + ".tsLastUpdate"] = 1;
72595
72915
  let indexName = "playerStatistics." + key + ".value_1_playerStatistics." + key + ".tsLastUpdate_1";
72596
72916
  gamePlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72597
- Debug.log("[GN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72917
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72598
72918
  }
72599
72919
  }
72600
72920
  }
@@ -72657,7 +72977,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72657
72977
  let key = removeKeyLst[i];
72658
72978
  let indexName = "tags." + key + "_1";
72659
72979
  gamePlayerCollection.dropIndex(indexName);
72660
- Debug.log("[GN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72980
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + gamePlayerCollection.collectionName);
72661
72981
  }
72662
72982
  for (let i = 0; i < addKeyLst.length; i++) {
72663
72983
  let key = addKeyLst[i];
@@ -72665,7 +72985,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72665
72985
  indexDoc["tags." + key] = 1;
72666
72986
  let indexName = "tags." + key + "_1";
72667
72987
  gamePlayerCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72668
- Debug.log("[GN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72988
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + gamePlayerCollection.collectionName);
72669
72989
  }
72670
72990
  }
72671
72991
  if (request.gameSettings.gamePlayerSettings.playerCharacterCatalogSettings != null) {
@@ -72758,12 +73078,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72758
73078
  {
72759
73079
  let indexName = "groupCurrencies." + key + ".value_-1";
72760
73080
  groupCollection.dropIndex(indexName);
72761
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73081
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72762
73082
  }
72763
73083
  {
72764
73084
  let indexName = "catalogId_1_" + "groupCurrencies." + key + ".value_-1";
72765
73085
  groupCollection.dropIndex(indexName);
72766
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73086
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72767
73087
  }
72768
73088
  }
72769
73089
  for (let i = 0; i < addKeyLst.length; i++) {
@@ -72773,7 +73093,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72773
73093
  indexDoc["groupCurrencies." + key + ".value"] = -1;
72774
73094
  let indexName = "groupCurrencies." + key + ".value_-1";
72775
73095
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72776
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73096
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72777
73097
  }
72778
73098
  {
72779
73099
  let indexDoc = {};
@@ -72781,7 +73101,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72781
73101
  indexDoc["groupCurrencies." + key + ".value"] = -1;
72782
73102
  let indexName = "catalogId_1_" + "groupCurrencies." + key + ".value_-1";
72783
73103
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72784
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73104
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72785
73105
  }
72786
73106
  }
72787
73107
  }
@@ -72835,12 +73155,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72835
73155
  {
72836
73156
  let indexName = "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
72837
73157
  groupCollection.dropIndex(indexName);
72838
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73158
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72839
73159
  }
72840
73160
  {
72841
73161
  let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
72842
73162
  groupCollection.dropIndex(indexName);
72843
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73163
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72844
73164
  }
72845
73165
  }
72846
73166
  for (let i = 0; i < addKeyLst.length; i++) {
@@ -72851,7 +73171,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72851
73171
  indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
72852
73172
  let indexName = "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
72853
73173
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72854
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73174
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72855
73175
  }
72856
73176
  {
72857
73177
  let indexDoc = {};
@@ -72860,7 +73180,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72860
73180
  indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
72861
73181
  let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_-1_groupStatistics." + key + ".tsLastUpdate_1";
72862
73182
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72863
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73183
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72864
73184
  }
72865
73185
  }
72866
73186
  }
@@ -72879,12 +73199,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
72879
73199
  {
72880
73200
  let indexName = "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
72881
73201
  groupCollection.dropIndex(indexName);
72882
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73202
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72883
73203
  }
72884
73204
  {
72885
73205
  let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
72886
73206
  groupCollection.dropIndex(indexName);
72887
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73207
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72888
73208
  }
72889
73209
  }
72890
73210
  for (let i = 0; i < addKeyAscLst.length; i++) {
@@ -72895,7 +73215,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72895
73215
  indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
72896
73216
  let indexName = "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
72897
73217
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72898
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73218
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72899
73219
  }
72900
73220
  {
72901
73221
  let indexDoc = {};
@@ -72904,7 +73224,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72904
73224
  indexDoc["groupStatistics." + key + ".tsLastUpdate"] = 1;
72905
73225
  let indexName = "catalogId_1_" + "groupStatistics." + key + ".value_1_groupStatistics." + key + ".tsLastUpdate_1";
72906
73226
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72907
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73227
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72908
73228
  }
72909
73229
  }
72910
73230
  }
@@ -72969,7 +73289,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72969
73289
  groupCollection.dropIndex("tags." + key + "_1");
72970
73290
  let indexName = "tags." + key + "_1";
72971
73291
  groupCollection.dropIndex(indexName);
72972
- Debug.log("[GN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
73292
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + groupCollection.collectionName);
72973
73293
  }
72974
73294
  for (let i = 0; i < addKeyLst.length; i++) {
72975
73295
  let key = addKeyLst[i];
@@ -72977,7 +73297,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
72977
73297
  indexDoc["tags." + key] = 1;
72978
73298
  let indexName = "tags." + key + "_1";
72979
73299
  groupCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
72980
- Debug.log("[GN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
73300
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + groupCollection.collectionName);
72981
73301
  }
72982
73302
  }
72983
73303
  if (request.gameSettings.groupSettings.groupItemCatalogSettings != null) {
@@ -73048,12 +73368,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
73048
73368
  {
73049
73369
  let indexName = "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
73050
73370
  inventoryCollection.dropIndex(indexName);
73051
- Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73371
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73052
73372
  }
73053
73373
  {
73054
73374
  let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
73055
73375
  inventoryCollection.dropIndex(indexName);
73056
- Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73376
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73057
73377
  }
73058
73378
  }
73059
73379
  for (let i = 0; i < addKeyLst.length; i++) {
@@ -73064,7 +73384,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73064
73384
  indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
73065
73385
  let indexName = "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
73066
73386
  inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
73067
- Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73387
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73068
73388
  }
73069
73389
  {
73070
73390
  let indexDoc = {};
@@ -73073,7 +73393,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73073
73393
  indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
73074
73394
  let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_-1_itemStatistics." + key + ".tsLastUpdate_1";
73075
73395
  inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
73076
- Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73396
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73077
73397
  }
73078
73398
  }
73079
73399
  }
@@ -73092,12 +73412,12 @@ class SetGameInformationRequestHandler extends RequestHandler {
73092
73412
  {
73093
73413
  let indexName = "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
73094
73414
  inventoryCollection.dropIndex(indexName);
73095
- Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73415
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73096
73416
  }
73097
73417
  {
73098
73418
  let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
73099
73419
  inventoryCollection.dropIndex(indexName);
73100
- Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73420
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73101
73421
  }
73102
73422
  }
73103
73423
  for (let i = 0; i < addKeyAscLst.length; i++) {
@@ -73108,7 +73428,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73108
73428
  indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
73109
73429
  let indexName = "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
73110
73430
  inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
73111
- Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73431
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73112
73432
  }
73113
73433
  {
73114
73434
  let indexDoc = {};
@@ -73117,7 +73437,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73117
73437
  indexDoc["itemStatistics." + key + ".tsLastUpdate"] = 1;
73118
73438
  let indexName = "catalogId_1_" + "itemStatistics." + key + ".value_1_itemStatistics." + key + ".tsLastUpdate_1";
73119
73439
  inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
73120
- Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73440
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73121
73441
  }
73122
73442
  }
73123
73443
  }
@@ -73181,7 +73501,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73181
73501
  let key = removeKeyLst[i];
73182
73502
  let indexName = "tags." + key + "_1";
73183
73503
  inventoryCollection.dropIndex(indexName);
73184
- Debug.log("[GN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73504
+ Debug.log("[GearN] [Database] drop index " + indexName + " at " + inventoryCollection.collectionName);
73185
73505
  }
73186
73506
  for (let i = 0; i < addKeyLst.length; i++) {
73187
73507
  let key = addKeyLst[i];
@@ -73189,7 +73509,7 @@ class SetGameInformationRequestHandler extends RequestHandler {
73189
73509
  indexDoc["tags." + key] = 1;
73190
73510
  let indexName = "tags." + key + "_1";
73191
73511
  inventoryCollection.createIndex(indexDoc, { background: true, sparse: true, name: indexName });
73192
- Debug.log("[GN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73512
+ Debug.log("[GearN] [Database] create new index " + indexName + " at " + inventoryCollection.collectionName);
73193
73513
  }
73194
73514
  }
73195
73515
  }
@@ -73809,7 +74129,7 @@ class CloudScriptService {
73809
74129
  }
73810
74130
  loadCloudScriptWorker(version) {
73811
74131
  let filePath = __dirname + "/./GN-startup/cloudScript/" + version + ".js";
73812
- Debug.log("[GN] [CloudScript] run cloudScript " + version);
74132
+ Debug.log("[GearN] [CloudScript] run cloudScript " + version);
73813
74133
  let cloudScriptWorker = (0,external_child_process_namespaceObject.fork)(filePath, {
73814
74134
  env: {
73815
74135
  gameId: this.gameId,
@@ -73875,7 +74195,7 @@ class CloudScriptService {
73875
74195
  }
73876
74196
  });
73877
74197
  cloudScriptWorker.on("exit", (code) => {
73878
- Debug.log("[GN] [CloudScript] terminal cloudScript " + version + " with code " + code);
74198
+ Debug.log("[GearN] [CloudScript] terminal cloudScript " + version + " with code " + code);
73879
74199
  thiz.cloudScriptWorkerDict.delete(version);
73880
74200
  });
73881
74201
  this.cloudScriptWorkerDict.set(version, cloudScriptWorker);
@@ -75325,7 +75645,11 @@ class GetMasterGameSettingsRequestHandler extends RequestHandler {
75325
75645
  let emailSettings = masterGameSettings.getEmailSettings();
75326
75646
  let gnEmailSettings = new GNHashtable();
75327
75647
  gnEmailSettings.add(GNParameterCode.SendFrom, emailSettings.sendFrom);
75328
- gnEmailSettings.add(GNParameterCode.SendGridApiKey, emailSettings.sendGridApiKey);
75648
+ gnEmailSettings.add(GNParameterCode.Host, emailSettings.host);
75649
+ gnEmailSettings.add(GNParameterCode.Port, emailSettings.port);
75650
+ gnEmailSettings.add(GNParameterCode.Secure, emailSettings.secure);
75651
+ gnEmailSettings.add(GNParameterCode.Username, emailSettings.username);
75652
+ gnEmailSettings.add(GNParameterCode.Password, emailSettings.password);
75329
75653
  operationResponse.setParameter(GNParameterCode.EmailSettings, gnEmailSettings);
75330
75654
  }
75331
75655
  {
@@ -75515,6 +75839,7 @@ class GetSecretInfoInformationRequestHandler extends RequestHandler {
75515
75839
  operationResponse.setParameter(GNParameterCode.CreatorId, secretInfoItem.getCreatorId());
75516
75840
  operationResponse.setParameter(GNParameterCode.Remove, secretInfoItem.getRemove());
75517
75841
  operationResponse.setParameter(GNParameterCode.TsExpire, secretInfoItem.getTsExpire());
75842
+ operationResponse.setParameter(GNParameterCode.DisplayName, secretInfoItem.getDisplayName());
75518
75843
  let gnPermission = GetSecretInfoInformationRequestHandler.getPermissionHashtable(secretInfoItem.getPermission());
75519
75844
  operationResponse.setParameter(GNParameterCode.Permission, gnPermission);
75520
75845
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.Ok);
@@ -78541,7 +78866,7 @@ class GetSecretInfoInformationRequestHandler extends RequestHandler {
78541
78866
  gnPermissionRules.add(GNParameterCode.OtherSelfEnable, permissionRules.otherSelfEnable);
78542
78867
  gnPermissionRules.add(GNParameterCode.ServerSelfEnable, permissionRules.serverSelfEnable);
78543
78868
  gnPermissionRules.add(GNParameterCode.AdminSelfEnable, permissionRules.adminSelfEnable);
78544
- gnMasterAdmin.add(GNParameterCode.ChangePasswordAdminAccount, gnPermissionRules);
78869
+ gnMasterAdmin.add(GNParameterCode.DeleteInDatabase, gnPermissionRules);
78545
78870
  }
78546
78871
  gnPermission.add(GNParameterCode.MasterAdmin, gnMasterAdmin);
78547
78872
  }
@@ -78705,6 +79030,7 @@ class GetSecretInfoInformationRequestHandler extends RequestHandler {
78705
79030
 
78706
79031
 
78707
79032
 
79033
+
78708
79034
  class GetSecretInfoListOperationRequest extends OperationRequest {
78709
79035
  isValidRequest() {
78710
79036
  if (!super.isValidRequest())
@@ -78737,15 +79063,25 @@ class GetSecretInfoListRequestHandler extends RequestHandler {
78737
79063
  operationResponse = new OperationResponse(operationRequest.getOperationCode(), operationRequest.getRequestId(), operationRequest.isEncrypted());
78738
79064
  operationResponse.setReturnCode(ReturnCode.Ok);
78739
79065
  let collection = this.gnServer.getDatabase().systemCollection("MasterAdmin");
78740
- let results = await collection.find({ type: "secretInfo" }, { secretKey: true });
78741
- let gnSecretInfoItems = new GNArray();
79066
+ let results = await collection.find({ type: "secretInfo" }, { secretKey: true, role: true });
79067
+ let gnAdminSecretKeys = new GNArray();
79068
+ let gnServerSecretKeys = new GNArray();
79069
+ let gnPlayerSecretKeys = new GNArray();
78742
79070
  while (await results.hasNext()) {
78743
79071
  let secretInfoItem = new SecretInfoItem(await results.next(), collection);
78744
79072
  let gnSecretInfoItem = new GNHashtable();
78745
79073
  gnSecretInfoItem.add(GNParameterCode.SecretKey, secretInfoItem.getSecretKey());
78746
- gnSecretInfoItems.add(gnSecretInfoItem);
79074
+ let role = secretInfoItem.getRole();
79075
+ if (role == SecretRole.Admin)
79076
+ gnAdminSecretKeys.add(gnSecretInfoItem);
79077
+ else if (role == SecretRole.Server)
79078
+ gnServerSecretKeys.add(gnSecretInfoItem);
79079
+ else
79080
+ gnPlayerSecretKeys.add(gnSecretInfoItem);
78747
79081
  }
78748
- operationResponse.setParameter(GNParameterCode.Results, gnSecretInfoItems);
79082
+ operationResponse.setParameter(GNParameterCode.AdminSecretKeys, gnAdminSecretKeys);
79083
+ operationResponse.setParameter(GNParameterCode.ServerSecretKeys, gnServerSecretKeys);
79084
+ operationResponse.setParameter(GNParameterCode.PlayerSecretKeys, gnPlayerSecretKeys);
78749
79085
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.Ok);
78750
79086
  await this.gnServer.getPostEventCallbackService().onEvent("dashboard_GetSecretInfoList", request, secretInfo, operationRequest, operationResponse);
78751
79087
  return operationResponse;
@@ -78779,6 +79115,7 @@ class SetSecretInfoInformationOperationRequest extends OperationRequest {
78779
79115
  remove;
78780
79116
  tsExpire;
78781
79117
  permissionParam;
79118
+ displayName;
78782
79119
  isValidRequest() {
78783
79120
  if (!super.isValidRequest())
78784
79121
  return false;
@@ -78801,6 +79138,10 @@ SetSecretInfoInformationRequestHandler_decorate([
78801
79138
  GNHashtableDataMember({ code: GNParameterCode.Permission, isOptional: true }),
78802
79139
  SetSecretInfoInformationRequestHandler_metadata("design:type", PermissionParam)
78803
79140
  ], SetSecretInfoInformationOperationRequest.prototype, "permissionParam", void 0);
79141
+ SetSecretInfoInformationRequestHandler_decorate([
79142
+ StringDataMember({ code: GNParameterCode.DisplayName, isOptional: true }),
79143
+ SetSecretInfoInformationRequestHandler_metadata("design:type", String)
79144
+ ], SetSecretInfoInformationOperationRequest.prototype, "displayName", void 0);
78804
79145
  class SetSecretInfoInformationRequestHandler extends RequestHandler {
78805
79146
  getCode() {
78806
79147
  return OperationCode.SetSecretInfoInformation;
@@ -78821,6 +79162,7 @@ class SetSecretInfoInformationRequestHandler extends RequestHandler {
78821
79162
  remove: request.remove,
78822
79163
  tsExpire: request.tsExpire,
78823
79164
  permissionParam: request.permissionParam,
79165
+ displayName: request.displayName,
78824
79166
  }, secretInfo, operationRequest);
78825
79167
  }
78826
79168
  async execute(request, secretInfo, operationRequest) {
@@ -78843,6 +79185,9 @@ class SetSecretInfoInformationRequestHandler extends RequestHandler {
78843
79185
  if (request.tsExpire != null) {
78844
79186
  secretInfoItem.setTsExpire(request.tsExpire);
78845
79187
  }
79188
+ if (request.displayName != null) {
79189
+ secretInfoItem.setDisplayName(request.displayName);
79190
+ }
78846
79191
  // let secretRole = <SecretRole>secretInfoItem.getRole();
78847
79192
  if (request.permissionParam) {
78848
79193
  let permissionAny = secretInfoItem.getPermission();
@@ -78908,6 +79253,7 @@ class SetSecretInfoInformationRequestHandler extends RequestHandler {
78908
79253
  .setRole(secretInfoItem.getRole())
78909
79254
  .setSecretKey(secretInfoItem.getSecretKey())
78910
79255
  .setTsExpire(secretInfoItem.getTsExpire())
79256
+ .setDisplayName(secretInfoItem.getDisplayName())
78911
79257
  .build();
78912
79258
  this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
78913
79259
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.Ok);
@@ -79493,7 +79839,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79493
79839
  let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
79494
79840
  let direction = statisticsAggregationMethod == xStatisticsAggregationMethod.Minimum ? 1 : -1;
79495
79841
  let masterPlayerCollection = await this.gnServer.getDatabase().systemCollection("MasterPlayer");
79496
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + masterPlayerCollection.collectionName + " starting");
79842
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + masterPlayerCollection.collectionName + " starting");
79497
79843
  let masterPlayers = await this.gnServer.getDatabase().loadMasterPlayersLeaderboardWithStatisticsAllAsync(key, direction, masterPlayerFindOptions);
79498
79844
  let backupData = {
79499
79845
  key: key,
@@ -79539,7 +79885,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79539
79885
  });
79540
79886
  await backupStatisticsLeaderboardCollection.insertOne(backupData);
79541
79887
  this.gnServer.getDatabase().insertMasterPlayerStatisticsLogsAsync(logRequests);
79542
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + masterPlayerCollection.collectionName + " success");
79888
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + masterPlayerCollection.collectionName + " success");
79543
79889
  }
79544
79890
  else {
79545
79891
  let gameId = request.gameId;
@@ -79563,7 +79909,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79563
79909
  let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
79564
79910
  let direction = statisticsAggregationMethod == xStatisticsAggregationMethod.Minimum ? 1 : -1;
79565
79911
  let gamePlayerCollection = await this.gnServer.getDatabase().systemGameCollection("GamePlayer", gameId);
79566
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + gamePlayerCollection.collectionName + " starting");
79912
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + gamePlayerCollection.collectionName + " starting");
79567
79913
  let gamePlayers = await this.gnServer.getDatabase().loadGamePlayersLeaderboardWithStatisticsAllAsync(key, gameId, direction, gamePlayerFindOptions);
79568
79914
  let backupData = {
79569
79915
  key: key,
@@ -79609,7 +79955,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79609
79955
  });
79610
79956
  await backupStatisticsLeaderboardCollection.insertOne(backupData);
79611
79957
  this.gnServer.getDatabase().insertGamePlayerStatisticsLogsAsync(logRequests, gameId);
79612
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + gamePlayerCollection.collectionName + " success");
79958
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + gamePlayerCollection.collectionName + " success");
79613
79959
  }
79614
79960
  else if (type == OwnerType.CharacterPlayer) {
79615
79961
  let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("CharacterPlayer.StatisticsBackup", gameId);
@@ -79631,7 +79977,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79631
79977
  let statisticsAggregationMethod = playerStatisticsSettingsItem.statisticsAggregationMethod;
79632
79978
  let direction = statisticsAggregationMethod == xStatisticsAggregationMethod.Minimum ? 1 : -1;
79633
79979
  let characterPlayerCollection = await this.gnServer.getDatabase().systemGameCollection("CharacterPlayer", gameId);
79634
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + characterPlayerCollection.collectionName + " starting");
79980
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + characterPlayerCollection.collectionName + " starting");
79635
79981
  let characterPlayers = await this.gnServer.getDatabase().loadCharacterPlayersLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, characterPlayerFindOptions);
79636
79982
  let backupData = {
79637
79983
  key: key,
@@ -79677,7 +80023,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79677
80023
  });
79678
80024
  await backupStatisticsLeaderboardCollection.insertOne(backupData);
79679
80025
  this.gnServer.getDatabase().insertCharacterPlayerStatisticsLogsAsync(logRequests, gameId);
79680
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + characterPlayerCollection.collectionName + " success");
80026
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + characterPlayerCollection.collectionName + " success");
79681
80027
  }
79682
80028
  else if (type == OwnerType.Group) {
79683
80029
  let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.StatisticsBackup", gameId);
@@ -79699,7 +80045,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79699
80045
  let statisticsAggregationMethod = groupStatisticsSettingsItem.statisticsAggregationMethod;
79700
80046
  let direction = statisticsAggregationMethod == xStatisticsAggregationMethod.Minimum ? 1 : -1;
79701
80047
  let groupCollection = await this.gnServer.getDatabase().systemGameCollection("Group", gameId);
79702
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + groupCollection.collectionName + " starting");
80048
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + groupCollection.collectionName + " starting");
79703
80049
  let groups = await this.gnServer.getDatabase().loadGroupsLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, groupFindOptions);
79704
80050
  let backupData = {
79705
80051
  key: key,
@@ -79745,7 +80091,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79745
80091
  });
79746
80092
  await backupStatisticsLeaderboardCollection.insertOne(backupData);
79747
80093
  this.gnServer.getDatabase().insertGroupStatisticsLogsAsync(logRequests, gameId);
79748
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + groupCollection.collectionName + " success");
80094
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + groupCollection.collectionName + " success");
79749
80095
  }
79750
80096
  else if (type == OwnerType.Inventory) {
79751
80097
  let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("Inventory.StatisticsBackup", gameId);
@@ -79762,7 +80108,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79762
80108
  let statisticsAggregationMethod = inventoryStatisticsSettingsItem.statisticsAggregationMethod;
79763
80109
  let direction = statisticsAggregationMethod == xStatisticsAggregationMethod.Minimum ? 1 : -1;
79764
80110
  let inventoryCollection = await this.gnServer.getDatabase().systemGameCollection("Inventory", gameId);
79765
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + inventoryCollection.collectionName + " starting");
80111
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + inventoryCollection.collectionName + " starting");
79766
80112
  let inventories = await this.gnServer.getDatabase().loadInventoriesLeaderboardWithStatisticsAllAsync(key, request.catalogId, gameId, direction, inventoryFindOptions);
79767
80113
  let backupData = {
79768
80114
  key: key,
@@ -79808,7 +80154,7 @@ class ResetStatisticsLeaderboardRequestHandler extends RequestHandler {
79808
80154
  });
79809
80155
  await backupStatisticsLeaderboardCollection.insertOne(backupData);
79810
80156
  this.gnServer.getDatabase().insertInventoryStatisticsLogsAsync(logRequests, gameId);
79811
- Debug.log("[GN] ResetStatisticsLeaderboard for key " + key + " at " + inventoryCollection.collectionName + " success");
80157
+ Debug.log("[GearN] ResetStatisticsLeaderboard for key " + key + " at " + inventoryCollection.collectionName + " success");
79812
80158
  }
79813
80159
  else {
79814
80160
  operationResponse.setParameter(ParameterCode.ErrorCode, GNErrorCode.OwnerTypeNotSupport);
@@ -80073,7 +80419,7 @@ class GetServerGameDataRequestHandler extends RequestHandler {
80073
80419
  }
80074
80420
  if (requestParams.groupCount) {
80075
80421
  let groupCollection = this.gnServer.getDatabase().systemGameCollection("Group", gameId);
80076
- operationResponse.setParameter(GNParameterCode.Group, await groupCollection.countDocuments());
80422
+ operationResponse.setParameter(GNParameterCode.GroupCount, await groupCollection.countDocuments());
80077
80423
  }
80078
80424
  if (requestParams.country) {
80079
80425
  // [ { countryCode: "", regions: [{regionCode: "", "lat": 0, "lon": 0, ccu: 0}]} ]
@@ -84200,7 +84546,8 @@ class CountryIPDetailService {
84200
84546
  }
84201
84547
 
84202
84548
  ;// ./src/GNServer.ts
84203
- const GN_VERSION = "2.5";
84549
+ const GN_VERSION = "2.6";
84550
+
84204
84551
 
84205
84552
 
84206
84553
 
@@ -84586,7 +84933,6 @@ class GNServer {
84586
84933
  googlePlayGameService;
84587
84934
  gameCenterService;
84588
84935
  timerService;
84589
- lockService;
84590
84936
  requestConverterService;
84591
84937
  analyticsService;
84592
84938
  postEventCallbackService;
@@ -84612,7 +84958,6 @@ class GNServer {
84612
84958
  this.googlePlayGameService = new GooglePlayGameService();
84613
84959
  this.gameCenterService = new GameCenterService();
84614
84960
  this.timerService = new TimerService();
84615
- this.lockService = new LockService();
84616
84961
  this.requestConverterService = new RequestConverterService();
84617
84962
  this.pushNotificationService = new PushNotificationService();
84618
84963
  this.emailService = new EmailService();
@@ -85039,6 +85384,18 @@ class GNServer {
85039
85384
  tempAnalyticsService.run();
85040
85385
  this.analyticsService = tempAnalyticsService;
85041
85386
  this.postEventCallbackCollection = this.xDatabase.systemCollection("EventCallback.Post");
85387
+ this.getHttpApp().getClusterHandler().onEvent("sendEventTo", data => {
85388
+ this.executeSendEventTo(data);
85389
+ });
85390
+ this.getHttpApp().getClusterHandler().onEvent("sendEventToRoom", data => {
85391
+ this.executeSendEventToRoom(data);
85392
+ });
85393
+ this.getHttpApp().getClusterHandler().onEvent("sendEventToMoreUser", data => {
85394
+ this.executeSendEventToMoreUser(data);
85395
+ });
85396
+ this.getHttpApp().getClusterHandler().onEvent("executeSendEventToAllPlayer", data => {
85397
+ this.executeSendEventToAllPlayer(data);
85398
+ });
85042
85399
  if (onRunSuccess != null)
85043
85400
  onRunSuccess();
85044
85401
  }
@@ -85132,9 +85489,6 @@ class GNServer {
85132
85489
  getTimerService() {
85133
85490
  return this.timerService;
85134
85491
  }
85135
- getLockService() {
85136
- return this.lockService;
85137
- }
85138
85492
  getAnalyticsService() {
85139
85493
  return this.analyticsService;
85140
85494
  }
@@ -85169,7 +85523,15 @@ class GNServer {
85169
85523
  operationEvent: operationEventToData,
85170
85524
  responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
85171
85525
  });
85172
- return await this.socketApp.getSocketAppHandler().sendEventTo(userId, operationEvent);
85526
+ this.getHttpApp().getClusterHandler().sendEvent("sendEventTo", {
85527
+ userId: userId,
85528
+ operationEvent: operationEventToData,
85529
+ useMsgPack: true,
85530
+ });
85531
+ }
85532
+ executeSendEventTo(data) {
85533
+ let operationEvent = new OperationEvent(data.operationEvent.eventCode, data.operationEvent.parameters != null ? GNHashtable.builder().addAll(data.operationEvent.parameters).build() : null, data.operationEvent.encrypted);
85534
+ return this.socketApp.getSocketAppHandler().sendEventTo(data.userId, operationEvent, data.useMsgPack);
85173
85535
  }
85174
85536
  async sendEventToRoom(roomId, operationEvent) {
85175
85537
  await this.eventCallbackCloudScriptService.executeEvent("system_SendEventToRoom", { roomId: roomId }, operationEvent);
@@ -85187,7 +85549,15 @@ class GNServer {
85187
85549
  operationEvent: operationEventToData,
85188
85550
  responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
85189
85551
  });
85190
- return await this.socketApp.getSocketAppHandler().sendEventToRoom(roomId, operationEvent);
85552
+ this.getHttpApp().getClusterHandler().sendEvent("sendEventToRoom", {
85553
+ roomId: roomId,
85554
+ operationEvent: operationEventToData,
85555
+ useMsgPack: true,
85556
+ });
85557
+ }
85558
+ executeSendEventToRoom(data) {
85559
+ let operationEvent = new OperationEvent(data.operationEvent.eventCode, data.operationEvent.parameters != null ? GNHashtable.builder().addAll(data.operationEvent.parameters).build() : null, data.operationEvent.encrypted);
85560
+ return this.socketApp.getSocketAppHandler().sendEventToRoom(data.roomId, operationEvent, data.useMsgPack);
85191
85561
  }
85192
85562
  async sendEventToMoreUser(userIds, operationEvent) {
85193
85563
  await this.eventCallbackCloudScriptService.executeEvent("system_SendEventToMoreUser", { userIds: userIds }, operationEvent);
@@ -85205,7 +85575,15 @@ class GNServer {
85205
85575
  operationEvent: operationEventToData,
85206
85576
  responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8") * userIds.length,
85207
85577
  });
85208
- return await this.socketApp.getSocketAppHandler().sendEventToMoreUser(userIds, operationEvent);
85578
+ this.getHttpApp().getClusterHandler().sendEvent("sendEventToMoreUser", {
85579
+ userIds: userIds,
85580
+ operationEvent: operationEventToData,
85581
+ useMsgPack: true,
85582
+ });
85583
+ }
85584
+ executeSendEventToMoreUser(data) {
85585
+ let operationEvent = new OperationEvent(data.operationEvent.eventCode, data.operationEvent.parameters != null ? GNHashtable.builder().addAll(data.operationEvent.parameters).build() : null, data.operationEvent.encrypted);
85586
+ return this.socketApp.getSocketAppHandler().sendEventToMoreUser(data.userIds, operationEvent, data.useMsgPack);
85209
85587
  }
85210
85588
  async sendEventToAllPlayer(operationEvent) {
85211
85589
  await this.eventCallbackCloudScriptService.executeEvent("system_SendEventToAllPlayer", {}, operationEvent);
@@ -85221,16 +85599,23 @@ class GNServer {
85221
85599
  operationEvent: operationEventToData,
85222
85600
  responseSize: Buffer.byteLength(JSON.stringify(operationEventToData), "utf-8"),
85223
85601
  });
85224
- return await this.socketApp.getSocketAppHandler().sendEventToAllPlayer(operationEvent);
85602
+ this.getHttpApp().getClusterHandler().sendEvent("sendEventToAllPlayer", {
85603
+ operationEvent: operationEventToData,
85604
+ useMsgPack: true,
85605
+ });
85606
+ }
85607
+ executeSendEventToAllPlayer(data) {
85608
+ let operationEvent = new OperationEvent(data.operationEvent.eventCode, data.operationEvent.parameters != null ? GNHashtable.builder().addAll(data.operationEvent.parameters).build() : null, data.operationEvent.encrypted);
85609
+ return this.socketApp.getSocketAppHandler().sendEventToAllPlayer(operationEvent, data.useMsgPack);
85225
85610
  }
85226
85611
  // public async sendEventToNamespace(namespace: string, operationEvent: OperationEvent): Promise<void> {
85227
85612
  // return await this.socketApp.getSocketAppHandler().sendEventToNamespace(namespace, operationEvent);
85228
85613
  // }
85229
- async joinRoom(userId, roomId) {
85230
- return await this.socketApp.getSocketAppHandler().joinRoom(userId, roomId);
85614
+ joinRoom(userId, roomId) {
85615
+ return this.socketApp.getSocketAppHandler().joinRoom(userId, roomId);
85231
85616
  }
85232
- async leaveRoom(userId, roomId) {
85233
- return await this.socketApp.getSocketAppHandler().leaveRoom(userId, roomId);
85617
+ leaveRoom(userId, roomId) {
85618
+ return this.socketApp.getSocketAppHandler().leaveRoom(userId, roomId);
85234
85619
  }
85235
85620
  async getRooms(userId) {
85236
85621
  return await this.socketApp.getSocketAppHandler().getRooms(userId);
@@ -85279,7 +85664,7 @@ class GNServer {
85279
85664
  }
85280
85665
  async requestMatchServerDetail(gameId, matchmakingTicketCanMatch) {
85281
85666
  let matchId = matchmakingTicketCanMatch.matchId;
85282
- Debug.logInfo("[GN] [Matchmaking] request match server detail for " + matchId + " to set serverDetail on gameId " + gameId);
85667
+ Debug.logInfo("[GearN] [Matchmaking] request match server detail for " + matchId + " to set serverDetail on gameId " + gameId);
85283
85668
  let thiz = this;
85284
85669
  let timeout = setTimeout(async () => {
85285
85670
  thiz.setMatchServerDetailFailed(gameId, matchId, matchmakingTicketCanMatch.ticketIds, "Timeout");
@@ -85307,7 +85692,7 @@ class GNServer {
85307
85692
  clearTimeout(timeout);
85308
85693
  this.waitingServerDetailDict.delete(matchId);
85309
85694
  }
85310
- Debug.logInfo("[GN] [Matchmaking] request match server detail for " + matchId + " failed on " + gameId + ", with reason " + reason);
85695
+ Debug.logInfo("[GearN] [Matchmaking] request match server detail for " + matchId + " failed on " + gameId + ", with reason " + reason);
85311
85696
  let matchCollection = this.getDatabase().systemGameCollection("Match", gameId);
85312
85697
  matchCollection.updateOne({ matchId: matchId }, { $set: {} });
85313
85698
  let matchmakingTicketCollection = this.getDatabase().runtimeGameCollection("MatchmakingTicket", gameId);
@@ -85323,6 +85708,8 @@ class GNServer {
85323
85708
 
85324
85709
  ;// external "@xmobitea/gn-typescript-client"
85325
85710
  const gn_typescript_client_namespaceObject = require("@xmobitea/gn-typescript-client");
85711
+ ;// external "@xmobitea/gn-typescript-client/dist/runtime/config/GNServerSettings"
85712
+ const GNServerSettings_namespaceObject = require("@xmobitea/gn-typescript-client/dist/runtime/config/GNServerSettings");
85326
85713
  ;// ./src/GN-startup/ServerApplication.ts
85327
85714
 
85328
85715
 
@@ -85346,6 +85733,7 @@ const gn_typescript_client_namespaceObject = require("@xmobitea/gn-typescript-cl
85346
85733
 
85347
85734
 
85348
85735
 
85736
+
85349
85737
 
85350
85738
 
85351
85739
  class ServerApplication_BuilderBase {
@@ -85453,18 +85841,18 @@ class ServerApplication extends ServerApplication_BuilderBase {
85453
85841
  fullLogPath = process.cwd() + "/" + configFullLogPath;
85454
85842
  }
85455
85843
  }
85456
- console.log("[GN] FullLogPath at: " + fullLogPath);
85844
+ console.log("[GearN] FullLogPath at: " + fullLogPath);
85457
85845
  Debug.init({
85458
85846
  isLogToConsoleEnable: this.getLogSettings().getLogToConsoleEnable(),
85459
85847
  isLogToFileEnable: this.getLogSettings().getLogToFileEnable(),
85460
85848
  logPath: fullLogPath,
85461
85849
  });
85462
85850
  Debug.run();
85463
- Debug.log("[GN XmobiTea] -->>==>>>--<<<==<<-- [GN XmobiTea]");
85464
- const port = this.applicationSettings.getPort();
85465
- Debug.log("[GN] Try run server on the port " + port);
85466
- const socketPort = this.applicationSettings.getSocketPort();
85467
- Debug.log("[GN] Try run socket server on the port " + socketPort);
85851
+ Debug.log("[GearN XmobiTea] -->>==>>>--<<<==<<-- [GN XmobiTea]");
85852
+ const port = this.getApplicationSettings().getPort();
85853
+ Debug.log("[GearN] Try run server on the port " + port);
85854
+ const socketPort = this.getApplicationSettings().getSocketPort();
85855
+ Debug.log("[GearN] Try run socket server on the port " + socketPort);
85468
85856
  const app = external_express_default()();
85469
85857
  const server = this.getServer(app, this.getApplicationSettings());
85470
85858
  const useOtherSocketServer = this.getApplicationSettings().getPort() != this.getApplicationSettings().getSocketPort() && this.getSocketAppSettings().getEnable();
@@ -85515,9 +85903,9 @@ class ServerApplication extends ServerApplication_BuilderBase {
85515
85903
  this.gnServer.setHttpApp(this.httpApp);
85516
85904
  this.gnServer.setSocketApp(this.socketApp);
85517
85905
  this.gnServer.getDatabase().run(() => {
85518
- Debug.log("[GN] Database run success");
85906
+ Debug.log("[GearN] Database run success");
85519
85907
  }, (err) => {
85520
- Debug.logError("[GN] Database connect error " + err);
85908
+ Debug.logError("[GearN] Database connect error " + err);
85521
85909
  });
85522
85910
  let authInfoCollection = this.gnServer.getDatabase().systemCollection("AuthInfo");
85523
85911
  this.apiMiddleware.setAuthInfoCollection(authInfoCollection);
@@ -85539,7 +85927,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85539
85927
  this.socketApp.setEmitter(adapterEventCollection);
85540
85928
  // if (this.mailSettings.getEnable()) {
85541
85929
  // this.gnServer.getMail().run(() => {
85542
- // Debug.log("[GN] Send Grid Mail run success");
85930
+ // Debug.log("[GearN] Send Grid Mail run success");
85543
85931
  // });
85544
85932
  // }
85545
85933
  let uploadFileInfoCollection = this.gnServer.getDatabase().systemCollection("UploadFileInfo");
@@ -85549,7 +85937,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85549
85937
  this.uploadFileMiddleware.setUploadFileInfoCollection(uploadFileInfoCollection);
85550
85938
  this.gnServer.init();
85551
85939
  this.gnServer.run(() => {
85552
- Debug.log("[GN] Game Application run success");
85940
+ Debug.log("[GearN] Game Application run success");
85553
85941
  });
85554
85942
  let secretInfoResults = await secretInfoCollection.find({ isDefault: true }).toArray();
85555
85943
  let secretInfo = secretInfoResults.at(0);
@@ -85561,11 +85949,11 @@ class ServerApplication extends ServerApplication_BuilderBase {
85561
85949
  useSsl: false,
85562
85950
  useSocket: false,
85563
85951
  useHttp: true,
85564
- sendRate: 20,
85952
+ messageType: GNServerSettings_namespaceObject.MessageType.MsgPack,
85953
+ sendRate: 2000,
85565
85954
  reconnectDelay: 5000,
85566
85955
  pingInterval: 20000,
85567
85956
  pingTimeout: 20000,
85568
- gnServerSourcePath: "",
85569
85957
  logType: gn_typescript_client_namespaceObject.LogType.Off,
85570
85958
  adminSecretKey: secretKey,
85571
85959
  serverSecretKey: secretKey,
@@ -85589,12 +85977,12 @@ class ServerApplication extends ServerApplication_BuilderBase {
85589
85977
  this.gnServer.getPostEventCallbackService().setEventCallbackCollection(postEventCallbackCollection);
85590
85978
  this.gnServer.getPostEventCallbackService().setCloudScriptService(this.gnServer.getEventCallbackCloudScriptService());
85591
85979
  this.gnServer.getPreEventCallbackService().setCloudScriptService(this.gnServer.getEventCallbackCloudScriptService());
85592
- server.listen(port, () => {
85593
- Debug.log("[GN XmobiTea] -->>==>>>--<<<==<<-- [GN XmobiTea]");
85594
- Debug.log("[GN] Server Application running on the port " + port + " with id: " + this.sessionId);
85980
+ server.listen(port, "0.0.0.0", () => {
85981
+ Debug.log("[GearN XmobiTea] -->>==>>>--<<<==<<-- [GearN XmobiTea]");
85982
+ Debug.log("[GearN] Server Application running on 0.0.0.0 the port " + port + " with sessionId: " + this.sessionId);
85595
85983
  if (useOtherSocketServer) {
85596
- socketServer.listen(socketPort, () => {
85597
- Debug.log("[GN] Socket Server running on the port " + socketPort);
85984
+ socketServer.listen(socketPort, "0.0.0.0", () => {
85985
+ Debug.log("[GearN] Socket Server running on 0.0.0.0 the port " + socketPort);
85598
85986
  });
85599
85987
  }
85600
85988
  if (onRunSuccess != null)
@@ -85645,132 +86033,120 @@ class ServerApplication extends ServerApplication_BuilderBase {
85645
86033
  }
85646
86034
  let userId = StringUtility.generateRandomString(10, 0);
85647
86035
  {
85648
- let permission = GrantSecretInfoRequestHandler.generateRecommendAdminPermission();
85649
- {
85650
- permission.masterAdmin.setMasterGameSettings = {
85651
- selfEnable: false,
85652
- adminSelfEnable: false,
85653
- otherSelfEnable: false,
85654
- serverSelfEnable: false,
85655
- };
85656
- permission.masterAdmin.grantAdminAccount = {
85657
- selfEnable: false,
85658
- adminSelfEnable: false,
85659
- otherSelfEnable: false,
85660
- serverSelfEnable: false,
85661
- };
85662
- permission.masterAdmin.removeAdminAccount = {
85663
- selfEnable: false,
85664
- adminSelfEnable: false,
85665
- otherSelfEnable: false,
85666
- serverSelfEnable: false,
85667
- };
85668
- permission.masterAdmin.setPasswordAdminAccount = {
85669
- selfEnable: false,
85670
- adminSelfEnable: false,
85671
- otherSelfEnable: false,
85672
- serverSelfEnable: false,
85673
- };
85674
- permission.masterAdmin.setSecretKeyAdminAccount = {
85675
- selfEnable: false,
85676
- adminSelfEnable: false,
85677
- otherSelfEnable: false,
85678
- serverSelfEnable: false,
85679
- };
85680
- permission.masterAdmin.setGameInformation = {
85681
- selfEnable: false,
85682
- adminSelfEnable: false,
85683
- otherSelfEnable: false,
85684
- serverSelfEnable: false,
85685
- };
85686
- permission.masterAdmin.grantGame = {
85687
- selfEnable: false,
85688
- adminSelfEnable: false,
85689
- otherSelfEnable: false,
85690
- serverSelfEnable: false,
85691
- };
85692
- permission.masterAdmin.changePasswordAdminAccount = {
85693
- selfEnable: false,
85694
- adminSelfEnable: false,
85695
- otherSelfEnable: false,
85696
- serverSelfEnable: false,
85697
- };
85698
- permission.masterAdmin.getAdminAccountList = {
85699
- selfEnable: false,
85700
- adminSelfEnable: false,
85701
- otherSelfEnable: false,
85702
- serverSelfEnable: false,
85703
- };
85704
- permission.masterAdmin.getGameInformation = {
85705
- selfEnable: false,
85706
- adminSelfEnable: false,
85707
- otherSelfEnable: false,
85708
- serverSelfEnable: false,
85709
- };
85710
- permission.masterAdmin.getGameList = {
85711
- selfEnable: false,
85712
- adminSelfEnable: false,
85713
- otherSelfEnable: false,
85714
- serverSelfEnable: false,
85715
- };
85716
- permission.masterAdmin.getMasterGameSettings = {
85717
- selfEnable: false,
85718
- adminSelfEnable: false,
85719
- otherSelfEnable: false,
85720
- serverSelfEnable: false,
85721
- };
85722
- permission.masterAdmin.getSecretInfoInformation = {
85723
- selfEnable: false,
85724
- adminSelfEnable: false,
85725
- otherSelfEnable: false,
85726
- serverSelfEnable: false,
85727
- };
85728
- permission.masterAdmin.getSecretInfoList = {
85729
- selfEnable: false,
85730
- adminSelfEnable: false,
85731
- otherSelfEnable: false,
85732
- serverSelfEnable: false,
85733
- };
85734
- permission.masterAdmin.grantSecretInfo = {
85735
- selfEnable: false,
85736
- adminSelfEnable: false,
85737
- otherSelfEnable: false,
85738
- serverSelfEnable: false,
85739
- };
85740
- permission.masterAdmin.setSecretInfoInformation = {
85741
- selfEnable: false,
85742
- adminSelfEnable: false,
85743
- otherSelfEnable: false,
85744
- serverSelfEnable: false,
85745
- };
85746
- permission.masterAdmin.getEventCallbackCloudScript = {
85747
- selfEnable: false,
85748
- adminSelfEnable: false,
85749
- otherSelfEnable: false,
85750
- serverSelfEnable: false,
85751
- };
85752
- permission.masterAdmin.setEventCallbackCloudScript = {
85753
- selfEnable: false,
85754
- adminSelfEnable: false,
85755
- otherSelfEnable: false,
85756
- serverSelfEnable: false,
85757
- };
85758
- }
85759
- {
85760
- let newSecretInfo = SecretInfo.Builder()
85761
- .setGameId("")
85762
- .setIsRemove(false)
85763
- .setPermission(permission)
85764
- .setRole(SecretRole.Admin)
85765
- .setSecretKey(StringUtility.generateRandomString(20, 0))
85766
- .setTsExpire(-1)
85767
- .setIsDefault(true)
85768
- .build();
85769
- await this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
85770
- }
85771
86036
  let currentMilliseconds = xDatetime.getCurrentMilliseconds();
85772
86037
  // create secretInfo for admin account
85773
86038
  {
86039
+ let permission = GrantSecretInfoRequestHandler.generateRecommendAdminPermission();
86040
+ {
86041
+ permission.masterAdmin.setMasterGameSettings = {
86042
+ selfEnable: false,
86043
+ adminSelfEnable: false,
86044
+ otherSelfEnable: false,
86045
+ serverSelfEnable: false,
86046
+ };
86047
+ permission.masterAdmin.grantAdminAccount = {
86048
+ selfEnable: false,
86049
+ adminSelfEnable: false,
86050
+ otherSelfEnable: false,
86051
+ serverSelfEnable: false,
86052
+ };
86053
+ permission.masterAdmin.removeAdminAccount = {
86054
+ selfEnable: false,
86055
+ adminSelfEnable: false,
86056
+ otherSelfEnable: false,
86057
+ serverSelfEnable: false,
86058
+ };
86059
+ permission.masterAdmin.setPasswordAdminAccount = {
86060
+ selfEnable: false,
86061
+ adminSelfEnable: false,
86062
+ otherSelfEnable: false,
86063
+ serverSelfEnable: false,
86064
+ };
86065
+ permission.masterAdmin.setSecretKeyAdminAccount = {
86066
+ selfEnable: false,
86067
+ adminSelfEnable: false,
86068
+ otherSelfEnable: false,
86069
+ serverSelfEnable: false,
86070
+ };
86071
+ permission.masterAdmin.setGameInformation = {
86072
+ selfEnable: false,
86073
+ adminSelfEnable: false,
86074
+ otherSelfEnable: false,
86075
+ serverSelfEnable: false,
86076
+ };
86077
+ permission.masterAdmin.grantGame = {
86078
+ selfEnable: false,
86079
+ adminSelfEnable: false,
86080
+ otherSelfEnable: false,
86081
+ serverSelfEnable: false,
86082
+ };
86083
+ permission.masterAdmin.changePasswordAdminAccount = {
86084
+ selfEnable: false,
86085
+ adminSelfEnable: false,
86086
+ otherSelfEnable: false,
86087
+ serverSelfEnable: false,
86088
+ };
86089
+ permission.masterAdmin.getAdminAccountList = {
86090
+ selfEnable: false,
86091
+ adminSelfEnable: false,
86092
+ otherSelfEnable: false,
86093
+ serverSelfEnable: false,
86094
+ };
86095
+ permission.masterAdmin.getGameInformation = {
86096
+ selfEnable: false,
86097
+ adminSelfEnable: false,
86098
+ otherSelfEnable: false,
86099
+ serverSelfEnable: false,
86100
+ };
86101
+ permission.masterAdmin.getGameList = {
86102
+ selfEnable: false,
86103
+ adminSelfEnable: false,
86104
+ otherSelfEnable: false,
86105
+ serverSelfEnable: false,
86106
+ };
86107
+ permission.masterAdmin.getMasterGameSettings = {
86108
+ selfEnable: false,
86109
+ adminSelfEnable: false,
86110
+ otherSelfEnable: false,
86111
+ serverSelfEnable: false,
86112
+ };
86113
+ permission.masterAdmin.getSecretInfoInformation = {
86114
+ selfEnable: false,
86115
+ adminSelfEnable: false,
86116
+ otherSelfEnable: false,
86117
+ serverSelfEnable: false,
86118
+ };
86119
+ permission.masterAdmin.getSecretInfoList = {
86120
+ selfEnable: false,
86121
+ adminSelfEnable: false,
86122
+ otherSelfEnable: false,
86123
+ serverSelfEnable: false,
86124
+ };
86125
+ permission.masterAdmin.grantSecretInfo = {
86126
+ selfEnable: false,
86127
+ adminSelfEnable: false,
86128
+ otherSelfEnable: false,
86129
+ serverSelfEnable: false,
86130
+ };
86131
+ permission.masterAdmin.setSecretInfoInformation = {
86132
+ selfEnable: false,
86133
+ adminSelfEnable: false,
86134
+ otherSelfEnable: false,
86135
+ serverSelfEnable: false,
86136
+ };
86137
+ permission.masterAdmin.getEventCallbackCloudScript = {
86138
+ selfEnable: false,
86139
+ adminSelfEnable: false,
86140
+ otherSelfEnable: false,
86141
+ serverSelfEnable: false,
86142
+ };
86143
+ permission.masterAdmin.setEventCallbackCloudScript = {
86144
+ selfEnable: false,
86145
+ adminSelfEnable: false,
86146
+ otherSelfEnable: false,
86147
+ serverSelfEnable: false,
86148
+ };
86149
+ }
85774
86150
  let adminPermission = structuredClone(permission);
85775
86151
  // adminPermission.masterAdmin.grantAdminAccount.selfEnable = false;
85776
86152
  // adminPermission.masterAdmin.removeAdminAccount.selfEnable = false;
@@ -85786,6 +86162,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85786
86162
  creatorId: userId,
85787
86163
  remove: false,
85788
86164
  tsExpire: -1,
86165
+ displayName: "default recommend sub admin secret info",
85789
86166
  tsCreate: currentMilliseconds,
85790
86167
  };
85791
86168
  await masterAdminCollection.insertOne(result);
@@ -85797,6 +86174,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85797
86174
  .setRole(secretInfoItem.getRole())
85798
86175
  .setSecretKey(secretInfoItem.getSecretKey())
85799
86176
  .setTsExpire(secretInfoItem.getTsExpire())
86177
+ .setDisplayName(secretInfoItem.getDisplayName())
85800
86178
  .build();
85801
86179
  this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
85802
86180
  }
@@ -85812,6 +86190,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85812
86190
  creatorId: userId,
85813
86191
  remove: false,
85814
86192
  tsExpire: -1,
86193
+ displayName: "default recommend player secret info for gameId dev",
85815
86194
  tsCreate: currentMilliseconds,
85816
86195
  };
85817
86196
  await masterAdminCollection.insertOne(result);
@@ -85823,6 +86202,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85823
86202
  .setRole(secretInfoItem.getRole())
85824
86203
  .setSecretKey(secretInfoItem.getSecretKey())
85825
86204
  .setTsExpire(secretInfoItem.getTsExpire())
86205
+ .setDisplayName(secretInfoItem.getDisplayName())
85826
86206
  .build();
85827
86207
  this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
85828
86208
  }
@@ -85836,6 +86216,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85836
86216
  creatorId: userId,
85837
86217
  remove: false,
85838
86218
  tsExpire: -1,
86219
+ displayName: "default recommend player secret info for gameId main",
85839
86220
  tsCreate: currentMilliseconds,
85840
86221
  };
85841
86222
  await masterAdminCollection.insertOne(result);
@@ -85847,16 +86228,17 @@ class ServerApplication extends ServerApplication_BuilderBase {
85847
86228
  .setRole(secretInfoItem.getRole())
85848
86229
  .setSecretKey(secretInfoItem.getSecretKey())
85849
86230
  .setTsExpire(secretInfoItem.getTsExpire())
86231
+ .setDisplayName(secretInfoItem.getDisplayName())
85850
86232
  .build();
85851
86233
  this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
85852
86234
  }
85853
86235
  }
85854
- let password = process.env["defaultPassword"] ?? "gnpassword";
85855
- let username = process.env["defaultUsername"] ?? "gnadmin";
86236
+ let username = process.env["GEARN_INIT_ROOT_USERNAME"] ?? "gearnadmin";
86237
+ let password = process.env["GEARN_INIT_ROOT_PASSWORD"] ?? "gearnpassword";
85856
86238
  // create secretInfo for admin account
85857
86239
  {
85858
86240
  let permission = GrantSecretInfoRequestHandler.generateDefaultPermission(true, true, true, true);
85859
- let secretKey = "admin_" + StringUtility.generateRandomString(14, 0);
86241
+ let secretKey = StringUtility.generateRandomString(20, 0);
85860
86242
  let newSecretInfo = SecretInfo.Builder()
85861
86243
  .setGameId("")
85862
86244
  .setIsRemove(false)
@@ -85864,6 +86246,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
85864
86246
  .setRole(SecretRole.Admin)
85865
86247
  .setSecretKey(secretKey)
85866
86248
  .setTsExpire(-1)
86249
+ .setDisplayName("default root admin secret info")
85867
86250
  .setIsDefault(true)
85868
86251
  .setIsOnlyMasterAdmin(true)
85869
86252
  .build();
@@ -86586,7 +86969,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
86586
86969
  }
86587
86970
  {
86588
86971
  let emailSettings = masterGameSettings.getEmailSettings();
86589
- this.gnServer.getEmailService().init(emailSettings.sendGridApiKey, emailSettings.sendFrom);
86972
+ this.gnServer.getEmailService().init(emailSettings.host, emailSettings.port, emailSettings.secure, emailSettings.username, emailSettings.password, emailSettings.sendFrom);
86590
86973
  this.gnServer.getEmailService().run();
86591
86974
  }
86592
86975
  {
@@ -87285,8 +87668,6 @@ group_model_GroupMemberParam_decorate([
87285
87668
 
87286
87669
 
87287
87670
 
87288
-
87289
-
87290
87671
 
87291
87672
 
87292
87673