@whyour/qinglong 2.18.1 → 2.18.2-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.
Files changed (128) hide show
  1. package/README-en.md +4 -127
  2. package/README.md +4 -125
  3. package/SECURITY.md +5 -0
  4. package/back.d.ts +9 -0
  5. package/package.json +6 -8
  6. package/sample/ql_sample.js +6 -0
  7. package/sample/ql_sample.py +6 -1
  8. package/shell/api.sh +4 -1
  9. package/shell/preload/client.js +45 -0
  10. package/shell/preload/client.py +113 -0
  11. package/shell/preload/sitecustomize.js +2 -0
  12. package/shell/preload/sitecustomize.py +2 -1
  13. package/shell/share.sh +15 -4
  14. package/shell/update.sh +2 -1
  15. package/static/build/api/log.js +1 -1
  16. package/static/build/app.js +0 -1
  17. package/static/build/config/index.js +0 -2
  18. package/static/build/config/util.js +8 -4
  19. package/static/build/data/env.js +1 -1
  20. package/static/build/loaders/db.js +0 -70
  21. package/static/build/loaders/express.js +2 -27
  22. package/static/build/loaders/initData.js +20 -12
  23. package/static/build/protos/api.js +1084 -0
  24. package/static/build/protos/cron.js +36 -27
  25. package/static/build/protos/health.js +12 -3
  26. package/static/build/schedule/api.js +140 -0
  27. package/static/build/schedule/index.js +26 -0
  28. package/static/build/services/env.js +1 -1
  29. package/static/build/services/notify.js +19 -34
  30. package/static/build/services/open.js +8 -7
  31. package/static/build/services/system.js +1 -1
  32. package/static/build/shared/pLimit.js +12 -1
  33. package/static/dist/2208.c1a40612.async.js +1 -0
  34. package/static/dist/{8528.3dffc548.async.js → 3127.2579e73a.async.js} +1 -1
  35. package/static/dist/{2237.4d3def87.async.js → 3191.f56b00f8.async.js} +1 -1
  36. package/static/dist/4402.49bbe98d.async.js +1 -0
  37. package/static/dist/{5312.5545b3ed.async.js → 5312.74b95311.async.js} +1 -1
  38. package/static/dist/{1149.33cb7e7a.async.js → 7253.4b9bf133.async.js} +1 -1
  39. package/static/dist/{872.10bd0974.async.js → 7508.a31662a3.async.js} +1 -1
  40. package/static/dist/{2081.d0d781b1.async.js → 7984.e6bb9378.async.js} +1 -1
  41. package/static/dist/8317.c44c1ebd.async.js +1 -0
  42. package/static/dist/874.ae8edb1a.async.js +1 -0
  43. package/static/dist/8826.37966028.async.js +1 -0
  44. package/static/dist/{4799.d5ca9f30.async.js → 9313.37acaf13.async.js} +1 -1
  45. package/static/dist/index.html +2 -2
  46. package/static/dist/layouts__index.c986408d.async.js +1 -0
  47. package/static/dist/preload_helper.6482f199.js +1 -0
  48. package/static/dist/src__pages__404.771168fc.async.js +1 -0
  49. package/static/dist/src__pages__config__index.de6dca30.async.js +1 -0
  50. package/static/dist/{src__pages__crontab__detail.6f7c3205.async.js → src__pages__crontab__detail.80d30a01.async.js} +1 -1
  51. package/static/dist/src__pages__crontab__index.9e38b6dc.async.js +1 -0
  52. package/static/dist/{src__pages__crontab__logModal.c88ea3b7.async.js → src__pages__crontab__logModal.6a345e8a.async.js} +1 -1
  53. package/static/dist/src__pages__crontab__modal.78b1e588.async.js +1 -0
  54. package/static/dist/{src__pages__crontab__type.5895ed02.async.js → src__pages__crontab__type.bde5cda4.async.js} +1 -1
  55. package/static/dist/src__pages__crontab__viewManageModal.4874669b.async.js +1 -0
  56. package/static/dist/src__pages__dependence__index.4a0af2b9.async.js +1 -0
  57. package/static/dist/src__pages__dependence__modal.e6696a7c.async.js +1 -0
  58. package/static/dist/{src__pages__dependence__type.bdac3725.async.js → src__pages__dependence__type.e48c5c88.async.js} +1 -1
  59. package/static/dist/src__pages__diff__index.a4176b58.async.js +1 -0
  60. package/static/dist/src__pages__env__editNameModal.02322e80.async.js +1 -0
  61. package/static/dist/src__pages__env__index.f3bfe0c7.async.js +1 -0
  62. package/static/dist/src__pages__env__modal.066399fd.async.js +1 -0
  63. package/static/dist/src__pages__error__index.656c9940.async.js +1 -0
  64. package/static/dist/src__pages__initialization__index.75484c39.async.js +1 -0
  65. package/static/dist/src__pages__log__index.8a782756.async.js +1 -0
  66. package/static/dist/src__pages__login__index.8a653852.async.js +1 -0
  67. package/static/dist/src__pages__script__editModal.e7bf71bd.async.js +1 -0
  68. package/static/dist/src__pages__script__editNameModal.c048343e.async.js +1 -0
  69. package/static/dist/src__pages__script__index.9d9099c1.async.js +1 -0
  70. package/static/dist/src__pages__script__renameModal.357c6c72.async.js +1 -0
  71. package/static/dist/src__pages__script__saveModal.61fcb1fe.async.js +1 -0
  72. package/static/dist/src__pages__script__setting.f2d78204.async.js +1 -0
  73. package/static/dist/{src__pages__setting__about.3a1a6f3b.async.js → src__pages__setting__about.3d3c019f.async.js} +1 -1
  74. package/static/dist/src__pages__setting__appModal.9eeaeee7.async.js +1 -0
  75. package/static/dist/{src__pages__setting__checkUpdate.0dfdaf7c.async.js → src__pages__setting__checkUpdate.04c00c9c.async.js} +1 -1
  76. package/static/dist/src__pages__setting__dependence.0dd0969b.async.js +1 -0
  77. package/static/dist/src__pages__setting__index.46a8e768.async.js +1 -0
  78. package/static/dist/{src__pages__setting__loginLog.fc87584a.async.js → src__pages__setting__loginLog.cea6056c.async.js} +1 -1
  79. package/static/dist/src__pages__setting__notification.b038afec.async.js +1 -0
  80. package/static/dist/{src__pages__setting__other.34ccb2e8.async.js → src__pages__setting__other.0d869d58.async.js} +1 -1
  81. package/static/dist/{src__pages__setting__progress.75143dca.async.js → src__pages__setting__progress.8823ac90.async.js} +1 -1
  82. package/static/dist/src__pages__setting__security.af57bd6a.async.js +1 -0
  83. package/static/dist/src__pages__setting__systemLog.501844bd.async.js +1 -0
  84. package/static/dist/src__pages__subscription__index.b43143e7.async.js +1 -0
  85. package/static/dist/{src__pages__subscription__logModal.b3c7c02c.async.js → src__pages__subscription__logModal.02c80eb3.async.js} +1 -1
  86. package/static/dist/src__pages__subscription__modal.a61ece75.async.js +1 -0
  87. package/static/dist/umi.e783bacd.js +1 -0
  88. package/version.yaml +6 -7
  89. package/static/build/loaders/sentry.js +0 -53
  90. package/static/dist/2634.a765cd37.async.js +0 -1
  91. package/static/dist/4642.9e24d86c.async.js +0 -1
  92. package/static/dist/4865.98e5a005.async.js +0 -1
  93. package/static/dist/852.15be2189.async.js +0 -1
  94. package/static/dist/9065.df8d5dcc.async.js +0 -1
  95. package/static/dist/layouts__index.c164d41f.async.js +0 -1
  96. package/static/dist/preload_helper.55b35ae0.js +0 -1
  97. package/static/dist/src__pages__404.6871535b.async.js +0 -1
  98. package/static/dist/src__pages__config__index.39b5f99f.async.js +0 -1
  99. package/static/dist/src__pages__crontab__index.55a8714d.async.js +0 -1
  100. package/static/dist/src__pages__crontab__modal.328fee41.async.js +0 -1
  101. package/static/dist/src__pages__crontab__viewManageModal.c71ebc5a.async.js +0 -1
  102. package/static/dist/src__pages__dependence__index.edec638b.async.js +0 -1
  103. package/static/dist/src__pages__dependence__modal.9fd1176b.async.js +0 -1
  104. package/static/dist/src__pages__diff__index.8ba53a1e.async.js +0 -1
  105. package/static/dist/src__pages__env__editNameModal.c35e96f9.async.js +0 -1
  106. package/static/dist/src__pages__env__index.c799138c.async.js +0 -1
  107. package/static/dist/src__pages__env__modal.3b0ca9a6.async.js +0 -1
  108. package/static/dist/src__pages__error__index.0221fcd9.async.js +0 -1
  109. package/static/dist/src__pages__initialization__index.346725d1.async.js +0 -1
  110. package/static/dist/src__pages__log__index.2fd615f2.async.js +0 -1
  111. package/static/dist/src__pages__login__index.1dd6e684.async.js +0 -1
  112. package/static/dist/src__pages__script__editModal.28caeb56.async.js +0 -1
  113. package/static/dist/src__pages__script__editNameModal.1155d34c.async.js +0 -1
  114. package/static/dist/src__pages__script__index.6a212c2d.async.js +0 -1
  115. package/static/dist/src__pages__script__renameModal.dabfccfd.async.js +0 -1
  116. package/static/dist/src__pages__script__saveModal.04d43882.async.js +0 -1
  117. package/static/dist/src__pages__script__setting.9d5ad53c.async.js +0 -1
  118. package/static/dist/src__pages__setting__appModal.7b3bff1e.async.js +0 -1
  119. package/static/dist/src__pages__setting__dependence.a9b7ed43.async.js +0 -1
  120. package/static/dist/src__pages__setting__index.ffa1cdd6.async.js +0 -1
  121. package/static/dist/src__pages__setting__notification.97b1d997.async.js +0 -1
  122. package/static/dist/src__pages__setting__security.c777fb87.async.js +0 -1
  123. package/static/dist/src__pages__setting__systemLog.63e9c69d.async.js +0 -1
  124. package/static/dist/src__pages__subscription__index.69a6de02.async.js +0 -1
  125. package/static/dist/src__pages__subscription__modal.aefaf070.async.js +0 -1
  126. package/static/dist/umi.fb3ed7a0.js +0 -1
  127. /package/static/dist/{2625.675b6a18.chunk.css → 1883.675b6a18.chunk.css} +0 -0
  128. /package/static/dist/{872.3fffed15.chunk.css → 7508.3fffed15.chunk.css} +0 -0
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.181.2
5
+ // protoc v3.17.3
6
+ // source: back/protos/cron.proto
2
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
9
  };
