@whyour/qinglong 0.16.0 → 0.17.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/.env.example +1 -0
- package/docker/310.Dockerfile +4 -0
- package/docker/docker-entrypoint.sh +1 -0
- package/docker/front.conf +16 -0
- package/other.config.js +13 -0
- package/package.json +3 -3
- package/sample/config.sample.sh +19 -8
- package/sample/notify.js +16 -14
- package/sample/notify.py +271 -128
- package/shell/check.sh +1 -0
- package/shell/share.sh +13 -1
- package/shell/update.sh +34 -22
- package/static/build/config/index.js +1 -0
- package/static/build/config/util.js +5 -4
- package/static/build/loaders/server.js +0 -21
- package/static/build/loaders/update.js +79 -0
- package/static/build/services/notify.js +4 -13
- package/static/build/services/system.js +17 -32
- package/static/build/update.js +29 -0
- package/static/dist/{833.c59c5023.async.js → 833.ea0fd669.async.js} +1 -1
- package/static/dist/index.html +1 -1
- package/static/dist/{src__pages__crontab__index.f4269e9c.async.js → src__pages__crontab__index.719429ac.async.js} +1 -1
- package/static/dist/{src__pages__script__index.364b93d9.async.js → src__pages__script__index.2a8d8477.async.js} +1 -1
- package/static/dist/src__pages__setting__checkUpdate.43e62d05.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.28193e94.async.js +1 -0
- package/static/dist/src__pages__setting__index.7ab054fb.async.js +1 -0
- package/static/dist/src__pages__setting__other.2c4534ef.async.js +1 -0
- package/static/dist/src__pages__setting__progress.7d65aebf.async.js +1 -0
- package/static/dist/{umi.cbe4d7e7.js → umi.3bb00f35.js} +1 -1
- package/version.yaml +8 -6
- package/static/dist/8008.89ba3d06.async.js +0 -1
- package/static/dist/src__pages__setting__checkUpdate.42020a45.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.2efb8ee3.async.js +0 -1
- package/static/dist/src__pages__setting__index.3e2ad723.async.js +0 -1
- package/static/dist/src__pages__setting__other.a029d99a.async.js +0 -1
- package/static/dist/src__pages__setting__progress.65e2e878.async.js +0 -1
package/.env.example
CHANGED
package/docker/310.Dockerfile
CHANGED
package/docker/front.conf
CHANGED
|
@@ -6,6 +6,10 @@ upstream publicApi {
|
|
|
6
6
|
server 0.0.0.0:5400;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
upstream updateApi {
|
|
10
|
+
server 0.0.0.0:5300;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
map $http_upgrade $connection_upgrade {
|
|
10
14
|
default keep-alive;
|
|
11
15
|
'websocket' upgrade;
|
|
@@ -16,6 +20,18 @@ server {
|
|
|
16
20
|
IPV6_CONFIG
|
|
17
21
|
ssl_session_timeout 5m;
|
|
18
22
|
|
|
23
|
+
location QL_BASE_URLapi/update/ {
|
|
24
|
+
proxy_set_header Host $http_host;
|
|
25
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
26
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
27
|
+
proxy_pass http://updateApi/api/;
|
|
28
|
+
proxy_buffering off;
|
|
29
|
+
proxy_redirect default;
|
|
30
|
+
proxy_connect_timeout 1800;
|
|
31
|
+
proxy_send_timeout 1800;
|
|
32
|
+
proxy_read_timeout 1800;
|
|
33
|
+
}
|
|
34
|
+
|
|
19
35
|
location QL_BASE_URLapi/public/ {
|
|
20
36
|
proxy_set_header Host $http_host;
|
|
21
37
|
proxy_set_header X-Real-IP $remote_addr;
|
package/other.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whyour/qinglong",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"start": "concurrently -n w: npm:start:*",
|
|
16
16
|
"start:front": "max dev",
|
|
17
17
|
"start:back": "nodemon",
|
|
18
|
+
"start:update": "ts-node -P tsconfig.back.json ./back/update.ts",
|
|
18
19
|
"start:public": "ts-node -P tsconfig.back.json ./back/public.ts",
|
|
19
20
|
"start:rpc": "ts-node -P tsconfig.back.json ./back/schedule/index.ts",
|
|
20
21
|
"build:front": "max build",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"panel": "npm run build:back && node static/build/app.js",
|
|
23
24
|
"schedule": "npm run build:back && node static/build/schedule/index.js",
|
|
24
25
|
"public": "npm run build:back && node static/build/public.js",
|
|
26
|
+
"update": "npm run build:back && node static/build/update.js",
|
|
25
27
|
"gen:proto": "protoc --experimental_allow_proto3_optional --plugin=./node_modules/.bin/protoc-gen-ts_proto ./back/protos/*.proto --ts_proto_out=./ --ts_proto_opt=outputServices=grpc-js,env=node,esModuleInterop=true",
|
|
26
28
|
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
|
27
29
|
"postinstall": "max setup 2>/dev/null || true",
|
|
@@ -106,7 +108,6 @@
|
|
|
106
108
|
"serve-handler": "^6.1.3",
|
|
107
109
|
"sockjs": "^0.3.24",
|
|
108
110
|
"sqlite3": "git+https://github.com/whyour/node-sqlite3.git#v1.0.3",
|
|
109
|
-
"tar": "^6.1.15",
|
|
110
111
|
"toad-scheduler": "^1.6.0",
|
|
111
112
|
"typedi": "^0.10.0",
|
|
112
113
|
"uuid": "^8.3.2",
|
|
@@ -144,7 +145,6 @@
|
|
|
144
145
|
"@types/serve-handler": "^6.1.1",
|
|
145
146
|
"@types/sockjs": "^0.3.33",
|
|
146
147
|
"@types/sockjs-client": "^1.5.1",
|
|
147
|
-
"@types/tar": "^6.1.5",
|
|
148
148
|
"@types/uuid": "^8.3.4",
|
|
149
149
|
"@types/request-ip": "0.0.41",
|
|
150
150
|
"@uiw/codemirror-extensions-langs": "^4.21.9",
|
package/sample/config.sample.sh
CHANGED
|
@@ -148,6 +148,15 @@ export AIBOTK_TYPE=""
|
|
|
148
148
|
## aibotk_name (必填)填写群名或用户昵称,和上面的type类型要对应
|
|
149
149
|
export AIBOTK_NAME=""
|
|
150
150
|
|
|
151
|
+
## 13. CHRONOCAT
|
|
152
|
+
## CHRONOCAT_URL 推送 http://127.0.0.1:16530
|
|
153
|
+
## CHRONOCAT_TOKEN 填写在CHRONOCAT文件生成的访问密钥
|
|
154
|
+
## CHRONOCAT_QQ 个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx
|
|
155
|
+
## CHRONOCAT相关API https://chronocat.vercel.app/install/docker/official/
|
|
156
|
+
export CHRONOCAT_URL=""
|
|
157
|
+
export CHRONOCAT_QQ=""
|
|
158
|
+
export CHRONOCAT_TOKEN=""
|
|
159
|
+
|
|
151
160
|
## 14. SMTP
|
|
152
161
|
## 邮箱服务名称,比如126、163、Gmail、QQ等,支持列表 https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json
|
|
153
162
|
export SMTP_SERVICE=""
|
|
@@ -163,13 +172,15 @@ export SMTP_NAME=""
|
|
|
163
172
|
## PUSHME_KEY (必填)填写PushMe APP上获取的push_key
|
|
164
173
|
export PUSHME_KEY=""
|
|
165
174
|
|
|
166
|
-
##
|
|
167
|
-
##
|
|
168
|
-
|
|
169
|
-
##
|
|
170
|
-
|
|
171
|
-
export
|
|
172
|
-
|
|
173
|
-
export
|
|
175
|
+
## 15. 自定义通知
|
|
176
|
+
## 自定义通知 接收回调的URL
|
|
177
|
+
export WEBHOOK_URL=""
|
|
178
|
+
## WEBHOOK_BODY 和 WEBHOOK_HEADERS 多个参数时,直接换行或者使用 $'\n' 连接多行字符串,比如 export dd="line 1"$'\n'"line 2"
|
|
179
|
+
export WEBHOOK_BODY=""
|
|
180
|
+
export WEBHOOK_HEADERS=""
|
|
181
|
+
## 支持 GET/POST/PUT
|
|
182
|
+
export WEBHOOK_METHOD=""
|
|
183
|
+
## 支持 text/plain、application/json、multipart/form-data、application/x-www-form-urlencoded
|
|
184
|
+
export WEBHOOK_CONTENT_TYPE=""
|
|
174
185
|
|
|
175
186
|
## 其他需要的变量,脚本中需要的变量使用 export 变量名= 声明即可
|
package/sample/notify.js
CHANGED
|
@@ -819,11 +819,11 @@ function ChangeUserId(desp) {
|
|
|
819
819
|
async function qywxamNotify(text, desp) {
|
|
820
820
|
const MAX_LENGTH = 900;
|
|
821
821
|
if (desp.length > MAX_LENGTH) {
|
|
822
|
-
let d = desp.substr(0, MAX_LENGTH) +
|
|
822
|
+
let d = desp.substr(0, MAX_LENGTH) + '\n==More==';
|
|
823
823
|
await do_qywxamNotify(text, d);
|
|
824
824
|
await qywxamNotify(text, desp.substr(MAX_LENGTH));
|
|
825
825
|
} else {
|
|
826
|
-
return await do_qywxamNotify(text,desp);
|
|
826
|
+
return await do_qywxamNotify(text, desp);
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
|
|
@@ -1284,18 +1284,15 @@ function chronocatNotify(title, desp) {
|
|
|
1284
1284
|
|
|
1285
1285
|
function webhookNotify(text, desp) {
|
|
1286
1286
|
return new Promise((resolve) => {
|
|
1287
|
-
|
|
1288
|
-
WEBHOOK_URL,
|
|
1289
|
-
WEBHOOK_BODY,
|
|
1290
|
-
text,
|
|
1291
|
-
desp,
|
|
1292
|
-
);
|
|
1293
|
-
if (!formatUrl && !formatBody) {
|
|
1287
|
+
if (!WEBHOOK_URL.includes('$title') && !WEBHOOK_BODY.includes('$title')) {
|
|
1294
1288
|
resolve();
|
|
1295
1289
|
return;
|
|
1296
1290
|
}
|
|
1291
|
+
|
|
1297
1292
|
const headers = parseHeaders(WEBHOOK_HEADERS);
|
|
1298
|
-
const body = parseBody(
|
|
1293
|
+
const body = parseBody(WEBHOOK_BODY, WEBHOOK_CONTENT_TYPE, (v) =>
|
|
1294
|
+
v?.replaceAll('$title', text)?.replaceAll('$content', desp),
|
|
1295
|
+
);
|
|
1299
1296
|
const bodyParam = formatBodyFun(WEBHOOK_CONTENT_TYPE, body);
|
|
1300
1297
|
const options = {
|
|
1301
1298
|
method: WEBHOOK_METHOD,
|
|
@@ -1307,6 +1304,10 @@ function webhookNotify(text, desp) {
|
|
|
1307
1304
|
};
|
|
1308
1305
|
|
|
1309
1306
|
if (WEBHOOK_METHOD) {
|
|
1307
|
+
const formatUrl = WEBHOOK_URL.replaceAll(
|
|
1308
|
+
'$title',
|
|
1309
|
+
encodeURIComponent(text),
|
|
1310
|
+
).replaceAll('$content', encodeURIComponent(desp));
|
|
1310
1311
|
got(formatUrl, options).then((resp) => {
|
|
1311
1312
|
try {
|
|
1312
1313
|
if (resp.statusCode !== 200) {
|
|
@@ -1326,7 +1327,7 @@ function webhookNotify(text, desp) {
|
|
|
1326
1327
|
});
|
|
1327
1328
|
}
|
|
1328
1329
|
|
|
1329
|
-
function parseString(input) {
|
|
1330
|
+
function parseString(input, valueFormatFn) {
|
|
1330
1331
|
const regex = /(\w+):\s*((?:(?!\n\w+:).)*)/g;
|
|
1331
1332
|
const matches = {};
|
|
1332
1333
|
|
|
@@ -1338,9 +1339,10 @@ function parseString(input) {
|
|
|
1338
1339
|
continue;
|
|
1339
1340
|
}
|
|
1340
1341
|
|
|
1341
|
-
|
|
1342
|
+
let _value = value.trim();
|
|
1342
1343
|
|
|
1343
1344
|
try {
|
|
1345
|
+
_value = valueFormatFn ? valueFormatFn(_value) : _value;
|
|
1344
1346
|
const jsonValue = JSON.parse(_value);
|
|
1345
1347
|
matches[_key] = jsonValue;
|
|
1346
1348
|
} catch (error) {
|
|
@@ -1375,12 +1377,12 @@ function parseHeaders(headers) {
|
|
|
1375
1377
|
return parsed;
|
|
1376
1378
|
}
|
|
1377
1379
|
|
|
1378
|
-
function parseBody(body, contentType) {
|
|
1380
|
+
function parseBody(body, contentType, valueFormatFn) {
|
|
1379
1381
|
if (contentType === 'text/plain' || !body) {
|
|
1380
1382
|
return body;
|
|
1381
1383
|
}
|
|
1382
1384
|
|
|
1383
|
-
const parsed = parseString(body);
|
|
1385
|
+
const parsed = parseString(body, valueFormatFn);
|
|
1384
1386
|
|
|
1385
1387
|
switch (contentType) {
|
|
1386
1388
|
case 'multipart/form-data':
|