@xmobitea/gn-server 2.6.2 → 2.6.4
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.
- package/dist/GN-app-api/service/EventCallbackService.d.ts +18 -0
- package/dist/GN-app-api/service/IEventCallbackService.d.ts +6 -0
- package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +5 -0
- package/dist/GN-startup/cloudScript/templateEventCallback.ts +401 -307
- package/dist/index.js +264 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2966,6 +2966,96 @@ class EventCallbackCloudScriptService {
|
|
|
2966
2966
|
}
|
|
2967
2967
|
return null;
|
|
2968
2968
|
}
|
|
2969
|
+
async executeAuthenticate(eventName, request, secretInfo, operationRequest, operationResponse) {
|
|
2970
|
+
let cloudFunction = this.cloudScriptFunctionDict.get("system");
|
|
2971
|
+
if (cloudFunction == null) {
|
|
2972
|
+
return;
|
|
2973
|
+
}
|
|
2974
|
+
let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(cloudFunction.type, eventName);
|
|
2975
|
+
if (cloudScriptWorker == null) {
|
|
2976
|
+
Debug.logError("[GearN] [SystemEventCallback] worker not found at " + cloudFunction.type);
|
|
2977
|
+
return;
|
|
2978
|
+
}
|
|
2979
|
+
let requestId = StringUtility.generateRandomString(10, 0);
|
|
2980
|
+
let finalSecretInfo = null;
|
|
2981
|
+
if (secretInfo) {
|
|
2982
|
+
finalSecretInfo = {
|
|
2983
|
+
gameId: secretInfo.getGameId(),
|
|
2984
|
+
isDefault: secretInfo.getIsDefault(),
|
|
2985
|
+
onlyMasterAdmin: secretInfo.getIsOnlyMasterAdmin(),
|
|
2986
|
+
permission: secretInfo.getPermission(),
|
|
2987
|
+
remove: secretInfo.isRemove(),
|
|
2988
|
+
role: secretInfo.getRole(),
|
|
2989
|
+
secretKey: secretInfo.getSecretKey(),
|
|
2990
|
+
tsExpire: secretInfo.getTsExpire(),
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
let cloudScriptRequest = {
|
|
2994
|
+
requestId: requestId,
|
|
2995
|
+
eventName: eventName,
|
|
2996
|
+
eventType: EventCallbackType.System,
|
|
2997
|
+
operationRequest: {
|
|
2998
|
+
operationCode: operationRequest.getOperationCode(),
|
|
2999
|
+
encrypted: operationRequest.isEncrypted(),
|
|
3000
|
+
parameters: operationRequest.getParameters()?.toData(),
|
|
3001
|
+
requestId: operationRequest.getRequestId(),
|
|
3002
|
+
},
|
|
3003
|
+
operationResponse: {
|
|
3004
|
+
debugMessage: operationResponse.getDebugMessage(),
|
|
3005
|
+
encrypted: operationResponse.isEncrypted(),
|
|
3006
|
+
parameters: operationResponse.getParameters()?.toData(),
|
|
3007
|
+
returnCode: operationResponse.getReturnCode(),
|
|
3008
|
+
},
|
|
3009
|
+
request: request,
|
|
3010
|
+
secretInfo: finalSecretInfo,
|
|
3011
|
+
};
|
|
3012
|
+
cloudScriptWorker.send(cloudScriptRequest);
|
|
3013
|
+
let thiz = this;
|
|
3014
|
+
let isResolved = false;
|
|
3015
|
+
let cloudScriptResponse = await new Promise((resolve) => {
|
|
3016
|
+
let timeout = setTimeout(() => {
|
|
3017
|
+
if (isResolved)
|
|
3018
|
+
return;
|
|
3019
|
+
isResolved = true;
|
|
3020
|
+
resolve({
|
|
3021
|
+
responseId: requestId,
|
|
3022
|
+
response: {
|
|
3023
|
+
status: ExecuteResponseStatus.Timeout,
|
|
3024
|
+
errorMessage: "function execute timeout",
|
|
3025
|
+
result: null,
|
|
3026
|
+
request: null,
|
|
3027
|
+
},
|
|
3028
|
+
stats: null,
|
|
3029
|
+
logs: [],
|
|
3030
|
+
});
|
|
3031
|
+
}, EventCallbackCloudScriptService.ExecuteTimeoutInMs);
|
|
3032
|
+
thiz.cloudScriptWaitingResponseCallbackDict.set(requestId, (cloudScriptResponse) => {
|
|
3033
|
+
if (isResolved)
|
|
3034
|
+
return;
|
|
3035
|
+
isResolved = true;
|
|
3036
|
+
clearTimeout(timeout);
|
|
3037
|
+
resolve(cloudScriptResponse);
|
|
3038
|
+
});
|
|
3039
|
+
});
|
|
3040
|
+
this.cloudScriptWaitingResponseCallbackDict.delete(requestId);
|
|
3041
|
+
if (cloudScriptResponse.logs.length != 0)
|
|
3042
|
+
Debug.log(JSON.stringify(cloudScriptResponse.logs));
|
|
3043
|
+
if (cloudScriptResponse.response.status == ExecuteResponseStatus.Ok) {
|
|
3044
|
+
if (cloudScriptResponse.response.result) {
|
|
3045
|
+
let responseOperationResponse = cloudScriptResponse.response.result;
|
|
3046
|
+
operationResponse.setReturnCode(responseOperationResponse.returnCode);
|
|
3047
|
+
operationResponse.setDebugMessage(responseOperationResponse.debugMessage);
|
|
3048
|
+
operationResponse.setEncrypted(responseOperationResponse.encrypted);
|
|
3049
|
+
if (responseOperationResponse.parameters)
|
|
3050
|
+
operationResponse.setParameters(GNHashtable.builder().addAll(responseOperationResponse.parameters).build());
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
else if (cloudScriptResponse.response.status == ExecuteResponseStatus.FunctionNameNotFound) {
|
|
3054
|
+
}
|
|
3055
|
+
else {
|
|
3056
|
+
operationResponse.setParameter(GNParameterCode.Message, cloudScriptResponse.response.errorMessage);
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
2969
3059
|
async executePost(eventName, request, secretInfo, operationRequest, operationResponse) {
|
|
2970
3060
|
let cloudScriptWorker = this.loadCloudScriptFunctionWorkerFromCache(eventName.split("_")[0], eventName);
|
|
2971
3061
|
if (cloudScriptWorker == null) {
|
|
@@ -3297,9 +3387,6 @@ class PostEventCallbackService {
|
|
|
3297
3387
|
this.cloudScriptService = cloudScriptService;
|
|
3298
3388
|
}
|
|
3299
3389
|
async onEvent(eventName, request, secretInfo, operationRequest, operationResponse) {
|
|
3300
|
-
if (this.cloudScriptService) {
|
|
3301
|
-
this.cloudScriptService.executePost(eventName, request, secretInfo, operationRequest, operationResponse);
|
|
3302
|
-
}
|
|
3303
3390
|
let operationResponseToData = OperationHelper.toDataOperationResponse(operationResponse);
|
|
3304
3391
|
this.eventCallbackCollection.insertOne({
|
|
3305
3392
|
eventName: eventName,
|
|
@@ -3311,6 +3398,9 @@ class PostEventCallbackService {
|
|
|
3311
3398
|
customTags: operationRequest.getParameters().getGNHashtable("CustomTags"),
|
|
3312
3399
|
responseSize: Buffer.byteLength(JSON.stringify(operationResponseToData), "utf-8"),
|
|
3313
3400
|
});
|
|
3401
|
+
if (this.cloudScriptService) {
|
|
3402
|
+
await this.cloudScriptService.executePost(eventName, request, secretInfo, operationRequest, operationResponse);
|
|
3403
|
+
}
|
|
3314
3404
|
if (!this.eventLstDict.has(eventName)) {
|
|
3315
3405
|
return;
|
|
3316
3406
|
}
|
|
@@ -3324,6 +3414,11 @@ class PostEventCallbackService {
|
|
|
3324
3414
|
}
|
|
3325
3415
|
}
|
|
3326
3416
|
}
|
|
3417
|
+
async onAuthenticateEvent(eventName, request, secretInfo, operationRequest, operationResponse) {
|
|
3418
|
+
if (this.cloudScriptService) {
|
|
3419
|
+
await this.cloudScriptService.executeAuthenticate(eventName, request, secretInfo, operationRequest, operationResponse);
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3327
3422
|
}
|
|
3328
3423
|
class PreEventCallbackService {
|
|
3329
3424
|
eventDict;
|
|
@@ -17918,6 +18013,12 @@ class LoginByAccountRequestHandler extends LoginBaseRequestHandler {
|
|
|
17918
18013
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
17919
18014
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
17920
18015
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18016
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18017
|
+
authenticationType: "LoginByAccount",
|
|
18018
|
+
userId: masterPlayer.getUserId(),
|
|
18019
|
+
ipAddress: request.ipAddress,
|
|
18020
|
+
isNewUser: false,
|
|
18021
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
17921
18022
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByAccount", request, secretInfo, operationRequest, operationResponse);
|
|
17922
18023
|
return operationResponse;
|
|
17923
18024
|
}
|
|
@@ -18044,6 +18145,12 @@ class LoginByAndroidDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
18044
18145
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18045
18146
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18046
18147
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18148
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18149
|
+
authenticationType: "LoginByAndroidDeviceId",
|
|
18150
|
+
userId: masterPlayer.getUserId(),
|
|
18151
|
+
ipAddress: request.ipAddress,
|
|
18152
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18153
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18047
18154
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByAndroidDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
18048
18155
|
return operationResponse;
|
|
18049
18156
|
}
|
|
@@ -18181,6 +18288,12 @@ class LoginByAppleRequestHandler extends LoginBaseRequestHandler {
|
|
|
18181
18288
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18182
18289
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18183
18290
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18291
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18292
|
+
authenticationType: "LoginByApple",
|
|
18293
|
+
userId: masterPlayer.getUserId(),
|
|
18294
|
+
ipAddress: request.ipAddress,
|
|
18295
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18296
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18184
18297
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByApple", request, secretInfo, operationRequest, operationResponse);
|
|
18185
18298
|
return operationResponse;
|
|
18186
18299
|
}
|
|
@@ -18307,6 +18420,12 @@ class LoginByCustomDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
18307
18420
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18308
18421
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18309
18422
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18423
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18424
|
+
authenticationType: "LoginByCustomDeviceId",
|
|
18425
|
+
userId: masterPlayer.getUserId(),
|
|
18426
|
+
ipAddress: request.ipAddress,
|
|
18427
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18428
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18310
18429
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByCustomDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
18311
18430
|
return operationResponse;
|
|
18312
18431
|
}
|
|
@@ -18433,6 +18552,12 @@ class LoginByCustomIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
18433
18552
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18434
18553
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18435
18554
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18555
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18556
|
+
authenticationType: "LoginByCustomId",
|
|
18557
|
+
userId: masterPlayer.getUserId(),
|
|
18558
|
+
ipAddress: request.ipAddress,
|
|
18559
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18560
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18436
18561
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByCustomId", request, secretInfo, operationRequest, operationResponse);
|
|
18437
18562
|
return operationResponse;
|
|
18438
18563
|
}
|
|
@@ -18573,6 +18698,12 @@ class LoginByFacebookRequestHandler extends LoginBaseRequestHandler {
|
|
|
18573
18698
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18574
18699
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18575
18700
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18701
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18702
|
+
authenticationType: "LoginByFacebook",
|
|
18703
|
+
userId: masterPlayer.getUserId(),
|
|
18704
|
+
ipAddress: request.ipAddress,
|
|
18705
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18706
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18576
18707
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByFacebook", request, secretInfo, operationRequest, operationResponse);
|
|
18577
18708
|
return operationResponse;
|
|
18578
18709
|
}
|
|
@@ -18730,6 +18861,12 @@ class LoginByGenericServiceRequestHandler extends LoginBaseRequestHandler {
|
|
|
18730
18861
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18731
18862
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18732
18863
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
18864
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
18865
|
+
authenticationType: "LoginByGenericService",
|
|
18866
|
+
userId: masterPlayer.getUserId(),
|
|
18867
|
+
ipAddress: request.ipAddress,
|
|
18868
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
18869
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18733
18870
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByGenericService", request, secretInfo, operationRequest, operationResponse);
|
|
18734
18871
|
return operationResponse;
|
|
18735
18872
|
}
|
|
@@ -18877,6 +19014,12 @@ class LoginByGoogleRequestHandler extends LoginBaseRequestHandler {
|
|
|
18877
19014
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
18878
19015
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
18879
19016
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19017
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19018
|
+
authenticationType: "LoginByGoogle",
|
|
19019
|
+
userId: masterPlayer.getUserId(),
|
|
19020
|
+
ipAddress: request.ipAddress,
|
|
19021
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19022
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
18880
19023
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByGoogle", request, secretInfo, operationRequest, operationResponse);
|
|
18881
19024
|
return operationResponse;
|
|
18882
19025
|
}
|
|
@@ -19017,6 +19160,12 @@ class LoginByGooglePlayGameServiceRequestHandler extends LoginBaseRequestHandler
|
|
|
19017
19160
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19018
19161
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19019
19162
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19163
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19164
|
+
authenticationType: "LoginByGooglePlayGameService",
|
|
19165
|
+
userId: masterPlayer.getUserId(),
|
|
19166
|
+
ipAddress: request.ipAddress,
|
|
19167
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19168
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19020
19169
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByGooglePlayGameService", request, secretInfo, operationRequest, operationResponse);
|
|
19021
19170
|
return operationResponse;
|
|
19022
19171
|
}
|
|
@@ -19194,6 +19343,12 @@ class LoginByGameCenterRequestHandler extends LoginBaseRequestHandler {
|
|
|
19194
19343
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19195
19344
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19196
19345
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19346
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19347
|
+
authenticationType: "LoginByGameCenter",
|
|
19348
|
+
userId: masterPlayer.getUserId(),
|
|
19349
|
+
ipAddress: request.ipAddress,
|
|
19350
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19351
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19197
19352
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByGameCenter", request, secretInfo, operationRequest, operationResponse);
|
|
19198
19353
|
return operationResponse;
|
|
19199
19354
|
}
|
|
@@ -19320,6 +19475,12 @@ class LoginByiOSDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
19320
19475
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19321
19476
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19322
19477
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19478
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19479
|
+
authenticationType: "LoginByiOSDeviceId",
|
|
19480
|
+
userId: masterPlayer.getUserId(),
|
|
19481
|
+
ipAddress: request.ipAddress,
|
|
19482
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19483
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19323
19484
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByiOSDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
19324
19485
|
return operationResponse;
|
|
19325
19486
|
}
|
|
@@ -19446,6 +19607,12 @@ class LoginByWindowsPhoneDeviceIdRequestHandler extends LoginBaseRequestHandler
|
|
|
19446
19607
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19447
19608
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19448
19609
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19610
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19611
|
+
authenticationType: "LoginByWindowsPhoneDeviceId",
|
|
19612
|
+
userId: masterPlayer.getUserId(),
|
|
19613
|
+
ipAddress: request.ipAddress,
|
|
19614
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19615
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19449
19616
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByWindowsPhoneDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
19450
19617
|
return operationResponse;
|
|
19451
19618
|
}
|
|
@@ -19555,6 +19722,12 @@ class RegisterAccountRequestHandler extends LoginBaseRequestHandler {
|
|
|
19555
19722
|
masterPlayer.setTsLastLogin(xDatetime.getCurrentMilliseconds());
|
|
19556
19723
|
masterPlayer.saveAsync();
|
|
19557
19724
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19725
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19726
|
+
authenticationType: "RegisterAccount",
|
|
19727
|
+
userId: masterPlayer.getUserId(),
|
|
19728
|
+
ipAddress: request.ipAddress,
|
|
19729
|
+
isNewUser: true,
|
|
19730
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19558
19731
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_RegisterAccount", request, secretInfo, operationRequest, operationResponse);
|
|
19559
19732
|
return operationResponse;
|
|
19560
19733
|
}
|
|
@@ -19681,6 +19854,12 @@ class LoginByEditorDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
19681
19854
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19682
19855
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19683
19856
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19857
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19858
|
+
authenticationType: "LoginByEditorDeviceId",
|
|
19859
|
+
userId: masterPlayer.getUserId(),
|
|
19860
|
+
ipAddress: request.ipAddress,
|
|
19861
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19862
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19684
19863
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByEditorDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
19685
19864
|
return operationResponse;
|
|
19686
19865
|
}
|
|
@@ -19807,6 +19986,12 @@ class LoginByLinuxDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
19807
19986
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19808
19987
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19809
19988
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
19989
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
19990
|
+
authenticationType: "LoginByLinuxDeviceId",
|
|
19991
|
+
userId: masterPlayer.getUserId(),
|
|
19992
|
+
ipAddress: request.ipAddress,
|
|
19993
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
19994
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19810
19995
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByLinuxDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
19811
19996
|
return operationResponse;
|
|
19812
19997
|
}
|
|
@@ -19933,6 +20118,12 @@ class LoginByMacOSDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
19933
20118
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
19934
20119
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
19935
20120
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
20121
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
20122
|
+
authenticationType: "LoginByMacOSDeviceId",
|
|
20123
|
+
userId: masterPlayer.getUserId(),
|
|
20124
|
+
ipAddress: request.ipAddress,
|
|
20125
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
20126
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
19936
20127
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByMacOSDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
19937
20128
|
return operationResponse;
|
|
19938
20129
|
}
|
|
@@ -20059,6 +20250,12 @@ class LoginByWindowsDeviceIdRequestHandler extends LoginBaseRequestHandler {
|
|
|
20059
20250
|
operationResponse.setParameter(GNParameterCode.UserId, masterPlayer.getUserId());
|
|
20060
20251
|
operationResponse.setParameter(GNParameterCode.InfoResponseParameters, this.generateInfoResponseParameters(masterPlayer, request.infoRequestParam));
|
|
20061
20252
|
this.setupAuthInfo(operationResponse, masterPlayer, secretInfo);
|
|
20253
|
+
await this.gnServer.getPostEventCallbackService().onAuthenticateEvent("system_OnAuthenticateSuccess", {
|
|
20254
|
+
authenticationType: "LoginByWindowsDeviceId",
|
|
20255
|
+
userId: masterPlayer.getUserId(),
|
|
20256
|
+
ipAddress: request.ipAddress,
|
|
20257
|
+
isNewUser: operationResponse.getParameters().getBoolean(GNParameterCode.NewlyCreated, false),
|
|
20258
|
+
}, secretInfo, operationRequest, operationResponse);
|
|
20062
20259
|
await this.gnServer.getPostEventCallbackService().onEvent("authenticate_LoginByWindowsDeviceId", request, secretInfo, operationRequest, operationResponse);
|
|
20063
20260
|
return operationResponse;
|
|
20064
20261
|
}
|
|
@@ -86017,7 +86214,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86017
86214
|
}
|
|
86018
86215
|
}
|
|
86019
86216
|
async setupNewGNDatabase() {
|
|
86020
|
-
Debug.log("The GN Server is installing some information
|
|
86217
|
+
Debug.log("The GN Server is installing some new information on Database...");
|
|
86021
86218
|
//let currentMilliseconds = xDatetime.getCurrentMilliseconds();
|
|
86022
86219
|
let masterAdminCollection = this.gnServer.getDatabase().systemCollection("MasterAdmin");
|
|
86023
86220
|
{
|
|
@@ -86028,6 +86225,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86028
86225
|
// create version
|
|
86029
86226
|
await masterAdminCollection.insertOne({ type: "version", gnVersion: GNServer.getServerVersion() });
|
|
86030
86227
|
}
|
|
86228
|
+
Debug.log("create some indexes on System.MasterAdmin success.");
|
|
86031
86229
|
let userId = StringUtility.generateRandomString(10, 0);
|
|
86032
86230
|
{
|
|
86033
86231
|
let currentMilliseconds = xDatetime.getCurrentMilliseconds();
|
|
@@ -86174,6 +86372,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86174
86372
|
.setDisplayName(secretInfoItem.getDisplayName())
|
|
86175
86373
|
.build();
|
|
86176
86374
|
this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
|
|
86375
|
+
Debug.log("create SecretInfo Permission for sub admin success.");
|
|
86177
86376
|
}
|
|
86178
86377
|
{
|
|
86179
86378
|
let permission = GrantSecretInfoRequestHandler.generateRecommendPlayerPermission();
|
|
@@ -86202,6 +86401,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86202
86401
|
.setDisplayName(secretInfoItem.getDisplayName())
|
|
86203
86402
|
.build();
|
|
86204
86403
|
this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
|
|
86404
|
+
Debug.log("create SecretInfo Permission for player gameId dev success.");
|
|
86205
86405
|
}
|
|
86206
86406
|
{
|
|
86207
86407
|
let result = {
|
|
@@ -86228,6 +86428,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86228
86428
|
.setDisplayName(secretInfoItem.getDisplayName())
|
|
86229
86429
|
.build();
|
|
86230
86430
|
this.gnServer.getApiMiddleware().updateSecretInfo(newSecretInfo);
|
|
86431
|
+
Debug.log("create SecretInfo Permission for player gameId main success.");
|
|
86231
86432
|
}
|
|
86232
86433
|
}
|
|
86233
86434
|
let username = process.env["GEARN_INIT_ROOT_USERNAME"] ?? "gearnadmin";
|
|
@@ -86257,7 +86458,9 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86257
86458
|
secretKey: secretKey,
|
|
86258
86459
|
};
|
|
86259
86460
|
await masterAdminCollection.insertOne(result);
|
|
86461
|
+
Debug.log("create SecretInfo Permission for root admin success.");
|
|
86260
86462
|
}
|
|
86463
|
+
Debug.log("creating some indexes on System.MasterPlayer...");
|
|
86261
86464
|
let masterPlayerCollection = this.gnServer.getDatabase().systemCollection("MasterPlayer");
|
|
86262
86465
|
await masterPlayerCollection.createIndex({ userId: 1 }, { background: true, name: "userId_1" });
|
|
86263
86466
|
await masterPlayerCollection.createIndex({ segments: 1 }, { background: true, name: "segments_1" });
|
|
@@ -86281,7 +86484,8 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86281
86484
|
await masterPlayerCollection.createIndex({ "external.apple.appleId": 1 }, { background: true, sparse: true, name: "external.apple.appleId_1" });
|
|
86282
86485
|
await masterPlayerCollection.createIndex({ "external.google.googleId": 1 }, { background: true, sparse: true, name: "external.google.googleId_1" });
|
|
86283
86486
|
await masterPlayerCollection.createIndex({ "external.facebook.facebookId": 1 }, { background: true, sparse: true, name: "external.facebook.facebookId_1" });
|
|
86284
|
-
Debug.log("
|
|
86487
|
+
Debug.log("create some indexes on System.MasterPlayer success.");
|
|
86488
|
+
Debug.log("[Security] Please login via account with username '" + username + "' and password is '" + password + "' and change new password");
|
|
86285
86489
|
}
|
|
86286
86490
|
{
|
|
86287
86491
|
// create masterGameSettings
|
|
@@ -86335,6 +86539,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86335
86539
|
}
|
|
86336
86540
|
};
|
|
86337
86541
|
await masterAdminCollection.insertOne(masterGameSettingsResult);
|
|
86542
|
+
Debug.log("create default MasterGameSettingsResult success.");
|
|
86338
86543
|
}
|
|
86339
86544
|
{
|
|
86340
86545
|
{
|
|
@@ -86346,6 +86551,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86346
86551
|
let currencyLogCollection = this.gnServer.getDatabase().runtimeCollection("MasterPlayer.CurrencyLog");
|
|
86347
86552
|
await currencyLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86348
86553
|
await currencyLogCollection.createIndex({ userId: 1, key: 1, _id: -1 }, { background: true, name: "userId_1_key_1_id_-1" });
|
|
86554
|
+
Debug.log("create some indexes on Runtime.MasterPlayer.CurrencyLog success.");
|
|
86349
86555
|
}
|
|
86350
86556
|
{
|
|
86351
86557
|
await this.gnServer.getDatabase().createCollection("Runtime.MasterPlayer.StatisticsLog", {
|
|
@@ -86356,18 +86562,22 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86356
86562
|
let statisticsLogCollection = this.gnServer.getDatabase().runtimeCollection("MasterPlayer.StatisticsLog");
|
|
86357
86563
|
await statisticsLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86358
86564
|
await statisticsLogCollection.createIndex({ userId: 1, key: 1, _id: -1 }, { background: true, name: "userId_1_key_1_id_-1" });
|
|
86565
|
+
Debug.log("create some indexes on Runtime.MasterPlayer.StatisticsLog success.");
|
|
86359
86566
|
}
|
|
86360
86567
|
{
|
|
86361
86568
|
let userIPAddressCollection = this.gnServer.getDatabase().systemCollection("MasterPlayer.IPAddress");
|
|
86362
86569
|
await userIPAddressCollection.createIndex({ userId: 1 }, { background: true, name: "userId_1" });
|
|
86570
|
+
Debug.log("create some indexes on System.MasterPlayer.IPAddress success.");
|
|
86363
86571
|
}
|
|
86364
86572
|
{
|
|
86365
86573
|
let countryRegionCollection = this.gnServer.getDatabase().systemCollection("CountryRegion");
|
|
86366
86574
|
await countryRegionCollection.createIndex({ countryCode: 1 }, { background: true, name: "countryCode_1" });
|
|
86575
|
+
Debug.log("create some indexes on System.MasterPlayer.CountryRegion success.");
|
|
86367
86576
|
}
|
|
86368
86577
|
{
|
|
86369
86578
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeCollection("MasterPlayer.StatisticsBackup");
|
|
86370
86579
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86580
|
+
Debug.log("create some indexes on Runtime.MasterPlayer.StatisticsBackup success.");
|
|
86371
86581
|
}
|
|
86372
86582
|
{
|
|
86373
86583
|
await this.gnServer.getDatabase().createCollection("System.Analytics", {
|
|
@@ -86377,6 +86587,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86377
86587
|
});
|
|
86378
86588
|
let analyticsCollection = this.gnServer.getDatabase().systemCollection("Analytics");
|
|
86379
86589
|
await analyticsCollection.createIndex({ tsCreate: -1 }, { background: true, name: "tsCreate_-1" });
|
|
86590
|
+
Debug.log("create some indexes on System.Analytics success.");
|
|
86380
86591
|
}
|
|
86381
86592
|
{
|
|
86382
86593
|
await this.gnServer.getDatabase().createCollection("System.StoreAnalytics", {
|
|
@@ -86386,11 +86597,13 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86386
86597
|
});
|
|
86387
86598
|
let storeAnalytics = this.gnServer.getDatabase().systemCollection("StoreAnalytics");
|
|
86388
86599
|
await storeAnalytics.createIndex({ tsCreate: -1 }, { background: true, name: "tsCreate_-1" });
|
|
86600
|
+
Debug.log("create some indexes on System.StoreAnalytics success.");
|
|
86389
86601
|
}
|
|
86390
86602
|
}
|
|
86391
86603
|
{
|
|
86392
86604
|
// create main game settings
|
|
86393
86605
|
{
|
|
86606
|
+
Debug.log("creating some indexes for gameId main...");
|
|
86394
86607
|
let gameId = "main";
|
|
86395
86608
|
let gameSettingsResult = {
|
|
86396
86609
|
type: "gameSettings",
|
|
@@ -86446,6 +86659,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86446
86659
|
await gamePlayerCollection.createIndex({ segments: 1 }, { background: true, name: "segments_1" });
|
|
86447
86660
|
await gamePlayerCollection.createIndex({ displayNameNormalize: 1 }, { background: true, name: "displayNameNormalize_1" });
|
|
86448
86661
|
await gamePlayerCollection.createIndex({ tsLastLogin: -1 }, { background: true, name: "tsLastLogin_-1" });
|
|
86662
|
+
Debug.log("create some indexes on System." + gameId + ".GamePlayer success.");
|
|
86449
86663
|
}
|
|
86450
86664
|
{
|
|
86451
86665
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".GamePlayer.CurrencyLog", {
|
|
@@ -86456,6 +86670,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86456
86670
|
let currencyLogCollection = this.gnServer.getDatabase().runtimeGameCollection("GamePlayer.CurrencyLog", gameId);
|
|
86457
86671
|
await currencyLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86458
86672
|
await currencyLogCollection.createIndex({ userId: 1, key: 1, _id: -1 }, { background: true, name: "userId_1_key_1_id_-1" });
|
|
86673
|
+
Debug.log("create some indexes on Runtime." + gameId + ".GamePlayer.CurrencyLog success.");
|
|
86459
86674
|
}
|
|
86460
86675
|
{
|
|
86461
86676
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".GamePlayer.StatisticsLog", {
|
|
@@ -86466,10 +86681,12 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86466
86681
|
let statisticsLogCollection = this.gnServer.getDatabase().runtimeGameCollection("GamePlayer.StatisticsLog", gameId);
|
|
86467
86682
|
await statisticsLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86468
86683
|
await statisticsLogCollection.createIndex({ userId: 1, key: 1, _id: -1 }, { background: true, name: "userId_1_key_1_id_-1" });
|
|
86684
|
+
Debug.log("create some indexes on Runtime." + gameId + ".GamePlayer.StatisticsLog success.");
|
|
86469
86685
|
}
|
|
86470
86686
|
{
|
|
86471
86687
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("GamePlayer.StatisticsBackup", gameId);
|
|
86472
86688
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86689
|
+
Debug.log("create some indexes on Runtime." + gameId + ".GamePlayer.StatisticsBackup success.");
|
|
86473
86690
|
}
|
|
86474
86691
|
{
|
|
86475
86692
|
let characterPlayerCollection = this.gnServer.getDatabase().systemGameCollection("CharacterPlayer", gameId);
|
|
@@ -86477,6 +86694,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86477
86694
|
await characterPlayerCollection.createIndex({ segments: 1 }, { background: true, name: "segments_1" });
|
|
86478
86695
|
await characterPlayerCollection.createIndex({ displayNameNormalize: 1 }, { background: true, name: "displayNameNormalize_1" });
|
|
86479
86696
|
await characterPlayerCollection.createIndex({ tsLastLogin: -1 }, { background: true, name: "tsLastLogin_-1" });
|
|
86697
|
+
Debug.log("create some indexes on System." + gameId + ".CharacterPlayer success.");
|
|
86480
86698
|
}
|
|
86481
86699
|
{
|
|
86482
86700
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".CharacterPlayer.CurrencyLog", {
|
|
@@ -86487,6 +86705,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86487
86705
|
let currencyLogCollection = this.gnServer.getDatabase().runtimeGameCollection("CharacterPlayer.CurrencyLog", gameId);
|
|
86488
86706
|
await currencyLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86489
86707
|
await currencyLogCollection.createIndex({ characterId: 1, key: 1, _id: -1 }, { background: true, name: "characterId_1_key_1_id_-1" });
|
|
86708
|
+
Debug.log("create some indexes on Runtime." + gameId + ".CharacterPlayer.CurrencyLog success.");
|
|
86490
86709
|
}
|
|
86491
86710
|
{
|
|
86492
86711
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".CharacterPlayer.StatisticsLog", {
|
|
@@ -86497,16 +86716,19 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86497
86716
|
let statisticsLogCollection = this.gnServer.getDatabase().runtimeGameCollection("CharacterPlayer.StatisticsLog", gameId);
|
|
86498
86717
|
await statisticsLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86499
86718
|
await statisticsLogCollection.createIndex({ characterId: 1, key: 1, _id: -1 }, { background: true, name: "characterId_1_key_1_id_-1" });
|
|
86719
|
+
Debug.log("create some indexes on Runtime." + gameId + ".CharacterPlayer.StatisticsLog success.");
|
|
86500
86720
|
}
|
|
86501
86721
|
{
|
|
86502
86722
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("CharacterPlayer.StatisticsBackup", gameId);
|
|
86503
86723
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86724
|
+
Debug.log("create some indexes on Runtime." + gameId + ".CharacterPlayer.StatisticsBackup success.");
|
|
86504
86725
|
}
|
|
86505
86726
|
{
|
|
86506
86727
|
let groupCollection = this.gnServer.getDatabase().systemGameCollection("Group", gameId);
|
|
86507
86728
|
await groupCollection.createIndex({ groupId: 1 }, { background: true, name: "groupId_1" });
|
|
86508
86729
|
await groupCollection.createIndex({ segments: 1 }, { background: true, name: "segments_1" });
|
|
86509
86730
|
await groupCollection.createIndex({ displayNameNormalize: 1 }, { background: true, name: "displayNameNormalize_1" });
|
|
86731
|
+
Debug.log("create some indexes on System." + gameId + ".Group success.");
|
|
86510
86732
|
}
|
|
86511
86733
|
{
|
|
86512
86734
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".Group.CurrencyLog", {
|
|
@@ -86517,6 +86739,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86517
86739
|
let currencyLogCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.CurrencyLog", gameId);
|
|
86518
86740
|
await currencyLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86519
86741
|
await currencyLogCollection.createIndex({ groupId: 1, key: 1, _id: -1 }, { background: true, name: "groupId_1_key_1_id_-1" });
|
|
86742
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Group.CurrencyLog success.");
|
|
86520
86743
|
}
|
|
86521
86744
|
{
|
|
86522
86745
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".Group.StatisticsLog", {
|
|
@@ -86527,10 +86750,12 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86527
86750
|
let statisticsLogCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.StatisticsLog", gameId);
|
|
86528
86751
|
await statisticsLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86529
86752
|
await statisticsLogCollection.createIndex({ groupId: 1, key: 1, _id: -1 }, { background: true, name: "groupId_1_key_1_id_-1" });
|
|
86753
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Group.StatisticsLog success.");
|
|
86530
86754
|
}
|
|
86531
86755
|
{
|
|
86532
86756
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.StatisticsBackup", gameId);
|
|
86533
86757
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86758
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Group.StatisticsBackup success.");
|
|
86534
86759
|
}
|
|
86535
86760
|
{
|
|
86536
86761
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".Group.Message", {
|
|
@@ -86540,12 +86765,14 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86540
86765
|
});
|
|
86541
86766
|
let groupMessageCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.Message", gameId);
|
|
86542
86767
|
await groupMessageCollection.createIndex({ groupId: 1, _id: -1 }, { background: true, name: "groupId_1_id_-1" });
|
|
86768
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Group.Message success.");
|
|
86543
86769
|
}
|
|
86544
86770
|
{
|
|
86545
86771
|
let inventoryCollection = this.gnServer.getDatabase().systemGameCollection("Inventory", gameId);
|
|
86546
86772
|
await inventoryCollection.createIndex({ itemId: 1 }, { background: true, name: "itemId_1" });
|
|
86547
86773
|
await inventoryCollection.createIndex({ segments: 1 }, { background: true, name: "segments_1" });
|
|
86548
86774
|
await inventoryCollection.createIndex({ displayNameNormalize: 1 }, { background: true, name: "displayNameNormalize_1" });
|
|
86775
|
+
Debug.log("create some indexes on System." + gameId + ".Inventory success.");
|
|
86549
86776
|
}
|
|
86550
86777
|
{
|
|
86551
86778
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".Inventory.StatisticsLog", {
|
|
@@ -86556,16 +86783,19 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86556
86783
|
let statisticsLogCollection = this.gnServer.getDatabase().runtimeGameCollection("Inventory.StatisticsLog", gameId);
|
|
86557
86784
|
await statisticsLogCollection.createIndex({ key: 1, _id: -1 }, { background: true, name: "key_1_id_-1" });
|
|
86558
86785
|
await statisticsLogCollection.createIndex({ itemId: 1, key: 1, _id: -1 }, { background: true, name: "itemId_1_key_1_id_-1" });
|
|
86786
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Inventory.StatisticsLog success.");
|
|
86559
86787
|
}
|
|
86560
86788
|
{
|
|
86561
86789
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("Inventory.StatisticsBackup", gameId);
|
|
86562
86790
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86791
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Inventory.StatisticsBackup success.");
|
|
86563
86792
|
}
|
|
86564
86793
|
{
|
|
86565
86794
|
let storeInventoryCollection = this.gnServer.getDatabase().systemGameCollection("StoreInventory", gameId);
|
|
86566
86795
|
await storeInventoryCollection.createIndex({ storeId: 1 }, { background: true, name: "storeId_1" });
|
|
86567
86796
|
await storeInventoryCollection.createIndex({ displayNameNormalize: 1 }, { background: true, name: "displayNameNormalize_1" });
|
|
86568
86797
|
await storeInventoryCollection.createIndex({ tags: 1 }, { background: true, sparse: true, name: "tags_1" });
|
|
86798
|
+
Debug.log("create some indexes on System." + gameId + ".StoreInventory success.");
|
|
86569
86799
|
}
|
|
86570
86800
|
{
|
|
86571
86801
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".StoreInventory.StoreLog", {
|
|
@@ -86577,15 +86807,18 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86577
86807
|
await storeInventoryLogCollection.createIndex({ storeId: 1, id: 1, storeReceiveType: -1, _id: -1 }, { background: true, name: "storeId_1_id_1_storeReceiveType_-1_id_-1" });
|
|
86578
86808
|
await storeInventoryLogCollection.createIndex({ id: 1, storeReceiveType: -1, _id: -1 }, { background: true, name: "id_1_storeReceiveType_-1_id_-1" });
|
|
86579
86809
|
await storeInventoryLogCollection.createIndex({ storeReceiveType: -1, _id: -1 }, { background: true, name: "storeReceiveType_-1_id_-1" });
|
|
86810
|
+
Debug.log("create some indexes on Runtime." + gameId + ".StoreInventory.StoreLog success.");
|
|
86580
86811
|
}
|
|
86581
86812
|
{
|
|
86582
86813
|
let storeInventoryUsedCollection = this.gnServer.getDatabase().systemGameCollection("StoreInventory.StoreUsed", gameId);
|
|
86583
86814
|
await storeInventoryUsedCollection.createIndex({ storeId: 1 }, { background: true, name: "storeId_1" });
|
|
86815
|
+
Debug.log("create some indexes on System." + gameId + ".StoreInventory.StoreUsed success.");
|
|
86584
86816
|
}
|
|
86585
86817
|
{
|
|
86586
86818
|
let receiptIAPCollection = this.gnServer.getDatabase().systemGameCollection("ReceiptIAP", gameId);
|
|
86587
86819
|
receiptIAPCollection.createIndex({ payloadMd5: 1 }, { background: true, name: "payloadMd5_1" });
|
|
86588
86820
|
receiptIAPCollection.createIndex({ transactionId: 1 }, { background: true, name: "transactionId_1" });
|
|
86821
|
+
Debug.log("create some indexes on System." + gameId + ".ReceiptIAP success.");
|
|
86589
86822
|
}
|
|
86590
86823
|
{
|
|
86591
86824
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".MatchmakingTicket", {
|
|
@@ -86598,6 +86831,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86598
86831
|
await matchmakingTicketCollection.createIndex({ queueName: 1, "status": -1, "tsCreate": -1 }, { background: true, name: "queueName_1_status_-1_tsCreate_-1" });
|
|
86599
86832
|
await matchmakingTicketCollection.createIndex({ ticketId: 1 }, { background: true, name: "ticketId_1" });
|
|
86600
86833
|
await matchmakingTicketCollection.createIndex({ status: -1, _id: -1 }, { background: true, name: "status_-1_id_-1" });
|
|
86834
|
+
Debug.log("create some indexes on Runtime." + gameId + ".MatchmakingTicket success.");
|
|
86601
86835
|
}
|
|
86602
86836
|
{
|
|
86603
86837
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".CloudScript.Log", {
|
|
@@ -86607,24 +86841,30 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86607
86841
|
});
|
|
86608
86842
|
let cloudScriptFunctionLogCollection = this.gnServer.getDatabase().runtimeGameCollection("CloudScript.Log", gameId);
|
|
86609
86843
|
await cloudScriptFunctionLogCollection.createIndex({ tsCreate: -1 }, { background: true, name: "tsCreate-1" });
|
|
86844
|
+
Debug.log("create some indexes on Runtime." + gameId + ".CloudScript.Log success.");
|
|
86610
86845
|
}
|
|
86611
86846
|
{
|
|
86612
86847
|
let matchCollection = this.gnServer.getDatabase().systemGameCollection("Match", gameId);
|
|
86613
86848
|
await matchCollection.createIndex({ matchId: 1 }, { background: true, name: "matchId_1" });
|
|
86614
86849
|
await matchCollection.createIndex({ queueName: 1, tsCreate: -1 }, { background: true, name: "queueName_1_tsCreate_-1" });
|
|
86615
86850
|
await matchCollection.createIndex({ status: -1, tsCreate: -1 }, { background: true, name: "status_-1_tsCreate_-1" });
|
|
86851
|
+
Debug.log("create some indexes on System." + gameId + ".Match success.");
|
|
86616
86852
|
}
|
|
86617
86853
|
{
|
|
86618
86854
|
let configCollection = this.gnServer.getDatabase().systemGameCollection("Config", gameId);
|
|
86619
86855
|
await configCollection.createIndex({ configName: 1, label: 1 }, { background: true, unique: true, name: "configName_1_label_1" });
|
|
86856
|
+
Debug.log("create some indexes on System." + gameId + ".Config success.");
|
|
86620
86857
|
}
|
|
86621
86858
|
{
|
|
86622
86859
|
let cacheCollection = this.gnServer.getDatabase().runtimeGameCollection("Cache", gameId);
|
|
86623
86860
|
await cacheCollection.createIndex({ key: 1 }, { background: true, name: "key_1" });
|
|
86861
|
+
Debug.log("create some indexes on System." + gameId + ".Cache success.");
|
|
86624
86862
|
}
|
|
86863
|
+
Debug.log("create some indexes for gameId main success.");
|
|
86625
86864
|
}
|
|
86626
86865
|
// create dev game settings
|
|
86627
86866
|
{
|
|
86867
|
+
Debug.log("creating some indexes for gameId dev...");
|
|
86628
86868
|
let gameId = "dev";
|
|
86629
86869
|
let gameSettingsResult = {
|
|
86630
86870
|
type: "gameSettings",
|
|
@@ -86705,6 +86945,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86705
86945
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("GamePlayer.StatisticsBackup", gameId);
|
|
86706
86946
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86707
86947
|
}
|
|
86948
|
+
Debug.log("create some indexes on GamePlayer for gameId " + gameId + " success.");
|
|
86708
86949
|
{
|
|
86709
86950
|
let characterPlayerCollection = this.gnServer.getDatabase().systemGameCollection("CharacterPlayer", gameId);
|
|
86710
86951
|
await characterPlayerCollection.createIndex({ characterId: 1 }, { background: true, name: "characterId_1" });
|
|
@@ -86736,6 +86977,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86736
86977
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("CharacterPlayer.StatisticsBackup", gameId);
|
|
86737
86978
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86738
86979
|
}
|
|
86980
|
+
Debug.log("create some indexes on CharacterPlayer for gameId " + gameId + " success.");
|
|
86739
86981
|
{
|
|
86740
86982
|
let groupCollection = this.gnServer.getDatabase().systemGameCollection("Group", gameId);
|
|
86741
86983
|
await groupCollection.createIndex({ groupId: 1 }, { background: true, name: "groupId_1" });
|
|
@@ -86775,6 +87017,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86775
87017
|
let groupMessageCollection = this.gnServer.getDatabase().runtimeGameCollection("Group.Message", gameId);
|
|
86776
87018
|
await groupMessageCollection.createIndex({ groupId: 1, _id: -1 }, { background: true, name: "groupId_1_id_-1" });
|
|
86777
87019
|
}
|
|
87020
|
+
Debug.log("create some indexes on Group for gameId " + gameId + " success.");
|
|
86778
87021
|
{
|
|
86779
87022
|
let inventoryCollection = this.gnServer.getDatabase().systemGameCollection("Inventory", gameId);
|
|
86780
87023
|
await inventoryCollection.createIndex({ itemId: 1 }, { background: true, name: "itemId_1" });
|
|
@@ -86795,6 +87038,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86795
87038
|
let backupStatisticsLeaderboardCollection = this.gnServer.getDatabase().runtimeGameCollection("Inventory.StatisticsBackup", gameId);
|
|
86796
87039
|
await backupStatisticsLeaderboardCollection.createIndex({ key: 1, version: 1 }, { background: true, name: "key_1_version_1" });
|
|
86797
87040
|
}
|
|
87041
|
+
Debug.log("create some indexes on Inventory for gameId " + gameId + " success.");
|
|
86798
87042
|
{
|
|
86799
87043
|
let storeInventoryCollection = this.gnServer.getDatabase().systemGameCollection("StoreInventory", gameId);
|
|
86800
87044
|
await storeInventoryCollection.createIndex({ storeId: 1 }, { background: true, name: "storeId_1" });
|
|
@@ -86816,11 +87060,13 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86816
87060
|
let storeInventoryUsedCollection = this.gnServer.getDatabase().systemGameCollection("StoreInventory.StoreUsed", gameId);
|
|
86817
87061
|
await storeInventoryUsedCollection.createIndex({ storeId: 1 }, { background: true, name: "storeId_1" });
|
|
86818
87062
|
}
|
|
87063
|
+
Debug.log("create some indexes on StoreInventory for gameId " + gameId + " success.");
|
|
86819
87064
|
{
|
|
86820
87065
|
let receiptIAPCollection = this.gnServer.getDatabase().systemGameCollection("ReceiptIAP", gameId);
|
|
86821
87066
|
receiptIAPCollection.createIndex({ payloadMd5: 1 }, { background: true, name: "payloadMd5_1" });
|
|
86822
87067
|
receiptIAPCollection.createIndex({ transactionId: 1 }, { background: true, name: "transactionId_1" });
|
|
86823
87068
|
}
|
|
87069
|
+
Debug.log("create some indexes on ReceiptIAP for gameId " + gameId + " success.");
|
|
86824
87070
|
{
|
|
86825
87071
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".MatchmakingTicket", {
|
|
86826
87072
|
capped: true,
|
|
@@ -86832,6 +87078,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86832
87078
|
await matchmakingTicketCollection.createIndex({ queueName: 1, status: -1, tsCreate: -1 }, { background: true, name: "queueName_1_status_-1_tsCreate_-1" });
|
|
86833
87079
|
await matchmakingTicketCollection.createIndex({ ticketId: 1 }, { background: true, name: "ticketId_1" });
|
|
86834
87080
|
await matchmakingTicketCollection.createIndex({ status: -1, "_id": -1 }, { background: true, name: "status_-1_id_-1" });
|
|
87081
|
+
Debug.log("create some indexes on Runtime." + gameId + ".MatchmakingTicket success.");
|
|
86835
87082
|
}
|
|
86836
87083
|
{
|
|
86837
87084
|
await this.gnServer.getDatabase().createCollection("Runtime." + gameId + ".CloudScript.Log", {
|
|
@@ -86841,21 +87088,26 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86841
87088
|
});
|
|
86842
87089
|
let cloudScriptFunctionLogCollection = this.gnServer.getDatabase().runtimeGameCollection("CloudScript.Log", gameId);
|
|
86843
87090
|
await cloudScriptFunctionLogCollection.createIndex({ tsCreate: -1 }, { background: true, name: "tsCreate-1" });
|
|
87091
|
+
Debug.log("create some indexes on Runtime." + gameId + ".CloudScript.Log success.");
|
|
86844
87092
|
}
|
|
86845
87093
|
{
|
|
86846
87094
|
let matchCollection = this.gnServer.getDatabase().systemGameCollection("Match", gameId);
|
|
86847
87095
|
await matchCollection.createIndex({ matchId: 1 }, { background: true, name: "matchId_1" });
|
|
86848
87096
|
await matchCollection.createIndex({ queueName: 1, tsCreate: -1 }, { background: true, name: "queueName_1_tsCreate_-1" });
|
|
86849
87097
|
await matchCollection.createIndex({ status: -1, tsCreate: -1 }, { background: true, name: "status_-1_tsCreate_-1" });
|
|
87098
|
+
Debug.log("create some indexes on System." + gameId + ".Match success.");
|
|
86850
87099
|
}
|
|
86851
87100
|
{
|
|
86852
87101
|
let configCollection = this.gnServer.getDatabase().systemGameCollection("Config", gameId);
|
|
86853
87102
|
await configCollection.createIndex({ configName: 1, label: 1 }, { background: true, unique: true, name: "configName_1_label_1" });
|
|
87103
|
+
Debug.log("create some indexes on System." + gameId + ".Config success.");
|
|
86854
87104
|
}
|
|
86855
87105
|
{
|
|
86856
87106
|
let cacheCollection = this.gnServer.getDatabase().runtimeGameCollection("Cache", gameId);
|
|
86857
87107
|
await cacheCollection.createIndex({ key: 1 }, { background: true, name: "key_1" });
|
|
87108
|
+
Debug.log("create some indexes on Runtime." + gameId + ".Cache success.");
|
|
86858
87109
|
}
|
|
87110
|
+
Debug.log("create some indexes for gameId dev success.");
|
|
86859
87111
|
}
|
|
86860
87112
|
}
|
|
86861
87113
|
{
|
|
@@ -86866,16 +87118,19 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86866
87118
|
});
|
|
86867
87119
|
let authInfoCollection = this.gnServer.getDatabase().systemCollection("AuthInfo");
|
|
86868
87120
|
await authInfoCollection.createIndex({ gnToken: 1 }, { background: true, name: "gnToken_1" });
|
|
87121
|
+
Debug.log("create some indexes for System.AuthInfo success.");
|
|
86869
87122
|
}
|
|
86870
87123
|
{
|
|
86871
87124
|
let downloadFileSessionCollection = this.gnServer.getDatabase().systemCollection("DownloadFileSession");
|
|
86872
87125
|
await downloadFileSessionCollection.createIndex({ downloadToken: 1 }, { background: true, name: "downloadToken_1" });
|
|
86873
87126
|
await downloadFileSessionCollection.createIndex({ createdAt: 1 }, { background: true, name: "createdAt_1", expireAfterSeconds: 3600 });
|
|
87127
|
+
Debug.log("create some indexes for System.DownloadFileSession success.");
|
|
86874
87128
|
}
|
|
86875
87129
|
{
|
|
86876
87130
|
let uploadFileInfoCollection = this.gnServer.getDatabase().systemCollection("UploadFileInfo");
|
|
86877
87131
|
await uploadFileInfoCollection.createIndex({ fileId: 1 }, { background: true, name: "fileId_1" });
|
|
86878
87132
|
await uploadFileInfoCollection.createIndex({ gameId: 1, _id: -1 }, { background: true, name: "gameId_1_id_-1" });
|
|
87133
|
+
Debug.log("create some indexes for System.UploadFileInfo success.");
|
|
86879
87134
|
}
|
|
86880
87135
|
{
|
|
86881
87136
|
await this.gnServer.getDatabase().createCollection("System.AdapterEvent", {
|
|
@@ -86888,6 +87143,7 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86888
87143
|
// { "createdAt": 1 },
|
|
86889
87144
|
// { expireAfterSeconds: 60, background: true, name: "createdAt_1" }
|
|
86890
87145
|
// );
|
|
87146
|
+
Debug.log("create some indexes for System.AdapterEvent success.");
|
|
86891
87147
|
}
|
|
86892
87148
|
{
|
|
86893
87149
|
// await this.gnServer.getDatabase().systemCollection("SecretInfo").createIndex({ secretKey": 1 }, { background: true, unique: true, name: "secretKey_1" });
|
|
@@ -86900,14 +87156,17 @@ class ServerApplication extends ServerApplication_BuilderBase {
|
|
|
86900
87156
|
});
|
|
86901
87157
|
// let postEventCallbackPostCollection = this.gnServer.getDatabase().systemCollection("EventCallback.Post");
|
|
86902
87158
|
// await postEventCallbackPostCollection.createIndex({ eventName: 1, _id: -1 }, { background: true, name: "eventName_1_id_-1" });
|
|
87159
|
+
Debug.log("create some indexes for System.EventCallback.Post success.");
|
|
86903
87160
|
}
|
|
86904
87161
|
{
|
|
86905
87162
|
let cloudScriptFunctionCollection = this.gnServer.getDatabase().systemCollection("EventCallback.CloudScript");
|
|
86906
87163
|
let path = __dirname + "/./GN-startup/cloudScript/eventCallbackCloudScriptData.json";
|
|
86907
87164
|
await cloudScriptFunctionCollection.insertMany(JSON.parse(external_fs_default().readFileSync(path).toString()));
|
|
87165
|
+
Debug.log("create some indexes for EventCallback.CloudScript success.");
|
|
86908
87166
|
}
|
|
86909
87167
|
}
|
|
86910
87168
|
async reSetupGNDatabase(oldVersion) {
|
|
87169
|
+
Debug.log("re setup Database from version " + oldVersion);
|
|
86911
87170
|
}
|
|
86912
87171
|
async applySettingsGame() {
|
|
86913
87172
|
let answer = [];
|