@whyour/qinglong 0.14.5 → 0.15.1

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.
Files changed (37) hide show
  1. package/README-en.md +9 -1
  2. package/README.md +9 -1
  3. package/docker/Dockerfile +5 -0
  4. package/package.json +2 -2
  5. package/sample/notify.py +57 -57
  6. package/shell/update.sh +2 -2
  7. package/static/build/api/config.js +16 -20
  8. package/static/build/api/log.js +13 -1
  9. package/static/build/api/script.js +12 -3
  10. package/static/build/api/user.js +3 -0
  11. package/static/build/loaders/initData.js +23 -1
  12. package/static/build/services/config.js +45 -0
  13. package/static/build/services/script.js +29 -1
  14. package/static/build/services/system.js +4 -4
  15. package/static/dist/8008.ffb3ed8e.async.js +1 -0
  16. package/static/dist/index.html +1 -1
  17. package/static/dist/src__pages__config__index.634c902a.async.js +1 -0
  18. package/static/dist/src__pages__crontab__detail.7d1c2d15.async.js +1 -0
  19. package/static/dist/src__pages__crontab__index.5aece157.async.js +1 -0
  20. package/static/dist/src__pages__log__index.757b3471.async.js +1 -0
  21. package/static/dist/src__pages__script__editModal.1822dae7.async.js +1 -0
  22. package/static/dist/src__pages__script__index.ed44bc1b.async.js +1 -0
  23. package/static/dist/src__pages__script__renameModal.8bbbc126.async.js +1 -0
  24. package/static/dist/src__pages__setting__dependence.2efb8ee3.async.js +1 -0
  25. package/static/dist/src__pages__setting__index.9fe663df.async.js +1 -0
  26. package/static/dist/{umi.8daa227c.js → umi.d9511dd2.js} +1 -1
  27. package/version.yaml +12 -27
  28. package/static/dist/8008.2d18f19d.async.js +0 -1
  29. package/static/dist/src__pages__config__index.77dd013c.async.js +0 -1
  30. package/static/dist/src__pages__crontab__detail.5b509309.async.js +0 -1
  31. package/static/dist/src__pages__crontab__index.e74d65bc.async.js +0 -1
  32. package/static/dist/src__pages__log__index.84556deb.async.js +0 -1
  33. package/static/dist/src__pages__script__editModal.17bcb1c2.async.js +0 -1
  34. package/static/dist/src__pages__script__index.320f4af9.async.js +0 -1
  35. package/static/dist/src__pages__script__renameModal.90d4d26a.async.js +0 -1
  36. package/static/dist/src__pages__setting__dependence.1f8b48fc.async.js +0 -1
  37. package/static/dist/src__pages__setting__index.f8842b47.async.js +0 -1
package/README-en.md CHANGED
@@ -166,6 +166,14 @@ podman run -dit \
166
166
  It is recommended to use a pure system installation to avoid losing the original system data, you need to install node/npm/python3/pip3 yourself
167
167
 
168
168
  ```bash
169
+ # Debian/Ubuntu
170
+ curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
171
+ # Centos
172
+ curl --silent --location https://rpm.nodesource.com/setup_20.x | sudo bash
173
+ ```
174
+
175
+ ```bash
176
+ npm install -g node-pre-gyp pnpm@8.3.1
169
177
  npm install -g @whyour/qinglong
170
178
  qinglong
171
179
  # Add the environment variables QL_DIR and QL_DATA_DIR when prompted
@@ -178,7 +186,7 @@ qinglong
178
186
  ## Development
179
187
 
180
188
  ```bash
181
- $ git clone git@github.com:whyour/qinglong.git
189
+ $ git clone https://github.com/whyour/qinglong.git
182
190
  $ cd qinglong
183
191
  $ cp .env.example .env
184
192
  # Recommended use pnpm https://pnpm.io/zh/installation
package/README.md CHANGED
@@ -166,6 +166,14 @@ podman run -dit \
166
166
  建议使用纯净系统安装,避免系统原有数据丢失,需要自己安装 node/npm/python3/pip3
167
167
 
168
168
  ```bash
169
+ # Debian/Ubuntu
170
+ curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
171
+ # Centos
172
+ curl --silent --location https://rpm.nodesource.com/setup_20.x | sudo bash
173
+ ```
174
+
175
+ ```bash
176
+ npm install -g node-pre-gyp pnpm@8.3.1
169
177
  npm install -g @whyour/qinglong
170
178
  qinglong
171
179
  # 根据提示增加环境变量 QL_DIR 和 QL_DATA_DIR
@@ -178,7 +186,7 @@ qinglong
178
186
  ## 开发
179
187
 
180
188
  ```bash
181
- $ git clone git@github.com:whyour/qinglong.git
189
+ $ git clone https://github.com/whyour/qinglong.git
182
190
  $ cd qinglong
183
191
  $ cp .env.example .env
184
192
  # 推荐使用 pnpm https://pnpm.io/zh/installation
package/docker/Dockerfile CHANGED
@@ -33,6 +33,7 @@ COPY --from=nodebuilder /usr/local/lib/node_modules/. /usr/local/lib/node_module
33
33
 
34
34
  RUN set -x && \
35
35
  ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
36
+ ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
36
37
  apt update && \
37
38
  apt upgrade -y && \
38
39
  apt install --no-install-recommends -y git \
@@ -79,3 +80,7 @@ HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
79
80
  CMD curl -sf --noproxy '*' http://127.0.0.1:5400/api/health || exit 1
80
81
 
81
82
  ENTRYPOINT ["./docker/docker-entrypoint.sh"]
83
+
84
+ VOLUME /ql/data
85
+
86
+ EXPOSE 5700
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
- "version": "0.14.5",
3
+ "version": "0.15.1",
4
4
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -105,7 +105,7 @@
105
105
  "sequelize": "^6.25.5",
106
106
  "serve-handler": "^6.1.3",
107
107
  "sockjs": "^0.3.24",
108
- "sqlite3": "git+https://github.com/whyour/node-sqlite3.git#v1.0.4",
108
+ "sqlite3": "git+https://github.com/whyour/node-sqlite3.git#v1.0.3",
109
109
  "tar": "^6.1.15",
110
110
  "toad-scheduler": "^1.6.0",
111
111
  "typedi": "^0.10.0",
package/sample/notify.py CHANGED
@@ -841,60 +841,61 @@ def one() -> str:
841
841
  return res["hitokoto"] + " ----" + res["from"]
842
842
 
843
843
 
