@whyour/qinglong 2.20.0-2 → 2.20.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 (51) hide show
  1. package/back/protos/api.proto +1 -0
  2. package/package.json +1 -1
  3. package/sample/notify.js +20 -4
  4. package/static/build/api/dependence.js +1 -1
  5. package/static/build/api/script.js +4 -4
  6. package/static/build/api/subscription.js +3 -3
  7. package/static/build/config/index.js +14 -1
  8. package/static/build/loaders/express.js +34 -5
  9. package/static/build/loaders/sock.js +2 -1
  10. package/static/build/protos/api.js +28 -12
  11. package/static/build/protos/cron.js +1 -1
  12. package/static/build/protos/health.js +1 -1
  13. package/static/build/services/cron.js +6 -3
  14. package/static/build/services/dependence.js +1 -1
  15. package/static/build/services/env.js +2 -1
  16. package/static/build/validation/schedule.js +2 -2
  17. package/static/dist/{1147.856bb861.async.js → 1147.32f41a88.async.js} +1 -1
  18. package/static/dist/{2208.7bf7e296.async.js → 2208.8e3a7325.async.js} +1 -1
  19. package/static/dist/3191.70bc19db.async.js +1 -0
  20. package/static/dist/8826.0291edfd.async.js +1 -0
  21. package/static/dist/index.html +2 -2
  22. package/static/dist/{preload_helper.0fb920eb.js → preload_helper.116a62f6.js} +1 -1
  23. package/static/dist/src__pages__crontab__index.2e2e1096.async.js +1 -0
  24. package/static/dist/src__pages__crontab__modal.4d8c2a22.async.js +1 -0
  25. package/static/dist/{src__pages__dependence__modal.86604072.async.js → src__pages__dependence__modal.631ffb5b.async.js} +1 -1
  26. package/static/dist/{src__pages__env__editNameModal.79b7cf83.async.js → src__pages__env__editNameModal.ff85ef8c.async.js} +1 -1
  27. package/static/dist/{src__pages__env__modal.b84c1173.async.js → src__pages__env__modal.d1004662.async.js} +1 -1
  28. package/static/dist/src__pages__error__index.1bc3c90b.async.js +1 -0
  29. package/static/dist/{src__pages__initialization__index.2e49cf43.async.js → src__pages__initialization__index.8b1cbaf9.async.js} +1 -1
  30. package/static/dist/{src__pages__script__editNameModal.05441c89.async.js → src__pages__script__editNameModal.53424d49.async.js} +1 -1
  31. package/static/dist/{src__pages__script__index.d6e9cb23.async.js → src__pages__script__index.e65df827.async.js} +1 -1
  32. package/static/dist/{src__pages__script__renameModal.3bb00014.async.js → src__pages__script__renameModal.4bbe7fb1.async.js} +1 -1
  33. package/static/dist/{src__pages__script__saveModal.8417503a.async.js → src__pages__script__saveModal.cf449f3c.async.js} +1 -1
  34. package/static/dist/{src__pages__script__setting.5a2a2a2c.async.js → src__pages__script__setting.b345d59a.async.js} +1 -1
  35. package/static/dist/src__pages__setting__appModal.03faec89.async.js +1 -0
  36. package/static/dist/src__pages__setting__dependence.4495c7b6.async.js +1 -0
  37. package/static/dist/{src__pages__setting__index.3a220288.async.js → src__pages__setting__index.6919c399.async.js} +1 -1
  38. package/static/dist/{src__pages__setting__notification.49003b2f.async.js → src__pages__setting__notification.d6a3884f.async.js} +1 -1
  39. package/static/dist/{src__pages__setting__security.a916e056.async.js → src__pages__setting__security.91cb545f.async.js} +1 -1
  40. package/static/dist/{src__pages__setting__systemLog.cbb0a3bb.async.js → src__pages__setting__systemLog.1d433a48.async.js} +1 -1
  41. package/static/dist/src__pages__subscription__modal.0b84f6cf.async.js +1 -0
  42. package/static/dist/{umi.e7cba995.js → umi.ef8199a4.js} +1 -1
  43. package/version.yaml +5 -46
  44. package/static/dist/3191.da7f3e07.async.js +0 -1
  45. package/static/dist/8826.5f289c4d.async.js +0 -1
  46. package/static/dist/src__pages__crontab__index.6b90d8c5.async.js +0 -1
  47. package/static/dist/src__pages__crontab__modal.2d3d4953.async.js +0 -1
  48. package/static/dist/src__pages__error__index.01fac00e.async.js +0 -1
  49. package/static/dist/src__pages__setting__appModal.7f763fa7.async.js +0 -1
  50. package/static/dist/src__pages__setting__dependence.e64c4554.async.js +0 -1
  51. package/static/dist/src__pages__subscription__modal.ade477c1.async.js +0 -1
