cgserver 14.0.2 → 14.0.3
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/lib/Framework/Core/Core.js +15 -8
- package/dist/lib/Framework/Server/WebServer/Engine/Engine.js +1 -1
- package/dist/lib/Framework/Server/WebServer/Engine/Response.js +5 -2
- package/dist/lib/Framework/ThirdParty/AppleTool.js +2 -2
- package/dist/lib/Framework/index_export_.js +6 -1
- package/dist/types/Framework/Core/Core.d.ts +2 -2
- package/dist/types/Framework/index_export_.d.ts +2 -0
- package/package.json +4 -5
|
@@ -37,12 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.core = void 0;
|
|
40
|
-
let os = require(
|
|
40
|
+
let os = require("os");
|
|
41
41
|
const _ = __importStar(require("underscore"));
|
|
42
42
|
const crypto = __importStar(require("crypto"));
|
|
43
43
|
const CryptoJS = __importStar(require("crypto-js"));
|
|
44
44
|
const ec_key_1 = __importDefault(require("ec-key"));
|
|
45
|
-
const uuid_1 = require("uuid");
|
|
46
45
|
const Log_1 = require("../Logic/Log");
|
|
47
46
|
const axios_1 = __importDefault(require("axios"));
|
|
48
47
|
/**
|
|
@@ -381,19 +380,20 @@ class core {
|
|
|
381
380
|
let hash_str = hash.digest(encoding);
|
|
382
381
|
return hash_str;
|
|
383
382
|
}
|
|
384
|
-
static getLocalIP
|
|
383
|
+
static getLocalIP() {
|
|
385
384
|
let iptable = {};
|
|
386
385
|
let ifaces = os.networkInterfaces();
|
|
387
386
|
for (let dev in ifaces) {
|
|
388
387
|
ifaces[dev].forEach(function (details, alias) {
|
|
389
|
-
|
|
388
|
+
let fa = details.family || "";
|
|
389
|
+
if ((fa.toLowerCase() == 'ipv4') && (details.internal == false)) {
|
|
390
390
|
iptable['localIP'] = details.address;
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
return iptable['localIP'];
|
|
395
|
-
}
|
|
396
|
-
static
|
|
395
|
+
}
|
|
396
|
+
static async getIP() {
|
|
397
397
|
return new Promise((resolve, reject) => {
|
|
398
398
|
axios_1.default.get('http://ip.chinaz.com/getip.aspx').then(response => {
|
|
399
399
|
let body = response.data;
|
|
@@ -403,7 +403,7 @@ class core {
|
|
|
403
403
|
resolve(null);
|
|
404
404
|
});
|
|
405
405
|
});
|
|
406
|
-
}
|
|
406
|
+
}
|
|
407
407
|
/**
|
|
408
408
|
* 判断是否是手机号
|
|
409
409
|
* @param phone 手机号
|
|
@@ -682,7 +682,14 @@ class core {
|
|
|
682
682
|
return dtext;
|
|
683
683
|
}
|
|
684
684
|
static getUuid() {
|
|
685
|
-
|
|
685
|
+
// 16 字节 = 128 位随机数
|
|
686
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
687
|
+
// 设置版本与变体位:第6字节的高4位为0100(版本4),第8字节的高2位为10(变体RFC4122)
|
|
688
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
|
|
689
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant RFC4122
|
|
690
|
+
// 转十六进制并按 8-4-4-4-12 输出
|
|
691
|
+
const hex = [...bytes].map(b => b.toString(16).padStart(2, '0')).join('');
|
|
692
|
+
const id = `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
686
693
|
return id;
|
|
687
694
|
}
|
|
688
695
|
static signatureBase64(private_key, rsa_name, payload) {
|
|
@@ -129,7 +129,7 @@ class Engine {
|
|
|
129
129
|
credentials: this._cfg.cors.credentials || false
|
|
130
130
|
}));
|
|
131
131
|
}
|
|
132
|
-
this._app.all("
|
|
132
|
+
this._app.all("*", (req, res) => {
|
|
133
133
|
let time = Date.now();
|
|
134
134
|
this._onall(req, res).then(() => {
|
|
135
135
|
if (this._cfg.debug) {
|
|
@@ -32,10 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.Response = void 0;
|
|
37
40
|
const fs = __importStar(require("fs"));
|
|
38
|
-
const
|
|
41
|
+
const mime_1 = __importDefault(require("mime"));
|
|
39
42
|
const Log_1 = require("../../../Logic/Log");
|
|
40
43
|
class Response {
|
|
41
44
|
_res = null;
|
|
@@ -103,7 +106,7 @@ class Response {
|
|
|
103
106
|
let size = stats.size;
|
|
104
107
|
var f = fs.createReadStream(fullPath);
|
|
105
108
|
this._res.writeHead(200, {
|
|
106
|
-
'Content-Type':
|
|
109
|
+
'Content-Type': mime_1.default.getType(fullPath) || 'application/octet-stream',
|
|
107
110
|
'Content-Disposition': 'attachment; filename=' + fileName,
|
|
108
111
|
'Content-Length': size
|
|
109
112
|
});
|
|
@@ -38,12 +38,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.gAppleTool = exports.AppleTool = exports.NotificationBody = exports.NotificationType = exports.ResponseBody = void 0;
|
|
40
40
|
const ec_key_1 = __importDefault(require("ec-key"));
|
|
41
|
-
const uuid_1 = require("uuid");
|
|
42
41
|
const fs = __importStar(require("fs"));
|
|
43
42
|
const Config_1 = require("../Config/Config");
|
|
44
43
|
const Log_1 = require("../Logic/Log");
|
|
45
44
|
const HttpTool_1 = require("../Logic/HttpTool");
|
|
46
45
|
const IServerConfig_1 = require("../Config/IServerConfig");
|
|
46
|
+
const index_export_1 = require("../index_export_");
|
|
47
47
|
//developer.apple.com/documentation/appstorereceipts/responsebody
|
|
48
48
|
class ReceiptInfo {
|
|
49
49
|
cancellation_date = "";
|
|
@@ -224,7 +224,7 @@ class AppleTool {
|
|
|
224
224
|
keyIdentifier = k;
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
|
-
var nonce =
|
|
227
|
+
var nonce = index_export_1.core.getUuid();
|
|
228
228
|
var payload = appBundleID + '\u2063' +
|
|
229
229
|
keyIdentifier + '\u2063' +
|
|
230
230
|
productIdentifier + '\u2063' +
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.IServerWebSocket = exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.EProtoType = exports.RedisManager = exports.MysqlConfig = exports.MongoConfig = exports.MSSqlConfig = exports.DbConfig = exports.MongoCacheService = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.MongoAccountService = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.SqlReturns = exports.SqlReturn = exports.MysqlBaseService = exports.MongoExt = exports.MongoManager = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.IServerConfig = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankCommandItem = exports.CgRankTool = exports.AliSmsConfig = exports.AlipaySdk = exports.EAlipayExecType = void 0;
|
|
4
|
-
exports.global = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.PacketParser = exports.SocketServerConfig = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonAuthorityValidate = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseController = exports.IWebServer = exports.BaseMsg = exports.IWebSocket = exports.WebSocketServerConfig = exports.IWebSocketServer = exports.IClientWebSocket = void 0;
|
|
7
|
+
exports.global = exports.mongoose = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.PacketParser = exports.SocketServerConfig = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonAuthorityValidate = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseController = exports.IWebServer = exports.BaseMsg = exports.IWebSocket = exports.WebSocketServerConfig = exports.IWebSocketServer = exports.IClientWebSocket = void 0;
|
|
5
8
|
var AlipayTool_1 = require("./ThirdParty/AlipayTool");
|
|
6
9
|
Object.defineProperty(exports, "EAlipayExecType", { enumerable: true, get: function () { return AlipayTool_1.EAlipayExecType; } });
|
|
7
10
|
var alipay_sdk_1 = require("alipay-sdk");
|
|
@@ -156,5 +159,7 @@ Object.defineProperty(exports, "SyncCall2", { enumerable: true, get: function ()
|
|
|
156
159
|
var SyncCallServer_1 = require("./Decorator/SyncCallServer");
|
|
157
160
|
Object.defineProperty(exports, "SyncCallServer", { enumerable: true, get: function () { return SyncCallServer_1.SyncCallServer; } });
|
|
158
161
|
Object.defineProperty(exports, "SyncCallServer2", { enumerable: true, get: function () { return SyncCallServer_1.SyncCallServer2; } });
|
|
162
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
163
|
+
exports.mongoose = mongoose_1.default;
|
|
159
164
|
var global_1 = require("./global");
|
|
160
165
|
Object.defineProperty(exports, "global", { enumerable: true, get: function () { return global_1.global; } });
|
|
@@ -43,8 +43,8 @@ export declare class core {
|
|
|
43
43
|
*/
|
|
44
44
|
static fuzzy(str: string): string;
|
|
45
45
|
static hash(algorithm: string, str: string, inputEncoding?: crypto.Encoding, encoding?: crypto.BinaryToTextEncoding): string;
|
|
46
|
-
static getLocalIP
|
|
47
|
-
static getIP
|
|
46
|
+
static getLocalIP(): any;
|
|
47
|
+
static getIP(): Promise<string>;
|
|
48
48
|
/**
|
|
49
49
|
* 判断是否是手机号
|
|
50
50
|
* @param phone 手机号
|
|
@@ -70,4 +70,6 @@ export { IRpcServerWebSocket } from './Server/RpcWebSocketServer/IRpcServerWebSo
|
|
|
70
70
|
export { IRpcClientWebSocket } from './Server/RpcWebSocketServer/IRpcClientWebSocket';
|
|
71
71
|
export { SyncCall, SyncCall2 } from './Decorator/SyncCall';
|
|
72
72
|
export { SyncCallServer, SyncCallServer2 } from './Decorator/SyncCallServer';
|
|
73
|
+
import mongoose from 'mongoose';
|
|
74
|
+
export { mongoose };
|
|
73
75
|
export { global } from "./global";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cgserver",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"author": "trojan",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "free for all.Websocket or Http",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/cookie-parser": "^1.4.10",
|
|
35
35
|
"@types/cors": "^2.8.19",
|
|
36
36
|
"@types/crypto-js": "^4.2.2",
|
|
37
|
-
"@types/express": "^
|
|
37
|
+
"@types/express": "^4.17.21",
|
|
38
38
|
"@types/formidable": "^3.4.6",
|
|
39
39
|
"@types/heapdump": "^0.3.4",
|
|
40
40
|
"@types/minimist": "^1.2.5",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"cors": "^2.8.5",
|
|
51
51
|
"crypto-js": "^4.2.0",
|
|
52
52
|
"ec-key": "0.0.6",
|
|
53
|
-
"express": "^
|
|
53
|
+
"express": "^4.21.2",
|
|
54
54
|
"fast-xml-parser": "^5.3.2",
|
|
55
55
|
"formidable": "^3.5.4",
|
|
56
56
|
"heapdump": "^0.3.15",
|
|
57
57
|
"https": "^1.0.0",
|
|
58
58
|
"jsonc": "^2.0.0",
|
|
59
59
|
"log4js": "^6.9.1",
|
|
60
|
-
"mime": "^
|
|
60
|
+
"mime": "^3.0.0",
|
|
61
61
|
"minimist": "^1.2.8",
|
|
62
62
|
"mongoose": "^9.0.0",
|
|
63
63
|
"mssql": "^12.1.1",
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"reflect-metadata": "^0.2.2",
|
|
70
70
|
"underscore": "^1.13.7",
|
|
71
71
|
"urlencode": "^2.0.0",
|
|
72
|
-
"uuid": "^13.0.0",
|
|
73
72
|
"websocket": "^1.0.35"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|