@@ -40,11 +45,13 @@ exports.ISchedule = {
40
45
  return message;
41
46
  },
42
47
  fromJSON(object) {
43
- return { schedule: isSet(object.schedule) ? String(object.schedule) : "" };
48
+ return { schedule: isSet(object.schedule) ? globalThis.String(object.schedule) : "" };
44
49
  },
45
50
  toJSON(message) {
46
51
  const obj = {};
47
- message.schedule !== undefined && (obj.schedule = message.schedule);
52
+ if (message.schedule !== "") {
53
+ obj.schedule = message.schedule;
54
+ }
48
55
  return obj;
49
56
  },
50
57
  create(base) {
@@ -126,27 +133,33 @@ exports.ICron = {
126
133
  },
127
134
  fromJSON(object) {
128
135
  return {
129
- id: isSet(object.id) ? String(object.id) : "",
130
- schedule: isSet(object.schedule) ? String(object.schedule) : "",
131
- command: isSet(object.command) ? String(object.command) : "",
132
- extraSchedules: Array.isArray(object === null || object === void 0 ? void 0 : object.extraSchedules)
136
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
137
+ schedule: isSet(object.schedule) ? globalThis.String(object.schedule) : "",
138
+ command: isSet(object.command) ? globalThis.String(object.command) : "",
139
+ extraSchedules: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.extraSchedules)
133
140
  ? object.extraSchedules.map((e) => exports.ISchedule.fromJSON(e))
134
141
  : [],
135
- name: isSet(object.name) ? String(object.name) : "",
142
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
136
143
  };
137
144
  },
