@whyour/qinglong 2.20.2-3 → 2.21.0-2
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/.env.example +5 -0
- package/AGENTS.md +43 -0
- package/CLAUDE.md +43 -0
- package/README-en.md +11 -0
- package/README.md +11 -0
- package/docker/Dockerfile +51 -69
- package/docker/Dockerfile.310 +94 -0
- package/docker/Dockerfile.debian +120 -0
- package/docker/{310.Dockerfile → Dockerfile.debian310} +13 -5
- package/docker/docker-entrypoint.sh +95 -3
- package/docs/PROJECT_ARCHITECTURE.md +550 -0
- package/package.json +28 -25
- package/sample/config.sample.sh +12 -1
- package/sample/notify.js +81 -9
- package/sample/notify.py +54 -11
- package/shell/api.sh +44 -20
- package/shell/bot.sh +30 -16
- package/shell/check.sh +21 -19
- package/shell/lang/en.sh +105 -0
- package/shell/lang/zh.sh +105 -0
- package/shell/otask.sh +117 -28
- package/shell/preload/client.js +20 -2
- package/shell/preload/esm-loader.mjs +41 -0
- package/shell/preload/sitecustomize.js +36 -0
- package/shell/pub.sh +8 -8
- package/shell/rmlog.sh +5 -5
- package/shell/share.sh +49 -30
- package/shell/start.sh +40 -27
- package/shell/task.sh +10 -2
- package/shell/update.sh +22 -22
- package/static/build/api/config.js +17 -7
- package/static/build/api/cron.js +40 -3
- package/static/build/api/dashboard.js +344 -0
- package/static/build/api/env.js +40 -2
- package/static/build/api/index.js +2 -0
- package/static/build/api/log.js +5 -4
- package/static/build/api/script.js +34 -9
- package/static/build/api/system.js +16 -1
- package/static/build/api/user.js +6 -5
- package/static/build/app.js +3 -0
- package/static/build/config/const.js +7 -6
- package/static/build/config/container.js +12 -0
- package/static/build/config/grpcCerts.js +150 -0
- package/static/build/config/index.js +6 -4
- package/static/build/config/util.js +69 -18
- package/static/build/data/cron.js +3 -1
- package/static/build/data/cronStats.js +59 -0
- package/static/build/data/env.js +2 -0
- package/static/build/data/notify.js +11 -1
- package/static/build/data/runningInstance.js +57 -0
- package/static/build/data/sock.js +1 -0
- package/static/build/loaders/app.js +1 -1
- package/static/build/loaders/db.js +6 -0
- package/static/build/loaders/deps.js +1 -22
- package/static/build/loaders/express.js +2 -1
- package/static/build/loaders/initData.js +19 -2
- package/static/build/loaders/initFile.js +2 -0
- package/static/build/loaders/initTask.js +3 -2
- package/static/build/schedule/api.js +1 -1
- package/static/build/schedule/client.js +9 -1
- package/static/build/schedule/health.js +1 -1
- package/static/build/services/config.js +19 -5
- package/static/build/services/cron.js +126 -13
- package/static/build/services/dependence.js +19 -18
- package/static/build/services/env.js +31 -3
- package/static/build/services/grpc.js +32 -6
- package/static/build/services/http.js +33 -18
- package/static/build/services/notify.js +45 -8
- package/static/build/services/open.js +2 -1
- package/static/build/services/sshKey.js +6 -3
- package/static/build/services/subscription.js +2 -1
- package/static/build/services/system.js +34 -9
- package/static/build/services/user.js +36 -13
- package/static/build/shared/i18n.js +145 -0
- package/static/build/shared/pLimit.js +15 -3
- package/static/build/shared/runCron.js +5 -0
- package/static/build/validation/schedule.js +1 -0
- package/static/dist/1089.0ecc5383.async.js +1 -0
- package/static/dist/1147.c420132e.async.js +1 -0
- package/static/dist/1192.4e5740f2.async.js +1 -0
- package/static/dist/1214.c6469b53.async.js +1 -0
- package/static/dist/134.54df9e38.async.js +1 -0
- package/static/dist/1352.96a77e1d.async.js +1 -0
- package/static/dist/{1765.d8e002d7.async.js → 1765.5ac01a93.async.js} +1 -1
- package/static/dist/1836.f0b74cf1.async.js +1 -0
- package/static/dist/{1885.e0d00d2d.async.js → 1885.e1ea09f6.async.js} +1 -1
- package/static/dist/1967.3f3945d0.async.js +1 -0
- package/static/dist/{2096.383c1047.async.js → 2096.6d98fd12.async.js} +1 -1
- package/static/dist/2208.f7ba3dfa.async.js +1 -0
- package/static/dist/2286.164bb089.async.js +1 -0
- package/static/dist/2476.4e9b0992.async.js +1 -0
- package/static/dist/2537.2b262ee0.async.js +1 -0
- package/static/dist/{255.12f03ab2.async.js → 255.8a80b983.async.js} +1 -1
- package/static/dist/2635.d4c59d23.async.js +1 -0
- package/static/dist/2808.cdc0995c.async.js +1 -0
- package/static/dist/{2821.be3dc88e.async.js → 2821.651f31e5.async.js} +1 -1
- package/static/dist/2986.4c49eef7.async.js +1 -0
- package/static/dist/300.08ac9875.async.js +1 -0
- package/static/dist/{3191.70bc19db.async.js → 3191.63263871.async.js} +1 -1
- package/static/dist/3714.8d6dba9e.async.js +1 -0
- package/static/dist/3906.a5eee612.async.js +1 -0
- package/static/dist/{6541.a6d499de.async.js → 3948.4fe809fd.async.js} +1 -1
- package/static/dist/{5171.7fc6d0a2.async.js → 4573.16f19278.async.js} +1 -1
- package/static/dist/{4859.93e63ea6.async.js → 4859.6592cebb.async.js} +1 -1
- package/static/dist/4887.8e3ae573.async.js +1 -0
- package/static/dist/{4902.54ecbdb5.async.js → 4902.555f92ab.async.js} +1 -1
- package/static/dist/{4934.1ca6b6b0.async.js → 4934.f3539d08.async.js} +1 -1
- package/static/dist/5077.cbd111cd.async.js +1 -0
- package/static/dist/{6247.b550d996.async.js → 5157.7c5af144.async.js} +1 -1
- package/static/dist/{540.481d4708.async.js → 540.19ddf020.async.js} +1 -1
- package/static/dist/{5970.10ac4f16.async.js → 5970.d3a6e7bd.async.js} +1 -1
- package/static/dist/{6013.2d7bb12a.async.js → 6013.4e38de36.async.js} +1 -1
- package/static/dist/{6016.9c379049.async.js → 6016.1e6574b6.async.js} +1 -1
- package/static/dist/{6035.5889ddc7.async.js → 6035.32ebfad9.async.js} +1 -1
- package/static/dist/6339.ab305e96.async.js +1 -0
- package/static/dist/6569.55177f6a.async.js +1 -0
- package/static/dist/6610.c111af7e.async.js +1 -0
- package/static/dist/{3034.6413c38e.async.js → 6638.87a163d2.async.js} +1 -1
- package/static/dist/{6646.5fc37228.async.js → 6646.95e92533.async.js} +1 -1
- package/static/dist/6665.1d099ad1.async.js +1 -0
- package/static/dist/{7355.b7c0562f.async.js → 7355.f9f263d8.async.js} +1 -1
- package/static/dist/{7384.065ccae2.async.js → 7384.1bb449d5.async.js} +1 -1
- package/static/dist/7441.ee1bf2bb.async.js +1 -0
- package/static/dist/{7508.a31662a3.async.js → 7508.7dcee91c.async.js} +1 -1
- package/static/dist/{7802.6b73f16a.async.js → 7802.34255805.async.js} +1 -1
- package/static/dist/{7984.e6bb9378.async.js → 7984.594296a5.async.js} +1 -1
- package/static/dist/{5653.4fce7ce8.async.js → 8033.5cb31493.async.js} +1 -1
- package/static/dist/8147.2fb55202.async.js +1 -0
- package/static/dist/8187.48c130d6.async.js +1 -0
- package/static/dist/8495.d53e15ca.async.js +1 -0
- package/static/dist/8587.315b06c0.async.js +1 -0
- package/static/dist/8826.6879b271.async.js +1 -0
- package/static/dist/{2742.4852aac8.async.js → 8865.ed665d31.async.js} +1 -1
- package/static/dist/901.7ee5c6d3.async.js +1 -0
- package/static/dist/9271.231db2ce.async.js +1 -0
- package/static/dist/9323.a33f47da.async.js +1 -0
- package/static/dist/{9730.30083c91.async.js → 9730.801665a3.async.js} +1 -1
- package/static/dist/{9761.627ca3b5.async.js → 9761.360a19d8.async.js} +1 -1
- package/static/dist/index.html +2 -2
- package/static/dist/layouts__index.a7a2bfe0.async.js +1 -0
- package/static/dist/layouts__index.adf0692f.chunk.css +1 -0
- package/static/dist/preload_helper.c1c91aaa.js +1 -0
- package/static/dist/{src__pages__config__index.622b6ee8.async.js → src__pages__config__index.a22ff7dc.async.js} +1 -1
- package/static/dist/{src__pages__crontab__const.323d5124.async.js → src__pages__crontab__const.aba07deb.async.js} +1 -1
- package/static/dist/src__pages__crontab__detail.cf4a6aaf.async.js +1 -0
- package/static/dist/src__pages__crontab__index.5b67b1a2.async.js +1 -0
- package/static/dist/{src__pages__crontab__logModal.5e6a4bf2.async.js → src__pages__crontab__logModal.831d5e4b.async.js} +1 -1
- package/static/dist/src__pages__crontab__modal.f7041c7c.async.js +1 -0
- package/static/dist/src__pages__crontab__type.d7af36e5.async.js +1 -0
- package/static/dist/{src__pages__crontab__viewCreateModal.ffcf7a24.async.js → src__pages__crontab__viewCreateModal.4d589f66.async.js} +1 -1
- package/static/dist/{src__pages__crontab__viewManageModal.c2724575.async.js → src__pages__crontab__viewManageModal.0e317746.async.js} +1 -1
- package/static/dist/src__pages__dashboard__index.58177357.async.js +1 -0
- package/static/dist/src__pages__dependence__index.b7bbc795.async.js +1 -0
- package/static/dist/{src__pages__dependence__logModal.f123e2ac.async.js → src__pages__dependence__logModal.0681830b.async.js} +1 -1
- package/static/dist/src__pages__dependence__modal.11124896.async.js +1 -0
- package/static/dist/src__pages__env__editNameModal.5d264b25.async.js +1 -0
- package/static/dist/src__pages__env__index.9a565d2b.async.js +1 -0
- package/static/dist/src__pages__env__modal.7f2ef1bc.async.js +1 -0
- package/static/dist/src__pages__error__index.f156b45e.async.js +1 -0
- package/static/dist/src__pages__initialization__index.e96d4ba8.async.js +1 -0
- package/static/dist/src__pages__log__index.9c66639f.async.js +1 -0
- package/static/dist/{src__pages__login__index.cd6e3152.async.js → src__pages__login__index.8c813eb1.async.js} +1 -1
- package/static/dist/{src__pages__script__components__UnsupportedFilePreview__index.39074c68.async.js → src__pages__script__components__UnsupportedFilePreview__index.c347a13a.async.js} +1 -1
- package/static/dist/src__pages__script__editNameModal.3e7e100d.async.js +1 -0
- package/static/dist/src__pages__script__index.e869812f.async.js +1 -0
- package/static/dist/src__pages__script__renameModal.5e987ef5.async.js +1 -0
- package/static/dist/src__pages__script__saveModal.3f9d23d6.async.js +1 -0
- package/static/dist/src__pages__script__setting.a535793a.async.js +1 -0
- package/static/dist/src__pages__setting__appModal.251cd14f.async.js +1 -0
- package/static/dist/src__pages__setting__checkUpdate.34d773f2.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.29f13e8c.async.js +1 -0
- package/static/dist/src__pages__setting__index.7a39d415.async.js +1 -0
- package/static/dist/src__pages__setting__notification.390fc905.async.js +1 -0
- package/static/dist/src__pages__setting__other.707cfafe.async.js +1 -0
- package/static/dist/src__pages__setting__security.598720a8.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.1a5c855f.async.js +1 -0
- package/static/dist/{src__pages__subscription__logModal.0caa7283.async.js → src__pages__subscription__logModal.3864b37f.async.js} +1 -1
- package/static/dist/src__pages__subscription__modal.3562c670.async.js +1 -0
- package/static/dist/{umi.ef8199a4.js → umi.97fb5a40.js} +1 -1
- package/version.yaml +33 -4
- package/sample/notify.py.save +0 -1010
- package/static/dist/105.85a5c47a.async.js +0 -1
- package/static/dist/1083.f86ce804.async.js +0 -1
- package/static/dist/1147.32f41a88.async.js +0 -1
- package/static/dist/1352.ab6da08e.async.js +0 -1
- package/static/dist/1690.f0290540.async.js +0 -1
- package/static/dist/1742.6cbe5aca.async.js +0 -1
- package/static/dist/2208.8e3a7325.async.js +0 -1
- package/static/dist/5312.74b95311.async.js +0 -1
- package/static/dist/5691.931f59c5.async.js +0 -1
- package/static/dist/6159.55cb068a.async.js +0 -1
- package/static/dist/7025.f4080d63.async.js +0 -1
- package/static/dist/739.6be5552a.async.js +0 -1
- package/static/dist/7571.4f6240b1.async.js +0 -1
- package/static/dist/786.59fc381c.async.js +0 -1
- package/static/dist/8317.c44c1ebd.async.js +0 -1
- package/static/dist/8826.0291edfd.async.js +0 -1
- package/static/dist/955.3c9481f7.async.js +0 -1
- package/static/dist/layouts__index.1fce90e0.chunk.css +0 -1
- package/static/dist/layouts__index.8dcf1576.async.js +0 -1
- package/static/dist/preload_helper.116a62f6.js +0 -1
- package/static/dist/src__pages__crontab__detail.b07f0c0a.async.js +0 -1
- package/static/dist/src__pages__crontab__index.2e2e1096.async.js +0 -1
- package/static/dist/src__pages__crontab__modal.4d8c2a22.async.js +0 -1
- package/static/dist/src__pages__crontab__type.db7c1858.async.js +0 -1
- package/static/dist/src__pages__dependence__index.3d87ceac.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.631ffb5b.async.js +0 -1
- package/static/dist/src__pages__env__editNameModal.ff85ef8c.async.js +0 -1
- package/static/dist/src__pages__env__index.a0a2fece.async.js +0 -1
- package/static/dist/src__pages__env__modal.d1004662.async.js +0 -1
- package/static/dist/src__pages__error__index.1bc3c90b.async.js +0 -1
- package/static/dist/src__pages__initialization__index.8b1cbaf9.async.js +0 -1
- package/static/dist/src__pages__log__index.cf00c9af.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.53424d49.async.js +0 -1
- package/static/dist/src__pages__script__index.e65df827.async.js +0 -1
- package/static/dist/src__pages__script__renameModal.4bbe7fb1.async.js +0 -1
- package/static/dist/src__pages__script__saveModal.cf449f3c.async.js +0 -1
- package/static/dist/src__pages__script__setting.b345d59a.async.js +0 -1
- package/static/dist/src__pages__setting__appModal.03faec89.async.js +0 -1
- package/static/dist/src__pages__setting__checkUpdate.46efe057.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.4495c7b6.async.js +0 -1
- package/static/dist/src__pages__setting__index.6919c399.async.js +0 -1
- package/static/dist/src__pages__setting__notification.d6a3884f.async.js +0 -1
- package/static/dist/src__pages__setting__other.0d931d6f.async.js +0 -1
- package/static/dist/src__pages__setting__security.91cb545f.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.1d433a48.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.0b84f6cf.async.js +0 -1
|
@@ -32,6 +32,7 @@ const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
|
32
32
|
const pickBy_1 = __importDefault(require("lodash/pickBy"));
|
|
33
33
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
34
34
|
const store_1 = require("../shared/store");
|
|
35
|
+
const i18n_1 = require("../shared/i18n");
|
|
35
36
|
let UserService = class UserService {
|
|
36
37
|
constructor(logger, scheduleService, sockService) {
|
|
37
38
|
this.logger = logger;
|
|
@@ -48,7 +49,7 @@ let UserService = class UserService {
|
|
|
48
49
|
const waitTime = Math.ceil((retriesTime - (timestamp - lastlogon)) / 1000);
|
|
49
50
|
return {
|
|
50
51
|
code: 410,
|
|
51
|
-
message:
|
|
52
|
+
message: (0, i18n_1.tf)('失败次数过多,请%s秒后重试', waitTime),
|
|
52
53
|
data: waitTime,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
@@ -97,7 +98,18 @@ let UserService = class UserService {
|
|
|
97
98
|
platform: req.platform,
|
|
98
99
|
isTwoFactorChecking: false,
|
|
99
100
|
});
|
|
100
|
-
this.notificationService.notify('登录通知',
|
|
101
|
+
this.notificationService.notify((0, i18n_1.t)('登录通知'), (0, i18n_1.t)('你于') +
|
|
102
|
+
(0, dayjs_1.default)(timestamp).format('YYYY-MM-DD HH:mm:ss') +
|
|
103
|
+
(0, i18n_1.t)('在') +
|
|
104
|
+
address +
|
|
105
|
+
' ' +
|
|
106
|
+
req.platform +
|
|
107
|
+
(0, i18n_1.t)('端') +
|
|
108
|
+
' ' +
|
|
109
|
+
(0, i18n_1.t)('登录成功') +
|
|
110
|
+
(0, i18n_1.t)(',ip地址') +
|
|
111
|
+
' ' +
|
|
112
|
+
ip);
|
|
101
113
|
await this.insertDb({
|
|
102
114
|
type: system_1.AuthDataType.loginLog,
|
|
103
115
|
info: {
|
|
@@ -129,7 +141,18 @@ let UserService = class UserService {
|
|
|
129
141
|
lastaddr: address,
|
|
130
142
|
platform: req.platform,
|
|
131
143
|
});
|
|
132
|
-
this.notificationService.notify('登录通知',
|
|
144
|
+
this.notificationService.notify((0, i18n_1.t)('登录通知'), (0, i18n_1.t)('你于') +
|
|
145
|
+
(0, dayjs_1.default)(timestamp).format('YYYY-MM-DD HH:mm:ss') +
|
|
146
|
+
(0, i18n_1.t)('在') +
|
|
147
|
+
address +
|
|
148
|
+
' ' +
|
|
149
|
+
req.platform +
|
|
150
|
+
(0, i18n_1.t)('端') +
|
|
151
|
+
' ' +
|
|
152
|
+
(0, i18n_1.t)('登录失败') +
|
|
153
|
+
(0, i18n_1.t)(',ip地址') +
|
|
154
|
+
' ' +
|
|
155
|
+
ip);
|
|
133
156
|
await this.insertDb({
|
|
134
157
|
type: system_1.AuthDataType.loginLog,
|
|
135
158
|
info: {
|
|
@@ -145,12 +168,12 @@ let UserService = class UserService {
|
|
|
145
168
|
const waitTime = Math.round(Math.pow(3, retries + 1));
|
|
146
169
|
return {
|
|
147
170
|
code: 410,
|
|
148
|
-
message:
|
|
171
|
+
message: (0, i18n_1.tf)('失败次数过多,请%s秒后重试', waitTime),
|
|
149
172
|
data: waitTime,
|
|
150
173
|
};
|
|
151
174
|
}
|
|
152
175
|
else {
|
|
153
|
-
return { code: 400, message:
|
|
176
|
+
return { code: 400, message: (0, i18n_1.t)('错误的用户名密码,请重试') };
|
|
154
177
|
}
|
|
155
178
|
}
|
|
156
179
|
}
|
|
@@ -195,16 +218,16 @@ let UserService = class UserService {
|
|
|
195
218
|
}
|
|
196
219
|
async updateUsernameAndPassword({ username, password, }) {
|
|
197
220
|
if (password === 'admin') {
|
|
198
|
-
return { code: 400, message: '密码不能设置为admin' };
|
|
221
|
+
return { code: 400, message: (0, i18n_1.t)('密码不能设置为admin') };
|
|
199
222
|
}
|
|
200
223
|
const authInfo = await this.getAuthInfo();
|
|
201
224
|
await this.updateAuthInfo(authInfo, { username, password });
|
|
202
|
-
return { code: 200, message: '更新成功' };
|
|
225
|
+
return { code: 200, message: (0, i18n_1.t)('更新成功') };
|
|
203
226
|
}
|
|
204
227
|
async updateAvatar(avatar) {
|
|
205
228
|
const authInfo = await this.getAuthInfo();
|
|
206
229
|
await this.updateAuthInfo(authInfo, { avatar });
|
|
207
|
-
return { code: 200, data: avatar, message: '更新成功' };
|
|
230
|
+
return { code: 200, data: avatar, message: (0, i18n_1.t)('更新成功') };
|
|
208
231
|
}
|
|
209
232
|
async initTwoFactor() {
|
|
210
233
|
const secret = preset_default_1.authenticator.generateSecret();
|
|
@@ -228,7 +251,7 @@ let UserService = class UserService {
|
|
|
228
251
|
const authInfo = await this.getAuthInfo();
|
|
229
252
|
const { isTwoFactorChecking, twoFactorSecret } = authInfo;
|
|
230
253
|
if (!isTwoFactorChecking) {
|
|
231
|
-
return { code: 450, message: '未知错误' };
|
|
254
|
+
return { code: 450, message: (0, i18n_1.t)('未知错误') };
|
|
232
255
|
}
|
|
233
256
|
const isValid = preset_default_1.authenticator.verify({
|
|
234
257
|
token: code,
|
|
@@ -253,10 +276,10 @@ let UserService = class UserService {
|
|
|
253
276
|
lastaddr: address,
|
|
254
277
|
platform: req.platform,
|
|
255
278
|
});
|
|
256
|
-
return { code: 430, message: '验证失败' };
|
|
279
|
+
return { code: 430, message: (0, i18n_1.t)('验证失败') };
|
|
257
280
|
}
|
|
258
281
|
}
|
|
259
|
-
async
|
|
282
|
+
async deactivateTwoFactor() {
|
|
260
283
|
const authInfo = await this.getAuthInfo();
|
|
261
284
|
await this.updateAuthInfo(authInfo, {
|
|
262
285
|
twoFactorActivated: false,
|
|
@@ -307,7 +330,7 @@ let UserService = class UserService {
|
|
|
307
330
|
}
|
|
308
331
|
async updateNotificationMode(notificationInfo) {
|
|
309
332
|
const code = Math.random().toString().slice(-6);
|
|
310
|
-
const isSuccess = await this.notificationService.testNotify(notificationInfo, '青龙',
|
|
333
|
+
const isSuccess = await this.notificationService.testNotify(notificationInfo, (0, i18n_1.t)('青龙'), (0, i18n_1.t)('【蛟龙】测试通知 https://t.me/jiao_long'));
|
|
311
334
|
if (isSuccess) {
|
|
312
335
|
const result = await this.updateAuthDb({
|
|
313
336
|
type: system_1.AuthDataType.notification,
|
|
@@ -316,7 +339,7 @@ let UserService = class UserService {
|
|
|
316
339
|
return { code: 200, data: Object.assign(Object.assign({}, result), { code }) };
|
|
317
340
|
}
|
|
318
341
|
else {
|
|
319
|
-
return { code: 400, message: '通知发送失败,请检查参数' };
|
|
342
|
+
return { code: 400, message: (0, i18n_1.t)('通知发送失败,请检查参数') };
|
|
320
343
|
}
|
|
321
344
|
}
|
|
322
345
|
normalizeTokens(tokens) {
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tf = exports.t = exports.getLang = exports.setLang = void 0;
|
|
4
|
+
const messages = {
|
|
5
|
+
zh: {},
|
|
6
|
+
en: {
|
|
7
|
+
'暂无权限': 'Access denied',
|
|
8
|
+
'参数错误': 'Invalid parameter',
|
|
9
|
+
'参数不正确': 'Invalid parameter',
|
|
10
|
+
'文件无法访问': 'File not accessible',
|
|
11
|
+
'文件不存在': 'File not found',
|
|
12
|
+
'路径不存在': 'Path does not exist',
|
|
13
|
+
'路径不正确': 'Invalid path',
|
|
14
|
+
'通知发送失败,请检查参数': 'Notification failed, check parameters',
|
|
15
|
+
'通知发送失败,请检查系统设置/通知配置': 'Notification failed, check system settings',
|
|
16
|
+
'通知发送成功': 'Notification sent successfully',
|
|
17
|
+
'设置时区失败': 'Failed to set timezone',
|
|
18
|
+
'任务未找到': 'Task not found',
|
|
19
|
+
'密码不能设置为admin': 'Password cannot be admin',
|
|
20
|
+
'更新成功': 'Update successful',
|
|
21
|
+
'未知错误': 'Unknown error',
|
|
22
|
+
'验证失败': 'Verification failed',
|
|
23
|
+
'实例不存在或已停止': 'Instance does not exist or stopped',
|
|
24
|
+
'实例已停止': 'Instance stopped',
|
|
25
|
+
'确认停止实例': 'Confirm to stop instance',
|
|
26
|
+
'确认停止运行实例': 'Confirm to stop running instance',
|
|
27
|
+
'确认停止': 'Confirm to stop',
|
|
28
|
+
'确认停止定时任务': 'Confirm to stop scheduled task',
|
|
29
|
+
'确认删除': 'Confirm to delete',
|
|
30
|
+
'确认删除定时任务': 'Confirm to delete scheduled task',
|
|
31
|
+
'确认删除选中的定时任务吗': 'Confirm to delete selected tasks?',
|
|
32
|
+
'确认运行': 'Confirm to run',
|
|
33
|
+
'确认运行定时任务': 'Confirm to run scheduled task',
|
|
34
|
+
'确认保存': 'Confirm to save',
|
|
35
|
+
'确认保存文件': 'Confirm to save file',
|
|
36
|
+
'确认重启': 'Confirm restart',
|
|
37
|
+
'确认启用': 'Confirm to enable',
|
|
38
|
+
'确认禁用': 'Confirm to disable',
|
|
39
|
+
'确认': 'Confirm',
|
|
40
|
+
'删除成功': 'Deleted successfully',
|
|
41
|
+
'操作成功': 'Operation successful',
|
|
42
|
+
'参数不完整': 'Incomplete parameters',
|
|
43
|
+
'默认路径不支持删除': 'Default path cannot be deleted',
|
|
44
|
+
'必须在日志目录下': 'Must be within log directory',
|
|
45
|
+
'备份数据上传成功,确认覆盖数据': 'Backup uploaded, confirm overwrite',
|
|
46
|
+
'如果恢复失败,可进入容器执行': 'If restore fails, run in container:',
|
|
47
|
+
'系统将在': 'System will',
|
|
48
|
+
'秒后自动刷新': 'refresh in seconds',
|
|
49
|
+
'生成数据中...': 'Generating data...',
|
|
50
|
+
'每条数据 name 或者 value 字段不能为空,参考导出文件格式': 'Each entry must have name and value, see export format',
|
|
51
|
+
'不支持当前依赖类型': 'Unsupported dependency type',
|
|
52
|
+
'依赖已存在': 'Dependency already exists',
|
|
53
|
+
'依赖不存在': 'Dependency does not exist',
|
|
54
|
+
'该脚本正在运行中': 'Script is running',
|
|
55
|
+
'该脚本未在运行中': 'Script is not running',
|
|
56
|
+
'文件内容为空': 'File content is empty',
|
|
57
|
+
'文件名不能为空': 'File name cannot be empty',
|
|
58
|
+
'标签不能为空': 'Label cannot be empty',
|
|
59
|
+
'名称不能为空': 'Name cannot be empty',
|
|
60
|
+
'名称不能为保留关键字': 'Name cannot be reserved keyword',
|
|
61
|
+
'名称已存在': 'Name already exists',
|
|
62
|
+
'密码错误': 'Incorrect password',
|
|
63
|
+
'用户不存在': 'User does not exist',
|
|
64
|
+
'请输入用户名和密码': 'Please enter username and password',
|
|
65
|
+
'无权访问': 'Access denied',
|
|
66
|
+
'登录成功': 'Login successful',
|
|
67
|
+
'退出成功': 'Logout successful',
|
|
68
|
+
'Token 已失效': 'Token expired',
|
|
69
|
+
'Token 无效': 'Invalid token',
|
|
70
|
+
'两步骤验证已开启': '2FA enabled',
|
|
71
|
+
'两步骤验证已关闭': '2FA disabled',
|
|
72
|
+
'验证码错误': 'Invalid verification code',
|
|
73
|
+
'验证码已过期': 'Verification code expired',
|
|
74
|
+
'请先开启两步骤验证': 'Please enable 2FA first',
|
|
75
|
+
'两步骤验证密钥不能为空': '2FA secret cannot be empty',
|
|
76
|
+
'用户已存在': 'User already exists',
|
|
77
|
+
'用户名不能为admin': 'Username cannot be admin',
|
|
78
|
+
'不能删除自己': 'Cannot delete yourself',
|
|
79
|
+
'不能禁用自己': 'Cannot disable yourself',
|
|
80
|
+
'文件路径无效': 'Invalid file path',
|
|
81
|
+
'保存成功': 'Saved successfully',
|
|
82
|
+
'client_id 或 client_seret 有误': 'Invalid client_id or client_secret',
|
|
83
|
+
'订阅执行完成': 'Subscription completed',
|
|
84
|
+
'wxPusher 服务的 TopicIds 和 Uids 至少配置一个才行': 'wxPusher requires at least one of TopicIds or Uids',
|
|
85
|
+
'Url 或者 Body 中必须包含 $title': 'Url or Body must contain $title',
|
|
86
|
+
'绝对路径必须在日志目录内或使用 /dev/null': 'Absolute path must be within log directory or use /dev/null',
|
|
87
|
+
'请先登录!': 'Please login first!',
|
|
88
|
+
'运行中...': 'Running...',
|
|
89
|
+
'日志不存在...': 'Log does not exist...',
|
|
90
|
+
'未分类': 'Uncategorized',
|
|
91
|
+
'任务重复运行': 'Duplicate task execution',
|
|
92
|
+
'日志设置为忽略': 'Log set to ignore',
|
|
93
|
+
'定时规则不能为空': 'Schedule rule cannot be empty',
|
|
94
|
+
'无效的定时规则': 'Invalid schedule rule',
|
|
95
|
+
'日志名称只能包含字母、数字、下划线和连字符': 'Log name can only contain letters, numbers, underscores, and hyphens',
|
|
96
|
+
'日志名称不能超过100个字符': 'Log name cannot exceed 100 characters',
|
|
97
|
+
'错误的用户名密码,请重试': 'Incorrect username or password, please try again',
|
|
98
|
+
'青龙快讯': 'QingLong',
|
|
99
|
+
'登录通知': 'Login Notification',
|
|
100
|
+
'你于': 'You at ',
|
|
101
|
+
'在': ' in ',
|
|
102
|
+
端: '',
|
|
103
|
+
登录失败: 'login failed',
|
|
104
|
+
',ip地址': ', IP: ',
|
|
105
|
+
'任务#%s': 'Task#%s',
|
|
106
|
+
安装: 'Install',
|
|
107
|
+
删除: 'Uninstall',
|
|
108
|
+
成功: 'Succeeded',
|
|
109
|
+
失败: 'Failed',
|
|
110
|
+
'失败次数过多,请%s秒后重试': 'Too many failed attempts, please retry in %s seconds',
|
|
111
|
+
智能助手: 'Smart Assistant',
|
|
112
|
+
更多: 'More',
|
|
113
|
+
'开始%s依赖 %s,开始时间 %s\n\n当前系统不支持\n\n依赖%s失败,结束时间 %s,耗时 %s 秒': 'Start %s dependency %s, start time %s\n\nCurrent system not supported\n\nDependency %s failed, end time %s, elapsed %s seconds',
|
|
114
|
+
'检测到已经安装 %s\n\n%s\n\n跳过安装\n\n依赖%s成功,结束时间 %s,耗时 %s 秒': 'Already installed %s\n\n%s\n\nSkipping install\n\nDependency %s succeeded, end time %s, elapsed %s seconds',
|
|
115
|
+
'开始%s依赖 %s,开始时间 %s\n\n': 'Start %s dependency %s, start time %s\n\n',
|
|
116
|
+
'依赖%s%s,结束时间 %s,耗时 %s 秒': 'Dependency %s%s, end time %s, elapsed %s seconds',
|
|
117
|
+
'任务:%s,命令:%s,定时:%s,处于运行中的超过 %d 个,请检查定时设置': 'Task: %s, command: %s, schedule: %s, more than %d instances running, please check schedule settings',
|
|
118
|
+
青龙: 'QingLong',
|
|
119
|
+
'【蛟龙】测试通知 https://t.me/jiao_long': '[JiaoLong] Test notification https://t.me/jiao_long',
|
|
120
|
+
'生成token': 'Generate token',
|
|
121
|
+
'删除日志': 'Delete logs',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
let currentLang = 'zh';
|
|
125
|
+
function setLang(lang) {
|
|
126
|
+
currentLang = lang || 'zh';
|
|
127
|
+
}
|
|
128
|
+
exports.setLang = setLang;
|
|
129
|
+
function getLang() {
|
|
130
|
+
return currentLang;
|
|
131
|
+
}
|
|
132
|
+
exports.getLang = getLang;
|
|
133
|
+
function t(key, lang) {
|
|
134
|
+
const effectiveLang = lang || currentLang;
|
|
135
|
+
if (effectiveLang === 'en' && messages.en[key]) {
|
|
136
|
+
return messages.en[key];
|
|
137
|
+
}
|
|
138
|
+
return key;
|
|
139
|
+
}
|
|
140
|
+
exports.t = t;
|
|
141
|
+
function tf(key, ...args) {
|
|
142
|
+
return args.reduce((str, arg) => str.replace(/%s|%d/, String(arg)), t(key));
|
|
143
|
+
}
|
|
144
|
+
exports.tf = tf;
|
|
145
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -8,10 +8,22 @@ const os_1 = __importDefault(require("os"));
|
|
|
8
8
|
const system_1 = require("../data/system");
|
|
9
9
|
const logger_1 = __importDefault(require("../loaders/logger"));
|
|
10
10
|
const notify_1 = __importDefault(require("../services/notify"));
|
|
11
|
+
const i18n_1 = require("../shared/i18n");
|
|
11
12
|
const config_1 = __importDefault(require("../config"));
|
|
12
13
|
const grpc_js_1 = require("@grpc/grpc-js");
|
|
13
14
|
const api_1 = require("../protos/api");
|
|
15
|
+
const grpcCerts_1 = require("../config/grpcCerts");
|
|
14
16
|
class TaskLimit {
|
|
17
|
+
get client() {
|
|
18
|
+
if (!this._client) {
|
|
19
|
+
const tlsConfig = (0, grpcCerts_1.getGrpcCerts)();
|
|
20
|
+
const creds = tlsConfig
|
|
21
|
+
? grpc_js_1.credentials.createSsl(Buffer.from(tlsConfig.caCert), Buffer.from(tlsConfig.clientKey), Buffer.from(tlsConfig.clientCert))
|
|
22
|
+
: grpc_js_1.credentials.createInsecure();
|
|
23
|
+
this._client = new api_1.ApiClient(`localhost:${config_1.default.grpcPort}`, creds, { 'grpc.enable_http_proxy': 0 });
|
|
24
|
+
}
|
|
25
|
+
return this._client;
|
|
26
|
+
}
|
|
15
27
|
get cronLimitActiveCount() {
|
|
16
28
|
return this.cronLimit.pending;
|
|
17
29
|
}
|
|
@@ -42,7 +54,7 @@ class TaskLimit {
|
|
|
42
54
|
this.systemLimit = new p_queue_cjs_1.default({
|
|
43
55
|
concurrency: Math.max(os_1.default.cpus().length, 4),
|
|
44
56
|
});
|
|
45
|
-
this.
|
|
57
|
+
this._client = null;
|
|
46
58
|
this.notificationService = new notify_1.default();
|
|
47
59
|
this.setCustomLimit();
|
|
48
60
|
this.handleEvents();
|
|
@@ -106,8 +118,8 @@ class TaskLimit {
|
|
|
106
118
|
if (repeatTimes < 3) {
|
|
107
119
|
this.repeatCronNotifyMap.set(cron.id, repeatTimes + 1);
|
|
108
120
|
this.client.systemNotify({
|
|
109
|
-
title: '任务重复运行',
|
|
110
|
-
content:
|
|
121
|
+
title: (0, i18n_1.t)('任务重复运行'),
|
|
122
|
+
content: (0, i18n_1.tf)('任务:%s,命令:%s,定时:%s,处于运行中的超过 %d 个,请检查定时设置', cron.name || '', cron.command || '', cron.schedule || '', 5),
|
|
111
123
|
}, (err, res) => {
|
|
112
124
|
if (err) {
|
|
113
125
|
logger_1.default.error(`[schedule][任务重复运行] 通知失败 ${JSON.stringify(err)}`);
|
|
@@ -9,6 +9,8 @@ const pLimit_1 = __importDefault(require("./pLimit"));
|
|
|
9
9
|
const logger_1 = __importDefault(require("../loaders/logger"));
|
|
10
10
|
const cron_1 = require("../data/cron");
|
|
11
11
|
const util_1 = require("../config/util");
|
|
12
|
+
const runningInstance_1 = require("../data/runningInstance");
|
|
13
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
12
14
|
function runCron(cmd, cron) {
|
|
13
15
|
return pLimit_1.default.runWithCronLimit(cron, () => {
|
|
14
16
|
return new Promise(async (resolve) => {
|
|
@@ -26,6 +28,9 @@ function runCron(cmd, cron) {
|
|
|
26
28
|
existingCron.status === cron_1.CrontabStatus.queued)) {
|
|
27
29
|
logger_1.default.info(`[schedule][停止已运行任务] 任务ID: ${cron.id}, PID: ${existingCron.pid}`);
|
|
28
30
|
await (0, util_1.killTask)(existingCron.pid);
|
|
31
|
+
// Mark old running instances as stopped
|
|
32
|
+
const stoppedAt = (0, dayjs_1.default)().unix();
|
|
33
|
+
await runningInstance_1.RunningInstanceModel.update({ status: runningInstance_1.InstanceStatus.stopped, finished_at: stoppedAt }, { where: { cron_id: Number(cron.id), status: runningInstance_1.InstanceStatus.running } });
|
|
29
34
|
// Update the status to idle after killing
|
|
30
35
|
await cron_1.CrontabModel.update({ status: cron_1.CrontabStatus.idle, pid: undefined }, { where: { id: Number(cron.id) } });
|
|
31
36
|
}
|
|
@@ -75,5 +75,6 @@ exports.commonCronSchema = {
|
|
|
75
75
|
'string.unsafePath': '绝对路径必须在日志目录内或使用 /dev/null',
|
|
76
76
|
}),
|
|
77
77
|
allow_multiple_instances: celebrate_1.Joi.number().optional().valid(0, 1).allow(null),
|
|
78
|
+
work_dir: celebrate_1.Joi.string().optional().allow('').allow(null),
|
|
78
79
|
};
|
|
79
80
|
//# sourceMappingURL=schedule.js.map
|