@whyour/qinglong 2.17.12-rc.2 → 2.18.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 +1 -1
- package/README.md +2 -2
- package/docker/docker-compose.yml +3 -8
- package/package.json +45 -41
- package/sample/config.sample.sh +21 -2
- package/sample/notify.js +114 -15
- package/sample/notify.py +99 -45
- package/shell/api.sh +26 -0
- package/shell/preload/sitecustomize.js +7 -1
- package/shell/preload/sitecustomize.py +9 -1
- package/shell/share.sh +3 -7
- package/shell/start.sh +6 -1
- package/shell/task.sh +1 -1
- package/shell/update.sh +2 -6
- package/static/build/api/config.js +2 -1
- package/static/build/api/script.js +4 -3
- package/static/build/api/system.js +16 -1
- package/static/build/api/user.js +1 -1
- package/static/build/config/util.js +13 -3
- package/static/build/data/notify.js +16 -1
- package/static/build/data/system.js +1 -0
- package/static/build/loaders/express.js +11 -14
- package/static/build/loaders/initData.js +41 -5
- package/static/build/loaders/initFile.js +74 -76
- package/static/build/loaders/sock.js +4 -5
- package/static/build/loaders/update.js +2 -2
- package/static/build/schedule/index.js +0 -1
- package/static/build/services/cron.js +2 -1
- package/static/build/services/dependence.js +16 -7
- package/static/build/services/env.js +4 -27
- package/static/build/services/notify.js +50 -4
- package/static/build/services/open.js +16 -14
- package/static/build/services/schedule.js +1 -1
- package/static/build/services/sshKey.js +5 -6
- package/static/build/services/system.js +17 -5
- package/static/build/services/user.js +116 -161
- package/static/build/shared/store.js +32 -0
- package/static/build/shared/utils.js +27 -0
- package/static/build/token.js +2 -6
- package/static/dist/{827.efeeec44.async.js → 105.85a5c47a.async.js} +1 -1
- package/static/dist/{4588.46a3a31e.async.js → 1083.f86ce804.async.js} +1 -1
- package/static/dist/1149.33cb7e7a.async.js +1 -0
- package/static/dist/119.89e2d610.async.js +1 -0
- package/static/dist/{9631.042017c3.async.js → 1352.ab6da08e.async.js} +1 -1
- package/static/dist/1690.f0290540.async.js +1 -0
- package/static/dist/1742.6cbe5aca.async.js +1 -0
- package/static/dist/1765.d8e002d7.async.js +1 -0
- package/static/dist/1885.e0d00d2d.async.js +1 -0
- package/static/dist/2081.d0d781b1.async.js +1 -0
- package/static/dist/2096.383c1047.async.js +1 -0
- package/static/dist/2237.4d3def87.async.js +1 -0
- package/static/dist/2325.dfa32834.async.js +1 -0
- package/static/dist/2338.d678967d.async.js +1 -0
- package/static/dist/255.12f03ab2.async.js +1 -0
- package/static/dist/2625.675b6a18.chunk.css +1 -0
- package/static/dist/2634.a765cd37.async.js +1 -0
- package/static/dist/{8605.f56664b9.async.js → 2742.4852aac8.async.js} +1 -1
- package/static/dist/2821.be3dc88e.async.js +1 -0
- package/static/dist/2890.9e373f5b.async.js +1 -0
- package/static/dist/{4658.8a9e2830.async.js → 3034.6413c38e.async.js} +1 -1
- package/static/dist/3382.a584a111.async.js +1 -0
- package/static/dist/{2755.f6377d52.async.js → 3383.041eee73.async.js} +1 -1
- package/static/dist/3390.fb4b6851.async.js +1 -0
- package/static/dist/3481.333c2962.async.js +1 -0
- package/static/dist/3600.7637c822.async.js +1 -0
- package/static/dist/4046.7fbcfa02.async.js +1 -0
- package/static/dist/4642.9e24d86c.async.js +1 -0
- package/static/dist/4799.d5ca9f30.async.js +1 -0
- package/static/dist/4865.98e5a005.async.js +1 -0
- package/static/dist/4902.54ecbdb5.async.js +1 -0
- package/static/dist/5171.7fc6d0a2.async.js +1 -0
- package/static/dist/5312.5545b3ed.async.js +1 -0
- package/static/dist/5481.624d0e07.async.js +1 -0
- package/static/dist/5520.ff2cfd6b.async.js +1 -0
- package/static/dist/{8167.8f9d5e88.async.js → 5653.4fce7ce8.async.js} +1 -1
- package/static/dist/5970.10ac4f16.async.js +1 -0
- package/static/dist/6013.2d7bb12a.async.js +1 -0
- package/static/dist/6016.9c379049.async.js +1 -0
- package/static/dist/6035.5889ddc7.async.js +1 -0
- package/static/dist/6159.55cb068a.async.js +1 -0
- package/static/dist/{5394.de174420.async.js → 6247.b550d996.async.js} +1 -1
- package/static/dist/6341.673fb65c.async.js +1 -0
- package/static/dist/6439.7ef6c5e3.async.js +1 -0
- package/static/dist/{6141.db67ebff.async.js → 6541.a6d499de.async.js} +1 -1
- package/static/dist/6646.5fc37228.async.js +1 -0
- package/static/dist/6707.801b886b.async.js +1 -0
- package/static/dist/6872.42f939f1.async.js +1 -0
- package/static/dist/691.187a388c.async.js +1 -0
- package/static/dist/{1667.94045304.async.js → 7025.f4080d63.async.js} +1 -1
- package/static/dist/7285.d561cf26.async.js +1 -0
- package/static/dist/7355.5e5e573b.async.js +1 -0
- package/static/dist/7384.065ccae2.async.js +1 -0
- package/static/dist/739.6be5552a.async.js +1 -0
- package/static/dist/7528.d8b76d8a.async.js +1 -0
- package/static/dist/7802.6b73f16a.async.js +1 -0
- package/static/dist/{9120.ef78d517.async.js → 8060.8b699029.async.js} +1 -1
- package/static/dist/{8078.4add9375.async.js → 8078.8586c875.async.js} +1 -1
- package/static/dist/8142.e3e82eda.async.js +1 -0
- package/static/dist/852.15be2189.async.js +1 -0
- package/static/dist/8528.3dffc548.async.js +1 -0
- package/static/dist/872.10bd0974.async.js +1 -0
- package/static/dist/872.3fffed15.chunk.css +1 -0
- package/static/dist/8982.d2dba153.async.js +1 -0
- package/static/dist/9065.df8d5dcc.async.js +1 -0
- package/static/dist/9066.605168f8.async.js +1 -0
- package/static/dist/955.3c9481f7.async.js +1 -0
- package/static/dist/9730.30083c91.async.js +1 -0
- package/static/dist/9761.627ca3b5.async.js +1 -0
- package/static/dist/index.html +8 -7
- package/static/dist/layouts__index.1fce90e0.chunk.css +1 -0
- package/static/dist/layouts__index.c164d41f.async.js +1 -0
- package/static/dist/preload_helper.55b35ae0.js +1 -0
- package/static/dist/src__pages__404.6871535b.async.js +1 -0
- package/static/dist/src__pages__config__index.39b5f99f.async.js +1 -0
- package/static/dist/src__pages__crontab__detail.6f7c3205.async.js +1 -0
- package/static/dist/src__pages__crontab__index.55a8714d.async.js +1 -0
- package/static/dist/src__pages__crontab__logModal.c88ea3b7.async.js +1 -0
- package/static/dist/src__pages__crontab__modal.328fee41.async.js +1 -0
- package/static/dist/{src__pages__crontab__type.a798cac7.async.js → src__pages__crontab__type.5895ed02.async.js} +1 -1
- package/static/dist/src__pages__crontab__viewCreateModal.ffcf7a24.async.js +1 -0
- package/static/dist/src__pages__crontab__viewManageModal.c71ebc5a.async.js +1 -0
- package/static/dist/src__pages__dependence__index.edec638b.async.js +1 -0
- package/static/dist/src__pages__dependence__logModal.f123e2ac.async.js +1 -0
- package/static/dist/src__pages__dependence__modal.9fd1176b.async.js +1 -0
- package/static/dist/{src__pages__dependence__type.860703e8.async.js → src__pages__dependence__type.bdac3725.async.js} +1 -1
- package/static/dist/src__pages__diff__index.8ba53a1e.async.js +1 -0
- package/static/dist/src__pages__env__editNameModal.c35e96f9.async.js +1 -0
- package/static/dist/src__pages__env__index.c799138c.async.js +1 -0
- package/static/dist/src__pages__env__modal.3b0ca9a6.async.js +1 -0
- package/static/dist/src__pages__error__index.0221fcd9.async.js +1 -0
- package/static/dist/src__pages__initialization__index.346725d1.async.js +1 -0
- package/static/dist/src__pages__log__index.2fd615f2.async.js +1 -0
- package/static/dist/src__pages__login__index.1dd6e684.async.js +1 -0
- package/static/dist/src__pages__script__editModal.28caeb56.async.js +1 -0
- package/static/dist/src__pages__script__editNameModal.1155d34c.async.js +1 -0
- package/static/dist/src__pages__script__index.6a212c2d.async.js +1 -0
- package/static/dist/src__pages__script__renameModal.dabfccfd.async.js +1 -0
- package/static/dist/src__pages__script__saveModal.04d43882.async.js +1 -0
- package/static/dist/src__pages__script__setting.9d5ad53c.async.js +1 -0
- package/static/dist/src__pages__setting__about.3a1a6f3b.async.js +1 -0
- package/static/dist/src__pages__setting__appModal.7b3bff1e.async.js +1 -0
- package/static/dist/src__pages__setting__checkUpdate.0dfdaf7c.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.a9b7ed43.async.js +1 -0
- package/static/dist/src__pages__setting__index.ffa1cdd6.async.js +1 -0
- package/static/dist/src__pages__setting__loginLog.fc87584a.async.js +1 -0
- package/static/dist/src__pages__setting__notification.97b1d997.async.js +1 -0
- package/static/dist/src__pages__setting__other.34ccb2e8.async.js +1 -0
- package/static/dist/src__pages__setting__progress.75143dca.async.js +1 -0
- package/static/dist/src__pages__setting__security.c777fb87.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.63e9c69d.async.js +1 -0
- package/static/dist/src__pages__subscription__index.69a6de02.async.js +1 -0
- package/static/dist/src__pages__subscription__logModal.b3c7c02c.async.js +1 -0
- package/static/dist/src__pages__subscription__modal.aefaf070.async.js +1 -0
- package/static/dist/umi.a4d14b92.css +1 -0
- package/static/dist/umi.fb3ed7a0.js +1 -0
- package/version.yaml +7 -10
- package/static/dist/1186.39086229.async.js +0 -1
- package/static/dist/1431.36b64dc5.async.js +0 -1
- package/static/dist/1467.6163d4ee.async.js +0 -1
- package/static/dist/2099.a46e32fc.async.js +0 -1
- package/static/dist/2182.59dcf306.chunk.css +0 -1
- package/static/dist/2260.6c4d0bd0.async.js +0 -1
- package/static/dist/2393.3d8adf53.async.js +0 -1
- package/static/dist/2618.7a71aedf.async.js +0 -1
- package/static/dist/2715.292538bc.async.js +0 -1
- package/static/dist/2796.9a52d80e.async.js +0 -1
- package/static/dist/2899.03668225.async.js +0 -1
- package/static/dist/29.32a92099.async.js +0 -1
- package/static/dist/3435.2670d41f.async.js +0 -1
- package/static/dist/3435.d2d0a2c7.chunk.css +0 -1
- package/static/dist/3669.d39d1a9d.async.js +0 -1
- package/static/dist/380.33bc8989.async.js +0 -1
- package/static/dist/3800.f0507af4.async.js +0 -1
- package/static/dist/4039.badd6267.async.js +0 -1
- package/static/dist/4124.980265f2.async.js +0 -1
- package/static/dist/4163.17026fe1.async.js +0 -1
- package/static/dist/419.908ca086.async.js +0 -1
- package/static/dist/4424.a840b858.async.js +0 -1
- package/static/dist/4645.d909733e.async.js +0 -1
- package/static/dist/4674.1b3db685.async.js +0 -1
- package/static/dist/4925.9b770864.async.js +0 -1
- package/static/dist/5310.4cd7a0c1.async.js +0 -1
- package/static/dist/5484.68655765.async.js +0 -1
- package/static/dist/573.21675f9c.async.js +0 -1
- package/static/dist/5830.9be47cbb.async.js +0 -1
- package/static/dist/6035.48d17c03.async.js +0 -1
- package/static/dist/6064.a5141a7d.async.js +0 -1
- package/static/dist/641.f0614d96.async.js +0 -1
- package/static/dist/6712.05e15d48.async.js +0 -1
- package/static/dist/6805.ae3d4019.async.js +0 -1
- package/static/dist/694.0baa21db.async.js +0 -1
- package/static/dist/6986.6a4ae181.async.js +0 -1
- package/static/dist/7346.7096e3b3.async.js +0 -1
- package/static/dist/7362.e740709d.async.js +0 -1
- package/static/dist/7393.ea2d5ba3.async.js +0 -1
- package/static/dist/745.3be9ce9f.async.js +0 -1
- package/static/dist/7742.51617038.async.js +0 -1
- package/static/dist/7787.b041d555.async.js +0 -1
- package/static/dist/7987.5bace809.async.js +0 -1
- package/static/dist/8298.978b54ae.async.js +0 -1
- package/static/dist/833.87a694db.async.js +0 -1
- package/static/dist/8430.0291dda0.async.js +0 -1
- package/static/dist/8432.d8d0ade6.async.js +0 -1
- package/static/dist/858.1a385b25.async.js +0 -1
- package/static/dist/8934.55adca8f.async.js +0 -1
- package/static/dist/9065.a1341834.async.js +0 -1
- package/static/dist/9504.22415050.async.js +0 -1
- package/static/dist/9673.ac17e45d.async.js +0 -1
- package/static/dist/9847.d72d4b37.async.js +0 -1
- package/static/dist/layouts__index.2f94d49c.async.js +0 -1
- package/static/dist/layouts__index.35164d74.chunk.css +0 -1
- package/static/dist/src__pages__404.e1ca45fd.async.js +0 -1
- package/static/dist/src__pages__config__index.c778a0e0.async.js +0 -1
- package/static/dist/src__pages__crontab__detail.34c9ca68.async.js +0 -1
- package/static/dist/src__pages__crontab__index.f196124c.async.js +0 -1
- package/static/dist/src__pages__crontab__logModal.91357c7c.async.js +0 -1
- package/static/dist/src__pages__crontab__modal.6fa9520e.async.js +0 -1
- package/static/dist/src__pages__crontab__viewCreateModal.1fe0e251.async.js +0 -1
- package/static/dist/src__pages__crontab__viewManageModal.c6dcfcf8.async.js +0 -1
- package/static/dist/src__pages__dependence__index.aca3926b.async.js +0 -1
- package/static/dist/src__pages__dependence__logModal.07786c7c.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.e67d0ff6.async.js +0 -1
- package/static/dist/src__pages__diff__index.82b124a8.async.js +0 -1
- package/static/dist/src__pages__env__editNameModal.38d65f05.async.js +0 -1
- package/static/dist/src__pages__env__index.f545d035.async.js +0 -1
- package/static/dist/src__pages__env__modal.6fad122b.async.js +0 -1
- package/static/dist/src__pages__error__index.c5c8ed46.async.js +0 -1
- package/static/dist/src__pages__initialization__index.a26591c2.async.js +0 -1
- package/static/dist/src__pages__log__index.bc06b12f.async.js +0 -1
- package/static/dist/src__pages__login__index.e4257741.async.js +0 -1
- package/static/dist/src__pages__script__editModal.be12c9e5.async.js +0 -1
- package/static/dist/src__pages__script__editNameModal.e7f7fea1.async.js +0 -1
- package/static/dist/src__pages__script__index.4fdb14ad.async.js +0 -1
- package/static/dist/src__pages__script__renameModal.436dedbf.async.js +0 -1
- package/static/dist/src__pages__script__saveModal.f65940c2.async.js +0 -1
- package/static/dist/src__pages__script__setting.b4891488.async.js +0 -1
- package/static/dist/src__pages__setting__about.d7cea886.async.js +0 -1
- package/static/dist/src__pages__setting__appModal.48994718.async.js +0 -1
- package/static/dist/src__pages__setting__checkUpdate.0dd2f8d5.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.b6d378b3.async.js +0 -1
- package/static/dist/src__pages__setting__index.45c54c51.async.js +0 -1
- package/static/dist/src__pages__setting__loginLog.4ba597ea.async.js +0 -1
- package/static/dist/src__pages__setting__notification.7df85f89.async.js +0 -1
- package/static/dist/src__pages__setting__other.2c4534ef.async.js +0 -1
- package/static/dist/src__pages__setting__progress.57907231.async.js +0 -1
- package/static/dist/src__pages__setting__security.e26348a7.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.a77a9995.async.js +0 -1
- package/static/dist/src__pages__subscription__index.0f0a7c0a.async.js +0 -1
- package/static/dist/src__pages__subscription__logModal.8d68bb96.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.26538bfd.async.js +0 -1
- package/static/dist/umi.8a0eaca6.css +0 -1
- package/static/dist/umi.ae45a508.js +0 -1
package/sample/notify.py
CHANGED
|
@@ -72,8 +72,13 @@ push_config = {
|
|
|
72
72
|
'CHAT_URL': '', # synology chat url
|
|
73
73
|
'CHAT_TOKEN': '', # synology chat token
|
|
74
74
|
|
|
75
|
-
'PUSH_PLUS_TOKEN': '', #
|
|
76
|
-
'PUSH_PLUS_USER': '', #
|
|
75
|
+
'PUSH_PLUS_TOKEN': '', # pushplus 推送的用户令牌
|
|
76
|
+
'PUSH_PLUS_USER': '', # pushplus 推送的群组编码
|
|
77
|
+
'PUSH_PLUS_TEMPLATE': 'html', # pushplus 发送模板,支持html,txt,json,markdown,cloudMonitor,jenkins,route,pay
|
|
78
|
+
'PUSH_PLUS_CHANNEL': 'wechat', # pushplus 发送渠道,支持wechat,webhook,cp,mail,sms
|
|
79
|
+
'PUSH_PLUS_WEBHOOK': '', # pushplus webhook编码,可在pushplus公众号上扩展配置出更多渠道
|
|
80
|
+
'PUSH_PLUS_CALLBACKURL': '', # pushplus 发送结果回调地址,会把推送最终结果通知到这个地址上
|
|
81
|
+
'PUSH_PLUS_TO': '', # pushplus 好友令牌,微信公众号渠道填写好友令牌,企业微信渠道填写企业微信用户id
|
|
77
82
|
|
|
78
83
|
'WE_PLUS_BOT_TOKEN': '', # 微加机器人的用户令牌
|
|
79
84
|
'WE_PLUS_BOT_RECEIVER': '', # 微加机器人的消息接收者
|
|
@@ -121,6 +126,10 @@ push_config = {
|
|
|
121
126
|
'NTFY_URL': '', # ntfy地址,如https://ntfy.sh
|
|
122
127
|
'NTFY_TOPIC': '', # ntfy的消息应用topic
|
|
123
128
|
'NTFY_PRIORITY':'3', # 推送消息优先级,默认为3
|
|
129
|
+
|
|
130
|
+
'WXPUSHER_APP_TOKEN': '', # wxpusher 的 appToken 官方文档: https://wxpusher.zjiecode.com/docs/ 管理后台: https://wxpusher.zjiecode.com/admin/
|
|
131
|
+
'WXPUSHER_TOPIC_IDS': '', # wxpusher 的 主题ID,多个用英文分号;分隔 topic_ids 与 uids 至少配置一个才行
|
|
132
|
+
'WXPUSHER_UIDS': '', # wxpusher 的 用户ID,多个用英文分号;分隔 topic_ids 与 uids 至少配置一个才行
|
|
124
133
|
}
|
|
125
134
|
# fmt: on
|
|
126
135
|
|
|
@@ -135,7 +144,6 @@ def bark(title: str, content: str) -> None:
|
|
|
135
144
|
使用 bark 推送消息。
|
|
136
145
|
"""
|
|
137
146
|
if not push_config.get("BARK_PUSH"):
|
|
138
|
-
print("bark 服务的 BARK_PUSH 未设置!!\n取消推送")
|
|
139
147
|
return
|
|
140
148
|
print("bark 服务启动")
|
|
141
149
|
|
|
@@ -187,7 +195,6 @@ def dingding_bot(title: str, content: str) -> None:
|
|
|
187
195
|
使用 钉钉机器人 推送消息。
|
|
188
196
|
"""
|
|
189
197
|
if not push_config.get("DD_BOT_SECRET") or not push_config.get("DD_BOT_TOKEN"):
|
|
190
|
-
print("钉钉机器人 服务的 DD_BOT_SECRET 或者 DD_BOT_TOKEN 未设置!!\n取消推送")
|
|
191
198
|
return
|
|
192
199
|
print("钉钉机器人 服务启动")
|
|
193
200
|
|
|
@@ -217,7 +224,6 @@ def feishu_bot(title: str, content: str) -> None:
|
|
|
217
224
|
使用 飞书机器人 推送消息。
|
|
218
225
|
"""
|
|
219
226
|
if not push_config.get("FSKEY"):
|
|
220
|
-
print("飞书 服务的 FSKEY 未设置!!\n取消推送")
|
|
221
227
|
return
|
|
222
228
|
print("飞书 服务启动")
|
|
223
229
|
|
|
@@ -236,7 +242,6 @@ def go_cqhttp(title: str, content: str) -> None:
|
|
|
236
242
|
使用 go_cqhttp 推送消息。
|
|
237
243
|
"""
|
|
238
244
|
if not push_config.get("GOBOT_URL") or not push_config.get("GOBOT_QQ"):
|
|
239
|
-
print("go-cqhttp 服务的 GOBOT_URL 或 GOBOT_QQ 未设置!!\n取消推送")
|
|
240
245
|
return
|
|
241
246
|
print("go-cqhttp 服务启动")
|
|
242
247
|
|
|
@@ -254,7 +259,6 @@ def gotify(title: str, content: str) -> None:
|
|
|
254
259
|
使用 gotify 推送消息。
|
|
255
260
|
"""
|
|
256
261
|
if not push_config.get("GOTIFY_URL") or not push_config.get("GOTIFY_TOKEN"):
|
|
257
|
-
print("gotify 服务的 GOTIFY_URL 或 GOTIFY_TOKEN 未设置!!\n取消推送")
|
|
258
262
|
return
|
|
259
263
|
print("gotify 服务启动")
|
|
260
264
|
|
|
@@ -277,7 +281,6 @@ def iGot(title: str, content: str) -> None:
|
|
|
277
281
|
使用 iGot 推送消息。
|
|
278
282
|
"""
|
|
279
283
|
if not push_config.get("IGOT_PUSH_KEY"):
|
|
280
|
-
print("iGot 服务的 IGOT_PUSH_KEY 未设置!!\n取消推送")
|
|
281
284
|
return
|
|
282
285
|
print("iGot 服务启动")
|
|
283
286
|
|
|
@@ -297,13 +300,12 @@ def serverJ(title: str, content: str) -> None:
|
|
|
297
300
|
通过 serverJ 推送消息。
|
|
298
301
|
"""
|
|
299
302
|
if not push_config.get("PUSH_KEY"):
|
|
300
|
-
print("serverJ 服务的 PUSH_KEY 未设置!!\n取消推送")
|
|
301
303
|
return
|
|
302
304
|
print("serverJ 服务启动")
|
|
303
305
|
|
|
304
306
|
data = {"text": title, "desp": content.replace("\n", "\n\n")}
|
|
305
307
|
|
|
306
|
-
match = re.match(r
|
|
308
|
+
match = re.match(r"sctp(\d+)t", push_config.get("PUSH_KEY"))
|
|
307
309
|
if match:
|
|
308
310
|
num = match.group(1)
|
|
309
311
|
url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send'
|
|
@@ -323,7 +325,6 @@ def pushdeer(title: str, content: str) -> None:
|
|
|
323
325
|
通过PushDeer 推送消息
|
|
324
326
|
"""
|
|
325
327
|
if not push_config.get("DEER_KEY"):
|
|
326
|
-
print("PushDeer 服务的 DEER_KEY 未设置!!\n取消推送")
|
|
327
328
|
return
|
|
328
329
|
print("PushDeer 服务启动")
|
|
329
330
|
data = {
|
|
@@ -349,7 +350,6 @@ def chat(title: str, content: str) -> None:
|
|
|
349
350
|
通过Chat 推送消息
|
|
350
351
|
"""
|
|
351
352
|
if not push_config.get("CHAT_URL") or not push_config.get("CHAT_TOKEN"):
|
|
352
|
-
print("chat 服务的 CHAT_URL或CHAT_TOKEN 未设置!!\n取消推送")
|
|
353
353
|
return
|
|
354
354
|
print("chat 服务启动")
|
|
355
355
|
data = "payload=" + json.dumps({"text": title + "\n" + content})
|
|
@@ -364,26 +364,36 @@ def chat(title: str, content: str) -> None:
|
|
|
364
364
|
|
|
365
365
|
def pushplus_bot(title: str, content: str) -> None:
|
|
366
366
|
"""
|
|
367
|
-
通过
|
|
367
|
+
通过 pushplus 推送消息。
|
|
368
368
|
"""
|
|
369
369
|
if not push_config.get("PUSH_PLUS_TOKEN"):
|
|
370
|
-
print("PUSHPLUS 服务的 PUSH_PLUS_TOKEN 未设置!!\n取消推送")
|
|
371
370
|
return
|
|
372
371
|
print("PUSHPLUS 服务启动")
|
|
373
372
|
|
|
374
|
-
url = "
|
|
373
|
+
url = "https://www.pushplus.plus/send"
|
|
375
374
|
data = {
|
|
376
375
|
"token": push_config.get("PUSH_PLUS_TOKEN"),
|
|
377
376
|
"title": title,
|
|
378
377
|
"content": content,
|
|
379
378
|
"topic": push_config.get("PUSH_PLUS_USER"),
|
|
379
|
+
"template": push_config.get("PUSH_PLUS_TEMPLATE"),
|
|
380
|
+
"channel": push_config.get("PUSH_PLUS_CHANNEL"),
|
|
381
|
+
"webhook": push_config.get("PUSH_PLUS_WEBHOOK"),
|
|
382
|
+
"callbackUrl": push_config.get("PUSH_PLUS_CALLBACKURL"),
|
|
383
|
+
"to": push_config.get("PUSH_PLUS_TO"),
|
|
380
384
|
}
|
|
381
385
|
body = json.dumps(data).encode(encoding="utf-8")
|
|
382
386
|
headers = {"Content-Type": "application/json"}
|
|
383
387
|
response = requests.post(url=url, data=body, headers=headers).json()
|
|
384
388
|
|
|
385
|
-
|
|
386
|
-
|
|
389
|
+
code = response["code"]
|
|
390
|
+
if code == 200:
|
|
391
|
+
print("PUSHPLUS 推送请求成功,可根据流水号查询推送结果:" + response["data"])
|
|
392
|
+
print(
|
|
393
|
+
"注意:请求成功并不代表推送成功,如未收到消息,请到pushplus官网使用流水号查询推送最终结果"
|
|
394
|
+
)
|
|
395
|
+
elif code == 900 or code == 903 or code == 905 or code == 999:
|
|
396
|
+
print(response["msg"])
|
|
387
397
|
|
|
388
398
|
else:
|
|
389
399
|
url_old = "http://pushplus.hxtrip.com/send"
|
|
@@ -402,7 +412,6 @@ def weplus_bot(title: str, content: str) -> None:
|
|
|
402
412
|
通过 微加机器人 推送消息。
|
|
403
413
|
"""
|
|
404
414
|
if not push_config.get("WE_PLUS_BOT_TOKEN"):
|
|
405
|
-
print("微加机器人 服务的 WE_PLUS_BOT_TOKEN 未设置!!\n取消推送")
|
|
406
415
|
return
|
|
407
416
|
print("微加机器人 服务启动")
|
|
408
417
|
|
|
@@ -434,7 +443,6 @@ def qmsg_bot(title: str, content: str) -> None:
|
|
|
434
443
|
使用 qmsg 推送消息。
|
|
435
444
|
"""
|
|
436
445
|
if not push_config.get("QMSG_KEY") or not push_config.get("QMSG_TYPE"):
|
|
437
|
-
print("qmsg 的 QMSG_KEY 或者 QMSG_TYPE 未设置!!\n取消推送")
|
|
438
446
|
return
|
|
439
447
|
print("qmsg 服务启动")
|
|
440
448
|
|
|
@@ -453,11 +461,10 @@ def wecom_app(title: str, content: str) -> None:
|
|
|
453
461
|
通过 企业微信 APP 推送消息。
|
|
454
462
|
"""
|
|
455
463
|
if not push_config.get("QYWX_AM"):
|
|
456
|
-
print("QYWX_AM 未设置!!\n取消推送")
|
|
457
464
|
return
|
|
458
465
|
QYWX_AM_AY = re.split(",", push_config.get("QYWX_AM"))
|
|
459
466
|
if 4 < len(QYWX_AM_AY) > 5:
|
|
460
|
-
print("QYWX_AM
|
|
467
|
+
print("QYWX_AM 设置错误!!")
|
|
461
468
|
return
|
|
462
469
|
print("企业微信 APP 服务启动")
|
|
463
470
|
|
|
@@ -550,7 +557,6 @@ def wecom_bot(title: str, content: str) -> None:
|
|
|
550
557
|
通过 企业微信机器人 推送消息。
|
|
551
558
|
"""
|
|
552
559
|
if not push_config.get("QYWX_KEY"):
|
|
553
|
-
print("企业微信机器人 服务的 QYWX_KEY 未设置!!\n取消推送")
|
|
554
560
|
return
|
|
555
561
|
print("企业微信机器人服务启动")
|
|
556
562
|
|
|
@@ -576,7 +582,6 @@ def telegram_bot(title: str, content: str) -> None:
|
|
|
576
582
|
使用 telegram 机器人 推送消息。
|
|
577
583
|
"""
|
|
578
584
|
if not push_config.get("TG_BOT_TOKEN") or not push_config.get("TG_USER_ID"):
|
|
579
|
-
print("tg 服务的 bot_token 或者 user_id 未设置!!\n取消推送")
|
|
580
585
|
return
|
|
581
586
|
print("tg 服务启动")
|
|
582
587
|
|
|
@@ -625,9 +630,6 @@ def aibotk(title: str, content: str) -> None:
|
|
|
625
630
|
or not push_config.get("AIBOTK_TYPE")
|
|
626
631
|
or not push_config.get("AIBOTK_NAME")
|
|
627
632
|
):
|
|
628
|
-
print(
|
|
629
|
-
"智能微秘书 的 AIBOTK_KEY 或者 AIBOTK_TYPE 或者 AIBOTK_NAME 未设置!!\n取消推送"
|
|
630
|
-
)
|
|
631
633
|
return
|
|
632
634
|
print("智能微秘书 服务启动")
|
|
633
635
|
|
|
@@ -666,9 +668,6 @@ def smtp(title: str, content: str) -> None:
|
|
|
666
668
|
or not push_config.get("SMTP_PASSWORD")
|
|
667
669
|
or not push_config.get("SMTP_NAME")
|
|
668
670
|
):
|
|
669
|
-
print(
|
|
670
|
-
"SMTP 邮件 的 SMTP_SERVER 或者 SMTP_SSL 或者 SMTP_EMAIL 或者 SMTP_PASSWORD 或者 SMTP_NAME 未设置!!\n取消推送"
|
|
671
|
-
)
|
|
672
671
|
return
|
|
673
672
|
print("SMTP 邮件 服务启动")
|
|
674
673
|
|
|
@@ -712,7 +711,6 @@ def pushme(title: str, content: str) -> None:
|
|
|
712
711
|
使用 PushMe 推送消息。
|
|
713
712
|
"""
|
|
714
713
|
if not push_config.get("PUSHME_KEY"):
|
|
715
|
-
print("PushMe 服务的 PUSHME_KEY 未设置!!\n取消推送")
|
|
716
714
|
return
|
|
717
715
|
print("PushMe 服务启动")
|
|
718
716
|
|
|
@@ -745,7 +743,6 @@ def chronocat(title: str, content: str) -> None:
|
|
|
745
743
|
or not push_config.get("CHRONOCAT_QQ")
|
|
746
744
|
or not push_config.get("CHRONOCAT_TOKEN")
|
|
747
745
|
):
|
|
748
|
-
print("CHRONOCAT 服务的 CHRONOCAT_URL 或 CHRONOCAT_QQ 未设置!!\n取消推送")
|
|
749
746
|
return
|
|
750
747
|
|
|
751
748
|
print("CHRONOCAT 服务启动")
|
|
@@ -789,31 +786,28 @@ def ntfy(title: str, content: str) -> None:
|
|
|
789
786
|
"""
|
|
790
787
|
通过 Ntfy 推送消息
|
|
791
788
|
"""
|
|
789
|
+
|
|
792
790
|
def encode_rfc2047(text: str) -> str:
|
|
793
791
|
"""将文本编码为符合 RFC 2047 标准的格式"""
|
|
794
|
-
encoded_bytes = base64.b64encode(text.encode(
|
|
795
|
-
encoded_str = encoded_bytes.decode(
|
|
796
|
-
return f
|
|
792
|
+
encoded_bytes = base64.b64encode(text.encode("utf-8"))
|
|
793
|
+
encoded_str = encoded_bytes.decode("utf-8")
|
|
794
|
+
return f"=?utf-8?B?{encoded_str}?="
|
|
797
795
|
|
|
798
796
|
if not push_config.get("NTFY_TOPIC"):
|
|
799
|
-
print("ntfy 服务的 NTFY_TOPIC 未设置!!\n取消推送")
|
|
800
797
|
return
|
|
801
798
|
print("ntfy 服务启动")
|
|
802
|
-
priority =
|
|
799
|
+
priority = "3"
|
|
803
800
|
if not push_config.get("NTFY_PRIORITY"):
|
|
804
801
|
print("ntfy 服务的NTFY_PRIORITY 未设置!!默认设置为3")
|
|
805
802
|
else:
|
|
806
803
|
priority = push_config.get("NTFY_PRIORITY")
|
|
807
|
-
|
|
804
|
+
|
|
808
805
|
# 使用 RFC 2047 编码 title
|
|
809
806
|
encoded_title = encode_rfc2047(title)
|
|
810
807
|
|
|
811
|
-
data = content.encode(encoding=
|
|
812
|
-
headers = {
|
|
813
|
-
|
|
814
|
-
"Priority": priority
|
|
815
|
-
}
|
|
816
|
-
|
|
808
|
+
data = content.encode(encoding="utf-8")
|
|
809
|
+
headers = {"Title": encoded_title, "Priority": priority} # 使用编码后的 title
|
|
810
|
+
|
|
817
811
|
url = push_config.get("NTFY_URL") + "/" + push_config.get("NTFY_TOPIC")
|
|
818
812
|
response = requests.post(url, data=data, headers=headers)
|
|
819
813
|
if response.status_code == 200: # 使用 response.status_code 进行检查
|
|
@@ -821,6 +815,63 @@ def ntfy(title: str, content: str) -> None:
|
|
|
821
815
|
else:
|
|
822
816
|
print("Ntfy 推送失败!错误信息:", response.text)
|
|
823
817
|
|
|
818
|
+
|
|
819
|
+
def wxpusher_bot(title: str, content: str) -> None:
|
|
820
|
+
"""
|
|
821
|
+
通过 wxpusher 推送消息。
|
|
822
|
+
支持的环境变量:
|
|
823
|
+
- WXPUSHER_APP_TOKEN: appToken
|
|
824
|
+
- WXPUSHER_TOPIC_IDS: 主题ID, 多个用英文分号;分隔
|
|
825
|
+
- WXPUSHER_UIDS: 用户ID, 多个用英文分号;分隔
|
|
826
|
+
"""
|
|
827
|
+
if not push_config.get("WXPUSHER_APP_TOKEN"):
|
|
828
|
+
return
|
|
829
|
+
|
|
830
|
+
url = "https://wxpusher.zjiecode.com/api/send/message"
|
|
831
|
+
|
|
832
|
+
# 处理topic_ids和uids,将分号分隔的字符串转为数组
|
|
833
|
+
topic_ids = []
|
|
834
|
+
if push_config.get("WXPUSHER_TOPIC_IDS"):
|
|
835
|
+
topic_ids = [
|
|
836
|
+
int(id.strip())
|
|
837
|
+
for id in push_config.get("WXPUSHER_TOPIC_IDS").split(";")
|
|
838
|
+
if id.strip()
|
|
839
|
+
]
|
|
840
|
+
|
|
841
|
+
uids = []
|
|
842
|
+
if push_config.get("WXPUSHER_UIDS"):
|
|
843
|
+
uids = [
|
|
844
|
+
uid.strip()
|
|
845
|
+
for uid in push_config.get("WXPUSHER_UIDS").split(";")
|
|
846
|
+
if uid.strip()
|
|
847
|
+
]
|
|
848
|
+
|
|
849
|
+
# topic_ids uids 至少有一个
|
|
850
|
+
if not topic_ids and not uids:
|
|
851
|
+
print("wxpusher 服务的 WXPUSHER_TOPIC_IDS 和 WXPUSHER_UIDS 至少设置一个!!")
|
|
852
|
+
return
|
|
853
|
+
|
|
854
|
+
print("wxpusher 服务启动")
|
|
855
|
+
|
|
856
|
+
data = {
|
|
857
|
+
"appToken": push_config.get("WXPUSHER_APP_TOKEN"),
|
|
858
|
+
"content": f"<h1>{title}</h1><br/><div style='white-space: pre-wrap;'>{content}</div>",
|
|
859
|
+
"summary": title,
|
|
860
|
+
"contentType": 2,
|
|
861
|
+
"topicIds": topic_ids,
|
|
862
|
+
"uids": uids,
|
|
863
|
+
"verifyPayType": 0,
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
headers = {"Content-Type": "application/json"}
|
|
867
|
+
response = requests.post(url=url, json=data, headers=headers).json()
|
|
868
|
+
|
|
869
|
+
if response.get("code") == 1000:
|
|
870
|
+
print("wxpusher 推送成功!")
|
|
871
|
+
else:
|
|
872
|
+
print(f"wxpusher 推送失败!错误信息:{response.get('msg')}")
|
|
873
|
+
|
|
874
|
+
|
|
824
875
|
def parse_headers(headers):
|
|
825
876
|
if not headers:
|
|
826
877
|
return {}
|
|
@@ -877,7 +928,6 @@ def custom_notify(title: str, content: str) -> None:
|
|
|
877
928
|
通过 自定义通知 推送消息。
|
|
878
929
|
"""
|
|
879
930
|
if not push_config.get("WEBHOOK_URL") or not push_config.get("WEBHOOK_METHOD"):
|
|
880
|
-
print("自定义通知的 WEBHOOK_URL 或 WEBHOOK_METHOD 未设置!!\n取消推送")
|
|
881
931
|
return
|
|
882
932
|
|
|
883
933
|
print("自定义通知服务启动")
|
|
@@ -983,6 +1033,10 @@ def add_notify_function():
|
|
|
983
1033
|
notify_function.append(custom_notify)
|
|
984
1034
|
if push_config.get("NTFY_TOPIC"):
|
|
985
1035
|
notify_function.append(ntfy)
|
|
1036
|
+
if push_config.get("WXPUSHER_APP_TOKEN") and (
|
|
1037
|
+
push_config.get("WXPUSHER_TOPIC_IDS") or push_config.get("WXPUSHER_UIDS")
|
|
1038
|
+
):
|
|
1039
|
+
notify_function.append(wxpusher_bot)
|
|
986
1040
|
if not notify_function:
|
|
987
1041
|
print(f"无推送渠道,请检查通知变量是否正确")
|
|
988
1042
|
return notify_function
|
|
@@ -1024,4 +1078,4 @@ def main():
|
|
|
1024
1078
|
|
|
1025
1079
|
|
|
1026
1080
|
if __name__ == "__main__":
|
|
1027
|
-
main()
|
|
1081
|
+
main()
|
package/shell/api.sh
CHANGED
|
@@ -231,4 +231,30 @@ find_cron_api() {
|
|
|
231
231
|
fi
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
update_auth_config() {
|
|
235
|
+
local body="$1"
|
|
236
|
+
local tip="$2"
|
|
237
|
+
local currentTimeStamp=$(date +%s)
|
|
238
|
+
local api=$(
|
|
239
|
+
curl -s --noproxy "*" "http://0.0.0.0:5600/open/system/auth/reset?t=$currentTimeStamp" \
|
|
240
|
+
-X 'PUT' \
|
|
241
|
+
-H "Accept: application/json" \
|
|
242
|
+
-H "Authorization: Bearer ${__ql_token__}" \
|
|
243
|
+
-H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36" \
|
|
244
|
+
-H "Content-Type: application/json;charset=UTF-8" \
|
|
245
|
+
-H "Origin: http://0.0.0.0:5700" \
|
|
246
|
+
-H "Referer: http://0.0.0.0:5700/crontab" \
|
|
247
|
+
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \
|
|
248
|
+
--data-raw "{$body}" \
|
|
249
|
+
--compressed
|
|
250
|
+
)
|
|
251
|
+
code=$(echo "$api" | jq -r .code)
|
|
252
|
+
message=$(echo "$api" | jq -r .message)
|
|
253
|
+
if [[ $code == 200 ]]; then
|
|
254
|
+
echo -e "${tip}成功🎉"
|
|
255
|
+
else
|
|
256
|
+
echo -e "${tip}失败(${message})"
|
|
257
|
+
fi
|
|
258
|
+
}
|
|
259
|
+
|
|
234
260
|
get_token
|
|
@@ -56,7 +56,9 @@ function run() {
|
|
|
56
56
|
for (const key in newEnvObject) {
|
|
57
57
|
process.env[key] = newEnvObject[key];
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
if (output) {
|
|
60
|
+
console.log(output);
|
|
61
|
+
}
|
|
60
62
|
if (task_before) {
|
|
61
63
|
console.log('执行前置命令结束\n');
|
|
62
64
|
}
|
|
@@ -89,6 +91,10 @@ try {
|
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
process.on('SIGTERM', (code) => {
|
|
95
|
+
process.exit(15);
|
|
96
|
+
});
|
|
97
|
+
|
|
92
98
|
run();
|
|
93
99
|
|
|
94
100
|
const { sendNotify } = require('./notify.js');
|
|
@@ -5,6 +5,7 @@ import json
|
|
|
5
5
|
import builtins
|
|
6
6
|
import sys
|
|
7
7
|
import env
|
|
8
|
+
import signal
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def try_parse_int(value):
|
|
@@ -63,7 +64,8 @@ def run():
|
|
|
63
64
|
for key, value in env_json.items():
|
|
64
65
|
os.environ[key] = value
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
if len(output) > 0:
|
|
68
|
+
print(output)
|
|
67
69
|
if task_before:
|
|
68
70
|
print("执行前置命令结束")
|
|
69
71
|
|
|
@@ -95,7 +97,13 @@ def run():
|
|
|
95
97
|
os.environ[env_param] = env_str
|
|
96
98
|
|
|
97
99
|
|
|
100
|
+
def handle_sigterm(signum, frame):
|
|
101
|
+
sys.exit(15)
|
|
102
|
+
|
|
103
|
+
|
|
98
104
|
try:
|
|
105
|
+
signal.signal(signal.SIGTERM, handle_sigterm)
|
|
106
|
+
|
|
99
107
|
run()
|
|
100
108
|
|
|
101
109
|
from notify import send
|
package/shell/share.sh
CHANGED
|
@@ -193,12 +193,6 @@ fix_config() {
|
|
|
193
193
|
echo
|
|
194
194
|
fi
|
|
195
195
|
|
|
196
|
-
if [[ ! -s $file_auth_user ]]; then
|
|
197
|
-
echo -e "复制一份 $file_auth_sample 为 $file_auth_user\n"
|
|
198
|
-
cp -fv $file_auth_sample $file_auth_user
|
|
199
|
-
echo
|
|
200
|
-
fi
|
|
201
|
-
|
|
202
196
|
if [[ ! -s $file_notify_py ]]; then
|
|
203
197
|
echo -e "复制一份 $file_notify_py_sample 为 $file_notify_py\n"
|
|
204
198
|
cp -fv $file_notify_py_sample $file_notify_py
|
|
@@ -473,10 +467,12 @@ handle_task_end() {
|
|
|
473
467
|
local end_time=$(format_time "$time_format" "$etime")
|
|
474
468
|
local end_timestamp=$(format_timestamp "$time_format" "$etime")
|
|
475
469
|
local diff_time=$(($end_timestamp - $begin_timestamp))
|
|
470
|
+
local suffix=""
|
|
471
|
+
[[ "$MANUAL" == "true" ]] && suffix="(手动停止)"
|
|
476
472
|
|
|
477
473
|
[[ "$diff_time" == 0 ]] && diff_time=1
|
|
478
474
|
|
|
479
|
-
echo -e "\n##
|
|
475
|
+
echo -e "\n## 执行结束$suffix... $end_time 耗时 $diff_time 秒 "
|
|
480
476
|
[[ $ID ]] && update_cron "\"$ID\"" "1" "" "$log_path" "$begin_timestamp" "$diff_time"
|
|
481
477
|
}
|
|
482
478
|
|
package/shell/start.sh
CHANGED
|
@@ -23,7 +23,12 @@ if [[ ! $QL_DIR ]]; then
|
|
|
23
23
|
fi
|
|
24
24
|
|
|
25
25
|
if [[ ! $QL_DATA_DIR ]]; then
|
|
26
|
-
echo -e "请先手动设置数据存储目录 export QL_DATA_DIR
|
|
26
|
+
echo -e "请先手动设置数据存储目录 export QL_DATA_DIR 环境变量,目录必须以斜杠开头的绝对路径,并且以 /data 结尾,例如 /ql/data 并手动添加到系统环境变量"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [[ $QL_DATA_DIR != */data ]]; then
|
|
31
|
+
echo -e "QL_DATA_DIR 必须以 /data 结尾,例如 /ql/data,如果有历史数据,请新建 data 目录,把历史数据放到 data 目录中"
|
|
27
32
|
exit 1
|
|
28
33
|
fi
|
|
29
34
|
|
package/shell/task.sh
CHANGED
package/shell/update.sh
CHANGED
|
@@ -537,14 +537,10 @@ main() {
|
|
|
537
537
|
eval . $dir_shell/check.sh $cmd
|
|
538
538
|
;;
|
|
539
539
|
resetlet)
|
|
540
|
-
|
|
541
|
-
echo "$auth_value" >$file_auth_user
|
|
542
|
-
eval echo -e "重置登录错误次数成功" $cmd
|
|
540
|
+
eval update_auth_config "\\\"retries\\\":0" "重置登录错误次数" $cmd
|
|
543
541
|
;;
|
|
544
542
|
resettfa)
|
|
545
|
-
|
|
546
|
-
echo "$auth_value" >$file_auth_user
|
|
547
|
-
eval echo -e "禁用两步验证成功" $cmd
|
|
543
|
+
eval update_auth_config "\\\"twoFactorActivated\\\":false" "禁用两步验证" $cmd
|
|
548
544
|
;;
|
|
549
545
|
*)
|
|
550
546
|
eval echo -e "命令输入错误...\\\n" $cmd
|
|
@@ -34,6 +34,7 @@ const celebrate_1 = require("celebrate");
|
|
|
34
34
|
const path_1 = require("path");
|
|
35
35
|
const const_1 = require("../config/const");
|
|
36
36
|
const config_2 = __importDefault(require("../services/config"));
|
|
37
|
+
const utils_1 = require("../shared/utils");
|
|
37
38
|
const route = (0, express_1.Router)();
|
|
38
39
|
exports.default = (app) => {
|
|
39
40
|
app.use('/configs', route);
|
|
@@ -90,7 +91,7 @@ exports.default = (app) => {
|
|
|
90
91
|
if (name.startsWith('data/scripts/')) {
|
|
91
92
|
path = (0, path_1.join)(config_1.default.rootPath, name);
|
|
92
93
|
}
|
|
93
|
-
await
|
|
94
|
+
await (0, utils_1.writeFileWithLock)(path, content);
|
|
94
95
|
res.send({ code: 200, message: '保存成功' });
|
|
95
96
|
}
|
|
96
97
|
catch (e) {
|
|
@@ -35,6 +35,7 @@ const celebrate_1 = require("celebrate");
|
|
|
35
35
|
const path_1 = __importStar(require("path"));
|
|
36
36
|
const script_1 = __importDefault(require("../services/script"));
|
|
37
37
|
const multer_1 = __importDefault(require("multer"));
|
|
38
|
+
const utils_1 = require("../shared/utils");
|
|
38
39
|
const route = (0, express_1.Router)();
|
|
39
40
|
const storage = multer_1.default.diskStorage({
|
|
40
41
|
destination: function (req, file, cb) {
|
|
@@ -142,7 +143,7 @@ exports.default = (app) => {
|
|
|
142
143
|
await (0, util_1.rmPath)(originFilePath);
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
|
-
await
|
|
146
|
+
await (0, utils_1.writeFileWithLock)(filePath, content);
|
|
146
147
|
return res.send({ code: 200 });
|
|
147
148
|
}
|
|
148
149
|
catch (e) {
|
|
@@ -160,7 +161,7 @@ exports.default = (app) => {
|
|
|
160
161
|
try {
|
|
161
162
|
let { filename, content, path } = req.body;
|
|
162
163
|
const filePath = (0, path_1.join)(config_1.default.scriptPath, path, filename);
|
|
163
|
-
await
|
|
164
|
+
await (0, utils_1.writeFileWithLock)(filePath, content);
|
|
164
165
|
return res.send({ code: 200 });
|
|
165
166
|
}
|
|
166
167
|
catch (e) {
|
|
@@ -221,7 +222,7 @@ exports.default = (app) => {
|
|
|
221
222
|
let { filename, content, path } = req.body;
|
|
222
223
|
const { name, ext } = (0, path_1.parse)(filename);
|
|
223
224
|
const filePath = (0, path_1.join)(config_1.default.scriptPath, path, `${name}.swap${ext}`);
|
|
224
|
-
await
|
|
225
|
+
await (0, utils_1.writeFileWithLock)(filePath, content || '');
|
|
225
226
|
const scriptService = typedi_1.Container.get(script_1.default);
|
|
226
227
|
const result = await scriptService.runScript(filePath);
|
|
227
228
|
res.send(result);
|
|
@@ -52,7 +52,7 @@ exports.default = (app) => {
|
|
|
52
52
|
const logger = typedi_1.Container.get('logger');
|
|
53
53
|
try {
|
|
54
54
|
const userService = typedi_1.Container.get(user_1.default);
|
|
55
|
-
const authInfo = await userService.
|
|
55
|
+
const authInfo = await userService.getAuthInfo();
|
|
56
56
|
const { version, changeLog, changeLogLink, publishTime } = await (0, util_1.parseVersion)(config_1.default.versionFile);
|
|
57
57
|
let isInitialized = true;
|
|
58
58
|
if (Object.keys(authInfo).length === 2 &&
|
|
@@ -321,5 +321,20 @@ exports.default = (app) => {
|
|
|
321
321
|
return next(e);
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
+
route.put('/auth/reset', (0, celebrate_1.celebrate)({
|
|
325
|
+
body: celebrate_1.Joi.object({
|
|
326
|
+
retries: celebrate_1.Joi.number().optional(),
|
|
327
|
+
twoFactorActivated: celebrate_1.Joi.boolean().optional(),
|
|
328
|
+
}),
|
|
329
|
+
}), async (req, res, next) => {
|
|
330
|
+
try {
|
|
331
|
+
const userService = typedi_1.Container.get(user_1.default);
|
|
332
|
+
await userService.resetAuthInfo(req.body);
|
|
333
|
+
res.send({ code: 200, message: '更新成功' });
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
return next(e);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
324
339
|
};
|
|
325
340
|
//# sourceMappingURL=system.js.map
|
package/static/build/api/user.js
CHANGED
|
@@ -79,7 +79,7 @@ exports.default = (app) => {
|
|
|
79
79
|
const logger = typedi_1.Container.get('logger');
|
|
80
80
|
try {
|
|
81
81
|
const userService = typedi_1.Container.get(user_1.default);
|
|
82
|
-
const authInfo = await userService.
|
|
82
|
+
const authInfo = await userService.getAuthInfo();
|
|
83
83
|
res.send({
|
|
84
84
|
code: 200,
|
|
85
85
|
data: {
|
|
@@ -42,6 +42,7 @@ const js_yaml_1 = require("js-yaml");
|
|
|
42
42
|
const index_1 = __importDefault(require("./index"));
|
|
43
43
|
const const_1 = require("./const");
|
|
44
44
|
const logger_1 = __importDefault(require("../loaders/logger"));
|
|
45
|
+
const utils_1 = require("../shared/utils");
|
|
45
46
|
const os_1 = __importDefault(require("os"));
|
|
46
47
|
__exportStar(require("./share"), exports);
|
|
47
48
|
let osType;
|
|
@@ -173,11 +174,17 @@ function getPlatform(userAgent) {
|
|
|
173
174
|
else if (testUa(/ios|iphone|ipad|ipod|iwatch/g)) {
|
|
174
175
|
system = 'ios'; // ios系统
|
|
175
176
|
}
|
|
177
|
+
else if (testUa(/openharmony/g)) {
|
|
178
|
+
system = 'openharmony'; // openharmony系统
|
|
179
|
+
}
|
|
176
180
|
let platform = 'desktop';
|
|
177
181
|
if (system === 'windows' || system === 'macos' || system === 'linux') {
|
|
178
182
|
platform = 'desktop';
|
|
179
183
|
}
|
|
180
|
-
else if (system === 'android' ||
|
|
184
|
+
else if (system === 'android' ||
|
|
185
|
+
system === 'ios' ||
|
|
186
|
+
system === 'openharmony' ||
|
|
187
|
+
testUa(/mobile/g)) {
|
|
181
188
|
platform = 'mobile';
|
|
182
189
|
}
|
|
183
190
|
return platform;
|
|
@@ -195,7 +202,7 @@ async function fileExist(file) {
|
|
|
195
202
|
exports.fileExist = fileExist;
|
|
196
203
|
async function createFile(file, data = '') {
|
|
197
204
|
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
198
|
-
await
|
|
205
|
+
await (0, utils_1.writeFileWithLock)(file, data);
|
|
199
206
|
}
|
|
200
207
|
exports.createFile = createFile;
|
|
201
208
|
async function handleLogPath(logPath, data = '') {
|
|
@@ -527,6 +534,9 @@ async function detectOS() {
|
|
|
527
534
|
console.error(`Unknown Linux Distribution: ${osReleaseInfo}`);
|
|
528
535
|
}
|
|
529
536
|
}
|
|
537
|
+
else if (platform === 'darwin') {
|
|
538
|
+
osType = undefined;
|
|
539
|
+
}
|
|
530
540
|
else {
|
|
531
541
|
logger_1.default.error(`Unsupported platform: ${platform}`);
|
|
532
542
|
console.error(`Unsupported platform: ${platform}`);
|
|
@@ -554,7 +564,7 @@ async function replaceDomainInFile(filePath, oldDomainWithScheme, newDomainWithS
|
|
|
554
564
|
if (!newDomainWithScheme.endsWith('/')) {
|
|
555
565
|
newDomainWithScheme += '/';
|
|
556
566
|
}
|
|
557
|
-
await
|
|
567
|
+
await (0, utils_1.writeFileWithLock)(filePath, updatedContent);
|
|
558
568
|
}
|
|
559
569
|
async function _updateLinuxMirror(osType, mirrorDomainWithScheme) {
|
|
560
570
|
let filePath, currentDomainWithScheme;
|