844
- if push_config.get("BARK_PUSH"):
845
- notify_function.append(bark)
846
- if push_config.get("CONSOLE"):
847
- notify_function.append(console)
848
- if push_config.get("DD_BOT_TOKEN") and push_config.get("DD_BOT_SECRET"):
849
- notify_function.append(dingding_bot)
850
- if push_config.get("FSKEY"):
851
- notify_function.append(feishu_bot)
852
- if push_config.get("GOBOT_URL") and push_config.get("GOBOT_QQ"):
853
- notify_function.append(go_cqhttp)
854
- if push_config.get("GOTIFY_URL") and push_config.get("GOTIFY_TOKEN"):
855
- notify_function.append(gotify)
856
- if push_config.get("IGOT_PUSH_KEY"):
857
- notify_function.append(iGot)
858
- if push_config.get("PUSH_KEY"):
859
- notify_function.append(serverJ)
860
- if push_config.get("DEER_KEY"):
861
- notify_function.append(pushdeer)
862
- if push_config.get("CHAT_URL") and push_config.get("CHAT_TOKEN"):
863
- notify_function.append(chat)
864
- if push_config.get("PUSH_PLUS_TOKEN"):
865
- notify_function.append(pushplus_bot)
866
- if push_config.get("QMSG_KEY") and push_config.get("QMSG_TYPE"):
867
- notify_function.append(qmsg_bot)
868
- if push_config.get("QYWX_AM"):
869
- notify_function.append(wecom_app)
870
- if push_config.get("QYWX_KEY"):
871
- notify_function.append(wecom_bot)
872
- if push_config.get("TG_BOT_TOKEN") and push_config.get("TG_USER_ID"):
873
- notify_function.append(telegram_bot)
874
- if (
875
- push_config.get("AIBOTK_KEY")
876
- and push_config.get("AIBOTK_TYPE")
877
- and push_config.get("AIBOTK_NAME")
878
- ):
879
- notify_function.append(aibotk)
880
- if (
881
- push_config.get("SMTP_SERVER")
882
- and push_config.get("SMTP_SSL")
883
- and push_config.get("SMTP_EMAIL")
884
- and push_config.get("SMTP_PASSWORD")
885
- and push_config.get("SMTP_NAME")
886
- ):
887
- notify_function.append(smtp)
888
- if push_config.get("PUSHME_KEY"):
889
- notify_function.append(pushme)
890
- if (
891
- push_config.get("CHRONOCAT_URL")
892
- and push_config.get("CHRONOCAT_QQ")
893
- and push_config.get("CHRONOCAT_TOKEN")
894
- ):
895
- notify_function.append(chronocat)
896
- if push_config.get("WEBHOOK_URL") and push_config.get("WEBHOOK_METHOD"):
897
- notify_function.append(custom_notify)
844
+ def add_notify_function():
845
+ if push_config.get("BARK_PUSH"):
846
+ notify_function.append(bark)
847
+ if push_config.get("CONSOLE"):
848
+ notify_function.append(console)
849
+ if push_config.get("DD_BOT_TOKEN") and push_config.get("DD_BOT_SECRET"):
850
+ notify_function.append(dingding_bot)
851
+ if push_config.get("FSKEY"):
852
+ notify_function.append(feishu_bot)
853
+ if push_config.get("GOBOT_URL") and push_config.get("GOBOT_QQ"):
854
+ notify_function.append(go_cqhttp)
855
+ if push_config.get("GOTIFY_URL") and push_config.get("GOTIFY_TOKEN"):
856
+ notify_function.append(gotify)
857
+ if push_config.get("IGOT_PUSH_KEY"):
858
+ notify_function.append(iGot)
859
+ if push_config.get("PUSH_KEY"):
860
+ notify_function.append(serverJ)
861
+ if push_config.get("DEER_KEY"):
862
+ notify_function.append(pushdeer)
863
+ if push_config.get("CHAT_URL") and push_config.get("CHAT_TOKEN"):
864
+ notify_function.append(chat)
865
+ if push_config.get("PUSH_PLUS_TOKEN"):
866
+ notify_function.append(pushplus_bot)
867
+ if push_config.get("QMSG_KEY") and push_config.get("QMSG_TYPE"):
868
+ notify_function.append(qmsg_bot)
869
+ if push_config.get("QYWX_AM"):
870
+ notify_function.append(wecom_app)
871
+ if push_config.get("QYWX_KEY"):
872
+ notify_function.append(wecom_bot)
873
+ if push_config.get("TG_BOT_TOKEN") and push_config.get("TG_USER_ID"):
874
+ notify_function.append(telegram_bot)
875
+ if (
876
+ push_config.get("AIBOTK_KEY")
877
+ and push_config.get("AIBOTK_TYPE")
878
+ and push_config.get("AIBOTK_NAME")
879
+ ):
880
+ notify_function.append(aibotk)
881
+ if (
882
+ push_config.get("SMTP_SERVER")
883
+ and push_config.get("SMTP_SSL")
884
+ and push_config.get("SMTP_EMAIL")
885
+ and push_config.get("SMTP_PASSWORD")
886
+ and push_config.get("SMTP_NAME")
887
+ ):
888
+ notify_function.append(smtp)
889
+ if push_config.get("PUSHME_KEY"):
890
+ notify_function.append(pushme)
891
+ if (
892
+ push_config.get("CHRONOCAT_URL")
893
+ and push_config.get("CHRONOCAT_QQ")
894
+ and push_config.get("CHRONOCAT_TOKEN")
895
+ ):
896
+ notify_function.append(chronocat)
897
+ if push_config.get("WEBHOOK_URL") and push_config.get("WEBHOOK_METHOD"):
898
+ notify_function.append(custom_notify)
898
899
 
899
900
 
900
901
  def send(title: str, content: str) -> None:
@@ -910,10 +911,9 @@ def send(title: str, content: str) -> None:
910
911
  return
911
912
 
912
913
  hitokoto = push_config.get("HITOKOTO")
914
+ content += "\n\n" + one() if hitokoto else ""
913
915
 
