@whyour/qinglong 2.17.11-rc.1 → 2.17.12-rc.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/docker/310.Dockerfile +3 -3
- package/docker/Dockerfile +3 -3
- package/package.json +3 -1
- package/sample/config.sample.sh +11 -1
- package/sample/notify.js +53 -4
- package/sample/notify.py +51 -6
- package/sample/notify.py.save +1010 -0
- package/shell/otask.sh +2 -1
- package/shell/preload/sitecustomize.js +3 -3
- package/shell/preload/sitecustomize.py +2 -2
- package/shell/share.sh +3 -3
- package/static/build/config/util.js +9 -7
- package/static/build/data/notify.js +11 -1
- package/static/build/loaders/logger.js +4 -4
- package/static/build/services/dependence.js +1 -1
- package/static/build/services/notify.js +28 -4
- package/static/build/services/user.js +1 -1
- package/static/dist/1467.6163d4ee.async.js +1 -0
- package/static/dist/2099.a46e32fc.async.js +1 -0
- package/static/dist/419.908ca086.async.js +1 -0
- package/static/dist/573.21675f9c.async.js +1 -0
- package/static/dist/833.87a694db.async.js +1 -0
- package/static/dist/index.html +1 -1
- package/static/dist/layouts__index.35164d74.chunk.css +1 -0
- package/static/dist/{src__pages__config__index.aac592a5.async.js → src__pages__config__index.c778a0e0.async.js} +1 -1
- package/static/dist/src__pages__crontab__index.f196124c.async.js +1 -0
- package/static/dist/src__pages__crontab__modal.6fa9520e.async.js +1 -0
- package/static/dist/src__pages__dependence__modal.e67d0ff6.async.js +1 -0
- package/static/dist/src__pages__env__editNameModal.38d65f05.async.js +1 -0
- package/static/dist/src__pages__env__modal.6fad122b.async.js +1 -0
- package/static/dist/src__pages__error__index.c5c8ed46.async.js +1 -0
- package/static/dist/src__pages__initialization__index.a26591c2.async.js +1 -0
- package/static/dist/{src__pages__log__index.e7377c48.async.js → src__pages__log__index.bc06b12f.async.js} +1 -1
- package/static/dist/src__pages__script__editNameModal.e7f7fea1.async.js +1 -0
- package/static/dist/src__pages__script__index.4fdb14ad.async.js +1 -0
- package/static/dist/src__pages__script__renameModal.436dedbf.async.js +1 -0
- package/static/dist/src__pages__script__saveModal.f65940c2.async.js +1 -0
- package/static/dist/src__pages__script__setting.b4891488.async.js +1 -0
- package/static/dist/src__pages__setting__appModal.48994718.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.b6d378b3.async.js +1 -0
- package/static/dist/src__pages__setting__index.45c54c51.async.js +1 -0
- package/static/dist/src__pages__setting__notification.7df85f89.async.js +1 -0
- package/static/dist/src__pages__setting__security.e26348a7.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.a77a9995.async.js +1 -0
- package/static/dist/src__pages__subscription__modal.26538bfd.async.js +1 -0
- package/static/dist/static/log.60d9c9b5.ttf +0 -0
- package/static/dist/static/log.6f52d441.woff +0 -0
- package/static/dist/static/log.c8ac7397.woff2 +0 -0
- package/static/dist/{umi.1d7f9bce.js → umi.ae45a508.js} +1 -1
- package/version.yaml +9 -6
- package/static/dist/1467.bdbd9138.async.js +0 -1
- package/static/dist/1988.5291d10f.async.js +0 -1
- package/static/dist/3752.56c3fba2.async.js +0 -1
- package/static/dist/419.ac2bf583.async.js +0 -1
- package/static/dist/833.dd5f313b.async.js +0 -1
- package/static/dist/layouts__index.fee54067.chunk.css +0 -1
- package/static/dist/src__pages__crontab__index.8412ad8b.async.js +0 -1
- package/static/dist/src__pages__crontab__modal.ac728c12.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.ee409571.async.js +0 -1
- package/static/dist/src__pages__env__editNameModal.d95cff10.async.js +0 -1
- package/static/dist/src__pages__env__modal.4d698214.async.js +0 -1
- package/static/dist/src__pages__error__index.e5c6d102.async.js +0 -1
- package/static/dist/src__pages__initialization__index.f980caf8.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.4aaf6f11.async.js +0 -1
- package/static/dist/src__pages__script__index.65a00de3.async.js +0 -1
- package/static/dist/src__pages__script__renameModal.4f49ba83.async.js +0 -1
- package/static/dist/src__pages__script__saveModal.7ac25eed.async.js +0 -1
- package/static/dist/src__pages__script__setting.c846a61a.async.js +0 -1
- package/static/dist/src__pages__setting__appModal.c56f35bc.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.9dd181cb.async.js +0 -1
- package/static/dist/src__pages__setting__index.b4f5ebb7.async.js +0 -1
- package/static/dist/src__pages__setting__notification.022e491e.async.js +0 -1
- package/static/dist/src__pages__setting__security.cbf8e0b7.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.1b30b79c.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.cadd80d8.async.js +0 -1
package/docker/310.Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
FROM node:20-slim AS nodebuilder
|
|
2
2
|
|
|
3
|
-
FROM python:3.10-slim-
|
|
3
|
+
FROM python:3.10-slim-bookworm AS builder
|
|
4
4
|
COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
|
|
5
5
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
|
|
6
6
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
|
|
@@ -12,7 +12,7 @@ RUN set -x && \
|
|
|
12
12
|
cd /tmp/build && \
|
|
13
13
|
pnpm install --prod
|
|
14
14
|
|
|
15
|
-
FROM python:3.10-slim-
|
|
15
|
+
FROM python:3.10-slim-bookworm
|
|
16
16
|
|
|
17
17
|
ARG QL_MAINTAINER="whyour"
|
|
18
18
|
LABEL maintainer="${QL_MAINTAINER}"
|
|
@@ -45,7 +45,7 @@ RUN set -x && \
|
|
|
45
45
|
nginx \
|
|
46
46
|
jq \
|
|
47
47
|
procps \
|
|
48
|
-
netcat \
|
|
48
|
+
netcat-openbsd \
|
|
49
49
|
unzip \
|
|
50
50
|
libatomic1 && \
|
|
51
51
|
apt-get clean && \
|
package/docker/Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
FROM node:20-slim AS nodebuilder
|
|
2
2
|
|
|
3
|
-
FROM python:3.11-slim-
|
|
3
|
+
FROM python:3.11-slim-bookworm AS builder
|
|
4
4
|
COPY package.json .npmrc pnpm-lock.yaml /tmp/build/
|
|
5
5
|
COPY --from=nodebuilder /usr/local/bin/node /usr/local/bin/
|
|
6
6
|
COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_modules/
|
|
@@ -12,7 +12,7 @@ RUN set -x && \
|
|
|
12
12
|
cd /tmp/build && \
|
|
13
13
|
pnpm install --prod
|
|
14
14
|
|
|
15
|
-
FROM python:3.11-slim-
|
|
15
|
+
FROM python:3.11-slim-bookworm
|
|
16
16
|
|
|
17
17
|
ARG QL_MAINTAINER="whyour"
|
|
18
18
|
LABEL maintainer="${QL_MAINTAINER}"
|
|
@@ -46,7 +46,7 @@ RUN set -x && \
|
|
|
46
46
|
nginx \
|
|
47
47
|
jq \
|
|
48
48
|
procps \
|
|
49
|
-
netcat \
|
|
49
|
+
netcat-openbsd \
|
|
50
50
|
unzip \
|
|
51
51
|
libatomic1 && \
|
|
52
52
|
apt-get clean && \
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whyour/qinglong",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.12-rc.2",
|
|
4
4
|
"description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -122,6 +122,8 @@
|
|
|
122
122
|
"moment": "2.30.1",
|
|
123
123
|
"@ant-design/icons": "^4.7.0",
|
|
124
124
|
"@ant-design/pro-layout": "6.38.22",
|
|
125
|
+
"@codemirror/view": "^6.34.1",
|
|
126
|
+
"@codemirror/state": "^6.4.1",
|
|
125
127
|
"@monaco-editor/react": "4.2.1",
|
|
126
128
|
"@react-hook/resize-observer": "^1.2.6",
|
|
127
129
|
"react-router-dom": "6.26.1",
|
package/sample/config.sample.sh
CHANGED
|
@@ -211,7 +211,17 @@ export FSKEY=""
|
|
|
211
211
|
export QMSG_KEY=""
|
|
212
212
|
export QMSG_TYPE=""
|
|
213
213
|
|
|
214
|
-
## 20.
|
|
214
|
+
## 20.Ntfy
|
|
215
|
+
## 官方文档: https://docs.ntfy.sh
|
|
216
|
+
## ntfy_url 填写ntfy地址,如https://ntfy.sh
|
|
217
|
+
## ntfy_topic 填写ntfy的消息应用topic
|
|
218
|
+
## ntfy_priority 填写推送消息优先级,默认为3
|
|
219
|
+
export NTFY_URL=""
|
|
220
|
+
export NTFY_TOPIC=""
|
|
221
|
+
export NTFY_PRIORITY="3"
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
## 21. 自定义通知
|
|
215
225
|
## 自定义通知 接收回调的URL
|
|
216
226
|
export WEBHOOK_URL=""
|
|
217
227
|
## WEBHOOK_BODY 和 WEBHOOK_HEADERS 多个参数时,直接换行或者使用 $'\n' 连接多行字符串,比如 export dd="line 1"$'\n'"line 2"
|
package/sample/notify.js
CHANGED
|
@@ -95,6 +95,10 @@ const push_config = {
|
|
|
95
95
|
WEBHOOK_HEADERS: '', // 自定义通知 请求头
|
|
96
96
|
WEBHOOK_METHOD: '', // 自定义通知 请求方法
|
|
97
97
|
WEBHOOK_CONTENT_TYPE: '', // 自定义通知 content-type
|
|
98
|
+
|
|
99
|
+
NTFY_URL: '', // ntfy地址,如https://ntfy.sh,默认为https://ntfy.sh
|
|
100
|
+
NTFY_TOPIC: '', // ntfy的消息应用topic
|
|
101
|
+
NTFY_PRIORITY: '3', // 推送消息优先级,默认为3
|
|
98
102
|
};
|
|
99
103
|
|
|
100
104
|
for (const key in push_config) {
|
|
@@ -224,11 +228,13 @@ function serverNotify(text, desp) {
|
|
|
224
228
|
if (PUSH_KEY) {
|
|
225
229
|
// 微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
|
|
226
230
|
desp = desp.replace(/[\n\r]/g, '\n\n');
|
|
231
|
+
|
|
232
|
+
const matchResult = PUSH_KEY.match(/^sctp(\d+)t/i);
|
|
227
233
|
const options = {
|
|
228
|
-
url:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
body: `text=${text}&desp=${desp}`,
|
|
234
|
+
url: matchResult && matchResult[1]
|
|
235
|
+
? `https://${matchResult[1]}.push.ft07.com/send/${PUSH_KEY}.send`
|
|
236
|
+
: `https://sctapi.ftqq.com/${PUSH_KEY}.send`,
|
|
237
|
+
body: `text=${encodeURIComponent(text)}&desp=${encodeURIComponent(desp)}`,
|
|
232
238
|
headers: {
|
|
233
239
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
234
240
|
},
|
|
@@ -1188,6 +1194,48 @@ function webhookNotify(text, desp) {
|
|
|
1188
1194
|
});
|
|
1189
1195
|
}
|
|
1190
1196
|
|
|
1197
|
+
function ntfyNotify(text, desp) {
|
|
1198
|
+
function encodeRFC2047(text) {
|
|
1199
|
+
const encodedBase64 = Buffer.from(text).toString('base64');
|
|
1200
|
+
return `=?utf-8?B?${encodedBase64}?=`;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
return new Promise((resolve) => {
|
|
1204
|
+
const { NTFY_URL, NTFY_TOPIC, NTFY_PRIORITY } = push_config;
|
|
1205
|
+
if (NTFY_TOPIC) {
|
|
1206
|
+
const options = {
|
|
1207
|
+
url: `${NTFY_URL || 'https://ntfy.sh'}/${NTFY_TOPIC}`,
|
|
1208
|
+
body: `${desp}`,
|
|
1209
|
+
headers: {
|
|
1210
|
+
'Title': `${encodeRFC2047(text)}`,
|
|
1211
|
+
'Priority': NTFY_PRIORITY || '3'
|
|
1212
|
+
},
|
|
1213
|
+
timeout,
|
|
1214
|
+
};
|
|
1215
|
+
$.post(options, (err, resp, data) => {
|
|
1216
|
+
try {
|
|
1217
|
+
if (err) {
|
|
1218
|
+
console.log('Ntfy 通知调用API失败😞\n', err);
|
|
1219
|
+
} else {
|
|
1220
|
+
if (data.id) {
|
|
1221
|
+
console.log('Ntfy 发送通知消息成功🎉\n');
|
|
1222
|
+
} else {
|
|
1223
|
+
console.log(`Ntfy 发送通知消息异常 ${JSON.stringify(data)}`);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
} catch (e) {
|
|
1227
|
+
$.logErr(e, resp);
|
|
1228
|
+
} finally {
|
|
1229
|
+
resolve(data);
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
} else {
|
|
1233
|
+
resolve();
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
|
|
1191
1239
|
function parseString(input, valueFormatFn) {
|
|
1192
1240
|
const regex = /(\w+):\s*((?:(?!\n\w+:).)*)/g;
|
|
1193
1241
|
const matches = {};
|
|
@@ -1316,6 +1364,7 @@ async function sendNotify(text, desp, params = {}) {
|
|
|
1316
1364
|
chronocatNotify(text, desp), // Chronocat
|
|
1317
1365
|
webhookNotify(text, desp), // 自定义通知
|
|
1318
1366
|
qmsgNotify(text, desp), // 自定义通知
|
|
1367
|
+
ntfyNotify(text, desp), // Ntfy
|
|
1319
1368
|
]);
|
|
1320
1369
|
}
|
|
1321
1370
|
|
package/sample/notify.py
CHANGED
|
@@ -116,7 +116,11 @@ push_config = {
|
|
|
116
116
|
'WEBHOOK_BODY': '', # 自定义通知 请求体
|
|
117
117
|
'WEBHOOK_HEADERS': '', # 自定义通知 请求头
|
|
118
118
|
'WEBHOOK_METHOD': '', # 自定义通知 请求方法
|
|
119
|
-
'WEBHOOK_CONTENT_TYPE': ''
|
|
119
|
+
'WEBHOOK_CONTENT_TYPE': '', # 自定义通知 content-type
|
|
120
|
+
|
|
121
|
+
'NTFY_URL': '', # ntfy地址,如https://ntfy.sh
|
|
122
|
+
'NTFY_TOPIC': '', # ntfy的消息应用topic
|
|
123
|
+
'NTFY_PRIORITY':'3', # 推送消息优先级,默认为3
|
|
120
124
|
}
|
|
121
125
|
# fmt: on
|
|
122
126
|
|
|
@@ -298,10 +302,14 @@ def serverJ(title: str, content: str) -> None:
|
|
|
298
302
|
print("serverJ 服务启动")
|
|
299
303
|
|
|
300
304
|
data = {"text": title, "desp": content.replace("\n", "\n\n")}
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
|
|
306
|
+
match = re.match(r'sctp(\d+)t', push_config.get("PUSH_KEY"))
|
|
307
|
+
if match:
|
|
308
|
+
num = match.group(1)
|
|
309
|
+
url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send'
|
|
303
310
|
else:
|
|
304
|
-
url = f'https://
|
|
311
|
+
url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send'
|
|
312
|
+
|
|
305
313
|
response = requests.post(url, data=data).json()
|
|
306
314
|
|
|
307
315
|
if response.get("errno") == 0 or response.get("code") == 0:
|
|
@@ -777,6 +785,42 @@ def chronocat(title: str, content: str) -> None:
|
|
|
777
785
|
print(f"QQ群消息:{ids}推送失败!")
|
|
778
786
|
|
|
779
787
|
|
|
788
|
+
def ntfy(title: str, content: str) -> None:
|
|
789
|
+
"""
|
|
790
|
+
通过 Ntfy 推送消息
|
|
791
|
+
"""
|
|
792
|
+
def encode_rfc2047(text: str) -> str:
|
|
793
|
+
"""将文本编码为符合 RFC 2047 标准的格式"""
|
|
794
|
+
encoded_bytes = base64.b64encode(text.encode('utf-8'))
|
|
795
|
+
encoded_str = encoded_bytes.decode('utf-8')
|
|
796
|
+
return f'=?utf-8?B?{encoded_str}?='
|
|
797
|
+
|
|
798
|
+
if not push_config.get("NTFY_TOPIC"):
|
|
799
|
+
print("ntfy 服务的 NTFY_TOPIC 未设置!!\n取消推送")
|
|
800
|
+
return
|
|
801
|
+
print("ntfy 服务启动")
|
|
802
|
+
priority = '3'
|
|
803
|
+
if not push_config.get("NTFY_PRIORITY"):
|
|
804
|
+
print("ntfy 服务的NTFY_PRIORITY 未设置!!默认设置为3")
|
|
805
|
+
else:
|
|
806
|
+
priority = push_config.get("NTFY_PRIORITY")
|
|
807
|
+
|
|
808
|
+
# 使用 RFC 2047 编码 title
|
|
809
|
+
encoded_title = encode_rfc2047(title)
|
|
810
|
+
|
|
811
|
+
data = content.encode(encoding='utf-8')
|
|
812
|
+
headers = {
|
|
813
|
+
"Title": encoded_title, # 使用编码后的 title
|
|
814
|
+
"Priority": priority
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
url = push_config.get("NTFY_URL") + "/" + push_config.get("NTFY_TOPIC")
|
|
818
|
+
response = requests.post(url, data=data, headers=headers)
|
|
819
|
+
if response.status_code == 200: # 使用 response.status_code 进行检查
|
|
820
|
+
print("Ntfy 推送成功!")
|
|
821
|
+
else:
|
|
822
|
+
print("Ntfy 推送失败!错误信息:", response.text)
|
|
823
|
+
|
|
780
824
|
def parse_headers(headers):
|
|
781
825
|
if not headers:
|
|
782
826
|
return {}
|
|
@@ -937,7 +981,8 @@ def add_notify_function():
|
|
|
937
981
|
notify_function.append(chronocat)
|
|
938
982
|
if push_config.get("WEBHOOK_URL") and push_config.get("WEBHOOK_METHOD"):
|
|
939
983
|
notify_function.append(custom_notify)
|
|
940
|
-
|
|
984
|
+
if push_config.get("NTFY_TOPIC"):
|
|
985
|
+
notify_function.append(ntfy)
|
|
941
986
|
if not notify_function:
|
|
942
987
|
print(f"无推送渠道,请检查通知变量是否正确")
|
|
943
988
|
return notify_function
|
|
@@ -979,4 +1024,4 @@ def main():
|
|
|
979
1024
|
|
|
980
1025
|
|
|
981
1026
|
if __name__ == "__main__":
|
|
982
|
-
main()
|
|
1027
|
+
main()
|