cgserver 7.3.1434 → 7.4.1442

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.
@@ -11,6 +11,7 @@ class Config {
11
11
  * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
12
12
  */
13
13
  static debug = false;
14
+ static rootDataDir = "data/";
14
15
  constructor(filename) {
15
16
  this._file_name = filename;
16
17
  }
@@ -22,16 +23,16 @@ class Config {
22
23
  if (Config.debug) {
23
24
  suffix2 = "_d";
24
25
  }
25
- let path = "data/" + this._file_name + "_" + this._suffix + suffix2 + ".json";
26
+ let path = Config.rootDataDir + this._file_name + "_" + this._suffix + suffix2 + ".json";
26
27
  path = path.toLowerCase();
27
28
  if (!fs.existsSync(path)) {
28
- path = "data/" + this._file_name + "_" + this._suffix + ".json";
29
+ path = Config.rootDataDir + this._file_name + "_" + this._suffix + ".json";
29
30
  path = path.toLowerCase();
30
31
  if (!fs.existsSync(path)) {
31
- path = "data/" + this._file_name + suffix2 + ".json";
32
+ path = Config.rootDataDir + this._file_name + suffix2 + ".json";
32
33
  path = path.toLowerCase();
33
34
  if (!fs.existsSync(path)) {
34
- path = "data/" + this._file_name + ".json";
35
+ path = Config.rootDataDir + this._file_name + ".json";
35
36
  path = path.toLowerCase();
36
37
  if (!fs.existsSync(path)) {
37
38
  console.error(path + " not exist!");
@@ -34,6 +34,13 @@ class CgServer {
34
34
  Config_1.Config.debug = true;
35
35
  this._debug = true;
36
36
  }
37
+ if (arg == "-data") {
38
+ if (i + 1 >= argv.length) {
39
+ break;
40
+ }
41
+ ++i;
42
+ Config_1.Config.rootDataDir = argv[i].toLocaleLowerCase();
43
+ }
37
44
  }
38
45
  }
39
46
  _done = 0;
@@ -6,6 +6,7 @@ export declare class Config {
6
6
  * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
7
7
  */
8
8
  static debug: boolean;
9
+ static rootDataDir: string;
9
10
  constructor(filename: any);
10
11
  init(): boolean;
11
12
  }
@@ -102,7 +102,7 @@ export declare class core {
102
102
  static sleep(milliseconds: number): Promise<unknown>;
103
103
  static safeCall(func: Function, thisArg?: any, ...params: any[]): Promise<any>;
104
104
  static getYearWeek(time: number): number;
105
- static toBase64(content: string): string;
106
- static aesEncode(content: string, key: string, iv: string): string;
107
- static aesDecode(base64_str: string, key: string, iv: string): string;
105
+ static toBase64(content: string): any;
106
+ static aesEncode(content: string, key: string, iv: string): any;
107
+ static aesDecode(base64_str: string, key: string, iv: string): any;
108
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "7.3.1434",
3
+ "version": "7.4.1442",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",