914
- text = one() if hitokoto else ""
915
- content += "\n\n" + text
916
-
916
+ add_notify_function()
917
917
  ts = [
918
918
  threading.Thread(target=mode, args=(title, content), name=mode.__name__)
919
919
  for mode in notify_function
package/shell/update.sh CHANGED
@@ -267,8 +267,8 @@ update_qinglong() {
267
267
  echo -e "使用 ${mirror} 源更新...\n"
268
268
 
269
269
  local primary_branch="master"
270
- if [[ "${QL_BRANCH}" == "develop" ]]; then
271
- primary_branch="develop"
270
+ if [[ "${QL_BRANCH}" == "develop" ]] || [[ "${QL_BRANCH}" == "debian" ]] || [[ "${QL_BRANCH}" == "debian-dev" ]]; then
271
+ primary_branch="${QL_BRANCH}"
272
272
  fi
273
273
 
274
274
  wget -cqO "${dir_tmp}/ql.zip" "${downloadQLUrl}/${primary_branch}.zip"
@@ -26,7 +26,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const util_1 = require("../config/util");
30
29
  const express_1 = require("express");
31
30
  const typedi_1 = require("typedi");
32
31
  const config_1 = __importDefault(require("../config"));
@@ -34,7 +33,7 @@ const fs = __importStar(require("fs/promises"));
34
33
  const celebrate_1 = require("celebrate");
35
34
  const path_1 = require("path");
36
35
  const const_1 = require("../config/const");
37
- const got_1 = __importDefault(require("got"));
36
+ const config_2 = __importDefault(require("../services/config"));
38
37
  const route = (0, express_1.Router)();
39
38
  exports.default = (app) => {
40
39
  app.use('/configs', route);
@@ -67,24 +66,9 @@ exports.default = (app) => {
67
66
  }
68
67
  });
69
68
  route.get('/detail', async (req, res, next) => {
70
- const logger = typedi_1.Container.get('logger');
71
69
  try {
72
- let content = '';
73
- const _path = req.query.path;
74
- if (config_1.default.blackFileList.includes(_path) || !_path) {
75
- res.send({ code: 403, message: '文件无法访问' });
76
- }
77
- if (_path.startsWith('sample/')) {
78
- const res = await got_1.default.get(`https://gitlab.com/whyour/qinglong/-/raw/master/${_path}`);
79
- content = res.body;
80
- }
81
- else if (_path.startsWith('data/scripts/')) {
82
- content = await (0, util_1.getFileContentByName)((0, path_1.join)(config_1.default.rootPath, _path));
83
- }
84
- else {
85
- content = await (0, util_1.getFileContentByName)((0, path_1.join)(config_1.default.configPath, _path));
86
- }
87
- res.send({ code: 200, data: content });
70
+ const configService = typedi_1.Container.get(config_2.default);
71
+ await configService.getFile(req.query.path, res);
88
72
  }
89
73
  catch (e) {
90
74
  return next(e);
@@ -102,7 +86,10 @@ exports.default = (app) => {
102
86
  if (config_1.default.blackFileList.includes(name)) {
103
87
  res.send({ code: 403, message: '文件无法访问' });
104
88
  }
105
- const path = (0, path_1.join)(config_1.default.configPath, name);
89
+ let path = (0, path_1.join)(config_1.default.configPath, name);
90
+ if (name.startsWith('data/scripts/')) {
91
+ path = (0, path_1.join)(config_1.default.rootPath, name);
92
+ }
106
93
  await fs.writeFile(path, content);
107
94
  res.send({ code: 200, message: '保存成功' });
108
95
  }
@@ -110,5 +97,14 @@ exports.default = (app) => {
110
97
  return next(e);
111
98
  }
112
99
  });
100
+ route.get('/:file', async (req, res, next) => {
101
+ try {
102
+ const configService = typedi_1.Container.get(config_2.default);
103
+ await configService.getFile(req.params.file, res);
104
+ }
105
+ catch (e) {
106
+ return next(e);
107
+ }
108
+ });
113
109
  };
114
110
  //# sourceMappingURL=config.js.map
@@ -27,8 +27,20 @@ exports.default = (app) => {
27
27
  return next(e);
28
28
  }
29
29
  });
