@whyour/qinglong 2.18.0 → 2.18.2-0
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/README-en.md +4 -127
- package/README.md +4 -125
- package/SECURITY.md +5 -0
- package/back.d.ts +9 -0
- package/package.json +6 -8
- package/sample/ql_sample.js +6 -0
- package/sample/ql_sample.py +6 -1
- package/shell/api.sh +4 -1
- package/shell/preload/client.js +45 -0
- package/shell/preload/client.py +113 -0
- package/shell/preload/sitecustomize.js +2 -0
- package/shell/preload/sitecustomize.py +2 -1
- package/shell/share.sh +15 -4
- package/shell/update.sh +2 -1
- package/static/build/api/log.js +1 -1
- package/static/build/app.js +0 -1
- package/static/build/config/index.js +0 -2
- package/static/build/config/util.js +8 -4
- package/static/build/data/env.js +1 -1
- package/static/build/loaders/db.js +0 -70
- package/static/build/loaders/express.js +2 -27
- package/static/build/loaders/initData.js +20 -12
- package/static/build/protos/api.js +1084 -0
- package/static/build/protos/cron.js +36 -27
- package/static/build/protos/health.js +12 -3
- package/static/build/schedule/api.js +140 -0
- package/static/build/schedule/index.js +26 -0
- package/static/build/services/env.js +1 -1
- package/static/build/services/notify.js +19 -34
- package/static/build/services/open.js +11 -3
- package/static/build/services/system.js +1 -1
- package/static/build/shared/pLimit.js +12 -1
- package/static/dist/2208.c1a40612.async.js +1 -0
- package/static/dist/{8528.3dffc548.async.js → 3127.2579e73a.async.js} +1 -1
- package/static/dist/{2237.4d3def87.async.js → 3191.f56b00f8.async.js} +1 -1
- package/static/dist/4402.49bbe98d.async.js +1 -0
- package/static/dist/{5312.5545b3ed.async.js → 5312.74b95311.async.js} +1 -1
- package/static/dist/{1149.33cb7e7a.async.js → 7253.4b9bf133.async.js} +1 -1
- package/static/dist/{872.10bd0974.async.js → 7508.a31662a3.async.js} +1 -1
- package/static/dist/{2081.d0d781b1.async.js → 7984.e6bb9378.async.js} +1 -1
- package/static/dist/8317.c44c1ebd.async.js +1 -0
- package/static/dist/874.ae8edb1a.async.js +1 -0
- package/static/dist/8826.37966028.async.js +1 -0
- package/static/dist/{4799.d5ca9f30.async.js → 9313.37acaf13.async.js} +1 -1
- package/static/dist/index.html +2 -2
- package/static/dist/layouts__index.c986408d.async.js +1 -0
- package/static/dist/preload_helper.6482f199.js +1 -0
- package/static/dist/src__pages__404.771168fc.async.js +1 -0
- package/static/dist/src__pages__config__index.de6dca30.async.js +1 -0
- package/static/dist/{src__pages__crontab__detail.6f7c3205.async.js → src__pages__crontab__detail.80d30a01.async.js} +1 -1
- package/static/dist/src__pages__crontab__index.9e38b6dc.async.js +1 -0
- package/static/dist/{src__pages__crontab__logModal.c88ea3b7.async.js → src__pages__crontab__logModal.6a345e8a.async.js} +1 -1
- package/static/dist/src__pages__crontab__modal.78b1e588.async.js +1 -0
- package/static/dist/{src__pages__crontab__type.5895ed02.async.js → src__pages__crontab__type.bde5cda4.async.js} +1 -1
- package/static/dist/src__pages__crontab__viewManageModal.4874669b.async.js +1 -0
- package/static/dist/src__pages__dependence__index.4a0af2b9.async.js +1 -0
- package/static/dist/src__pages__dependence__modal.e6696a7c.async.js +1 -0
- package/static/dist/{src__pages__dependence__type.bdac3725.async.js → src__pages__dependence__type.e48c5c88.async.js} +1 -1
- package/static/dist/src__pages__diff__index.a4176b58.async.js +1 -0
- package/static/dist/src__pages__env__editNameModal.02322e80.async.js +1 -0
- package/static/dist/src__pages__env__index.f3bfe0c7.async.js +1 -0
- package/static/dist/src__pages__env__modal.066399fd.async.js +1 -0
- package/static/dist/src__pages__error__index.656c9940.async.js +1 -0
- package/static/dist/src__pages__initialization__index.75484c39.async.js +1 -0
- package/static/dist/src__pages__log__index.8a782756.async.js +1 -0
- package/static/dist/src__pages__login__index.8a653852.async.js +1 -0
- package/static/dist/src__pages__script__editModal.e7bf71bd.async.js +1 -0
- package/static/dist/src__pages__script__editNameModal.c048343e.async.js +1 -0
- package/static/dist/src__pages__script__index.9d9099c1.async.js +1 -0
- package/static/dist/src__pages__script__renameModal.357c6c72.async.js +1 -0
- package/static/dist/src__pages__script__saveModal.61fcb1fe.async.js +1 -0
- package/static/dist/src__pages__script__setting.f2d78204.async.js +1 -0
- package/static/dist/{src__pages__setting__about.3a1a6f3b.async.js → src__pages__setting__about.3d3c019f.async.js} +1 -1
- package/static/dist/src__pages__setting__appModal.9eeaeee7.async.js +1 -0
- package/static/dist/{src__pages__setting__checkUpdate.0dfdaf7c.async.js → src__pages__setting__checkUpdate.04c00c9c.async.js} +1 -1
- package/static/dist/src__pages__setting__dependence.0dd0969b.async.js +1 -0
- package/static/dist/src__pages__setting__index.46a8e768.async.js +1 -0
- package/static/dist/{src__pages__setting__loginLog.fc87584a.async.js → src__pages__setting__loginLog.cea6056c.async.js} +1 -1
- package/static/dist/src__pages__setting__notification.b038afec.async.js +1 -0
- package/static/dist/{src__pages__setting__other.34ccb2e8.async.js → src__pages__setting__other.0d869d58.async.js} +1 -1
- package/static/dist/{src__pages__setting__progress.75143dca.async.js → src__pages__setting__progress.8823ac90.async.js} +1 -1
- package/static/dist/src__pages__setting__security.af57bd6a.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.501844bd.async.js +1 -0
- package/static/dist/src__pages__subscription__index.b43143e7.async.js +1 -0
- package/static/dist/{src__pages__subscription__logModal.b3c7c02c.async.js → src__pages__subscription__logModal.02c80eb3.async.js} +1 -1
- package/static/dist/src__pages__subscription__modal.a61ece75.async.js +1 -0
- package/static/dist/umi.e783bacd.js +1 -0
- package/version.yaml +6 -7
- package/static/build/loaders/sentry.js +0 -53
- package/static/dist/2634.a765cd37.async.js +0 -1
- package/static/dist/4642.9e24d86c.async.js +0 -1
- package/static/dist/4865.98e5a005.async.js +0 -1
- package/static/dist/852.15be2189.async.js +0 -1
- package/static/dist/9065.df8d5dcc.async.js +0 -1
- package/static/dist/layouts__index.c164d41f.async.js +0 -1
- package/static/dist/preload_helper.55b35ae0.js +0 -1
- package/static/dist/src__pages__404.6871535b.async.js +0 -1
- package/static/dist/src__pages__config__index.39b5f99f.async.js +0 -1
- package/static/dist/src__pages__crontab__index.55a8714d.async.js +0 -1
- package/static/dist/src__pages__crontab__modal.328fee41.async.js +0 -1
- package/static/dist/src__pages__crontab__viewManageModal.c71ebc5a.async.js +0 -1
- package/static/dist/src__pages__dependence__index.edec638b.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.9fd1176b.async.js +0 -1
- package/static/dist/src__pages__diff__index.8ba53a1e.async.js +0 -1
- package/static/dist/src__pages__env__editNameModal.c35e96f9.async.js +0 -1
- package/static/dist/src__pages__env__index.c799138c.async.js +0 -1
- package/static/dist/src__pages__env__modal.3b0ca9a6.async.js +0 -1
- package/static/dist/src__pages__error__index.0221fcd9.async.js +0 -1
- package/static/dist/src__pages__initialization__index.346725d1.async.js +0 -1
- package/static/dist/src__pages__log__index.2fd615f2.async.js +0 -1
- package/static/dist/src__pages__login__index.1dd6e684.async.js +0 -1
- package/static/dist/src__pages__script__editModal.28caeb56.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.1155d34c.async.js +0 -1
- package/static/dist/src__pages__script__index.6a212c2d.async.js +0 -1
- package/static/dist/src__pages__script__renameModal.dabfccfd.async.js +0 -1
- package/static/dist/src__pages__script__saveModal.04d43882.async.js +0 -1
- package/static/dist/src__pages__script__setting.9d5ad53c.async.js +0 -1
- package/static/dist/src__pages__setting__appModal.7b3bff1e.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.a9b7ed43.async.js +0 -1
- package/static/dist/src__pages__setting__index.ffa1cdd6.async.js +0 -1
- package/static/dist/src__pages__setting__notification.97b1d997.async.js +0 -1
- package/static/dist/src__pages__setting__security.c777fb87.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.63e9c69d.async.js +0 -1
- package/static/dist/src__pages__subscription__index.69a6de02.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.aefaf070.async.js +0 -1
- package/static/dist/umi.fb3ed7a0.js +0 -1
- /package/static/dist/{2625.675b6a18.chunk.css → 1883.675b6a18.chunk.css} +0 -0
- /package/static/dist/{872.3fffed15.chunk.css → 7508.3fffed15.chunk.css} +0 -0
|
@@ -48,7 +48,6 @@ const extraFile = path_1.default.join(configPath, 'extra.sh');
|
|
|
48
48
|
const confBakDir = path_1.default.join(dataPath, 'config/bak/');
|
|
49
49
|
const sampleFile = path_1.default.join(samplePath, 'config.sample.sh');
|
|
50
50
|
const sqliteFile = path_1.default.join(samplePath, 'database.sqlite');
|
|
51
|
-
const systemNotifyFile = path_1.default.join(preloadPath, 'system-notify.json');
|
|
52
51
|
const authError = '错误的用户名密码,请重试';
|
|
53
52
|
const loginFaild = '请先登录!';
|
|
54
53
|
const configString = 'config sample crontab shareCode diy';
|
|
@@ -129,6 +128,5 @@ exports.default = {
|
|
|
129
128
|
sqliteFile,
|
|
130
129
|
sshdPath,
|
|
131
130
|
systemLogPath,
|
|
132
|
-
systemNotifyFile,
|
|
133
131
|
};
|
|
134
132
|
//# sourceMappingURL=index.js.map
|
|
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.updateLinuxMirrorFile = exports.detectOS = exports.rmPath = exports.safeJSONParse = exports.getUniqPath = exports.parseContentVersion = exports.parseVersion = exports.getPid = exports.killTask = exports.psTree = exports.parseBody = exports.parseHeaders = exports.promiseExecSuccess = exports.promiseExec = exports.readDir = exports.readDirs = exports.dirSort = exports.concurrentRun = exports.handleLogPath = exports.createFile = exports.fileExist = exports.getPlatform = exports.getNetIp = exports.getToken = exports.getLastModifyFilePath = exports.getFileContentByName = void 0;
|
|
32
|
+
exports.updateLinuxMirrorFile = exports.detectOS = exports.rmPath = exports.safeJSONParse = exports.getUniqPath = exports.parseContentVersion = exports.parseVersion = exports.getPid = exports.killTask = exports.psTree = exports.parseBody = exports.parseHeaders = exports.promiseExecSuccess = exports.promiseExec = exports.readDir = exports.readDirs = exports.dirSort = exports.concurrentRun = exports.handleLogPath = exports.createFile = exports.fileExist = exports.getPlatform = exports.getNetIp = exports.getToken = exports.getLastModifyFilePath = exports.removeAnsi = exports.getFileContentByName = void 0;
|
|
33
33
|
const fs = __importStar(require("fs/promises"));
|
|
34
34
|
const path = __importStar(require("path"));
|
|
35
35
|
const got_1 = __importDefault(require("got"));
|
|
@@ -54,6 +54,10 @@ async function getFileContentByName(fileName) {
|
|
|
54
54
|
return '';
|
|
55
55
|
}
|
|
56
56
|
exports.getFileContentByName = getFileContentByName;
|
|
57
|
+
function removeAnsi(text) {
|
|
58
|
+
return text.replace(/\x1b\[\d+m/g, '');
|
|
59
|
+
}
|
|
60
|
+
exports.removeAnsi = removeAnsi;
|
|
57
61
|
async function getLastModifyFilePath(dir) {
|
|
58
62
|
let filePath = '';
|
|
59
63
|
const _exsit = await fileExist(dir);
|
|
@@ -250,7 +254,7 @@ var FileType;
|
|
|
250
254
|
})(FileType || (FileType = {}));
|
|
251
255
|
function dirSort(a, b) {
|
|
252
256
|
if (a.type === 'file' && b.type === 'file') {
|
|
253
|
-
return b.
|
|
257
|
+
return b.createTime - a.createTime;
|
|
254
258
|
}
|
|
255
259
|
else if (a.type === 'directory' && b.type === 'directory') {
|
|
256
260
|
return a.title.localeCompare(b.title);
|
|
@@ -278,7 +282,7 @@ async function readDirs(dir, baseDir = '', blacklist = [], sort = dirSort) {
|
|
|
278
282
|
key,
|
|
279
283
|
type: 'directory',
|
|
280
284
|
parent: relativePath,
|
|
281
|
-
|
|
285
|
+
createTime: stats.birthtime.getTime(),
|
|
282
286
|
children: children.sort(sort),
|
|
283
287
|
});
|
|
284
288
|
}
|
|
@@ -289,7 +293,7 @@ async function readDirs(dir, baseDir = '', blacklist = [], sort = dirSort) {
|
|
|
289
293
|
key,
|
|
290
294
|
parent: relativePath,
|
|
291
295
|
size: stats.size,
|
|
292
|
-
|
|
296
|
+
createTime: stats.birthtime.getTime(),
|
|
293
297
|
});
|
|
294
298
|
}
|
|
295
299
|
}
|
package/static/build/data/env.js
CHANGED
|
@@ -4,17 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const logger_1 = __importDefault(require("./logger"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const nedb_1 = __importDefault(require("nedb"));
|
|
9
7
|
const env_1 = require("../data/env");
|
|
10
8
|
const cron_1 = require("../data/cron");
|
|
11
9
|
const dependence_1 = require("../data/dependence");
|
|
12
10
|
const open_1 = require("../data/open");
|
|
13
11
|
const system_1 = require("../data/system");
|
|
14
|
-
const util_1 = require("../config/util");
|
|
15
12
|
const subscription_1 = require("../data/subscription");
|
|
16
13
|
const cronView_1 = require("../data/cronView");
|
|
17
|
-
const config_1 = __importDefault(require("../config"));
|
|
18
14
|
const data_1 = require("../data");
|
|
19
15
|
exports.default = async () => {
|
|
20
16
|
try {
|
|
@@ -62,72 +58,6 @@ exports.default = async () => {
|
|
|
62
58
|
await data_1.sequelize.query('alter table Crontabs add column task_after TEXT');
|
|
63
59
|
}
|
|
64
60
|
catch (error) { }
|
|
65
|
-
// 2.10-2.11 升级
|
|
66
|
-
const cronDbFile = path_1.default.join(config_1.default.rootPath, 'db/crontab.db');
|
|
67
|
-
const envDbFile = path_1.default.join(config_1.default.rootPath, 'db/env.db');
|
|
68
|
-
const appDbFile = path_1.default.join(config_1.default.rootPath, 'db/app.db');
|
|
69
|
-
const authDbFile = path_1.default.join(config_1.default.rootPath, 'db/auth.db');
|
|
70
|
-
const dependenceDbFile = path_1.default.join(config_1.default.rootPath, 'db/dependence.db');
|
|
71
|
-
const crondbExist = await (0, util_1.fileExist)(cronDbFile);
|
|
72
|
-
const dependenceDbExist = await (0, util_1.fileExist)(dependenceDbFile);
|
|
73
|
-
const envDbExist = await (0, util_1.fileExist)(envDbFile);
|
|
74
|
-
const appDbExist = await (0, util_1.fileExist)(appDbFile);
|
|
75
|
-
const authDbExist = await (0, util_1.fileExist)(authDbFile);
|
|
76
|
-
const cronCount = await cron_1.CrontabModel.count();
|
|
77
|
-
const dependenceCount = await dependence_1.DependenceModel.count();
|
|
78
|
-
const envCount = await env_1.EnvModel.count();
|
|
79
|
-
const appCount = await open_1.AppModel.count();
|
|
80
|
-
const authCount = await system_1.SystemModel.count();
|
|
81
|
-
if (crondbExist && cronCount === 0) {
|
|
82
|
-
const cronDb = new nedb_1.default({
|
|
83
|
-
filename: cronDbFile,
|
|
84
|
-
autoload: true,
|
|
85
|
-
});
|
|
86
|
-
cronDb.persistence.compactDatafile();
|
|
87
|
-
cronDb.find({}).exec(async (err, docs) => {
|
|
88
|
-
await cron_1.CrontabModel.bulkCreate(docs, { ignoreDuplicates: true });
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (dependenceDbExist && dependenceCount === 0) {
|
|
92
|
-
const dependenceDb = new nedb_1.default({
|
|
93
|
-
filename: dependenceDbFile,
|
|
94
|
-
autoload: true,
|
|
95
|
-
});
|
|
96
|
-
dependenceDb.persistence.compactDatafile();
|
|
97
|
-
dependenceDb.find({}).exec(async (err, docs) => {
|
|
98
|
-
await dependence_1.DependenceModel.bulkCreate(docs, { ignoreDuplicates: true });
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
if (envDbExist && envCount === 0) {
|
|
102
|
-
const envDb = new nedb_1.default({
|
|
103
|
-
filename: envDbFile,
|
|
104
|
-
autoload: true,
|
|
105
|
-
});
|
|
106
|
-
envDb.persistence.compactDatafile();
|
|
107
|
-
envDb.find({}).exec(async (err, docs) => {
|
|
108
|
-
await env_1.EnvModel.bulkCreate(docs, { ignoreDuplicates: true });
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
if (appDbExist && appCount === 0) {
|
|
112
|
-
const appDb = new nedb_1.default({
|
|
113
|
-
filename: appDbFile,
|
|
114
|
-
autoload: true,
|
|
115
|
-
});
|
|
116
|
-
appDb.persistence.compactDatafile();
|
|
117
|
-
appDb.find({}).exec(async (err, docs) => {
|
|
118
|
-
await open_1.AppModel.bulkCreate(docs, { ignoreDuplicates: true });
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
if (authDbExist && authCount === 0) {
|
|
122
|
-
const authDb = new nedb_1.default({
|
|
123
|
-
filename: authDbFile,
|
|
124
|
-
autoload: true,
|
|
125
|
-
});
|
|
126
|
-
authDb.persistence.compactDatafile();
|
|
127
|
-
authDb.find({}).exec(async (err, docs) => {
|
|
128
|
-
await system_1.SystemModel.bulkCreate(docs, { ignoreDuplicates: true });
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
61
|
console.log('✌️ DB loaded');
|
|
132
62
|
logger_1.default.info('✌️ DB loaded');
|
|
133
63
|
}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -34,7 +11,6 @@ const config_1 = __importDefault(require("../config"));
|
|
|
34
11
|
const express_jwt_1 = require("express-jwt");
|
|
35
12
|
const util_1 = require("../config/util");
|
|
36
13
|
const express_urlrewrite_1 = __importDefault(require("express-urlrewrite"));
|
|
37
|
-
const Sentry = __importStar(require("@sentry/node"));
|
|
38
14
|
const celebrate_1 = require("celebrate");
|
|
39
15
|
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
40
16
|
const serverEnv_1 = require("../config/serverEnv");
|
|
@@ -132,7 +108,6 @@ exports.default = ({ app }) => {
|
|
|
132
108
|
next(err);
|
|
133
109
|
});
|
|
134
110
|
app.use((0, celebrate_1.errors)());
|
|
135
|
-
Sentry.setupExpressErrorHandler(app);
|
|
136
111
|
app.use((err, req, res, next) => {
|
|
137
112
|
if (err.name === 'UnauthorizedError') {
|
|
138
113
|
return res
|
|
@@ -148,8 +123,8 @@ exports.default = ({ app }) => {
|
|
|
148
123
|
.status(500)
|
|
149
124
|
.send({
|
|
150
125
|
code: 400,
|
|
151
|
-
message: `${err.
|
|
152
|
-
|
|
126
|
+
message: `${err.message}`,
|
|
127
|
+
errors: err.errors,
|
|
153
128
|
})
|
|
154
129
|
.end();
|
|
155
130
|
}
|
|
@@ -22,8 +22,9 @@ const util_1 = require("../config/util");
|
|
|
22
22
|
const open_1 = __importDefault(require("../services/open"));
|
|
23
23
|
const store_1 = require("../shared/store");
|
|
24
24
|
const logger_1 = __importDefault(require("./logger"));
|
|
25
|
+
const open_2 = require("../data/open");
|
|
25
26
|
exports.default = async () => {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27
28
|
const cronService = typedi_1.Container.get(cron_2.default);
|
|
28
29
|
const envService = typedi_1.Container.get(env_1.default);
|
|
29
30
|
const dependenceService = typedi_1.Container.get(dependence_1.default);
|
|
@@ -31,10 +32,21 @@ exports.default = async () => {
|
|
|
31
32
|
const userService = typedi_1.Container.get(user_1.default);
|
|
32
33
|
const openService = typedi_1.Container.get(open_1.default);
|
|
33
34
|
// 初始化增加系统配置
|
|
35
|
+
let systemApp = (_a = (await open_2.AppModel.findOne({
|
|
36
|
+
where: { name: 'system' },
|
|
37
|
+
}))) === null || _a === void 0 ? void 0 : _a.get({ plain: true });
|
|
38
|
+
if (!systemApp) {
|
|
39
|
+
systemApp = await open_2.AppModel.create({
|
|
40
|
+
name: 'system',
|
|
41
|
+
scopes: ['crons', 'system'],
|
|
42
|
+
client_id: (0, util_1.createRandomString)(12, 12),
|
|
43
|
+
client_secret: (0, util_1.createRandomString)(24, 24),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
34
46
|
const [systemConfig] = await system_1.SystemModel.findOrCreate({
|
|
35
47
|
where: { type: system_1.AuthDataType.systemConfig },
|
|
36
48
|
});
|
|
37
|
-
|
|
49
|
+
await system_1.SystemModel.findOrCreate({
|
|
38
50
|
where: { type: system_1.AuthDataType.notification },
|
|
39
51
|
});
|
|
40
52
|
const [authConfig] = await system_1.SystemModel.findOrCreate({
|
|
@@ -58,10 +70,6 @@ exports.default = async () => {
|
|
|
58
70
|
type: system_1.AuthDataType.authConfig,
|
|
59
71
|
});
|
|
60
72
|
}
|
|
61
|
-
// 初始化通知配置
|
|
62
|
-
if (notifyConfig.info) {
|
|
63
|
-
await (0, promises_1.writeFile)(config_1.default.systemNotifyFile, JSON.stringify(notifyConfig.info));
|
|
64
|
-
}
|
|
65
73
|
const installDependencies = () => {
|
|
66
74
|
// 初始化时安装所有处于安装中,安装成功,安装失败的依赖
|
|
67
75
|
dependence_2.DependenceModel.findAll({
|
|
@@ -79,22 +87,22 @@ exports.default = async () => {
|
|
|
79
87
|
});
|
|
80
88
|
};
|
|
81
89
|
// 初始化更新 linux/python/nodejs 镜像源配置
|
|
82
|
-
if ((
|
|
90
|
+
if ((_b = systemConfig.info) === null || _b === void 0 ? void 0 : _b.pythonMirror) {
|
|
83
91
|
systemService.updatePythonMirror({
|
|
84
|
-
pythonMirror: (
|
|
92
|
+
pythonMirror: (_c = systemConfig.info) === null || _c === void 0 ? void 0 : _c.pythonMirror,
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
|
-
if ((
|
|
95
|
+
if ((_d = systemConfig.info) === null || _d === void 0 ? void 0 : _d.linuxMirror) {
|
|
88
96
|
systemService.updateLinuxMirror({
|
|
89
|
-
linuxMirror: (
|
|
97
|
+
linuxMirror: (_e = systemConfig.info) === null || _e === void 0 ? void 0 : _e.linuxMirror,
|
|
90
98
|
}, undefined, () => installDependencies());
|
|
91
99
|
}
|
|
92
100
|
else {
|
|
93
101
|
installDependencies();
|
|
94
102
|
}
|
|
95
|
-
if ((
|
|
103
|
+
if ((_f = systemConfig.info) === null || _f === void 0 ? void 0 : _f.nodeMirror) {
|
|
96
104
|
systemService.updateNodeMirror({
|
|
97
|
-
nodeMirror: (
|
|
105
|
+
nodeMirror: (_g = systemConfig.info) === null || _g === void 0 ? void 0 : _g.nodeMirror,
|
|
98
106
|
});
|
|
99
107
|
}
|
|
100
108
|
// 初始化新增默认全部任务视图
|