138
145
  toJSON(message) {
146
+ var _a;
139
147
  const obj = {};
140
- message.id !== undefined && (obj.id = message.id);
141
- message.schedule !== undefined && (obj.schedule = message.schedule);
142
- message.command !== undefined && (obj.command = message.command);
143
- if (message.extraSchedules) {
144
- obj.extraSchedules = message.extraSchedules.map((e) => e ? exports.ISchedule.toJSON(e) : undefined);
148
+ if (message.id !== "") {
149
+ obj.id = message.id;
150
+ }
151
+ if (message.schedule !== "") {
152
+ obj.schedule = message.schedule;
153
+ }
154
+ if (message.command !== "") {
155
+ obj.command = message.command;
156
+ }
157
+ if ((_a = message.extraSchedules) === null || _a === void 0 ? void 0 : _a.length) {
158
+ obj.extraSchedules = message.extraSchedules.map((e) => exports.ISchedule.toJSON(e));
145
159
  }
146
- else {
147
- obj.extraSchedules = [];
160
+ if (message.name !== "") {
161
+ obj.name = message.name;
148
162
  }
149
- message.name !== undefined && (obj.name = message.name);
150
163
  return obj;
151
164
  },
152
165
  create(base) {
@@ -195,15 +208,13 @@ exports.AddCronRequest = {
195
208
  return message;
196
209
  },
197
210
  fromJSON(object) {
198
- return { crons: Array.isArray(object === null || object === void 0 ? void 0 : object.crons) ? object.crons.map((e) => exports.ICron.fromJSON(e)) : [] };
211
+ return { crons: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.crons) ? object.crons.map((e) => exports.ICron.fromJSON(e)) : [] };
199
212
  },
200
213
  toJSON(message) {
214
+ var _a;
201
215
  const obj = {};
202
- if (message.crons) {
203
- obj.crons = message.crons.map((e) => e ? exports.ICron.toJSON(e) : undefined);
204
- }
205
- else {
206
- obj.crons = [];
216
+ if ((_a = message.crons) === null || _a === void 0 ? void 0 : _a.length) {
217
+ obj.crons = message.crons.map((e) => exports.ICron.toJSON(e));
207
218
  }
208
219
  return obj;
209
220
  },
@@ -286,15 +297,13 @@ exports.DeleteCronRequest = {
286
297
  return message;
287
298
  },
288
299
  fromJSON(object) {
289
- return { ids: Array.isArray(object === null || object === void 0 ? void 0 : object.ids) ? object.ids.map((e) => String(e)) : [] };
300
+ return { ids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.ids) ? object.ids.map((e) => globalThis.String(e)) : [] };
290
301
  },
291
302
  toJSON(message) {
303
+ var _a;
292
304
  const obj = {};
293
- if (message.ids) {
294
- obj.ids = message.ids.map((e) => e);
295
- }
296
- else {
297
- obj.ids = [];
305
+ if ((_a = message.ids) === null || _a === void 0 ? void 0 : _a.length) {
306
+ obj.ids = message.ids;
298
307
  }
299
308
  return obj;
300
309
  },
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v1.181.2
5
+ // protoc v3.17.3
6
+ // source: back/protos/health.proto
2
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
9
  };
@@ -85,11 +90,13 @@ exports.HealthCheckRequest = {
85
90
  return message;
86
91
  },
87
92
  fromJSON(object) {
88
- return { service: isSet(object.service) ? String(object.service) : "" };
93
+ return { service: isSet(object.service) ? globalThis.String(object.service) : "" };
89
94
  },
90
95
  toJSON(message) {
91
96
  const obj = {};
92
- message.service !== undefined && (obj.service = message.service);
97
+ if (message.service !== "") {
98
+ obj.service = message.service;
99
+ }
93
100
  return obj;
94
101
  },
95
102
  create(base) {
@@ -138,7 +145,9 @@ exports.HealthCheckResponse = {
138
145
  },
139
146
  toJSON(message) {
140
147
  const obj = {};
141
- message.status !== undefined && (obj.status = healthCheckResponse_ServingStatusToJSON(message.status));
148
+ if (message.status !== 0) {
149
+ obj.status = healthCheckResponse_ServingStatusToJSON(message.status);
150
+ }
142
151
  return obj;
143
152
  },
144
153
  create(base) {
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.systemNotify = exports.getEnvById = exports.updateEnvNames = exports.enableEnvs = exports.disableEnvs = exports.moveEnv = exports.deleteEnvs = exports.updateEnv = exports.createEnv = exports.getEnvs = void 0;
7
+ require("reflect-metadata");
8
+ const typedi_1 = require("typedi");
9
+ const env_1 = __importDefault(require("../services/env"));
10
+ const logger_1 = __importDefault(require("../loaders/logger"));
11
+ const pick_1 = __importDefault(require("lodash/pick"));
12
+ const system_1 = __importDefault(require("../services/system"));
13
+ typedi_1.Container.set('logger', logger_1.default);
14
+ const getEnvs = async (call, callback) => {
15
+ try {
16
+ const envService = typedi_1.Container.get(env_1.default);
17
+ const data = await envService.envs(call.request.searchValue);
18
+ callback(null, {
19
+ code: 200,
20
+ data: data.map((x) => (Object.assign(Object.assign({}, x), { remarks: x.remarks || '' }))),
21
+ });
22
+ }
23
+ catch (e) {
24
+ callback(null, {
25
+ code: 500,
26
+ data: [],
27
+ message: e.message,
28
+ });
29
+ }
30
+ };
31
+ exports.getEnvs = getEnvs;
32
+ const createEnv = async (call, callback) => {
33
+ try {
34
+ const envService = typedi_1.Container.get(env_1.default);
35
+ const data = await envService.create(call.request.envs);
36
+ callback(null, { code: 200, data });
37
+ }
38
+ catch (e) {
39
+ callback(e);
40
+ }
41
+ };
42
+ exports.createEnv = createEnv;
43
+ const updateEnv = async (call, callback) => {
44
+ try {
45
+ const envService = typedi_1.Container.get(env_1.default);
46
+ const data = await envService.update((0, pick_1.default)(call.request.env, ['id', 'name', 'value', 'remark']));
47
+ callback(null, { code: 200, data });
48
+ }
49
+ catch (e) {
50
+ callback(e);
51
+ }
52
+ };
53
+ exports.updateEnv = updateEnv;
54
+ const deleteEnvs = async (call, callback) => {
55
+ try {
56
+ const envService = typedi_1.Container.get(env_1.default);
57
+ await envService.remove(call.request.ids);
58
+ callback(null, { code: 200 });
59
+ }
60
+ catch (e) {
61
+ callback(e);
62
+ }
63
+ };
64
+ exports.deleteEnvs = deleteEnvs;
65
+ const moveEnv = async (call, callback) => {
66
+ try {
67
+ const envService = typedi_1.Container.get(env_1.default);
68
+ const data = await envService.move(call.request.id, {
69
+ fromIndex: call.request.fromIndex,
70
+ toIndex: call.request.toIndex,
71
+ });
72
+ callback(null, { code: 200, data });
73
+ }
74
+ catch (e) {
75
+ callback(e);
76
+ }
77
+ };
78
+ exports.moveEnv = moveEnv;
79
+ const disableEnvs = async (call, callback) => {
80
+ try {
81
+ const envService = typedi_1.Container.get(env_1.default);
82
+ await envService.disabled(call.request.ids);
83
+ callback(null, { code: 200 });
84
+ }
85
+ catch (e) {
86
+ callback(e);
87
+ }
88
+ };
89
+ exports.disableEnvs = disableEnvs;
90
+ const enableEnvs = async (call, callback) => {
91
+ try {
92
+ const envService = typedi_1.Container.get(env_1.default);
93
+ await envService.enabled(call.request.ids);
94
+ callback(null, { code: 200 });
95
+ }
96
+ catch (e) {
97
+ callback(e);
98
+ }
99
+ };
100
+ exports.enableEnvs = enableEnvs;
101
+ const updateEnvNames = async (call, callback) => {
102
+ try {
103
+ const envService = typedi_1.Container.get(env_1.default);
104
+ await envService.updateNames({
105
+ ids: call.request.ids,
106
+ name: call.request.name,
107
+ });
108
+ callback(null, { code: 200 });
109
+ }
110
+ catch (e) {
111
+ callback(e);
112
+ }
113
+ };
114
+ exports.updateEnvNames = updateEnvNames;
115
+ const getEnvById = async (call, callback) => {
116
+ try {
117
+ const envService = typedi_1.Container.get(env_1.default);
118
+ const data = await envService.getDb({ id: call.request.id });
119
+ callback(null, {
120
+ code: 200,
121
+ data: Object.assign(Object.assign({}, data), { remarks: data.remarks || '' }),
122
+ });
123
+ }
124
+ catch (e) {
125
+ callback(e);
126
+ }
127
+ };
128
+ exports.getEnvById = getEnvById;
129
+ const systemNotify = async (call, callback) => {
130
+ try {
131
+ const systemService = typedi_1.Container.get(system_1.default);
132
+ const data = await systemService.notify(call.request);
133
+ callback(null, data);
134
+ }
135
+ catch (e) {
136
+ callback(e);
137
+ }
138
+ };
139
+ exports.systemNotify = systemNotify;
140
+ //# sourceMappingURL=api.js.map
@@ -1,4 +1,27 @@
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
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -11,9 +34,12 @@ const health_1 = require("../protos/health");
11
34
  const health_2 = require("./health");
12
35
  const config_1 = __importDefault(require("../config"));
13
36
  const logger_1 = __importDefault(require("../loaders/logger"));
37
+ const api_1 = require("../protos/api");
38
+ const Api = __importStar(require("./api"));
14
39
  const server = new grpc_js_1.Server({ 'grpc.enable_http_proxy': 0 });
15
40
  server.addService(health_1.HealthService, { check: health_2.check });
16
41
  server.addService(cron_1.CronService, { addCron: addCron_1.addCron, delCron: delCron_1.delCron });
42
+ server.addService(api_1.ApiService, Api);
17
43
  server.bindAsync(`0.0.0.0:${config_1.default.cronPort}`, grpc_js_1.ServerCredentials.createInsecure(), (err, port) => {
18
44
  var _a;
19
45
  if (err) {
@@ -142,7 +142,7 @@ let EnvService = class EnvService {
142
142
  where: Object.assign({}, query),
143
143
  order: [...sort],
144
144
  });
145
- return docs;
145
+ return docs.map((x) => x.get({ plain: true }));
146
146
  }
147
147
  async getDb(query) {
148
148
  const doc = await env_1.EnvModel.findOne({ where: Object.assign({}, query) });
@@ -30,8 +30,6 @@ const nodemailer_1 = __importDefault(require("nodemailer"));
30
30
  const typedi_1 = require("typedi");
31
31
  const util_1 = require("../config/util");
32
32
  const user_1 = __importDefault(require("./user"));
33
- const promises_1 = require("fs/promises");
34
- const config_1 = __importDefault(require("../config"));
35
33
  let NotificationService = class NotificationService {
36
34
  constructor() {
37
35
  this.modeMap = new Map([
@@ -64,22 +62,6 @@ let NotificationService = class NotificationService {
64
62
  retry: 1,
65
63
  };
66
64
  }
67
- async externalNotify(title, content) {
68
- const _a = (0, util_1.safeJSONParse)(await (0, promises_1.readFile)(config_1.default.systemNotifyFile, 'utf-8')), { type } = _a, rest = __rest(_a, ["type"]);
69
- if (type) {
70
- this.title = title;
71
- this.content = content;
72
- this.params = rest;
73
- const notificationModeAction = this.modeMap.get(type);
74
- try {
75
- return await (notificationModeAction === null || notificationModeAction === void 0 ? void 0 : notificationModeAction.call(this));
76
- }
77
- catch (error) {
78
- throw error;
79
- }
80
- }
81
- return false;
82
- }
83
65
  async notify(title, content) {
84
66
  const _a = await this.userService.getNotificationMode(), { type } = _a, rest = __rest(_a, ["type"]);
85
67
  if (type) {
@@ -445,7 +427,7 @@ let NotificationService = class NotificationService {
445
427
  }
446
428
  }
447
429
  async pushPlus() {
448
- const { pushPlusToken, pushPlusUser, pushplusWebhook, pushPlusTemplate, pushplusChannel, pushplusCallbackUrl, pushplusTo } = this.params;
430
+ const { pushPlusToken, pushPlusUser, pushplusWebhook, pushPlusTemplate, pushplusChannel, pushplusCallbackUrl, pushplusTo, } = this.params;
449
431
  const url = `https://www.pushplus.plus/send`;
450
432
  try {
451
433
  let body = Object.assign(Object.assign({}, this.gotOption), { json: {
@@ -457,11 +439,9 @@ let NotificationService = class NotificationService {
457
439
  channel: `${pushplusChannel || 'wechat'}`,
458
440
  webhook: `${pushplusWebhook || ''}`,
459
441
  callbackUrl: `${pushplusCallbackUrl || ''}`,
460
- to: `${pushplusTo || ''}`
442
+ to: `${pushplusTo || ''}`,
461
443
  } });
462
- const res = await got_1.default
463
- .post(url, body)
464
- .json();
444
+ const res = await got_1.default.post(url, body).json();
465
445
  if (res.code === 200) {
466
446
  return true;
467
447
  }
@@ -583,8 +563,7 @@ let NotificationService = class NotificationService {
583
563
  };
584
564
  try {
585
565
  const encodedTitle = encodeRfc2047(this.title);
586
- const res = await got_1.default
587
- .post(`${ntfyUrl || 'https://ntfy.sh'}/${ntfyTopic}`, Object.assign(Object.assign({}, this.gotOption), { body: `${this.content}`, headers: { 'Title': encodedTitle, 'Priority': `${ntfyPriority || '3'}` } }));
566
+ const res = await got_1.default.post(`${ntfyUrl || 'https://ntfy.sh'}/${ntfyTopic}`, Object.assign(Object.assign({}, this.gotOption), { body: `${this.content}`, headers: { Title: encodedTitle, Priority: `${ntfyPriority || '3'}` } }));
588
567
  if (res.statusCode === 200) {
589
568
  return true;
590
569
  }
@@ -599,14 +578,20 @@ let NotificationService = class NotificationService {
599
578
  async wxPusherBot() {
600
579
  const { wxPusherBotAppToken, wxPusherBotTopicIds, wxPusherBotUids } = this.params;
601
580
  // 处理 topicIds,将分号分隔的字符串转为数组
602
- const topicIds = wxPusherBotTopicIds ? wxPusherBotTopicIds.split(';')
603
- .map(id => id.trim())
604
- .filter(id => id)
605
- .map(id => parseInt(id)) : [];
606
- // 处理 uids,将分号分隔的字符串转为数组
607
- const uids = wxPusherBotUids ? wxPusherBotUids.split(';')
608
- .map(uid => uid.trim())
609
- .filter(uid => uid) : [];
581
+ const topicIds = wxPusherBotTopicIds
582
+ ? wxPusherBotTopicIds
583
+ .split(';')
584
+ .map((id) => id.trim())
585
+ .filter((id) => id)
586
+ .map((id) => parseInt(id))
587
+ : [];
588
+ // 处理 uids,将分号分隔的字符串转为数组
589
+ const uids = wxPusherBotUids
590
+ ? wxPusherBotUids
591
+ .split(';')
592
+ .map((uid) => uid.trim())
593
+ .filter((uid) => uid)
594
+ : [];
610
595
  // topic_ids 和 uids 至少要有一个
611
596
  if (!topicIds.length && !uids.length) {
612
597
  throw new Error('wxPusher 服务的 TopicIds 和 Uids 至少配置一个才行');
@@ -621,7 +606,7 @@ let NotificationService = class NotificationService {
621
606
  contentType: 2,
622
607
  topicIds: topicIds,
623
608
  uids: uids,
624
- verifyPayType: 0
609
+ verifyPayType: 0,
625
610
  } }))
626
611
  .json();
627
612
  if (res.code === 1000) {
@@ -146,14 +146,15 @@ let OpenService = class OpenService {
146
146
  }
147
147
  async generateSystemToken() {
148
148
  var _a;
149
- let systemApp = (_a = (await open_1.AppModel.findOne({
150
- where: { name: 'system' },
151
- }))) === null || _a === void 0 ? void 0 : _a.get({ plain: true });
149
+ const apps = await store_1.shareStore.getApps();
150
+ const systemApp = apps === null || apps === void 0 ? void 0 : apps.find((x) => x.name === 'system');
152
151
  if (!systemApp) {
153
- systemApp = await this.create({
154
- name: 'system',
155
- scopes: ['crons', 'system'],
156
- });
152
+ throw new Error('system app not found');
153
+ }
154
+ const now = Math.round(Date.now() / 1000);
155
+ const currentToken = (_a = systemApp.tokens) === null || _a === void 0 ? void 0 : _a.find((x) => x.expiration > now);
156
+ if (currentToken) {
157
+ return currentToken;
157
158
  }
158
159
  const { data } = await this.authToken({
159
160
  client_id: systemApp.client_id,
@@ -350,7 +350,7 @@ let SystemService = class SystemService {
350
350
  const logs = result
351
351
  .reverse()
352
352
  .filter((x) => x.title.endsWith('.log'))
353
- .filter((x) => x.mtime >= startTime && x.mtime <= endTime);
353
+ .filter((x) => x.createTime >= startTime && x.createTime <= endTime);
354
354
  res.set({
355
355
  'Content-Length': (0, sum_1.default)(logs.map((x) => x.size)),
356
356
  });
@@ -8,6 +8,9 @@ const os_1 = __importDefault(require("os"));
8
8
  const system_1 = require("../data/system");
9
9
  const logger_1 = __importDefault(require("../loaders/logger"));
10
10
  const notify_1 = __importDefault(require("../services/notify"));
11
+ const config_1 = __importDefault(require("../config"));
12
+ const grpc_js_1 = require("@grpc/grpc-js");
13
+ const api_1 = require("../protos/api");
11
14
  class TaskLimit {
12
15
  get cronLimitActiveCount() {
13
16
  return this.cronLimit.pending;
@@ -39,6 +42,7 @@ class TaskLimit {
39
42
  this.systemLimit = new p_queue_cjs_1.default({
40
43
  concurrency: Math.max(os_1.default.cpus().length, 4),
41
44
  });
45
+ this.client = new api_1.ApiClient(`0.0.0.0:${config_1.default.cronPort}`, grpc_js_1.credentials.createInsecure(), { 'grpc.enable_http_proxy': 0 });
42
46
  this.notificationService = new notify_1.default();
43
47
  this.setCustomLimit();
44
48
  this.handleEvents();
@@ -101,7 +105,14 @@ class TaskLimit {
101
105
  if ((result === null || result === void 0 ? void 0 : result.length) > 5) {
102
106
  if (repeatTimes < 3) {
103
107
  this.repeatCronNotifyMap.set(cron.id, repeatTimes + 1);
104
- this.notificationService.externalNotify('任务重复运行', `任务:${cron.name},命令:${cron.command},定时:${cron.schedule},处于运行中的超过 5 个,请检查定时设置`);
108
+ this.client.systemNotify({
109
+ title: '任务重复运行',
110
+ content: `任务:${cron.name},命令:${cron.command},定时:${cron.schedule},处于运行中的超过 5 个,请检查定时设置`,
111
+ }, (err, res) => {
112
+ if (err) {
113
+ logger_1.default.error(`[schedule][任务重复运行] 通知失败 ${JSON.stringify(err)}`);
114
+ }
115
+ });
105
116
  }
106
117
  logger_1.default.warn(`[schedule][任务重复运行] 参数 ${JSON.stringify(cron)}`);
107
118
  return;
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[2208,5812],{44224:function(e,t,r){var a=(0,r(19919).Z)({scriptUrl:["//at.alicdn.com/t/c/font_3354854_lc939gab1iq.js"]});t.Z=a},44860:function(e,t,r){r.r(t),r.d(t,{CrontabStatus:function(){return a},OperationName:function(){return l},OperationPath:function(){return n}});var a=function(e){return e[e.running=0]="running",e[e.queued=.5]="queued",e[e.idle=1]="idle",e[e.disabled=2]="disabled",e}({}),l=function(e){return e[e["启用"]=0]="启用",e[e["禁用"]=1]="禁用",e[e["运行"]=2]="运行",e[e["停止"]=3]="停止",e[e["置顶"]=4]="置顶",e[e["取消置顶"]=5]="取消置顶",e}({}),n=function(e){return e[e.enable=0]="enable",e[e.disable=1]="disable",e[e.run=2]="run",e[e.stop=3]="stop",e[e.pin=4]="pin",e[e.unpin=5]="unpin",e}({})},42208:function(e,t,r){r.r(t);var a=r(67825),l=r.n(a),n=r(90228),i=r.n(n),o=r(26068),s=r.n(o),u=r(87999),p=r.n(u),c=r(48305),d=r.n(c),g=r(72317),h=r(75271),P=r(72338),m=r(35181),Z=r(45520),b=r(17082),v=r(93481),f=r(63505),x=r(16314),y=r(3475),k=r(37559),w=r(21288),q=r(44224),j=r(44860),B=r(31352),C=r(52676),_=["name"],S=["key","name"],T=["key","name"],R=[{name:g.ZP.get("命令"),value:"command"},{name:g.ZP.get("名称"),value:"name"},{name:g.ZP.get("定时规则"),value:"schedule"},{name:g.ZP.get("状态"),value:"status",onlySelect:!0},{name:g.ZP.get("标签"),value:"labels"},{name:g.ZP.get("订阅"),value:"sub_id",onlySelect:!0}],I={Reg:"",NotReg:"",In:"select",Nin:"select"},U=[{name:g.ZP.get("包含"),value:"Reg"},{name:g.ZP.get("不包含"),value:"NotReg"},{name:g.ZP.get("属于"),value:"In",type:"select"},{name:g.ZP.get("不属于"),value:"Nin",type:"select"}],K=[{name:g.ZP.get("顺序"),value:"ASC"},{name:g.ZP.get("倒序"),value:"DESC"}],A=function(e){return e.and="且",e.or="或",e}(A||{});t.default=function(e){var t=e.view,r=e.handleCancel,a=e.visible,n=P.Z.useForm(),o=d()(n,1)[0],u=(0,h.useState)(!1),c=d()(u,2),N=c[0],Q=c[1],H=(0,h.useState)("and"),X=d()(H,2),E=X[0],M=X[1],O=P.Z.useWatch("filters",o),W=(0,B.Z)((function(){return x.W.get("".concat(y.Z.apiPrefix,"subscriptions"))}),{cacheKey:"subscriptions"}).data,F={status:[{name:g.ZP.get("运行中"),value:j.CrontabStatus.running},{name:g.ZP.get("空闲中"),value:j.CrontabStatus.idle},{name:g.ZP.get("已禁用"),value:j.CrontabStatus.disabled}],sub_id:null==W?void 0:W.data.map((function(e){return{name:e.name,value:e.id}}))},G=function(){var e=p()(i()().mark((function e(a){var l,n,o,u;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Q(!0),a.filterRelation=E,l=t?"put":"post",e.prev=3,e.next=6,x.W[l]("".concat(y.Z.apiPrefix,"crons/views"),t?s()(s()({},a),{},{id:t.id}):a);case 6:n=e.sent,o=n.code,u=n.data,200===o&&r(u),Q(!1),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(3),Q(!1);case 16:case"end":return e.stop()}}),e,null,[[3,13]])})));return function(t){return e.apply(this,arguments)}}();(0,h.useEffect)((function(){t||o.resetFields(),o.setFieldsValue(t||{filters:[{property:"command"}]})}),[t,a]);var D=function(e){var t=e.name,r=l()(e,_),a=o.getFieldValue(["filters",t,"property"]);return(0,C.jsx)(m.Z,s()(s()({style:{width:120},placeholder:g.ZP.get("请选择操作符")},r),{},{children:U.filter((function(e){return F[a]?"select"===e.type:e})).map((function(e){return(0,C.jsx)(m.Z.Option,{value:e.value,children:e.name},e.name)}))}))},L=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,C.jsx)(m.Z,{style:t,children:e.map((function(e){return(0,C.jsx)(m.Z.Option,{value:e.value,children:e.name},e.name)}))})},z=(0,C.jsx)(m.Z,{style:{width:80},children:K.map((function(e){return(0,C.jsx)(m.Z.Option,{value:e.value,children:e.name},e.name)}))});return(0,C.jsx)(Z.Z,{title:t?g.ZP.get("编辑视图"):g.ZP.get("创建视图"),open:a,forceRender:!0,width:580,centered:!0,maskClosable:!1,onOk:function(){o.validateFields().then((function(e){G(e)})).catch((function(e){console.log("Validate Failed:",e)}))},onCancel:function(){return r()},confirmLoading:N,children:(0,C.jsxs)(P.Z,{form:o,layout:"vertical",name:"env_modal",children:[(0,C.jsx)(P.Z.Item,{name:"name",label:g.ZP.get("视图名称"),rules:[{required:!0,message:g.ZP.get("请输入视图名称")}],children:(0,C.jsx)(b.Z,{placeholder:g.ZP.get("请输入视图名称")})}),(0,C.jsx)(P.Z.List,{name:"filters",children:function(e,t,r){var a=t.add,n=t.remove,i=r.errors;return(0,C.jsxs)("div",{style:{position:"relative"},className:"view-filters-container ".concat(e.length>1?"active":""),children:[e.length>1&&(0,C.jsx)("div",{style:{position:"absolute",width:50,borderRadius:10,border:"1px solid rgb(190, 220, 255)",borderRight:"none",height:56*(e.length-1),top:46,left:15},children:(0,C.jsx)(v.Z,{type:"primary",size:"small",style:{position:"absolute",top:"50%",translate:"-50% -50%",padding:"0 3px",cursor:"pointer"},onClick:function(){M("and"===E?"or":"and")},children:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{children:A[E]}),(0,C.jsx)(q.Z,{type:"ql-icon-d-caret"})]})})}),(0,C.jsxs)("div",{children:[e.map((function(e){var t,r,a=e.key,i=e.name,o=l()(e,S);return(0,C.jsx)(P.Z.Item,{label:0===i?g.ZP.get("筛选条件"):"",style:{marginBottom:0},required:!0,className:"filter-item",children:(0,C.jsxs)(f.Z,{className:"view-create-modal-filters",align:"baseline",children:[(0,C.jsx)(P.Z.Item,s()(s()({},o),{},{name:[i,"property"],rules:[{required:!0}],children:L(R,{width:120})})),(0,C.jsx)(P.Z.Item,s()(s()({},o),{},{name:[i,"operation"],rules:[{required:!0,message:g.ZP.get("请选择操作符")}],children:(0,C.jsx)(D,{name:i})})),(0,C.jsx)(P.Z.Item,s()(s()({},o),{},{name:[i,"value"],rules:[{required:!0,message:g.ZP.get("请输入内容")}],children:"select"===I[null==O?void 0:O[i].operation]?(t=null==O?void 0:O[i].property,(0,C.jsx)(m.Z,{mode:"tags",allowClear:!0,placeholder:g.ZP.get("输入后回车增加自定义选项"),children:null===(r=F[t])||void 0===r?void 0:r.map((function(e){return(0,C.jsx)(m.Z.Option,{value:e.value,children:e.name},e.name)}))})):(0,C.jsx)(b.Z,{placeholder:g.ZP.get("请输入内容")})})),0!==i&&(0,C.jsx)(k.Z,{onClick:function(){return n(i)}})]})},a)})),(0,C.jsx)(P.Z.Item,{children:(0,C.jsxs)("a",{onClick:function(){return a({property:"command",operation:"Reg"})},children:[(0,C.jsx)(w.Z,{}),g.ZP.get("新增筛选条件")]})}),(0,C.jsx)(P.Z.ErrorList,{errors:i})]})]})}}),(0,C.jsx)(P.Z.List,{name:"sorts",children:function(e,t,r){var a=t.add,n=t.remove,i=r.errors;return(0,C.jsxs)("div",{style:{position:"relative"},className:"view-filters-container ".concat(e.length>1?"active":""),children:[e.length>1&&(0,C.jsx)("div",{style:{position:"absolute",width:50,borderRadius:10,border:"1px solid rgb(190, 220, 255)",borderRight:"none",height:56*(e.length-1),top:46,left:15},children:(0,C.jsx)(v.Z,{type:"primary",size:"small",style:{position:"absolute",top:"50%",translate:"-50% -50%",padding:"0 3px",cursor:"pointer"},children:(0,C.jsx)(C.Fragment,{children:(0,C.jsx)("span",{children:A[E]})})})}),(0,C.jsxs)("div",{children:[e.map((function(e){var t=e.key,r=e.name,a=l()(e,T);return(0,C.jsx)(P.Z.Item,{label:0===r?g.ZP.get("排序方式"):"",style:{marginBottom:0},className:"filter-item",children:(0,C.jsxs)(f.Z,{className:"view-create-modal-sorts",align:"baseline",children:[(0,C.jsx)(P.Z.Item,s()(s()({},a),{},{name:[r,"property"],rules:[{required:!0}],children:L(R)})),(0,C.jsx)(P.Z.Item,s()(s()({},a),{},{name:[r,"type"],rules:[{required:!0}],children:z})),(0,C.jsx)(k.Z,{onClick:function(){return n(r)}})]})},t)})),(0,C.jsx)(P.Z.Item,{children:(0,C.jsxs)("a",{onClick:function(){return a({property:"command",type:"ASC"})},children:[(0,C.jsx)(w.Z,{}),g.ZP.get("新增排序方式")]})}),(0,C.jsx)(P.Z.ErrorList,{errors:i})]})]})}})]})})}},3475:function(e,t,r){var a=r(72317),l=window.__ENV__QlBaseUrl||"/";t.Z={siteName:a.ZP.get("青龙"),baseUrl:l,apiPrefix:"".concat(l,"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:"ntfy",label:"Ntfy"},{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:"wePlusBot",label:a.ZP.get("微加机器人")},{value:"wxPusherBot",label:"wxPusher"},{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("推送消息的优先级")}],ntfy:[{label:"ntfyUrl",tip:a.ZP.get("ntfy的url地址,例如 https://ntfy.sh"),required:!0},{label:"ntfyTopic",tip:a.ZP.get("ntfy的消息应用topic"),required:!0},{label:"ntfyPriority",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")},{label:"barkArchive",tip:a.ZP.get("BARK是否保存推送消息")}],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("一对多推送的“群组编码”(一对多推送下面->您的群组(如无则创建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)")},{label:"pushplusTemplate",tip:a.ZP.get("发送模板")},{label:"pushplusChannel",tip:a.ZP.get("发送渠道")},{label:"pushplusWebhook",tip:a.ZP.get("webhook编码")},{label:"pushplusCallbackUrl",tip:a.ZP.get("发送结果回调地址")},{label:"pushplusTo",tip:a.ZP.get("好友令牌")}],wePlusBot:[{label:"wePlusBotToken",tip:a.ZP.get("用户令牌,扫描登录后 我的—>设置->令牌 中获取,参考 https://www.weplusbot.com/"),required:!0},{label:"wePlusBotReceiver",tip:a.ZP.get("消息接收人")},{label:"wePlusBotVersion",tip:a.ZP.get("调用版本;专业版填写pro,个人版填写personal,为空默认使用专业版")}],wxPusherBot:[{label:"wxPusherBotAppToken",tip:a.ZP.get("wxPusherBot的appToken"),required:!0},{label:"wxPusherBotTopicIds",tip:a.ZP.get("wxPusherBot的topicIds"),required:!1},{label:"wxPusherBotUids",tip:a.ZP.get("wxPusherBot的uids"),required:!1}],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},{label:"pushMeUrl",tip:a.ZP.get("自建的PushMeServer消息接口地址,例如:http://127.0.0.1:3010,不填则使用官方消息接口"),required:!1}],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"]}},16314:function(e,t,r){r.d(t,{W:function(){return Z}});var a=r(90228),l=r.n(a),n=r(87999),i=r.n(n),o=r(72317),s=r(61508),u=r(33839),p=r(3475),c=r(98783),d=r(69313),g=r(52676);s.ZP.config({duration:2});var h=Date.now(),P=d.Z.create({timeout:6e4,params:{t:h}}),m=["/api/user/login","/open/auth/token","/api/user/two-factor/login","/api/system","/api/user/init","/api/user/notification/init"];P.interceptors.request.use((function(e){var t=localStorage.getItem(p.Z.authKey);return t&&!m.includes(e.url)?(e.headers.Authorization="Bearer ".concat(t),e):e})),P.interceptors.response.use(function(){var e=i()(l()().mark((function e(t){var r,a,n;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.status,![502,504].includes(r)){e.next=5;break}c.history.push("/error"),e.next=18;break;case 5:if(401!==r){e.next=9;break}"/login"!==c.history.location.pathname&&(localStorage.removeItem(p.Z.authKey),c.history.push("/login")),e.next=18;break;case 9:return e.prev=9,200!==(a=t.data).code&&(n=a.message||a.data)&&u.Z.error({message:n,description:(0,g.jsx)(g.Fragment,{children:null==a?void 0:a.errors.map((function(e){return(0,g.jsx)("div",{children:e.message})}))})}),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.statusText,r=e.response.status;if([502,504].includes(r))c.history.push("/error");else if(401===r)"/login"!==c.history.location.pathname&&(s.ZP.error(o.ZP.get("登录已过期,请重新登录")),localStorage.removeItem(p.Z.authKey),c.history.push("/login"));else{var a,l,n;if("function"==typeof(null===(a=e.config)||void 0===a?void 0:a.onError))return null===(n=e.config)||void 0===n?void 0:n.onError(e.response);u.Z.error({message:t,description:(0,g.jsx)(g.Fragment,{children:null===(l=e.response)||void 0===l||null===(l=l.data)||void 0===l||null===(l=l.errors)||void 0===l?void 0:l.map((function(e){return(0,g.jsxs)("div",{children:[e.message," (",e.value,")"]})}))})})}}else console.log(e.message);return Promise.reject(e)}));var Z=P}}]);