@@ -231,6 +231,7 @@ message NotificationInfo {
231
231
  optional string webhookContentType = 57;
232
232
 
233
233
  optional string larkKey = 58;
234
+ optional string larkSecret = 69;
234
235
 
235
236
  optional string ntfyUrl = 59;
236
237
  optional string ntfyTopic = 60;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
3
  "packageManager": "pnpm@8.3.1",
4
- "version": "2.20.0-2",
4
+ "version": "2.20.2-0",
5
5
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
6
6
  "repository": {
7
7
  "type": "git",
package/sample/notify.js CHANGED
@@ -482,9 +482,13 @@ function tgBotNotify(text, desp) {
482
482
  timeout,
483
483
  };
484
484
  if (TG_PROXY_HOST && TG_PROXY_PORT) {
485
+ let proxyHost = TG_PROXY_HOST;
486
+ if (TG_PROXY_AUTH && !TG_PROXY_HOST.includes('@')) {
487
+ proxyHost = `${TG_PROXY_AUTH}@${TG_PROXY_HOST}`;
488
+ }
485
489
  let agent;
486
490
  agent = new ProxyAgent({
487
- uri: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
491
+ uri: `http://${proxyHost}:${TG_PROXY_PORT}`,
488
492
  });
489
493
  options.dispatcher = agent;
490
494
  }
@@ -992,7 +996,10 @@ function fsBotNotify(text, desp) {
992
996
  return new Promise((resolve) => {
993
997
  const { FSKEY, FSSECRET } = push_config;
994
998
  if (FSKEY) {
995
- const body = { msg_type: 'text', content: { text: `${text}\n\n${desp}` } };
999
+ const body = {
1000
+ msg_type: 'text',
1001
+ content: { text: `${text}\n\n${desp}` },
1002
+ };
996
1003
 
997
1004
  // Add signature if secret is provided
998
1005
  // Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
@@ -1278,7 +1285,15 @@ function ntfyNotify(text, desp) {
1278
1285
  }
1279
1286
 
1280
1287
  return new Promise((resolve) => {
1281
- const { NTFY_URL, NTFY_TOPIC, NTFY_PRIORITY, NTFY_TOKEN, NTFY_USERNAME, NTFY_PASSWORD, NTFY_ACTIONS } = push_config;
1288
+ const {
1289
+ NTFY_URL,
1290
+ NTFY_TOPIC,
1291
+ NTFY_PRIORITY,
1292
+ NTFY_TOKEN,
1293
+ NTFY_USERNAME,
1294
+ NTFY_PASSWORD,
1295
+ NTFY_ACTIONS,
1296
+ } = push_config;
1282
1297
  if (NTFY_TOPIC) {
1283
1298
  const options = {
1284
1299
  url: `${NTFY_URL || 'https://ntfy.sh'}/${NTFY_TOPIC}`,
@@ -1293,7 +1308,8 @@ function ntfyNotify(text, desp) {
1293
1308
  if (NTFY_TOKEN) {
1294
1309
  options.headers['Authorization'] = `Bearer ${NTFY_TOKEN}`;
1295
1310
  } else if (NTFY_USERNAME && NTFY_PASSWORD) {
1296
- options.headers['Authorization'] = `Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
1311
+ options.headers['Authorization'] =
1312
+ `Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
1297
1313
  }
1298
1314
  if (NTFY_ACTIONS) {
1299
1315
  options.headers['Actions'] = encodeRFC2047(NTFY_ACTIONS);
@@ -15,7 +15,7 @@ exports.default = (app) => {
15
15
  searchValue: celebrate_1.Joi.string().optional().allow(''),
16
16
  type: celebrate_1.Joi.string().optional().allow(''),
17
17
  status: celebrate_1.Joi.string().optional().allow(''),
18
- }),
18
+ }).unknown(true),
19
19
  }), async (req, res, next) => {
20
20
  const logger = typedi_1.Container.get('logger');
21
21
  try {
@@ -51,7 +51,7 @@ exports.default = (app) => {
51
51
  route.get('/', (0, celebrate_1.celebrate)({
52
52
  query: celebrate_1.Joi.object({
53
53
  path: celebrate_1.Joi.string().optional().allow(''),
54
- }),
54
+ }).unknown(true),
55
55
  }), async (req, res, next) => {
56
56
  const logger = typedi_1.Container.get('logger');
57
57
  try {
@@ -91,7 +91,7 @@ exports.default = (app) => {
91
91
  query: celebrate_1.Joi.object({
92
92
  path: celebrate_1.Joi.string().optional().allow(''),
93
93
  file: celebrate_1.Joi.string().required(),
94
- }),
94
+ }).unknown(true),
95
95
  }), async (req, res, next) => {
96
96
  var _a;
97
97
  try {
@@ -109,7 +109,7 @@ exports.default = (app) => {
109
109
  }),
110
110
  query: celebrate_1.Joi.object({
111
111
  path: celebrate_1.Joi.string().optional().allow(''),
112
- }),
112
+ }).unknown(true),
113
113
  }), async (req, res, next) => {
114
114
  var _a;
115
115
  try {
@@ -129,7 +129,7 @@ exports.default = (app) => {
129
129
  originFilename: celebrate_1.Joi.string().optional().allow(''),
130
130
  directory: celebrate_1.Joi.string().optional().allow(''),
131
131
  file: celebrate_1.Joi.string().optional().allow(''),
132
- }),
132
+ }).unknown(true),
133
133
  }), async (req, res, next) => {
134
134
  try {
135
135
  let { filename, path, content, originFilename, directory } = req.body;
@@ -7,7 +7,7 @@ const express_1 = require("express");
7
7
  const typedi_1 = require("typedi");
8
8
  const subscription_1 = __importDefault(require("../services/subscription"));
9
9
  const celebrate_1 = require("celebrate");
10
- const cron_parser_1 = require("cron-parser");
10
+ const cron_parser_1 = __importDefault(require("cron-parser"));
11
11
  const route = (0, express_1.Router)();
12
12
  exports.default = (app) => {
13
13
  app.use('/subscriptions', route);
@@ -55,7 +55,7 @@ exports.default = (app) => {
55
55
  const logger = typedi_1.Container.get('logger');
56
56
  try {
57
57
  if (!req.body.schedule ||
58
- cron_parser_1.CronExpressionParser.parse(req.body.schedule).hasNext()) {
58
+ cron_parser_1.default.parse(req.body.schedule).hasNext()) {
59
59
  const subscriptionService = typedi_1.Container.get(subscription_1.default);
60
60
  const data = await subscriptionService.create(req.body);
61
61
  return res.send({ code: 200, data });
@@ -163,7 +163,7 @@ exports.default = (app) => {
163
163
  try {
164
164
  if (!req.body.schedule ||
165
165
  typeof req.body.schedule === 'object' ||
166
- cron_parser_1.CronExpressionParser.parse(req.body.schedule).hasNext()) {
166
+ cron_parser_1.default.parse(req.body.schedule).hasNext()) {
167
167
  const subscriptionService = typedi_1.Container.get(subscription_1.default);
168
168
  const data = await subscriptionService.update(req.body);
169
169
  return res.send({ code: 200, data });
@@ -40,6 +40,18 @@ if (!process.env.QL_DIR) {
40
40
  process.env.QL_DIR = qlHomePath.replace(/\/$/g, '');
41
41
  }
42
42
  const lastVersionFile = `https://qn.whyour.cn/version.yaml`;
43
+ // Get and normalize QlBaseUrl
44
+ let baseUrl = process.env.QlBaseUrl || '';
45
+ if (baseUrl) {
46
+ // Ensure it starts with /
47
+ if (!baseUrl.startsWith('/')) {
48
+ baseUrl = `/${baseUrl}`;
49
+ }
50
+ // Remove trailing slash for consistency in route definitions
51
+ if (baseUrl.endsWith('/')) {
52
+ baseUrl = baseUrl.slice(0, -1);
53
+ }
54
+ }
43
55
  const rootPath = process.env.QL_DIR;
44
56
  const envFound = dotenv_1.default.config({ path: path_1.default.join(rootPath, '.env') });
45
57
  let dataPath = path_1.default.join(rootPath, 'data/');
@@ -82,7 +94,8 @@ const dependenceProxyFile = path_1.default.join(configPath, 'dependence-proxy.sh
82
94
  if (envFound.error) {
83
95
  throw new Error("⚠️ Couldn't find .env file ⚠️");
84
96
  }
85
- exports.default = Object.assign(Object.assign({}, config), { jwt: config.jwt, rootPath,
97
+ exports.default = Object.assign(Object.assign({}, config), { jwt: config.jwt, baseUrl,
98
+ rootPath,
86
99
  tmpPath,
87
100
  dataPath,
88
101
  dataTgzFile,
@@ -17,8 +17,30 @@ const store_1 = require("../shared/store");
17
17
  const auth_1 = require("../shared/auth");
18
18
  const path_1 = __importDefault(require("path"));
19
19
  exports.default = ({ app }) => {
20
+ // Security: Enable strict routing to prevent case-insensitive path bypass
21
+ app.set('case sensitive routing', true);
22
+ app.set('strict routing', true);
20
23
  app.set('trust proxy', 'loopback');
21
24
  app.use((0, cors_1.default)());
25
+ // Security: Path normalization middleware to prevent case variation attacks
26
+ app.use((req, res, next) => {
27
+ const originalPath = req.path;
28
+ const normalizedPath = originalPath.toLowerCase();
29
+ // Block requests with case variations on protected paths
30
+ if (originalPath !== normalizedPath &&
31
+ (normalizedPath.startsWith('/api/') || normalizedPath.startsWith('/open/'))) {
32
+ return res.status(400).json({
33
+ code: 400,
34
+ message: 'Invalid path format'
35
+ });
36
+ }
37
+ next();
38
+ });
39
+ // Rewrite URLs to strip baseUrl prefix if configured
40
+ // This allows the rest of the app to work without baseUrl awareness
41
+ if (config_1.default.baseUrl) {
42
+ app.use((0, express_urlrewrite_1.default)(`${config_1.default.baseUrl}/*`, '/$1'));
43
+ }
22
44
  app.get(`${config_1.default.api.prefix}/env.js`, serverEnv_1.serveEnv);
23
45
  app.use(`${config_1.default.api.prefix}/static`, express_1.default.static(config_1.default.uploadPath));
24
46
  app.use(body_parser_1.default.json({ limit: '50mb' }));
@@ -29,7 +51,7 @@ exports.default = ({ app }) => {
29
51
  secret: config_1.default.jwt.secret,
30
52
  algorithms: ['HS384'],
31
53
  }).unless({
32
- path: [...config_1.default.apiWhiteList, /^\/(?!api\/).*/],
54
+ path: [...config_1.default.apiWhiteList, /^(\/(?!api\/).*)$/i],
33
55
  }));
34
56
  app.use((req, res, next) => {
35
57
  if (!req.headers) {
@@ -43,16 +65,17 @@ exports.default = ({ app }) => {
43
65
  });
44
66
  app.use(async (req, res, next) => {
45
67
  var _a;
46
- if (!['/open/', '/api/'].some((x) => req.path.startsWith(x))) {
68
+ const pathLower = req.path.toLowerCase();
69
+ if (!['/open/', '/api/'].some((x) => pathLower.startsWith(x))) {
47
70
  return next();
48
71
  }
49
72
  const headerToken = (0, util_1.getToken)(req);
50
- if (req.path.startsWith('/open/')) {
73
+ if (pathLower.startsWith('/open/')) {
51
74
  const apps = await store_1.shareStore.getApps();
52
75
  const doc = (_a = apps === null || apps === void 0 ? void 0 : apps.filter((x) => { var _a; return (_a = x.tokens) === null || _a === void 0 ? void 0 : _a.find((y) => y.value === headerToken); })) === null || _a === void 0 ? void 0 : _a[0];
53
76
  if (doc && doc.tokens && doc.tokens.length > 0) {
54
77
  const currentToken = doc.tokens.find((x) => x.value === headerToken);
55
- const keyMatch = req.path.match(/\/open\/([a-z]+)\/*/);
78
+ const keyMatch = pathLower.match(/\/open\/([a-z]+)\/*/);
56
79
  const key = keyMatch && keyMatch[1];
57
80
  if (doc.scopes.includes(key) &&
58
81
  currentToken &&
@@ -79,7 +102,13 @@ exports.default = ({ app }) => {
79
102
  next(err);
80
103
  });
81
104
  app.use(async (req, res, next) => {
82
- if (!['/api/user/init', '/api/user/notification/init'].includes(req.path)) {
105
+ const pathLower = req.path.toLowerCase();
106
+ if (![
107
+ '/api/user/init',
108
+ '/api/user/notification/init',
109
+ '/open/user/init',
110
+ '/open/user/notification/init',
111
+ ].includes(req.path)) {
83
112
  return next();
84
113
  }
85
114
  const authInfo = (await store_1.shareStore.getAuthInfo()) || {};
@@ -9,8 +9,9 @@ const sock_1 = __importDefault(require("../services/sock"));
9
9
  const util_1 = require("../config/util");
10
10
  const store_1 = require("../shared/store");
11
11
  const auth_1 = require("../shared/auth");
12
+ const config_1 = __importDefault(require("../config"));
12
13
  exports.default = async ({ server }) => {
13
- const echo = sockjs_1.default.createServer({ prefix: '/api/ws', log: () => { } });
14
+ const echo = sockjs_1.default.createServer({ prefix: `${config_1.default.baseUrl}/api/ws`, log: () => { } });
14
15
  const sockService = typedi_1.Container.get(sock_1.default);
15
16
  echo.on('connection', async (conn) => {
16
17
  if (!conn.headers || !conn.url || !conn.pathname) {
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.6.1
5
- // protoc v3.17.3
5
+ // protoc v3.21.12
6
6
  // source: back/protos/api.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.ApiClient = exports.ApiService = exports.SystemNotifyRequest = exports.NotificationInfo = exports.CronDetailResponse = exports.CronDetailRequest = exports.CronResponse = exports.CronsResponse = exports.RunCronsRequest = exports.DisableCronsRequest = exports.EnableCronsRequest = exports.GetCronByIdRequest = exports.GetCronsRequest = exports.DeleteCronsRequest = exports.UpdateCronRequest = exports.CreateCronRequest = exports.CronItem = exports.ExtraScheduleItem = exports.Response = exports.EnvResponse = exports.EnvsResponse = exports.GetEnvByIdRequest = exports.UpdateEnvNamesRequest = exports.EnableEnvsRequest = exports.DisableEnvsRequest = exports.MoveEnvRequest = exports.DeleteEnvsRequest = exports.UpdateEnvRequest = exports.CreateEnvRequest = exports.GetEnvsRequest = exports.EnvItem = exports.notificationModeToJSON = exports.notificationModeFromJSON = exports.NotificationMode = exports.protobufPackage = void 0;
@@ -2484,6 +2484,7 @@ function createBaseNotificationInfo() {
2484
2484
  webhookMethod: undefined,
2485
2485
  webhookContentType: undefined,
2486
2486
  larkKey: undefined,
2487
+ larkSecret: undefined,
2487
2488
  ntfyUrl: undefined,
2488
2489
  ntfyTopic: undefined,
2489
2490
  ntfyPriority: undefined,
@@ -2672,6 +2673,9 @@ exports.NotificationInfo = {
2672
2673
  if (message.larkKey !== undefined) {
2673
2674
  writer.uint32(466).string(message.larkKey);
2674
2675
  }
2676
+ if (message.larkSecret !== undefined) {
2677
+ writer.uint32(554).string(message.larkSecret);
2678
+ }
2675
2679
  if (message.ntfyUrl !== undefined) {
2676
2680
  writer.uint32(474).string(message.ntfyUrl);
2677
2681
  }
@@ -3117,6 +3121,13 @@ exports.NotificationInfo = {
3117
3121
  message.larkKey = reader.string();
3118
3122
  continue;
3119
3123
  }
3124
+ case 69: {
3125
+ if (tag !== 554) {
3126
+ break;
3127
+ }
3128
+ message.larkSecret = reader.string();
3129
+ continue;
3130
+ }
3120
3131
  case 59: {
3121
3132
  if (tag !== 474) {
3122
3133
  break;
@@ -3263,6 +3274,7 @@ exports.NotificationInfo = {
3263
3274
  webhookMethod: isSet(object.webhookMethod) ? globalThis.String(object.webhookMethod) : undefined,
3264
3275
  webhookContentType: isSet(object.webhookContentType) ? globalThis.String(object.webhookContentType) : undefined,
3265
3276
  larkKey: isSet(object.larkKey) ? globalThis.String(object.larkKey) : undefined,
3277
+ larkSecret: isSet(object.larkSecret) ? globalThis.String(object.larkSecret) : undefined,
3266
3278
  ntfyUrl: isSet(object.ntfyUrl) ? globalThis.String(object.ntfyUrl) : undefined,
3267
3279
  ntfyTopic: isSet(object.ntfyTopic) ? globalThis.String(object.ntfyTopic) : undefined,
3268
3280
  ntfyPriority: isSet(object.ntfyPriority) ? globalThis.String(object.ntfyPriority) : undefined,
@@ -3455,6 +3467,9 @@ exports.NotificationInfo = {
3455
3467
  if (message.larkKey !== undefined) {
3456
3468
  obj.larkKey = message.larkKey;
3457
3469
  }
3470
+ if (message.larkSecret !== undefined) {
3471
+ obj.larkSecret = message.larkSecret;
3472
+ }
3458
3473
  if (message.ntfyUrl !== undefined) {
3459
3474
  obj.ntfyUrl = message.ntfyUrl;
3460
3475
  }
@@ -3491,7 +3506,7 @@ exports.NotificationInfo = {
3491
3506
  return exports.NotificationInfo.fromPartial(base !== null && base !== void 0 ? base : {});
3492
3507
  },
3493
3508
  fromPartial(object) {
3494
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43;
3509
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
3495
3510
  const message = createBaseNotificationInfo();
3496
3511
  message.type = (_a = object.type) !== null && _a !== void 0 ? _a : 0;
3497
3512
  message.gotifyUrl = (_b = object.gotifyUrl) !== null && _b !== void 0 ? _b : undefined;
@@ -3551,16 +3566,17 @@ exports.NotificationInfo = {
3551
3566
  message.webhookMethod = (_31 = object.webhookMethod) !== null && _31 !== void 0 ? _31 : undefined;
3552
3567
  message.webhookContentType = (_32 = object.webhookContentType) !== null && _32 !== void 0 ? _32 : undefined;
3553
3568
  message.larkKey = (_33 = object.larkKey) !== null && _33 !== void 0 ? _33 : undefined;
3554
- message.ntfyUrl = (_34 = object.ntfyUrl) !== null && _34 !== void 0 ? _34 : undefined;
3555
- message.ntfyTopic = (_35 = object.ntfyTopic) !== null && _35 !== void 0 ? _35 : undefined;
3556
- message.ntfyPriority = (_36 = object.ntfyPriority) !== null && _36 !== void 0 ? _36 : undefined;
3557
- message.ntfyToken = (_37 = object.ntfyToken) !== null && _37 !== void 0 ? _37 : undefined;
3558
- message.ntfyUsername = (_38 = object.ntfyUsername) !== null && _38 !== void 0 ? _38 : undefined;
3559
- message.ntfyPassword = (_39 = object.ntfyPassword) !== null && _39 !== void 0 ? _39 : undefined;
3560
- message.ntfyActions = (_40 = object.ntfyActions) !== null && _40 !== void 0 ? _40 : undefined;
3561
- message.wxPusherBotAppToken = (_41 = object.wxPusherBotAppToken) !== null && _41 !== void 0 ? _41 : undefined;
3562
- message.wxPusherBotTopicIds = (_42 = object.wxPusherBotTopicIds) !== null && _42 !== void 0 ? _42 : undefined;
3563
- message.wxPusherBotUids = (_43 = object.wxPusherBotUids) !== null && _43 !== void 0 ? _43 : undefined;
3569
+ message.larkSecret = (_34 = object.larkSecret) !== null && _34 !== void 0 ? _34 : undefined;
3570
+ message.ntfyUrl = (_35 = object.ntfyUrl) !== null && _35 !== void 0 ? _35 : undefined;
3571
+ message.ntfyTopic = (_36 = object.ntfyTopic) !== null && _36 !== void 0 ? _36 : undefined;
3572
+ message.ntfyPriority = (_37 = object.ntfyPriority) !== null && _37 !== void 0 ? _37 : undefined;
3573
+ message.ntfyToken = (_38 = object.ntfyToken) !== null && _38 !== void 0 ? _38 : undefined;
3574
+ message.ntfyUsername = (_39 = object.ntfyUsername) !== null && _39 !== void 0 ? _39 : undefined;
3575
+ message.ntfyPassword = (_40 = object.ntfyPassword) !== null && _40 !== void 0 ? _40 : undefined;
3576
+ message.ntfyActions = (_41 = object.ntfyActions) !== null && _41 !== void 0 ? _41 : undefined;
3577
+ message.wxPusherBotAppToken = (_42 = object.wxPusherBotAppToken) !== null && _42 !== void 0 ? _42 : undefined;
3578
+ message.wxPusherBotTopicIds = (_43 = object.wxPusherBotTopicIds) !== null && _43 !== void 0 ? _43 : undefined;
3579
+ message.wxPusherBotUids = (_44 = object.wxPusherBotUids) !== null && _44 !== void 0 ? _44 : undefined;
3564
3580
  return message;
3565
3581
  },
3566
3582
  };
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.6.1
5
- // protoc v3.17.3
5
+ // protoc v3.21.12
6
6
  // source: back/protos/cron.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.CronClient = exports.CronService = exports.DeleteCronResponse = exports.DeleteCronRequest = exports.AddCronResponse = exports.AddCronRequest = exports.ICron = exports.ISchedule = exports.protobufPackage = void 0;
@@ -2,7 +2,7 @@
2
2
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
3
  // versions:
4
4
  // protoc-gen-ts_proto v2.6.1
5
- // protoc v3.17.3
5
+ // protoc v3.21.12
6
6
  // source: back/protos/health.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.HealthClient = exports.HealthService = exports.HealthCheckResponse = exports.HealthCheckRequest = exports.healthCheckResponse_ServingStatusToJSON = exports.healthCheckResponse_ServingStatusFromJSON = exports.HealthCheckResponse_ServingStatus = exports.protobufPackage = void 0;
@@ -21,7 +21,7 @@ const config_1 = __importDefault(require("../config"));
21
21
  const cron_1 = require("../data/cron");
22
22
  const child_process_1 = require("child_process");
23
23
  const promises_1 = __importDefault(require("fs/promises"));
24
- const cron_parser_1 = require("cron-parser");
24
+ const cron_parser_1 = __importDefault(require("cron-parser"));
25
25
  const util_1 = require("../config/util");
26
26
  const sequelize_1 = require("sequelize");
27
27
  const path_1 = __importDefault(require("path"));
@@ -407,7 +407,10 @@ let CronService = class CronService {
407
407
  for (const doc of docs) {
408
408
  // Kill all running instances of this task
409
409
  try {
410
- const command = this.makeCommand(doc);
410
+ if (doc.pid) {
411
+ await (0, util_1.killTask)(doc.pid);
412
+ }
413
+ const command = doc.command.replace(/\s+/g, ' ').trim();
411
414
  await (0, util_1.killAllTasks)(command);
412
415
  this.logger.info(`[panel][停止所有运行中的任务实例] 任务ID: ${doc.id}, 命令: ${command}`);
413
416
  }
@@ -588,7 +591,7 @@ let CronService = class CronService {
588
591
  const schedule = line.replace(command, '').trim();
589
592
  if (command &&
590
593
  schedule &&
591
- cron_parser_1.CronExpressionParser.parse(schedule).hasNext()) {
594
+ cron_parser_1.default.parse(schedule).hasNext()) {
592
595
  const name = namePrefix + '_' + index;
593
596
  const _crontab = await cron_1.CrontabModel.findOne({
594
597
  where: { command, schedule },
@@ -87,7 +87,7 @@ let DependenceService = class DependenceService {
87
87
  }
88
88
  async dependencies({ searchValue, type, status, }, sort = [], query = {}) {
89
89
  let condition = query;
90
- if (dependence_1.DependenceTypes[type]) {
90
+ if (type && dependence_1.DependenceTypes[type] !== undefined) {
91
91
  condition.type = dependence_1.DependenceTypes[type];
92
92
  }
93
93
  if (status) {
@@ -22,6 +22,7 @@ const winston_1 = __importDefault(require("winston"));
22
22
  const config_1 = __importDefault(require("../config"));
23
23
  const env_1 = require("../data/env");
24
24
  const utils_1 = require("../shared/utils");
25
+ const data_1 = require("../data");
25
26
  let EnvService = class EnvService {
26
27
  constructor(logger) {
27
28
  this.logger = logger;
@@ -128,7 +129,7 @@ let EnvService = class EnvService {
128
129
  }
129
130
  try {
130
131
  const result = await this.find(condition, [
131
- ['isPinned', 'DESC'],
132
+ [data_1.sequelize.literal('COALESCE(`isPinned`, 0)'), 'DESC'],
132
133
  ['position', 'DESC'],
133
134
  ['createdAt', 'ASC'],
134
135
  ]);
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.commonCronSchema = exports.scheduleSchema = void 0;
7
7
  const celebrate_1 = require("celebrate");
8
- const cron_parser_1 = require("cron-parser");
8
+ const cron_parser_1 = __importDefault(require("cron-parser"));
9
9
  const schedule_1 = require("../interface/schedule");
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const config_1 = __importDefault(require("../config"));
@@ -15,7 +15,7 @@ const validateSchedule = (value, helpers) => {
15
15
  return value;
16
16
  }
17
17
  try {
18
- if (cron_parser_1.CronExpressionParser.parse(value).hasNext()) {
18
+ if (cron_parser_1.default.parse(value).hasNext()) {
19
19
  return value;
20
20
  }
21
21
  }