ee-core 4.1.4 → 4.1.5
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/LICENSE +21 -21
- package/README.md +65 -65
- package/app/application.d.ts +5 -5
- package/app/application.js +30 -30
- package/app/boot.d.ts +5 -5
- package/app/boot.js +80 -80
- package/app/dir.d.ts +1 -1
- package/app/dir.js +26 -26
- package/app/events.d.ts +14 -14
- package/app/events.js +55 -55
- package/app/index.d.ts +2 -2
- package/app/index.js +6 -6
- package/config/config_loader.d.ts +13 -13
- package/config/config_loader.js +65 -65
- package/config/default_config.d.ts +95 -95
- package/config/default_config.js +111 -111
- package/config/index.d.ts +28 -28
- package/config/index.js +24 -24
- package/const/channel.d.ts +16 -16
- package/const/channel.js +27 -27
- package/controller/controller_loader.d.ts +9 -9
- package/controller/controller_loader.js +77 -77
- package/controller/index.d.ts +2 -2
- package/controller/index.js +24 -24
- package/core/index.d.ts +2 -2
- package/core/index.js +11 -11
- package/core/loader/file_loader.d.ts +66 -66
- package/core/loader/file_loader.js +211 -211
- package/core/utils/index.d.ts +12 -12
- package/core/utils/index.js +83 -83
- package/core/utils/timing.d.ts +22 -22
- package/core/utils/timing.js +78 -78
- package/cross/cross.d.ts +19 -19
- package/cross/cross.js +152 -151
- package/cross/crossProcess.d.ts +29 -29
- package/cross/crossProcess.js +172 -172
- package/cross/index.d.ts +2 -2
- package/cross/index.js +8 -8
- package/electron/app/index.d.ts +5 -5
- package/electron/app/index.js +48 -48
- package/electron/index.d.ts +3 -3
- package/electron/index.js +15 -15
- package/electron/window/index.d.ts +6 -6
- package/electron/window/index.js +268 -268
- package/exception/index.d.ts +9 -9
- package/exception/index.js +100 -100
- package/html/boot.html +98 -98
- package/html/cross-failure.html +28 -28
- package/html/failure.html +28 -28
- package/html/index.d.ts +1 -1
- package/html/index.js +10 -10
- package/index.d.ts +2 -2
- package/index.js +6 -6
- package/jobs/child/app.d.ts +1 -1
- package/jobs/child/app.js +69 -69
- package/jobs/child/index.d.ts +13 -13
- package/jobs/child/index.js +85 -85
- package/jobs/child/jobProcess.d.ts +16 -16
- package/jobs/child/jobProcess.js +133 -133
- package/jobs/child-pool/index.d.ts +26 -26
- package/jobs/child-pool/index.js +190 -190
- package/jobs/index.d.ts +3 -3
- package/jobs/index.js +6 -6
- package/jobs/load-balancer/algorithm/index.d.ts +4 -4
- package/jobs/load-balancer/algorithm/index.js +11 -11
- package/jobs/load-balancer/algorithm/minimumConnection.d.ts +2 -2
- package/jobs/load-balancer/algorithm/minimumConnection.js +18 -18
- package/jobs/load-balancer/algorithm/polling.d.ts +2 -2
- package/jobs/load-balancer/algorithm/polling.js +11 -11
- package/jobs/load-balancer/algorithm/random.d.ts +2 -2
- package/jobs/load-balancer/algorithm/random.js +9 -9
- package/jobs/load-balancer/algorithm/specify.d.ts +2 -2
- package/jobs/load-balancer/algorithm/specify.js +14 -14
- package/jobs/load-balancer/algorithm/weights.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weights.js +21 -21
- package/jobs/load-balancer/algorithm/weightsMinimumConnection.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsMinimumConnection.js +29 -29
- package/jobs/load-balancer/algorithm/weightsPolling.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsPolling.js +22 -22
- package/jobs/load-balancer/algorithm/weightsRandom.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsRandom.js +16 -16
- package/jobs/load-balancer/consts.d.ts +8 -8
- package/jobs/load-balancer/consts.js +9 -9
- package/jobs/load-balancer/index.d.ts +96 -96
- package/jobs/load-balancer/index.js +201 -201
- package/jobs/load-balancer/scheduler.d.ts +16 -16
- package/jobs/load-balancer/scheduler.js +31 -31
- package/loader/index.d.ts +9 -9
- package/loader/index.js +99 -99
- package/log/index.d.ts +5 -5
- package/log/index.js +85 -85
- package/log/logger.d.ts +1 -1
- package/log/logger.js +94 -94
- package/message/childMessage.d.ts +10 -10
- package/message/childMessage.js +43 -43
- package/message/index.d.ts +3 -3
- package/message/index.js +9 -9
- package/package.json +42 -42
- package/ps/index.d.ts +39 -39
- package/ps/index.js +294 -294
- package/socket/httpServer.d.ts +8 -8
- package/socket/httpServer.js +199 -199
- package/socket/index.d.ts +10 -10
- package/socket/index.js +64 -64
- package/socket/ipcServer.d.ts +9 -9
- package/socket/ipcServer.js +105 -105
- package/socket/socketServer.d.ts +10 -10
- package/socket/socketServer.js +81 -81
- package/storage/index.d.ts +4 -4
- package/storage/index.js +6 -6
- package/storage/sqliteStorage.d.ts +16 -16
- package/storage/sqliteStorage.js +123 -123
- package/tsconfig.json +13 -13
- package/utils/extend.d.ts +2 -2
- package/utils/extend.js +77 -77
- package/utils/helper.d.ts +14 -14
- package/utils/helper.js +206 -206
- package/utils/index.d.ts +11 -10
- package/utils/index.js +198 -167
- package/utils/ip.d.ts +2 -2
- package/utils/ip.js +221 -221
- package/utils/is.d.ts +14 -14
- package/utils/is.js +111 -111
- package/utils/json.d.ts +5 -5
- package/utils/json.js +79 -79
- package/utils/pargv.d.ts +3 -3
- package/utils/pargv.js +267 -267
- package/utils/port/index.d.ts +1 -1
- package/utils/port/index.js +125 -125
- package/utils/wrap.d.ts +4 -4
- package/utils/wrap.js +40 -40
package/config/config_loader.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const debug = require('debug')('ee-core:config:config_loader');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { appName, env, getElectronDir, getBaseDir, getRootDir } = require('../ps');
|
|
6
|
-
const { extend } = require('../utils/extend');
|
|
7
|
-
const { loadFile } = require('../loader');
|
|
8
|
-
const { Timing } = require('../core/utils/timing');
|
|
9
|
-
const defaultConfig = require('./default_config');
|
|
10
|
-
|
|
11
|
-
class ConfigLoader {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.timing = new Timing();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Load config/config.xxx.js
|
|
18
|
-
*/
|
|
19
|
-
load() {
|
|
20
|
-
this.timing.start('Load Config');
|
|
21
|
-
|
|
22
|
-
// Load Application config
|
|
23
|
-
const appConfig = this._AppConfig();
|
|
24
|
-
// debug("[load] appConfig: %O", appConfig);
|
|
25
|
-
|
|
26
|
-
const defaultConf = defaultConfig();
|
|
27
|
-
const config = extend(true, defaultConf, appConfig);
|
|
28
|
-
debug("[load] config: %o", config);
|
|
29
|
-
|
|
30
|
-
this.timing.end('Load Config');
|
|
31
|
-
return config;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
_AppConfig() {
|
|
35
|
-
const names = [
|
|
36
|
-
'config.default',
|
|
37
|
-
`config.${env()}`,
|
|
38
|
-
];
|
|
39
|
-
const target = {};
|
|
40
|
-
for (const filename of names) {
|
|
41
|
-
const config = this._loadConfig(getElectronDir(), filename);
|
|
42
|
-
extend(true, target, config);
|
|
43
|
-
}
|
|
44
|
-
return target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_loadConfig(dirpath, filename) {
|
|
48
|
-
const appInfo = {
|
|
49
|
-
name: appName(),
|
|
50
|
-
baseDir: getBaseDir(),
|
|
51
|
-
electronDir: getElectronDir(),
|
|
52
|
-
env: env(),
|
|
53
|
-
root: getRootDir(),
|
|
54
|
-
}
|
|
55
|
-
const filepath = path.join(dirpath, 'config', filename);
|
|
56
|
-
const config = loadFile(filepath, appInfo);
|
|
57
|
-
debug("[_loadConfig] filepath: %s", filepath);
|
|
58
|
-
if (!config) return null;
|
|
59
|
-
|
|
60
|
-
return config;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
module.exports = {
|
|
65
|
-
ConfigLoader
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const debug = require('debug')('ee-core:config:config_loader');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { appName, env, getElectronDir, getBaseDir, getRootDir } = require('../ps');
|
|
6
|
+
const { extend } = require('../utils/extend');
|
|
7
|
+
const { loadFile } = require('../loader');
|
|
8
|
+
const { Timing } = require('../core/utils/timing');
|
|
9
|
+
const defaultConfig = require('./default_config');
|
|
10
|
+
|
|
11
|
+
class ConfigLoader {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.timing = new Timing();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Load config/config.xxx.js
|
|
18
|
+
*/
|
|
19
|
+
load() {
|
|
20
|
+
this.timing.start('Load Config');
|
|
21
|
+
|
|
22
|
+
// Load Application config
|
|
23
|
+
const appConfig = this._AppConfig();
|
|
24
|
+
// debug("[load] appConfig: %O", appConfig);
|
|
25
|
+
|
|
26
|
+
const defaultConf = defaultConfig();
|
|
27
|
+
const config = extend(true, defaultConf, appConfig);
|
|
28
|
+
debug("[load] config: %o", config);
|
|
29
|
+
|
|
30
|
+
this.timing.end('Load Config');
|
|
31
|
+
return config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_AppConfig() {
|
|
35
|
+
const names = [
|
|
36
|
+
'config.default',
|
|
37
|
+
`config.${env()}`,
|
|
38
|
+
];
|
|
39
|
+
const target = {};
|
|
40
|
+
for (const filename of names) {
|
|
41
|
+
const config = this._loadConfig(getElectronDir(), filename);
|
|
42
|
+
extend(true, target, config);
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_loadConfig(dirpath, filename) {
|
|
48
|
+
const appInfo = {
|
|
49
|
+
name: appName(),
|
|
50
|
+
baseDir: getBaseDir(),
|
|
51
|
+
electronDir: getElectronDir(),
|
|
52
|
+
env: env(),
|
|
53
|
+
root: getRootDir(),
|
|
54
|
+
}
|
|
55
|
+
const filepath = path.join(dirpath, 'config', filename);
|
|
56
|
+
const config = loadFile(filepath, appInfo);
|
|
57
|
+
debug("[_loadConfig] filepath: %s", filepath);
|
|
58
|
+
if (!config) return null;
|
|
59
|
+
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
ConfigLoader
|
|
66
66
|
};
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { BrowserWindowConstructorOptions } from 'electron';
|
|
2
|
-
|
|
3
|
-
export declare interface AppConfig {
|
|
4
|
-
openDevTools?: boolean | Object;
|
|
5
|
-
singleLock?: boolean;
|
|
6
|
-
windowsOption?: BrowserWindowConstructorOptions;
|
|
7
|
-
logger?: LoggerConfig;
|
|
8
|
-
socketServer?: SocketConfig;
|
|
9
|
-
httpServer?: HttpConfig;
|
|
10
|
-
remote?: RemoteConfig;
|
|
11
|
-
mainServer?: MainConfig;
|
|
12
|
-
exception?: ExceptionConfig;
|
|
13
|
-
job?: JobConfig;
|
|
14
|
-
cross?: CrossConfig;
|
|
15
|
-
}
|
|
16
|
-
export declare interface LoggerConfig {
|
|
17
|
-
type?: string;
|
|
18
|
-
dir?: string;
|
|
19
|
-
encoding?: string;
|
|
20
|
-
env?: string;
|
|
21
|
-
level?: string;
|
|
22
|
-
consoleLevel?: string;
|
|
23
|
-
disableConsoleAfterReady?: boolean;
|
|
24
|
-
outputJSON?: boolean;
|
|
25
|
-
buffer?: boolean;
|
|
26
|
-
appLogName: string;
|
|
27
|
-
coreLogName?: string;
|
|
28
|
-
agentLogName?: string;
|
|
29
|
-
errorLogName: string;
|
|
30
|
-
coreLogger?: {};
|
|
31
|
-
allowDebugAtProd?: boolean;
|
|
32
|
-
enablePerformanceTimer?: boolean;
|
|
33
|
-
rotator?: string;
|
|
34
|
-
}
|
|
35
|
-
export declare interface SocketConfig {
|
|
36
|
-
enable: boolean;
|
|
37
|
-
port: number;
|
|
38
|
-
path?: string;
|
|
39
|
-
connectTimeout?: number;
|
|
40
|
-
pingTimeout?: number;
|
|
41
|
-
pingInterval?: number;
|
|
42
|
-
maxHttpBufferSize?: number;
|
|
43
|
-
transports?: string[];
|
|
44
|
-
cors?: {
|
|
45
|
-
origin?: boolean;
|
|
46
|
-
};
|
|
47
|
-
channel?: string;
|
|
48
|
-
}
|
|
49
|
-
export declare interface HttpConfig {
|
|
50
|
-
enable: boolean;
|
|
51
|
-
https?: {
|
|
52
|
-
enable: boolean;
|
|
53
|
-
key: string;
|
|
54
|
-
cert: string;
|
|
55
|
-
};
|
|
56
|
-
protocol?: string;
|
|
57
|
-
host?: string;
|
|
58
|
-
port: number;
|
|
59
|
-
cors?: {
|
|
60
|
-
origin?: string;
|
|
61
|
-
};
|
|
62
|
-
body?: {
|
|
63
|
-
multipart?: boolean;
|
|
64
|
-
formidable?: {
|
|
65
|
-
keepExtensions?: boolean;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
filterRequest?: {
|
|
69
|
-
uris?: string[];
|
|
70
|
-
returnData?: string;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export declare interface RemoteConfig {
|
|
74
|
-
enable: boolean;
|
|
75
|
-
url: string;
|
|
76
|
-
}
|
|
77
|
-
export declare interface MainConfig {
|
|
78
|
-
protocol?: string;
|
|
79
|
-
indexPath: string;
|
|
80
|
-
options?: {};
|
|
81
|
-
takeover?: string;
|
|
82
|
-
loadingPage?: string;
|
|
83
|
-
channelSeparator?: string;
|
|
84
|
-
}
|
|
85
|
-
export declare interface ExceptionConfig {
|
|
86
|
-
mainExit?: boolean;
|
|
87
|
-
childExit?: boolean;
|
|
88
|
-
rendererExit?: boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare interface JobConfig {
|
|
91
|
-
messageLog: boolean;
|
|
92
|
-
}
|
|
93
|
-
export declare interface CrossConfig {}
|
|
94
|
-
declare function config(): AppConfig;
|
|
95
|
-
export = config;
|
|
1
|
+
import { BrowserWindowConstructorOptions } from 'electron';
|
|
2
|
+
|
|
3
|
+
export declare interface AppConfig {
|
|
4
|
+
openDevTools?: boolean | Object;
|
|
5
|
+
singleLock?: boolean;
|
|
6
|
+
windowsOption?: BrowserWindowConstructorOptions;
|
|
7
|
+
logger?: LoggerConfig;
|
|
8
|
+
socketServer?: SocketConfig;
|
|
9
|
+
httpServer?: HttpConfig;
|
|
10
|
+
remote?: RemoteConfig;
|
|
11
|
+
mainServer?: MainConfig;
|
|
12
|
+
exception?: ExceptionConfig;
|
|
13
|
+
job?: JobConfig;
|
|
14
|
+
cross?: CrossConfig;
|
|
15
|
+
}
|
|
16
|
+
export declare interface LoggerConfig {
|
|
17
|
+
type?: string;
|
|
18
|
+
dir?: string;
|
|
19
|
+
encoding?: string;
|
|
20
|
+
env?: string;
|
|
21
|
+
level?: string;
|
|
22
|
+
consoleLevel?: string;
|
|
23
|
+
disableConsoleAfterReady?: boolean;
|
|
24
|
+
outputJSON?: boolean;
|
|
25
|
+
buffer?: boolean;
|
|
26
|
+
appLogName: string;
|
|
27
|
+
coreLogName?: string;
|
|
28
|
+
agentLogName?: string;
|
|
29
|
+
errorLogName: string;
|
|
30
|
+
coreLogger?: {};
|
|
31
|
+
allowDebugAtProd?: boolean;
|
|
32
|
+
enablePerformanceTimer?: boolean;
|
|
33
|
+
rotator?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare interface SocketConfig {
|
|
36
|
+
enable: boolean;
|
|
37
|
+
port: number;
|
|
38
|
+
path?: string;
|
|
39
|
+
connectTimeout?: number;
|
|
40
|
+
pingTimeout?: number;
|
|
41
|
+
pingInterval?: number;
|
|
42
|
+
maxHttpBufferSize?: number;
|
|
43
|
+
transports?: string[];
|
|
44
|
+
cors?: {
|
|
45
|
+
origin?: boolean;
|
|
46
|
+
};
|
|
47
|
+
channel?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare interface HttpConfig {
|
|
50
|
+
enable: boolean;
|
|
51
|
+
https?: {
|
|
52
|
+
enable: boolean;
|
|
53
|
+
key: string;
|
|
54
|
+
cert: string;
|
|
55
|
+
};
|
|
56
|
+
protocol?: string;
|
|
57
|
+
host?: string;
|
|
58
|
+
port: number;
|
|
59
|
+
cors?: {
|
|
60
|
+
origin?: string;
|
|
61
|
+
};
|
|
62
|
+
body?: {
|
|
63
|
+
multipart?: boolean;
|
|
64
|
+
formidable?: {
|
|
65
|
+
keepExtensions?: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
filterRequest?: {
|
|
69
|
+
uris?: string[];
|
|
70
|
+
returnData?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export declare interface RemoteConfig {
|
|
74
|
+
enable: boolean;
|
|
75
|
+
url: string;
|
|
76
|
+
}
|
|
77
|
+
export declare interface MainConfig {
|
|
78
|
+
protocol?: string;
|
|
79
|
+
indexPath: string;
|
|
80
|
+
options?: {};
|
|
81
|
+
takeover?: string;
|
|
82
|
+
loadingPage?: string;
|
|
83
|
+
channelSeparator?: string;
|
|
84
|
+
}
|
|
85
|
+
export declare interface ExceptionConfig {
|
|
86
|
+
mainExit?: boolean;
|
|
87
|
+
childExit?: boolean;
|
|
88
|
+
rendererExit?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare interface JobConfig {
|
|
91
|
+
messageLog: boolean;
|
|
92
|
+
}
|
|
93
|
+
export declare interface CrossConfig {}
|
|
94
|
+
declare function config(): AppConfig;
|
|
95
|
+
export = config;
|
package/config/default_config.js
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const { env, getBaseDir, getLogDir } = require('../ps');
|
|
5
|
-
const { SocketIO } = require('../const/channel');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* default
|
|
9
|
-
*/
|
|
10
|
-
module.exports = () => {
|
|
11
|
-
return {
|
|
12
|
-
openDevTools: false,
|
|
13
|
-
singleLock: true,
|
|
14
|
-
windowsOption: {
|
|
15
|
-
title: 'electron-egg',
|
|
16
|
-
width: 980,
|
|
17
|
-
height: 650,
|
|
18
|
-
minWidth: 400,
|
|
19
|
-
minHeight: 300,
|
|
20
|
-
webPreferences: {
|
|
21
|
-
//webSecurity: false,
|
|
22
|
-
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
|
23
|
-
nodeIntegration: true,
|
|
24
|
-
//preload: path.join(appInfo.electronDir, 'preload', 'bridge.js'),
|
|
25
|
-
},
|
|
26
|
-
frame: true,
|
|
27
|
-
show: false,
|
|
28
|
-
icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
|
|
29
|
-
},
|
|
30
|
-
logger: {
|
|
31
|
-
type: 'application',
|
|
32
|
-
dir: getLogDir(),
|
|
33
|
-
encoding: 'utf8',
|
|
34
|
-
env: env(),
|
|
35
|
-
level: 'INFO',
|
|
36
|
-
consoleLevel: 'INFO',
|
|
37
|
-
disableConsoleAfterReady: env() !== 'local',
|
|
38
|
-
outputJSON: false,
|
|
39
|
-
buffer: true,
|
|
40
|
-
appLogName: `ee.log`,
|
|
41
|
-
coreLogName: 'ee-core.log',
|
|
42
|
-
agentLogName: 'ee-agent.log',
|
|
43
|
-
errorLogName: `ee-error.log`,
|
|
44
|
-
coreLogger: {},
|
|
45
|
-
allowDebugAtProd: false,
|
|
46
|
-
enablePerformanceTimer: false,
|
|
47
|
-
rotator: 'day',
|
|
48
|
-
},
|
|
49
|
-
socketServer: {
|
|
50
|
-
enable: false, // is it enabled
|
|
51
|
-
port: 7070, // default port (if the port is in use, randomly select one)
|
|
52
|
-
path: "/socket.io/", // path
|
|
53
|
-
connectTimeout: 45000, // client connection timeout
|
|
54
|
-
pingTimeout: 30000, // heartbeat detection timeout
|
|
55
|
-
pingInterval: 25000, // heartbeat detection interval
|
|
56
|
-
maxHttpBufferSize: 1e8, // the data size of each message 1M
|
|
57
|
-
transports: ["polling", "websocket"], // http polling or websocket
|
|
58
|
-
cors: {
|
|
59
|
-
origin: true, // http协议时,要设置跨域 类型 Boolean String RegExp Array Function
|
|
60
|
-
},
|
|
61
|
-
channel: SocketIO.partySoftware
|
|
62
|
-
},
|
|
63
|
-
httpServer: {
|
|
64
|
-
enable: false, // Is it enabled
|
|
65
|
-
https: {
|
|
66
|
-
enable: false,
|
|
67
|
-
key: '/public/ssl/localhost+1.key',
|
|
68
|
-
cert: '/public/ssl/localhost+1.pem'
|
|
69
|
-
},
|
|
70
|
-
protocol: 'http://',
|
|
71
|
-
host: '127.0.0.1',
|
|
72
|
-
port: 7071, // Default port (if the port is in use, randomly select one)
|
|
73
|
-
cors: {
|
|
74
|
-
origin: "*"
|
|
75
|
-
},
|
|
76
|
-
body: {
|
|
77
|
-
multipart: true,
|
|
78
|
-
formidable: {
|
|
79
|
-
keepExtensions: true
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
filterRequest: {
|
|
83
|
-
uris: [
|
|
84
|
-
'favicon.ico'
|
|
85
|
-
],
|
|
86
|
-
returnData: ''
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
remote: {
|
|
90
|
-
enable: false,
|
|
91
|
-
url: ''
|
|
92
|
-
},
|
|
93
|
-
mainServer: {
|
|
94
|
-
protocol: 'file://', // file://
|
|
95
|
-
indexPath: '/public/dist/index.html',
|
|
96
|
-
options: {},
|
|
97
|
-
takeover: '',
|
|
98
|
-
loadingPage: '',
|
|
99
|
-
channelSeparator: '/',
|
|
100
|
-
},
|
|
101
|
-
exception: {
|
|
102
|
-
mainExit: false,
|
|
103
|
-
childExit: false,
|
|
104
|
-
rendererExit: true,
|
|
105
|
-
},
|
|
106
|
-
jobs: {
|
|
107
|
-
messageLog: false
|
|
108
|
-
},
|
|
109
|
-
cross: {}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { env, getBaseDir, getLogDir } = require('../ps');
|
|
5
|
+
const { SocketIO } = require('../const/channel');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* default
|
|
9
|
+
*/
|
|
10
|
+
module.exports = () => {
|
|
11
|
+
return {
|
|
12
|
+
openDevTools: false,
|
|
13
|
+
singleLock: true,
|
|
14
|
+
windowsOption: {
|
|
15
|
+
title: 'electron-egg',
|
|
16
|
+
width: 980,
|
|
17
|
+
height: 650,
|
|
18
|
+
minWidth: 400,
|
|
19
|
+
minHeight: 300,
|
|
20
|
+
webPreferences: {
|
|
21
|
+
//webSecurity: false,
|
|
22
|
+
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
|
23
|
+
nodeIntegration: true,
|
|
24
|
+
//preload: path.join(appInfo.electronDir, 'preload', 'bridge.js'),
|
|
25
|
+
},
|
|
26
|
+
frame: true,
|
|
27
|
+
show: false,
|
|
28
|
+
icon: path.join(getBaseDir(), 'public', 'images', 'logo-32.png'),
|
|
29
|
+
},
|
|
30
|
+
logger: {
|
|
31
|
+
type: 'application',
|
|
32
|
+
dir: getLogDir(),
|
|
33
|
+
encoding: 'utf8',
|
|
34
|
+
env: env(),
|
|
35
|
+
level: 'INFO',
|
|
36
|
+
consoleLevel: 'INFO',
|
|
37
|
+
disableConsoleAfterReady: env() !== 'local',
|
|
38
|
+
outputJSON: false,
|
|
39
|
+
buffer: true,
|
|
40
|
+
appLogName: `ee.log`,
|
|
41
|
+
coreLogName: 'ee-core.log',
|
|
42
|
+
agentLogName: 'ee-agent.log',
|
|
43
|
+
errorLogName: `ee-error.log`,
|
|
44
|
+
coreLogger: {},
|
|
45
|
+
allowDebugAtProd: false,
|
|
46
|
+
enablePerformanceTimer: false,
|
|
47
|
+
rotator: 'day',
|
|
48
|
+
},
|
|
49
|
+
socketServer: {
|
|
50
|
+
enable: false, // is it enabled
|
|
51
|
+
port: 7070, // default port (if the port is in use, randomly select one)
|
|
52
|
+
path: "/socket.io/", // path
|
|
53
|
+
connectTimeout: 45000, // client connection timeout
|
|
54
|
+
pingTimeout: 30000, // heartbeat detection timeout
|
|
55
|
+
pingInterval: 25000, // heartbeat detection interval
|
|
56
|
+
maxHttpBufferSize: 1e8, // the data size of each message 1M
|
|
57
|
+
transports: ["polling", "websocket"], // http polling or websocket
|
|
58
|
+
cors: {
|
|
59
|
+
origin: true, // http协议时,要设置跨域 类型 Boolean String RegExp Array Function
|
|
60
|
+
},
|
|
61
|
+
channel: SocketIO.partySoftware
|
|
62
|
+
},
|
|
63
|
+
httpServer: {
|
|
64
|
+
enable: false, // Is it enabled
|
|
65
|
+
https: {
|
|
66
|
+
enable: false,
|
|
67
|
+
key: '/public/ssl/localhost+1.key',
|
|
68
|
+
cert: '/public/ssl/localhost+1.pem'
|
|
69
|
+
},
|
|
70
|
+
protocol: 'http://',
|
|
71
|
+
host: '127.0.0.1',
|
|
72
|
+
port: 7071, // Default port (if the port is in use, randomly select one)
|
|
73
|
+
cors: {
|
|
74
|
+
origin: "*"
|
|
75
|
+
},
|
|
76
|
+
body: {
|
|
77
|
+
multipart: true,
|
|
78
|
+
formidable: {
|
|
79
|
+
keepExtensions: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
filterRequest: {
|
|
83
|
+
uris: [
|
|
84
|
+
'favicon.ico'
|
|
85
|
+
],
|
|
86
|
+
returnData: ''
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
remote: {
|
|
90
|
+
enable: false,
|
|
91
|
+
url: ''
|
|
92
|
+
},
|
|
93
|
+
mainServer: {
|
|
94
|
+
protocol: 'file://', // file://
|
|
95
|
+
indexPath: '/public/dist/index.html',
|
|
96
|
+
options: {},
|
|
97
|
+
takeover: '',
|
|
98
|
+
loadingPage: '',
|
|
99
|
+
channelSeparator: '/',
|
|
100
|
+
},
|
|
101
|
+
exception: {
|
|
102
|
+
mainExit: false,
|
|
103
|
+
childExit: false,
|
|
104
|
+
rendererExit: true,
|
|
105
|
+
},
|
|
106
|
+
jobs: {
|
|
107
|
+
messageLog: false
|
|
108
|
+
},
|
|
109
|
+
cross: {}
|
|
110
|
+
}
|
|
111
|
+
}
|
package/config/index.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AppConfig,
|
|
3
|
-
WindowsConfig,
|
|
4
|
-
LoggerConfig,
|
|
5
|
-
SocketConfig,
|
|
6
|
-
HttpConfig,
|
|
7
|
-
RemoteConfig,
|
|
8
|
-
MainConfig,
|
|
9
|
-
ExceptionConfig,
|
|
10
|
-
JobConfig,
|
|
11
|
-
CrossConfig
|
|
12
|
-
} from "./default_config";
|
|
13
|
-
declare function loadConfig(): AppConfig;
|
|
14
|
-
declare function getConfig(): AppConfig;
|
|
15
|
-
export {
|
|
16
|
-
AppConfig,
|
|
17
|
-
WindowsConfig,
|
|
18
|
-
LoggerConfig,
|
|
19
|
-
SocketConfig,
|
|
20
|
-
HttpConfig,
|
|
21
|
-
RemoteConfig,
|
|
22
|
-
MainConfig,
|
|
23
|
-
ExceptionConfig,
|
|
24
|
-
JobConfig,
|
|
25
|
-
CrossConfig,
|
|
26
|
-
loadConfig,
|
|
27
|
-
getConfig
|
|
28
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
AppConfig,
|
|
3
|
+
WindowsConfig,
|
|
4
|
+
LoggerConfig,
|
|
5
|
+
SocketConfig,
|
|
6
|
+
HttpConfig,
|
|
7
|
+
RemoteConfig,
|
|
8
|
+
MainConfig,
|
|
9
|
+
ExceptionConfig,
|
|
10
|
+
JobConfig,
|
|
11
|
+
CrossConfig
|
|
12
|
+
} from "./default_config";
|
|
13
|
+
declare function loadConfig(): AppConfig;
|
|
14
|
+
declare function getConfig(): AppConfig;
|
|
15
|
+
export {
|
|
16
|
+
AppConfig,
|
|
17
|
+
WindowsConfig,
|
|
18
|
+
LoggerConfig,
|
|
19
|
+
SocketConfig,
|
|
20
|
+
HttpConfig,
|
|
21
|
+
RemoteConfig,
|
|
22
|
+
MainConfig,
|
|
23
|
+
ExceptionConfig,
|
|
24
|
+
JobConfig,
|
|
25
|
+
CrossConfig,
|
|
26
|
+
loadConfig,
|
|
27
|
+
getConfig
|
|
28
|
+
}
|
package/config/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { ConfigLoader } = require('./config_loader');
|
|
4
|
-
|
|
5
|
-
const Instance = {
|
|
6
|
-
config: null,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
function loadConfig() {
|
|
10
|
-
const configLoader = new ConfigLoader();
|
|
11
|
-
Instance["config"] = configLoader.load();
|
|
12
|
-
return Instance["config"];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getConfig() {
|
|
16
|
-
if (!Instance["config"]) {
|
|
17
|
-
loadConfig();
|
|
18
|
-
};
|
|
19
|
-
return Instance["config"];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
loadConfig,
|
|
24
|
-
getConfig,
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { ConfigLoader } = require('./config_loader');
|
|
4
|
+
|
|
5
|
+
const Instance = {
|
|
6
|
+
config: null,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function loadConfig() {
|
|
10
|
+
const configLoader = new ConfigLoader();
|
|
11
|
+
Instance["config"] = configLoader.load();
|
|
12
|
+
return Instance["config"];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getConfig() {
|
|
16
|
+
if (!Instance["config"]) {
|
|
17
|
+
loadConfig();
|
|
18
|
+
};
|
|
19
|
+
return Instance["config"];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = {
|
|
23
|
+
loadConfig,
|
|
24
|
+
getConfig,
|
|
25
25
|
};
|
package/const/channel.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export declare namespace Processes {
|
|
2
|
-
let showException: string;
|
|
3
|
-
let sendToMain: string;
|
|
4
|
-
}
|
|
5
|
-
export declare namespace SocketIO {
|
|
6
|
-
let partySoftware: string;
|
|
7
|
-
}
|
|
8
|
-
export declare namespace Events {
|
|
9
|
-
let childProcessExit: string;
|
|
10
|
-
let childProcessError: string;
|
|
11
|
-
}
|
|
12
|
-
export declare namespace Receiver {
|
|
13
|
-
let childJob: string;
|
|
14
|
-
let forkProcess: string;
|
|
15
|
-
let all: string;
|
|
16
|
-
}
|
|
1
|
+
export declare namespace Processes {
|
|
2
|
+
let showException: string;
|
|
3
|
+
let sendToMain: string;
|
|
4
|
+
}
|
|
5
|
+
export declare namespace SocketIO {
|
|
6
|
+
let partySoftware: string;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace Events {
|
|
9
|
+
let childProcessExit: string;
|
|
10
|
+
let childProcessError: string;
|
|
11
|
+
}
|
|
12
|
+
export declare namespace Receiver {
|
|
13
|
+
let childJob: string;
|
|
14
|
+
let forkProcess: string;
|
|
15
|
+
let all: string;
|
|
16
|
+
}
|