30
+ route.get('/detail', async (req, res, next) => {
31
+ try {
32
+ if (blacklist.includes(req.path)) {
33
+ return res.send({ code: 403, message: '暂无权限' });
34
+ }
35
+ const filePath = (0, path_1.join)(config_1.default.logPath, (req.query.path || ''), req.query.file);
36
+ const content = await (0, util_1.getFileContentByName)(filePath);
37
+ res.send({ code: 200, data: content });
38
+ }
39
+ catch (e) {
40
+ return next(e);
41
+ }
42
+ });
30
43
  route.get('/:file', async (req, res, next) => {
31
- const logger = typedi_1.Container.get('logger');
32
44
  try {
33
45
  if (blacklist.includes(req.path)) {
34
46
  return res.send({ code: 403, message: '暂无权限' });
@@ -83,11 +83,20 @@ exports.default = (app) => {
83
83
  return next(e);
84
84
  }
85
85
  });
86
+ route.get('/detail', async (req, res, next) => {
87
+ try {
88
+ const scriptService = typedi_1.Container.get(script_1.default);
89
+ const content = await scriptService.getFile(req.query.path, req.query.file);
90
+ res.send({ code: 200, data: content });
91
+ }
92
+ catch (e) {
93
+ return next(e);
94
+ }
95
+ });
86
96
  route.get('/:file', async (req, res, next) => {
87
- const logger = typedi_1.Container.get('logger');
88
97
  try {
89
- const filePath = (0, path_1.join)(config_1.default.scriptPath, req.query.path, req.params.file);
90
- const content = await (0, util_1.getFileContentByName)(filePath);
98
+ const scriptService = typedi_1.Container.get(script_1.default);
99
+ const content = await scriptService.getFile(req.query.path, req.params.file);
91
100
  res.send({ code: 200, data: content });
92
101
  }
93
102
  catch (e) {
@@ -64,6 +64,9 @@ exports.default = (app) => {
64
64
  }), async (req, res, next) => {
65
65
  const logger = typedi_1.Container.get('logger');
66
66
  try {
67
+ if (process.env.DeployEnv === 'demo') {
68
+ return res.send({ code: 450, message: '未知错误' });
69
+ }
67
70
  const userService = typedi_1.Container.get(user_1.default);
68
71
  await userService.updateUsernameAndPassword(req.body);
69
72
  res.send({ code: 200, message: '更新成功' });
@@ -15,10 +15,30 @@ const config_1 = __importDefault(require("../config"));
15
15
  const cronView_1 = require("../data/cronView");
16
16
  const env_2 = require("../data/env");
17
17
  const system_1 = require("../data/system");
18
+ const system_2 = __importDefault(require("../services/system"));
18
19
  exports.default = async () => {
20
+ var _a, _b, _c, _d, _e, _f;
19
21
  const cronService = typedi_1.Container.get(cron_2.default);
20
22
  const envService = typedi_1.Container.get(env_1.default);
21
23
  const dependenceService = typedi_1.Container.get(dependence_1.default);
24
+ const systemService = typedi_1.Container.get(system_2.default);
25
+ // 初始化更新 linux/python/nodejs 镜像源配置
26
+ const systemConfig = await systemService.getSystemConfig();
27
+ if ((_a = systemConfig.info) === null || _a === void 0 ? void 0 : _a.pythonMirror) {
28
+ systemService.updatePythonMirror({
29
+ linuxMirror: (_b = systemConfig.info) === null || _b === void 0 ? void 0 : _b.linuxMirror,
30
+ });
31
+ }
32
+ if ((_c = systemConfig.info) === null || _c === void 0 ? void 0 : _c.linuxMirror) {
33
+ systemService.updateLinuxMirror({
34
+ linuxMirror: (_d = systemConfig.info) === null || _d === void 0 ? void 0 : _d.linuxMirror,
35
+ });
36
+ }
37
+ if ((_e = systemConfig.info) === null || _e === void 0 ? void 0 : _e.nodeMirror) {
38
+ systemService.updateNodeMirror({
39
+ linuxMirror: (_f = systemConfig.info) === null || _f === void 0 ? void 0 : _f.linuxMirror,
40
+ });
41
+ }
22
42
  // 初始化新增默认全部任务视图
23
43
  cronView_1.CrontabViewModel.findAll({
24
44
  where: { type: cronView_1.CronViewType.系统, name: '全部任务' },
@@ -44,7 +64,9 @@ exports.default = async () => {
44
64
  raw: true,
45
65
  }).then(async (docs) => {
46
66
  await dependence_2.DependenceModel.update({ status: dependence_2.DependenceStatus.queued, log: [] }, { where: { id: docs.map((x) => x.id) } });
47
- dependenceService.installDependenceOneByOne(docs);
67
+ setTimeout(() => {
68
+ dependenceService.installDependenceOneByOne(docs);
69
+ }, 5000);
48
70
  });
49
71
  // 初始化时执行一次所有的 ql repo 任务
50
72
  cron_1.CrontabModel.findAll({
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const typedi_1 = require("typedi");
16
+ const path_1 = require("path");
17
+ const config_1 = __importDefault(require("../config"));
18
+ const util_1 = require("../config/util");
19
+ const got_1 = __importDefault(require("got"));
20
+ let ConfigService = class ConfigService {
21
+ constructor() { }
22
+ async getFile(filePath, res) {
23
+ let content = '';
24
+ if (config_1.default.blackFileList.includes(filePath) || !filePath) {
25
+ res.send({ code: 403, message: '文件无法访问' });
26
+ }
27
+ if (filePath.startsWith('sample/')) {
28
+ const res = await got_1.default.get(`https://gitlab.com/whyour/qinglong/-/raw/master/${filePath}`);
29
+ content = res.body;
30
+ }
31
+ else if (filePath.startsWith('data/scripts/')) {
32
+ content = await (0, util_1.getFileContentByName)((0, path_1.join)(config_1.default.rootPath, filePath));
33
+ }
34
+ else {
35
+ content = await (0, util_1.getFileContentByName)((0, path_1.join)(config_1.default.configPath, filePath));
36
+ }
37
+ res.send({ code: 200, data: content });
38
+ }
39
+ };
40
+ ConfigService = __decorate([
41
+ (0, typedi_1.Service)(),
42
+ __metadata("design:paramtypes", [])
43
+ ], ConfigService);
44
+ exports.default = ConfigService;
45
+ //# sourceMappingURL=config.js.map
@@ -1,10 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
2
18
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
19
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
20
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
21
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
22
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
23
  };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  var __metadata = (this && this.__metadata) || function (k, v) {
9
32
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
33
  };
@@ -17,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
40
  Object.defineProperty(exports, "__esModule", { value: true });
18
41
  const typedi_1 = require("typedi");
19
42
  const winston_1 = __importDefault(require("winston"));
20
- const path_1 = __importDefault(require("path"));
43
+ const path_1 = __importStar(require("path"));
21
44
  const sock_1 = __importDefault(require("./sock"));
22
45
  const cron_1 = __importDefault(require("./cron"));
23
46
  const schedule_1 = __importDefault(require("./schedule"));
@@ -67,6 +90,11 @@ let ScriptService = class ScriptService {
67
90
  catch (error) { }
68
91
  return { code: 200 };
69
92
  }
93
+ async getFile(filePath, fileName) {
94
+ const _filePath = (0, path_1.join)(config_1.default.scriptPath, filePath, fileName);
95
+ const content = await (0, util_1.getFileContentByName)(_filePath);
96
+ return content;
97
+ }
70
98
  };
71
99
  ScriptService = __decorate([
72
100
  (0, typedi_1.Service)(),
@@ -112,8 +112,8 @@ let SystemService = class SystemService {
112
112
  const command = `cd && ${cmd} && pnpm i -g`;
113
113
  this.scheduleService.runTask(command, {
114
114
  onStart: async (cp) => {
115
- res.setHeader('QL-Task-Pid', `${cp.pid}`);
116
- res.end();
115
+ res === null || res === void 0 ? void 0 : res.setHeader('QL-Task-Pid', `${cp.pid}`);
116
+ res === null || res === void 0 ? void 0 : res.end();
117
117
  },
118
118
  onEnd: async () => {
119
119
  this.sockService.sendMessage({
@@ -156,8 +156,8 @@ let SystemService = class SystemService {
156
156
  const command = `sed -i 's/${defaultDomain.replace(/\//g, '\\/')}/${targetDomain.replace(/\//g, '\\/')}/g' /etc/apt/sources.list && apt update`;
157
157
  this.scheduleService.runTask(command, {
158
158
  onStart: async (cp) => {
159
- res.setHeader('QL-Task-Pid', `${cp.pid}`);
160
- res.end();
159
+ res === null || res === void 0 ? void 0 : res.setHeader('QL-Task-Pid', `${cp.pid}`);
160
+ res === null || res === void 0 ? void 0 : res.end();
161
161
  },
162
162
  onEnd: async () => {
163
163
  this.sockService.sendMessage({
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[8008],{78008:function(e,t,n){n.r(t);var a=n(54306),i=n.n(a),o=n(88265),r=n(63313),s=n(89065),l=n(9835),c=n(84163),u=n(24378),p=n(57229),g=n(15207),h=n(21758),d=n(99120),P=n.n(d),b=n(11527),m=s.Z.Countdown;t.default=function(e){var t=e.systemInfo,n=(0,r.useState)(!1),a=i()(n,2),s=a[0],d=a[1],f=(0,r.useState)(""),v=i()(f,2),Z=v[0],k=v[1],y=(0,r.useRef)(),x=function(e){c.Z.confirm({width:500,title:o.ZP.get("更新"),content:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{children:o.ZP.get("已经是最新版了!")}),(0,b.jsxs)("div",{style:{fontSize:12,fontWeight:400,marginTop:5},children:[o.ZP.get("青龙")," ",e.lastVersion," ",o.ZP.get("是目前检测到的最新可用版本了。")]})]}),okText:o.ZP.get("重新下载"),onOk:function(){q(),p.W.put("".concat(g.Z.apiPrefix,"system/update")).then((function(e){})).catch((function(e){console.log(e)}))}})},w=function(e){var n=e.lastVersion,a=e.lastLog;c.Z.confirm({width:500,title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{children:o.ZP.get("更新可用")}),(0,b.jsxs)("div",{style:{fontSize:12,fontWeight:400,marginTop:5},children:[o.ZP.get("新版本")," ",n," ",o.ZP.get("可用,你使用的版本为")," ",t.version,"。"]})]}),content:(0,b.jsx)("pre",{children:(0,b.jsx)(P(),{children:a})}),okText:o.ZP.get("下载更新"),cancelText:o.ZP.get("以后再说"),onOk:function(){q(),p.W.put("".concat(g.Z.apiPrefix,"system/update")).then((function(e){})).catch((function(e){console.log(e)}))}})},q=function(){k(""),y.current=c.Z.info({width:600,maskClosable:!1,closable:!1,keyboard:!1,okButtonProps:{disabled:!0},title:o.ZP.get("下载更新中..."),centered:!0,content:(0,b.jsx)("pre",{children:(0,b.jsx)(P(),{children:Z})})})},B=function(){p.W.put("".concat(g.Z.apiPrefix,"system/reload"),{type:"system"}).then((function(e){l.ZP.success({content:(0,b.jsxs)("span",{children:[o.ZP.get("系统将在"),(0,b.jsx)(m,{className:"inline-countdown",format:"ss",value:Date.now()+3e4}),o.ZP.get("秒后自动刷新")]}),duration:30}),setTimeout((function(){window.location.reload()}),3e4)})).catch((function(e){console.log(e)}))};(0,r.useEffect)((function(){if(Z){var e=Z.includes("失败,请检查");y.current.update({maskClosable:e,closable:e,okButtonProps:{disabled:!e},content:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{children:(0,b.jsx)(P(),{children:Z})}),(0,b.jsx)("div",{id:"log-identifier",style:{paddingBottom:5}})]})})}}),[Z]);var T=(0,r.useCallback)((function(e){var t=e.message;t.includes("失败,请检查")&&l.ZP.error(o.ZP.get("更新失败,请检查网络及日志或稍后再试")),setTimeout((function(){document.querySelector("#log-identifier").scrollIntoView({behavior:"smooth"})}),600),t.includes("更新包下载成功")&&setTimeout((function(){c.Z.confirm({width:600,maskClosable:!1,title:o.ZP.get("确认重启"),centered:!0,content:o.ZP.get("系统安装包下载成功,确认重启"),okText:o.ZP.get("重启"),onOk:function(){B()},onCancel:function(){y.current.update({maskClosable:!0,closable:!0,okButtonProps:{disabled:!1}})}})}),1e3),k((function(e){return"".concat(e).concat(t)}))}),[]);return(0,r.useEffect)((function(){var e=h.Z.getInstance();return e.subscribe("updateSystemVersion",T),function(){e.unsubscribe("updateSystemVersion",T)}}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(u.Z,{type:"primary",onClick:function(){s||(d(!0),l.ZP.loading(o.ZP.get("检查更新中..."),0),p.W.put("".concat(g.Z.apiPrefix,"system/update-check")).then((function(e){var t=e.code,n=e.data;l.ZP.destroy(),200===t&&(n.hasNewVersion?w(n):x(n))})).catch((function(e){l.ZP.destroy(),console.log(e)})).finally((function(){d(!1)})))},children:o.ZP.get("检查更新")}),(0,b.jsx)(u.Z,{type:"primary",onClick:B,style:{marginLeft:8},children:o.ZP.get("重新启动")})]})}},15207:function(e,t,n){var a=n(88265),i=window.__ENV__QlBaseUrl||"/";t.Z={siteName:a.ZP.get("青龙"),baseUrl:i,apiPrefix:"".concat(i,"api/"),authKey:"token",layouts:[{name:"primary",include:[/.*/],exclude:[/(\/(en|zh))*\/login/]}],i18n:{languages:[{key:"pt-br",title:"Português",flag:"/portugal.svg"},{key:"en",title:"English",flag:"/america.svg"},{key:"zh",title:a.ZP.get("中文"),flag:"/china.svg"}],defaultLanguage:"en"},scopes:[{name:a.ZP.get("定时任务"),value:"crons"},{name:a.ZP.get("环境变量"),value:"envs"},{name:a.ZP.get("订阅管理"),value:"subscriptions"},{name:a.ZP.get("配置文件"),value:"configs"},{name:a.ZP.get("脚本管理"),value:"scripts"},{name:a.ZP.get("日志管理"),value:"logs"},{name:a.ZP.get("依赖管理"),value:"dependencies"},{name:a.ZP.get("系统信息"),value:"system"}],scopesMap:{crons:a.ZP.get("定时任务"),envs:a.ZP.get("环境变量"),subscriptions:a.ZP.get("订阅管理"),configs:a.ZP.get("配置文件"),scripts:a.ZP.get("脚本管理"),logs:a.ZP.get("日志管理"),dependencies:a.ZP.get("依赖管理"),system:a.ZP.get("系统信息")},notificationModes:[{value:"gotify",label:"Gotify"},{value:"goCqHttpBot",label:"GoCqHttpBot"},{value:"serverChan",label:a.ZP.get("Server酱")},{value:"pushDeer",label:"PushDeer"},{value:"bark",label:"Bark"},{value:"telegramBot",label:a.ZP.get("Telegram机器人")},{value:"dingtalkBot",label:a.ZP.get("钉钉机器人")},{value:"weWorkBot",label:a.ZP.get("企业微信机器人")},{value:"weWorkApp",label:a.ZP.get("企业微信应用")},{value:"aibotk",label:a.ZP.get("智能微秘书")},{value:"iGot",label:"IGot"},{value:"pushPlus",label:"PushPlus"},{value:"chat",label:a.ZP.get("群晖chat")},{value:"email",label:a.ZP.get("邮箱")},{value:"lark",label:a.ZP.get("飞书机器人")},{value:"pushMe",label:"PushMe"},{value:"chronocat",label:"Chronocat"},{value:"webhook",label:a.ZP.get("自定义通知")},{value:"closed",label:a.ZP.get("已关闭")}],notificationModeMap:{gotify:[{label:"gotifyUrl",tip:a.ZP.get("gotify的url地址,例如 https://push.example.de:8080"),required:!0},{label:"gotifyToken",tip:a.ZP.get("gotify的消息应用token码"),required:!0},{label:"gotifyPriority",tip:a.ZP.get("推送消息的优先级")}],chat:[{label:"chatUrl",tip:a.ZP.get("chat的url地址"),required:!0},{label:"chatToken",tip:a.ZP.get("chat的token码"),required:!0}],goCqHttpBot:[{label:"goCqHttpBotUrl",tip:a.ZP.get("推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg"),required:!0},{label:"goCqHttpBotToken",tip:a.ZP.get("访问密钥"),required:!0},{label:"goCqHttpBotQq",tip:a.ZP.get("如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群"),required:!0}],serverChan:[{label:"serverChanKey",tip:a.ZP.get("Server酱SENDKEY"),required:!0}],pushDeer:[{label:"pushDeerKey",tip:a.ZP.get("PushDeer的Key,https://github.com/easychen/pushdeer"),required:!0},{label:"pushDeerUrl",tip:a.ZP.get("PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push")}],bark:[{label:"barkPush",tip:a.ZP.get("Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX"),required:!0},{label:"barkIcon",tip:a.ZP.get("BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)")},{label:"barkSound",tip:a.ZP.get("BARK推送铃声,铃声列表去APP查看复制填写")},{label:"barkGroup",tip:a.ZP.get("BARK推送消息的分组,默认为qinglong")},{label:"barkLevel",tip:a.ZP.get("BARK推送消息的时效性,默认为active")},{label:"barkUrl",tip:a.ZP.get("BARK推送消息的跳转URL")}],telegramBot:[{label:"telegramBotToken",tip:a.ZP.get("telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw"),required:!0},{label:"telegramBotUserId",tip:a.ZP.get("telegram用户的id,例如:129xxx206"),required:!0},{label:"telegramBotProxyHost",tip:a.ZP.get("代理IP")},{label:"telegramBotProxyPort",tip:a.ZP.get("代理端口")},{label:"telegramBotProxyAuth",tip:a.ZP.get("telegram代理配置认证参数,用户名与密码用英文冒号连接 user:password")},{label:"telegramBotApiHost",tip:a.ZP.get("telegram api自建的反向代理地址,默认tg官方api")}],dingtalkBot:[{label:"dingtalkBotToken",tip:a.ZP.get("钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd"),required:!0},{label:"dingtalkBotSecret",tip:a.ZP.get("密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串")}],weWorkBot:[{label:"weWorkBotKey",tip:a.ZP.get("企业微信机器人的webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa"),required:!0},{label:"weWorkOrigin",tip:a.ZP.get("企业微信代理地址")}],weWorkApp:[{label:"weWorkAppKey",tip:a.ZP.get("corpid、corpsecret、touser(注:多个成员ID使用|隔开)、agentid、消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat"),required:!0},{label:"weWorkOrigin",tip:a.ZP.get("企业微信代理地址")}],aibotk:[{label:"aibotkKey",tip:a.ZP.get("密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql"),required:!0},{label:"aibotkType",tip:a.ZP.get("发送的目标,群组或者好友"),required:!0,placeholder:a.ZP.get("请输入要发送的目标"),items:[{value:"room",label:a.ZP.get("群聊")},{value:"contact",label:a.ZP.get("好友")}]},{label:"aibotkName",tip:a.ZP.get("要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称"),required:!0}],iGot:[{label:"iGotPushKey",tip:a.ZP.get("iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX"),required:!0}],pushPlus:[{label:"pushPlusToken",tip:a.ZP.get("微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/"),required:!0},{label:"pushPlusUser",tip:a.ZP.get("一对多推送的“群组编码”(一对多推送下面->您的群组(如无则创建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)")}],lark:[{label:"larkKey",tip:a.ZP.get("飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973"),required:!0}],email:[{label:"emailService",tip:a.ZP.get("邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json"),required:!0},{label:"emailUser",tip:a.ZP.get("邮箱地址"),required:!0},{label:"emailPass",tip:a.ZP.get("SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定"),required:!0}],pushMe:[{label:"pushMeKey",tip:a.ZP.get("PushMe的Key,https://push.i-i.me/"),required:!0}],chronocat:[{label:"chronocatURL",tip:a.ZP.get("Chronocat Red 服务的连接地址 https://chronocat.vercel.app/install/docker/official/"),required:!0},{label:"chronocatQQ",tip:a.ZP.get("个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx"),required:!0},{label:"chronocatToken",tip:a.ZP.get("docker安装在持久化config目录下的chronocat.yml文件可找到"),required:!0}],webhook:[{label:"webhookMethod",tip:a.ZP.get("请求方法"),required:!0,items:[{value:"GET"},{value:"POST"},{value:"PUT"}]},{label:"webhookContentType",tip:a.ZP.get("请求头Content-Type"),required:!0,items:[{value:"text/plain"},{value:"application/json"},{value:"multipart/form-data"},{value:"application/x-www-form-urlencoded"}]},{label:"webhookUrl",tip:a.ZP.get("请求链接以http或者https开头。url或者body中必须包含$title,$content可选,对应api内容的位置"),required:!0,placeholder:"https://xxx.cn/api?content=$title\n"},{label:"webhookHeaders",tip:a.ZP.get("请求头格式Custom-Header1: Header1,多个换行分割"),placeholder:"Custom-Header1: Header1\nCustom-Header2: Header2"},{label:"webhookBody",tip:a.ZP.get("请求体格式key1: value1,多个换行分割。url或者body中必须包含$title,$content可选,对应api内容的位置"),placeholder:"key1: $title\nkey2: $content"}]},documentTitleMap:{"/login":a.ZP.get("登录"),"/initialization":a.ZP.get("初始化"),"/crontab":a.ZP.get("定时任务"),"/env":a.ZP.get("环境变量"),"/subscription":a.ZP.get("订阅管理"),"/config":a.ZP.get("配置文件"),"/script":a.ZP.get("脚本管理"),"/diff":a.ZP.get("对比工具"),"/log":a.ZP.get("日志管理"),"/setting":a.ZP.get("系统设置"),"/error":a.ZP.get("错误日志"),"/dependence":a.ZP.get("依赖管理")},dependenceTypes:["nodejs","python3","linux"]}},57229:function(e,t,n){n.d(t,{W:function(){return P}});var a=n(25359),i=n.n(a),o=n(49811),r=n.n(o),s=n(88265),l=n(9835),c=n(15207),u=n(14851),p=n(73669);l.ZP.config({duration:2});var g=Date.now(),h=p.Z.create({timeout:6e4,params:{t:g}}),d=["/api/user/login","/open/auth/token","/api/user/two-factor/login","/api/system","/api/user/init","/api/user/notification/init"];h.interceptors.request.use((function(e){var t=localStorage.getItem(c.Z.authKey);return t&&!d.includes(e.url)?(e.headers.Authorization="Bearer ".concat(t),e):e})),h.interceptors.response.use(function(){var e=r()(i()().mark((function e(t){var n,a,o;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.status,![502,504].includes(n)){e.next=5;break}u.history.push("/error"),e.next=18;break;case 5:if(401!==n){e.next=9;break}"/login"!==u.history.location.pathname&&(localStorage.removeItem(c.Z.authKey),u.history.push("/login")),e.next=18;break;case 9:return e.prev=9,200!==(a=t.data).code&&(o=a.message||a.data)&&l.ZP.error({content:o,style:{maxWidth:500,margin:"0 auto"}}),e.abrupt("return",a);case 15:e.prev=15,e.t0=e.catch(9);case 17:case 18:return e.abrupt("return",t);case 19:case"end":return e.stop()}}),e,null,[[9,15]])})));return function(t){return e.apply(this,arguments)}}(),(function(e){if(e.response){var t=e.response.data?e.response.data.message||e.message||e.response.data:e.response.statusText,n=e.response.status;[502,504].includes(n)?u.history.push("/error"):401===n?"/login"!==u.history.location.pathname&&(l.ZP.error(s.ZP.get("登录已过期,请重新登录")),localStorage.removeItem(c.Z.authKey),u.history.push("/login")):l.ZP.error({content:t,style:{maxWidth:500,margin:"0 auto"}})}else console.log(e.message);return Promise.reject(e)}));var P=h},21758:function(e,t,n){var a=n(93525),i=n.n(a),o=n(12342),r=n.n(o),s=n(25359),l=n.n(s),c=n(49811),u=n.n(c),p=n(21140),g=n.n(p),h=n(63466),d=n.n(h),P=n(52510),b=n.n(P),m=n(78078),f=n.n(m),v=["type"],Z=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g()(this,e),b()(this,"url",void 0),b()(this,"socket",null),b()(this,"subscriptions",new Map),b()(this,"options",void 0),b()(this,"reconnectAttempts",0),b()(this,"heartbeatTimeout",null),b()(this,"state","closed"),this.url=t,this.options={maxReconnectAttempts:n.maxReconnectAttempts||5,reconnectInterval:n.reconnectInterval||3e3,heartbeatInterval:n.heartbeatInterval||3e4},this.init()}var t,n;return d()(e,[{key:"init",value:(n=u()(l()().mark((function e(){var t=this;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,this.state="connecting",this.emit("connecting");case 3:if(!(this.reconnectAttempts<this.options.maxReconnectAttempts)){e.next=16;break}return this.socket=new(f())(this.url),this.setupEventListeners(),this.startHeartbeat(),e.next=9,this.waitForClose();case 9:return this.stopHeartbeat(),this.socket=null,this.reconnectAttempts++,e.next=14,new Promise((function(e){return setTimeout(e,t.options.reconnectInterval)}));case 14:e.next=3;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),this.handleError(e.t0);case 21:case"end":return e.stop()}}),e,this,[[0,18]])}))),function(){return n.apply(this,arguments)})},{key:"setupEventListeners",value:function(){var e=this;this.socket&&(this.socket.onopen=function(){e.state="open",e.emit("open")},this.socket.onmessage=function(t){var n=JSON.parse(t.data);e.dispatchMessage(n)},this.socket.onclose=function(){e.state="closed",e.emit("close")})}},{key:"waitForClose",value:(t=u()(l()().mark((function e(){var t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((null===(t=this.socket)||void 0===t?void 0:t.readyState)===f().CLOSED){e.next=5;break}return e.next=3,new Promise((function(e){return setTimeout(e,100)}));case 3:e.next=0;break;case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"subscribe",value:function(e,t){var n=this.subscriptions.get(e)||new Set;if(!n.has(t)){n.add(t),this.subscriptions.set(e,n);var a={action:"subscribe",topic:e};this.send(a)}}},{key:"unsubscribe",value:function(e,t){var n=this.subscriptions.get(e)||new Set;if(n.has(t)){n.delete(t);var a={action:"unsubscribe",topic:e};this.send(a)}}},{key:"send",value:function(e){var t;(null===(t=this.socket)||void 0===t?void 0:t.readyState)===f().OPEN&&this.socket.send(JSON.stringify(e))}},{key:"dispatchMessage",value:function(e){var t=e.type,n=r()(e,v),a=this.subscriptions.get(t)||new Set;i()(a).forEach((function(e){return e(n)}))}},{key:"startHeartbeat",value:function(){var e=this;this.heartbeatTimeout=setInterval((function(){var t;(null===(t=e.socket)||void 0===t?void 0:t.readyState)===f().OPEN&&e.socket.send(JSON.stringify({type:"heartbeat"}))}),this.options.heartbeatInterval)}},{key:"stopHeartbeat",value:function(){this.heartbeatTimeout&&clearInterval(this.heartbeatTimeout)}},{key:"close",value:function(){this.socket&&(this.state="closed",this.stopHeartbeat(),this.socket.close(),this.emit("close"))}},{key:"handleError",value:function(e){console.error("WebSocket错误:",e),this.emit("error",e)}},{key:"on",value:function(e,t){}},{key:"emit",value:function(e,t){}}],[{key:"getInstance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;return e.instance||(e.instance=new e(t,n)),e.instance}}]),e}();b()(Z,"instance",null),t.Z=Z}}]);
@@ -10,6 +10,6 @@
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
13
- <script src="./umi.8daa227c.js"></script>
13
+ <script src="./umi.d9511dd2.js"></script>
14
14
 
15
15
  </body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[5825],{37126:function(e,n,t){t.d(n,{Z:function(){return s}});var a=t(14797),o=t(63313),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},c=t(46420),i=function(e,n){return o.createElement(c.Z,(0,a.Z)((0,a.Z)({},e),{},{ref:n,icon:r}))};i.displayName="SearchOutlined";var s=o.forwardRef(i)},74301:function(e,n,t){t.r(n);var a=t(54306),o=t.n(a),r=t(88265),c=t(63313),i=t(9835),s=t(75310),u=t(24378),l=t(15207),d=t(23435),E=t(57229),f=t(82755),h=t(31988),p=t(14851),g=t(26747),m=t(95407),S=t(40141),N=t(11527);n.default=function(){var e=(0,p.useOutletContext)(),n=e.headerStyle,t=e.isPhone,a=e.theme,C=(0,c.useState)(""),M=o()(C,2),y=M[0],O=M[1],v=(0,c.useState)(!0),T=o()(v,2),_=T[0],U=T[1],P=(0,c.useState)("config.sh"),I=o()(P,2),A=I[0],R=I[1],x=(0,c.useState)("config.sh"),w=o()(x,2),Z=w[0],L=w[1],b=(0,c.useState)([]),D=o()(b,2),F=D[0],K=D[1],k=(0,c.useRef)(null),H=(0,c.useState)(!1),W=o()(H,2),G=W[0],j=W[1],B=(0,c.useState)("shell"),V=o()(B,2),Q=V[0],z=V[1],q=function(e){E.W.get("".concat(l.Z.apiPrefix,"configs/detail?path=").concat(encodeURIComponent(e))).then((function(e){var n=e.code,t=e.data;200===n&&O(t)}))},Y=function(){j(!0);var e=k.current?k.current.getValue().replace(/\r\n/g,"\n"):y;E.W.post("".concat(l.Z.apiPrefix,"configs/save"),{content:e,name:Z}).then((function(e){var n=e.code;e.data;200===n&&i.ZP.success(r.ZP.get("保存成功")),j(!1)}))};return(0,m.y1)("mod+s",(function(e){Y()}),{enableOnFormTags:["textarea"],preventDefault:!0}),(0,c.useEffect)((function(){U(!0),E.W.get("".concat(l.Z.apiPrefix,"configs/files")).then((function(e){var n=e.code,t=e.data;200===n&&K(t)})).finally((function(){return U(!1)})),q("config.sh")}),[]),(0,N.jsx)(d.ZP,{className:"ql-container-wrapper config-wrapper",title:A,loading:_,extra:[(0,N.jsx)(s.Z,{treeExpandAction:"click",className:"config-select",value:Z,dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:F,defaultValue:"config.sh",onSelect:function(e,n){L(e),R(n.value),q(n.value);var t=(0,S.H$)(e);z(t)}},"value"),(0,N.jsx)(u.Z,{loading:G,type:"primary",onClick:Y,children:r.ZP.get("保存")},"1")],header:{style:n},children:t?(0,N.jsx)(h.ZP,{value:y,theme:a.includes("dark")?"dark":"light",extensions:[g.RI.shell()],onChange:function(e){O(e)}}):(0,N.jsx)(f.ZP,{language:Q,value:y,theme:a,options:{fontSize:12,lineNumbersMinChars:3,folding:!1,glyphMargin:!1},onMount:function(e){k.current=e}})})}},52105:function(e,n,t){var a=t(41171),o=t(63313),r=t(68098);n.Z=function(){var e=o.useState(!1),n=(0,a.Z)(e,2),t=n[0],c=n[1];return o.useEffect((function(){c((0,r.fk)())}),[]),t}},11847:function(e,n,t){t.d(n,{c4:function(){return r}});var a=t(22481),o=t(88028),r=["xxl","xl","lg","md","sm","xs"],c={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)"},i=new Map,s=-1,u={},l={matchHandlers:{},dispatch:function(e){return u=e,i.forEach((function(e){return e(u)})),i.size>=1},subscribe:function(e){return i.size||this.register(),s+=1,i.set(s,e),e(u),s},unsubscribe:function(e){i.delete(e),i.size||this.unregister()},unregister:function(){var e=this;Object.keys(c).forEach((function(n){var t=c[n],a=e.matchHandlers[t];null==a||a.mql.removeListener(null==a?void 0:a.listener)})),i.clear()},register:function(){var e=this;Object.keys(c).forEach((function(n){var t=c[n],r=function(t){var r=t.matches;e.dispatch((0,o.Z)((0,o.Z)({},u),(0,a.Z)({},n,r)))},i=window.matchMedia(t);i.addListener(r),e.matchHandlers[t]={mql:i,listener:r},r(i)}))}};n.ZP=l},1020:function(e,n,t){t.d(n,{F:function(){return i},Z:function(){return c}});var a=t(22481),o=t(84875),r=t.n(o);(0,t(20341).b)("warning","error","");function c(e,n,t){var o;return r()((o={},(0,a.Z)(o,"".concat(e,"-status-success"),"success"===n),(0,a.Z)(o,"".concat(e,"-status-warning"),"warning"===n),(0,a.Z)(o,"".concat(e,"-status-error"),"error"===n),(0,a.Z)(o,"".concat(e,"-status-validating"),"validating"===n),(0,a.Z)(o,"".concat(e,"-has-feedback"),t),o))}var i=function(e,n){return n||e}},68098:function(e,n,t){t.d(n,{fk:function(){return c},jD:function(){return r}});var a,o=t(46594),r=function(){return(0,o.Z)()&&window.document.documentElement},c=function(){if(!r())return!1;if(void 0!==a)return a;var e=document.createElement("div");return e.style.display="flex",e.style.flexDirection="column",e.style.rowGap="1px",e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),document.body.appendChild(e),a=1===e.scrollHeight,document.body.removeChild(e),a}},20277:function(e,n,t){var a=t(88028),o=t(32602),r=t(63313),c=function(e,n){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)n.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(t[a[o]]=e[a[o]])}return t},i={border:0,background:"transparent",padding:0,lineHeight:"inherit",display:"inline-block"},s=r.forwardRef((function(e,n){var t=e.style,s=e.noStyle,u=e.disabled,l=c(e,["style","noStyle","disabled"]),d={};return s||(d=(0,a.Z)({},i)),u&&(d.pointerEvents="none"),d=(0,a.Z)((0,a.Z)({},d),t),r.createElement("div",(0,a.Z)({role:"button",tabIndex:0,ref:n},l,{onKeyDown:function(e){e.keyCode===o.Z.ENTER&&e.preventDefault()},onKeyUp:function(n){var t=n.keyCode,a=e.onClick;t===o.Z.ENTER&&a&&a()},style:d}))}));n.Z=s},32602:function(e,n){var t={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var n=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||n>=t.F1&&n<=t.F12)return!1;switch(n){case t.ALT:case t.CAPS_LOCK:case t.CONTEXT_MENU:case t.CTRL:case t.DOWN:case t.END:case t.ESC:case t.HOME:case t.INSERT:case t.LEFT:case t.MAC_FF_META:case t.META:case t.NUMLOCK:case t.NUM_CENTER:case t.PAGE_DOWN:case t.PAGE_UP:case t.PAUSE:case t.PRINT_SCREEN:case t.RIGHT:case t.SHIFT:case t.UP:case t.WIN_KEY:case t.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=t.ZERO&&e<=t.NINE)return!0;if(e>=t.NUM_ZERO&&e<=t.NUM_MULTIPLY)return!0;if(e>=t.A&&e<=t.Z)return!0;if(-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case t.SPACE:case t.QUESTION_MARK:case t.NUM_PLUS:case t.NUM_MINUS:case t.NUM_PERIOD:case t.NUM_DIVISION:case t.SEMICOLON:case t.DASH:case t.EQUALS:case t.COMMA:case t.PERIOD:case t.SLASH:case t.APOSTROPHE:case t.SINGLE_QUOTE:case t.OPEN_SQUARE_BRACKET:case t.BACKSLASH:case t.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};n.Z=t},35019:function(e,n,t){t.d(n,{Z:function(){return s}});var a=t(2595),o="".concat("accept acceptCharset accessKey action allowFullScreen allowTransparency\n alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n charSet checked classID className colSpan cols content contentEditable contextMenu\n controls coords crossOrigin data dateTime default defer dir disabled download draggable\n encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n mediaGroup method min minLength multiple muted name noValidate nonce open\n optimum pattern placeholder poster preload radioGroup readOnly rel required\n reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n summary tabIndex target title type useMap value width wmode wrap"," ").concat("onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError").split(/[\s\n]+/),r="aria-",c="data-";function i(e,n){return 0===e.indexOf(n)}function s(e){var n,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n=!1===t?{aria:!0,data:!0,attr:!0}:!0===t?{aria:!0}:(0,a.Z)({},t);var s={};return Object.keys(e).forEach((function(t){(n.aria&&("role"===t||i(t,r))||n.data&&i(t,c)||n.attr&&o.includes(t))&&(s[t]=e[t])})),s}}}]);