@whyour/qinglong 2.23.0 → 2.25.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/README-NODE.md +10 -0
- package/back/protos/api.proto +10 -0
- package/cli/README.en.md +156 -0
- package/cli/README.md +156 -0
- package/cli/src/internal/maintenance/nodeRuntime.cjs +18 -0
- package/cli/src/internal/maintenance/panelUpgrade.cjs +577 -0
- package/cli/src/internal/maintenance/platformBundle.cjs +582 -0
- package/cli/src/internal/maintenance/upgradeArtifacts.cjs +979 -0
- package/cli/src/internal/maintenance/upgradePrestart.cjs +396 -0
- package/ecosystem.config.js +3 -0
- package/package.json +53 -10
- package/sample/notify.js +308 -135
- package/sample/notify.py +251 -56
- package/shell/api.sh +18 -7
- package/shell/install-bundle.cjs +320 -0
- package/shell/install-package.cjs +74 -0
- package/shell/lang/en.sh +38 -0
- package/shell/node-runtime-probe.cjs +62 -0
- package/shell/otask.sh +38 -36
- package/shell/preload/client.js +1 -0
- package/shell/preload/notificationAudit.js +51 -0
- package/shell/preload/sitecustomize.js +3 -3
- package/shell/preload/sitecustomize.py +5 -5
- package/shell/rmlog.sh +21 -16
- package/shell/share.sh +61 -44
- package/shell/start-simplify.sh +90 -0
- package/shell/start.sh +48 -71
- package/shell/task-timeout.sh +22 -10
- package/shell/task.sh +7 -7
- package/shell/update.sh +52 -38
- package/shell/upgrade-lock.yaml +16122 -0
- package/shell/upgrade.cjs +1 -1
- package/static/build/api/clientIp.js +2 -1
- package/static/build/api/clientIp.js.map +1 -0
- package/static/build/api/config.js.map +1 -0
- package/static/build/api/cron.js.map +1 -0
- package/static/build/api/dashboard.js.map +1 -0
- package/static/build/api/dependence.js +52 -0
- package/static/build/api/dependence.js.map +1 -0
- package/static/build/api/env.js.map +1 -0
- package/static/build/api/health.js +0 -1
- package/static/build/api/health.js.map +1 -0
- package/static/build/api/index.js.map +1 -0
- package/static/build/api/log.js.map +1 -0
- package/static/build/api/open.js +2 -2
- package/static/build/api/open.js.map +1 -0
- package/static/build/api/retention.js.map +1 -0
- package/static/build/api/script.js.map +1 -0
- package/static/build/api/subscription.js.map +1 -0
- package/static/build/api/system.js +18 -0
- package/static/build/api/system.js.map +1 -0
- package/static/build/api/update.js.map +1 -0
- package/static/build/api/user.js +0 -11
- package/static/build/api/user.js.map +1 -0
- package/static/build/app.js +10 -23
- package/static/build/app.js.map +1 -0
- package/static/build/bootstrap/database.js.map +1 -0
- package/static/build/bootstrap/upgradeProbe.js +154 -0
- package/static/build/bootstrap/upgradeProbe.js.map +1 -0
- package/static/build/config/const.js +2 -1
- package/static/build/config/const.js.map +1 -0
- package/static/build/config/container.js.map +1 -0
- package/static/build/config/grpcCerts.js.map +1 -0
- package/static/build/config/http.js.map +1 -0
- package/static/build/config/index.js +0 -2
- package/static/build/config/index.js.map +1 -0
- package/static/build/config/serverEnv.js.map +1 -0
- package/static/build/config/share.js.map +1 -0
- package/static/build/config/subscription.js.map +1 -0
- package/static/build/config/util.js +178 -79
- package/static/build/config/util.js.map +1 -0
- package/static/build/data/cron.js.map +1 -0
- package/static/build/data/cronStats.js.map +1 -0
- package/static/build/data/cronView.js.map +1 -0
- package/static/build/data/dependence.js.map +1 -0
- package/static/build/data/env.js.map +1 -0
- package/static/build/data/index.js.map +1 -0
- package/static/build/data/notify.js.map +1 -0
- package/static/build/data/open.js.map +1 -0
- package/static/build/data/runningInstance.js.map +1 -0
- package/static/build/data/sock.js.map +1 -0
- package/static/build/data/subscription.js.map +1 -0
- package/static/build/data/system.js +3 -1
- package/static/build/data/system.js.map +1 -0
- package/static/build/interface/schedule.js.map +1 -0
- package/static/build/loaders/app.js.map +1 -0
- package/static/build/loaders/bootAfter.js.map +1 -0
- package/static/build/loaders/db.js.map +1 -0
- package/static/build/loaders/depInjector.js.map +1 -0
- package/static/build/loaders/deps.js.map +1 -0
- package/static/build/loaders/express.js +67 -29
- package/static/build/loaders/express.js.map +1 -0
- package/static/build/loaders/httpApplication.js +55 -0
- package/static/build/loaders/httpApplication.js.map +1 -0
- package/static/build/loaders/initData.js +2 -1
- package/static/build/loaders/initData.js.map +1 -0
- package/static/build/loaders/initFile.js.map +1 -0
- package/static/build/loaders/initTask.js +1 -1
- package/static/build/loaders/initTask.js.map +1 -0
- package/static/build/loaders/logger.js.map +1 -0
- package/static/build/loaders/server.js.map +1 -0
- package/static/build/loaders/sock.js.map +1 -0
- package/static/build/middlewares/monitoring.js.map +1 -0
- package/static/build/middlewares/protectedPathCase.js.map +1 -0
- package/static/build/middlewares/uniqueConstraintError.js.map +1 -0
- package/static/build/middlewares/validationErrors.js +17 -0
- package/static/build/middlewares/validationErrors.js.map +1 -0
- package/static/build/protos/api.js +140 -2
- package/static/build/protos/api.js.map +1 -0
- package/static/build/protos/cron.js.map +1 -0
- package/static/build/protos/health.js.map +1 -0
- package/static/build/schedule/addCron.js +2 -2
- package/static/build/schedule/addCron.js.map +1 -0
- package/static/build/schedule/api.js +21 -2
- package/static/build/schedule/api.js.map +1 -0
- package/static/build/schedule/client.js.map +1 -0
- package/static/build/schedule/data.js.map +1 -0
- package/static/build/schedule/delCron.js +5 -3
- package/static/build/schedule/delCron.js.map +1 -0
- package/static/build/schedule/health.js.map +1 -0
- package/static/build/schedule/setConcurrency.js.map +1 -0
- package/static/build/services/config.js.map +1 -0
- package/static/build/services/cron.js +7 -7
- package/static/build/services/cron.js.map +1 -0
- package/static/build/services/cronView.js.map +1 -0
- package/static/build/services/dependence.js +101 -22
- package/static/build/services/dependence.js.map +1 -0
- package/static/build/services/env.js +13 -3
- package/static/build/services/env.js.map +1 -0
- package/static/build/services/grpc.js +2 -2
- package/static/build/services/grpc.js.map +1 -0
- package/static/build/services/health.js +2 -0
- package/static/build/services/health.js.map +1 -0
- package/static/build/services/http.js.map +1 -0
- package/static/build/services/log.js +1 -1
- package/static/build/services/log.js.map +1 -0
- package/static/build/services/metrics.js +2 -1
- package/static/build/services/metrics.js.map +1 -0
- package/static/build/services/notify.js +45 -24
- package/static/build/services/notify.js.map +1 -0
- package/static/build/services/open.js +10 -0
- package/static/build/services/open.js.map +1 -0
- package/static/build/services/retention.js.map +1 -0
- package/static/build/services/schedule.js +13 -12
- package/static/build/services/schedule.js.map +1 -0
- package/static/build/services/script.js.map +1 -0
- package/static/build/services/scriptHistory.js.map +1 -0
- package/static/build/services/sock.js.map +1 -0
- package/static/build/services/sshKey.js +8 -5
- package/static/build/services/sshKey.js.map +1 -0
- package/static/build/services/subscription.js.map +1 -0
- package/static/build/services/system.js +76 -46
- package/static/build/services/system.js.map +1 -0
- package/static/build/services/user.js +2 -2
- package/static/build/services/user.js.map +1 -0
- package/static/build/shared/auth.js.map +1 -0
- package/static/build/shared/authMutation.js.map +1 -0
- package/static/build/shared/childProcess.js.map +1 -0
- package/static/build/shared/clientIp.js.map +1 -0
- package/static/build/shared/cronCommand.js.map +1 -0
- package/static/build/shared/cronSchedule.js +65 -9
- package/static/build/shared/cronSchedule.js.map +1 -0
- package/static/build/shared/cronScheduler.js +3 -2
- package/static/build/shared/cronScheduler.js.map +1 -0
- package/static/build/shared/errors.js.map +1 -0
- package/static/build/shared/fileAccess.js +4 -1
- package/static/build/shared/fileAccess.js.map +1 -0
- package/static/build/shared/i18n.js +165 -85
- package/static/build/shared/i18n.js.map +1 -0
- package/static/build/shared/interface.js.map +1 -0
- package/static/build/shared/languageSync.js +61 -0
- package/static/build/shared/languageSync.js.map +1 -0
- package/static/build/shared/linuxMirror.js +96 -0
- package/static/build/shared/linuxMirror.js.map +1 -0
- package/static/build/shared/logPath.js.map +1 -0
- package/static/build/shared/logReader.js.map +1 -0
- package/static/build/shared/logStreamManager.js.map +1 -0
- package/static/build/shared/loginThrottle.js.map +1 -0
- package/static/build/shared/notificationAudit.js +46 -0
- package/static/build/shared/notificationAudit.js.map +1 -0
- package/static/build/shared/pLimit.js +8 -8
- package/static/build/shared/pLimit.js.map +1 -0
- package/static/build/shared/password.js.map +1 -0
- package/static/build/shared/retention.js.map +1 -0
- package/static/build/shared/runCron.js +69 -26
- package/static/build/shared/runCron.js.map +1 -0
- package/static/build/shared/runtimeBuild.js +44 -0
- package/static/build/shared/runtimeBuild.js.map +1 -0
- package/static/build/shared/schedulerMutationLock.js.map +1 -0
- package/static/build/shared/schedulerReadiness.js.map +1 -0
- package/static/build/shared/schemaMigrations.js +7 -0
- package/static/build/shared/schemaMigrations.js.map +1 -0
- package/static/build/shared/scriptHistory.js.map +1 -0
- package/static/build/shared/shellQuote.js.map +1 -0
- package/static/build/shared/startupProcess.js.map +1 -0
- package/static/build/shared/store.js.map +1 -0
- package/static/build/shared/subscriptionMutationLock.js.map +1 -0
- package/static/build/shared/subscriptionPath.js.map +1 -0
- package/static/build/shared/subscriptionStorage.js.map +1 -0
- package/static/build/shared/taskEnvName.js +79 -0
- package/static/build/shared/taskEnvName.js.map +1 -0
- package/static/build/shared/trustProxy.js +5 -4
- package/static/build/shared/trustProxy.js.map +1 -0
- package/static/build/shared/utils.js.map +1 -0
- package/static/build/token.js.map +1 -0
- package/static/build/validation/schedule.js +19 -1
- package/static/build/validation/schedule.js.map +1 -0
- package/static/build-info.json +757 -0
- package/static/dist/1089.0ecc5383.async.js.gz +0 -0
- package/static/dist/1174.41a43fee.async.js.gz +0 -0
- package/static/dist/119.89e2d610.async.js.gz +0 -0
- package/static/dist/1212.f87fd07a.async.js.gz +0 -0
- package/static/dist/1352.96a77e1d.async.js.gz +0 -0
- package/static/dist/1379.f91563a1.async.js.gz +0 -0
- package/static/dist/1571.94ddca13.async.js.gz +0 -0
- package/static/dist/1706.ac98cb3f.async.js.gz +0 -0
- package/static/dist/1765.5ac01a93.async.js.gz +0 -0
- package/static/dist/1836.f0b74cf1.async.js.gz +0 -0
- package/static/dist/1883.675b6a18.chunk.css.gz +0 -0
- package/static/dist/1885.b8f427bf.async.js.gz +0 -0
- package/static/dist/1887.9e0d3da8.async.js.gz +0 -0
- package/static/dist/198.db47fc1a.async.js.gz +0 -0
- package/static/dist/2325.dfa32834.async.js.gz +0 -0
- package/static/dist/2338.d678967d.async.js.gz +0 -0
- package/static/dist/2372.b5a50ee7.async.js +1 -0
- package/static/dist/2372.b5a50ee7.async.js.gz +0 -0
- package/static/dist/2476.4e9b0992.async.js.gz +0 -0
- package/static/dist/2537.2b262ee0.async.js.gz +0 -0
- package/static/dist/2577.aa8fe709.async.js.gz +0 -0
- package/static/dist/2635.d4c59d23.async.js.gz +0 -0
- package/static/dist/2664.e69530fb.async.js +1 -0
- package/static/dist/2664.e69530fb.async.js.gz +0 -0
- package/static/dist/2693.51c2636b.async.js.gz +0 -0
- package/static/dist/2808.cdc0995c.async.js.gz +0 -0
- package/static/dist/2821.651f31e5.async.js.gz +0 -0
- package/static/dist/2890.add55e85.async.js.gz +0 -0
- package/static/dist/2901.6d0de54e.async.js +1 -0
- package/static/dist/2901.6d0de54e.async.js.gz +0 -0
- package/static/dist/292.1b962b29.chunk.css.gz +0 -0
- package/static/dist/292.27ce781f.async.js +1 -0
- package/static/dist/292.27ce781f.async.js.gz +0 -0
- package/static/dist/300.08ac9875.async.js.gz +0 -0
- package/static/dist/3191.3b7e4b42.async.js +1 -0
- package/static/dist/3191.3b7e4b42.async.js.gz +0 -0
- package/static/dist/3382.a584a111.async.js.gz +0 -0
- package/static/dist/3383.041eee73.async.js.gz +0 -0
- package/static/dist/3512.95e41255.async.js.gz +0 -0
- package/static/dist/3714.8d6dba9e.async.js.gz +0 -0
- package/static/dist/3906.a5eee612.async.js.gz +0 -0
- package/static/dist/3948.4fe809fd.async.js.gz +0 -0
- package/static/dist/4324.5a5887d1.async.js.gz +0 -0
- package/static/dist/4559.faab3673.async.js.gz +0 -0
- package/static/dist/4573.16f19278.async.js.gz +0 -0
- package/static/dist/{4736.1d2b5cb6.async.js → 4736.7c4c489b.async.js} +1 -1
- package/static/dist/4736.7c4c489b.async.js.gz +0 -0
- package/static/dist/4887.8e3ae573.async.js.gz +0 -0
- package/static/dist/4934.f3539d08.async.js.gz +0 -0
- package/static/dist/5077.cbd111cd.async.js.gz +0 -0
- package/static/dist/{5481.624d0e07.async.js → 5481.e2945a63.async.js} +1 -1
- package/static/dist/5481.e2945a63.async.js.gz +0 -0
- package/static/dist/5662.678b0cfb.async.js.gz +0 -0
- package/static/dist/5970.5862e59e.async.js +1 -0
- package/static/dist/5970.5862e59e.async.js.gz +0 -0
- package/static/dist/6013.db535339.async.js.gz +0 -0
- package/static/dist/6035.32ebfad9.async.js.gz +0 -0
- package/static/dist/6212.e056fb2d.async.js +1 -0
- package/static/dist/6212.e056fb2d.async.js.gz +0 -0
- package/static/dist/6341.673fb65c.async.js.gz +0 -0
- package/static/dist/6367.8b0e838c.async.js.gz +0 -0
- package/static/dist/6431.c50479be.async.js +1 -0
- package/static/dist/6569.55177f6a.async.js.gz +0 -0
- package/static/dist/6610.c111af7e.async.js.gz +0 -0
- package/static/dist/{1967.3f3945d0.async.js → 6636.fed84003.async.js} +1 -1
- package/static/dist/6636.fed84003.async.js.gz +0 -0
- package/static/dist/6638.87a163d2.async.js.gz +0 -0
- package/static/dist/6646.95e92533.async.js.gz +0 -0
- package/static/dist/{6872.a503ef55.async.js → 6872.fcc9ce17.async.js} +1 -1
- package/static/dist/6872.fcc9ce17.async.js.gz +0 -0
- package/static/dist/691.187a388c.async.js.gz +0 -0
- package/static/dist/7146.4dc150b1.async.js +1 -0
- package/static/dist/7146.4dc150b1.async.js.gz +0 -0
- package/static/dist/7231.f7e5b668.async.js.gz +0 -0
- package/static/dist/7253.4b9bf133.async.js.gz +0 -0
- package/static/dist/7278.96bf439f.async.js.gz +0 -0
- package/static/dist/7355.fca746f5.async.js.gz +0 -0
- package/static/dist/7384.1bb449d5.async.js.gz +0 -0
- package/static/dist/7508.3fffed15.chunk.css.gz +0 -0
- package/static/dist/7508.d90eac63.async.js.gz +0 -0
- package/static/dist/7802.34255805.async.js.gz +0 -0
- package/static/dist/7984.eaac7402.async.js.gz +0 -0
- package/static/dist/8033.5cb31493.async.js.gz +0 -0
- package/static/dist/8078.8586c875.async.js.gz +0 -0
- package/static/dist/8147.2fb55202.async.js.gz +0 -0
- package/static/dist/8187.48c130d6.async.js.gz +0 -0
- package/static/dist/8495.d53e15ca.async.js.gz +0 -0
- package/static/dist/8844.a0fef08e.async.js.gz +0 -0
- package/static/dist/9308.3202ac13.async.js.gz +0 -0
- package/static/dist/9323.a33f47da.async.js.gz +0 -0
- package/static/dist/965.8d9b1fbd.async.js +1 -0
- package/static/dist/965.8d9b1fbd.async.js.gz +0 -0
- package/static/dist/9761.360a19d8.async.js.gz +0 -0
- package/static/dist/index.html +2 -2
- package/static/dist/layouts__index.86b6bcbe.chunk.css +1 -0
- package/static/dist/layouts__index.86b6bcbe.chunk.css.gz +0 -0
- package/static/dist/layouts__index.c8e9788e.async.js +1 -0
- package/static/dist/layouts__index.c8e9788e.async.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/base/worker/workerMain.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/abap/abap.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/clojure/clojure.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/elixir/elixir.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/freemarker2/freemarker2.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/mysql/mysql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/pgsql/pgsql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/powerquery/powerquery.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/redshift/redshift.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/solidity/solidity.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/basic-languages/sql/sql.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.css.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.de.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.es.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.fr.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.it.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ja.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ko.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.ru.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.zh-cn.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/editor/editor.main.nls.zh-tw.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/css/cssMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/css/cssWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/html/htmlMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/html/htmlWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/json/jsonMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/json/jsonWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/typescript/tsMode.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/language/typescript/tsWorker.js.gz +0 -0
- package/static/dist/monaco-editor/min/vs/loader.js.gz +0 -0
- package/static/dist/preload_helper.a71416e6.js +1 -0
- package/static/dist/src__pages__404.3fd8332e.async.js +1 -0
- package/static/dist/src__pages__config__index.088ddd9d.async.js +1 -0
- package/static/dist/src__pages__config__index.088ddd9d.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__detail.88729e8f.async.js +1 -0
- package/static/dist/src__pages__crontab__detail.88729e8f.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__index.b0ae0f99.async.js +1 -0
- package/static/dist/src__pages__crontab__index.b0ae0f99.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__logModal.930535e2.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__modal.a2c8fdcc.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__viewCreateModal.7b4f9cbe.async.js.gz +0 -0
- package/static/dist/src__pages__crontab__viewManageModal.cd454ea0.async.js.gz +0 -0
- package/static/dist/src__pages__dashboard__index.c05ce904.async.js +1 -0
- package/static/dist/src__pages__dashboard__index.c05ce904.async.js.gz +0 -0
- package/static/dist/src__pages__dependence__index.edad6a53.async.js +1 -0
- package/static/dist/src__pages__dependence__index.edad6a53.async.js.gz +0 -0
- package/static/dist/{src__pages__dependence__logModal.154efe7a.async.js → src__pages__dependence__logModal.01729f63.async.js} +1 -1
- package/static/dist/src__pages__dependence__logModal.01729f63.async.js.gz +0 -0
- package/static/dist/src__pages__dependence__modal.ef7ae53b.async.js +1 -0
- package/static/dist/src__pages__dependence__modal.ef7ae53b.async.js.gz +0 -0
- package/static/dist/src__pages__diff__index.4233ea93.async.js +1 -0
- package/static/dist/src__pages__diff__index.4233ea93.async.js.gz +0 -0
- package/static/dist/src__pages__env__index.c236a754.async.js +1 -0
- package/static/dist/src__pages__env__index.c236a754.async.js.gz +0 -0
- package/static/dist/src__pages__env__modal.4d71adb3.async.js.gz +0 -0
- package/static/dist/src__pages__error__index.66605c72.async.js +1 -0
- package/static/dist/src__pages__initialization__index.d4d89bf9.async.js +1 -0
- package/static/dist/src__pages__initialization__index.d4d89bf9.async.js.gz +0 -0
- package/static/dist/src__pages__log__index.71250e0d.async.js.gz +0 -0
- package/static/dist/src__pages__login__index.58bb4b38.async.js +1 -0
- package/static/dist/src__pages__login__index.58bb4b38.async.js.gz +0 -0
- package/static/dist/src__pages__script__components__UnsupportedFilePreview__index.c347a13a.async.js.gz +0 -0
- package/static/dist/src__pages__script__editModal.785f8431.async.js +1 -0
- package/static/dist/src__pages__script__editModal.785f8431.async.js.gz +0 -0
- package/static/dist/src__pages__script__editNameModal.789ad87b.async.js.gz +0 -0
- package/static/dist/src__pages__script__historyDrawer.8c58d958.async.js.gz +0 -0
- package/static/dist/src__pages__script__index.3e142045.async.js +1 -0
- package/static/dist/src__pages__script__index.3e142045.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__about.e6db5090.chunk.css → src__pages__setting__about.0d6ea255.chunk.css} +1 -1
- package/static/dist/src__pages__setting__about.3d3c019f.async.js.gz +0 -0
- package/static/dist/src__pages__setting__checkUpdate.429a42f3.async.js +1 -0
- package/static/dist/src__pages__setting__checkUpdate.429a42f3.async.js.gz +0 -0
- package/static/dist/src__pages__setting__clientIp.3a8711ed.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__dependence.28ecea01.chunk.css → src__pages__setting__dependence.80b183a5.chunk.css} +1 -1
- package/static/dist/src__pages__setting__dependence.c227c0f5.async.js +1 -0
- package/static/dist/src__pages__setting__dependence.c227c0f5.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__index.7cf46d4a.chunk.css → src__pages__setting__index.46315660.chunk.css} +1 -1
- package/static/dist/src__pages__setting__index.c5615182.async.js +1 -0
- package/static/dist/src__pages__setting__index.c5615182.async.js.gz +0 -0
- package/static/dist/src__pages__setting__loginLog.ef135f19.async.js +1 -0
- package/static/dist/src__pages__setting__loginLog.ef135f19.async.js.gz +0 -0
- package/static/dist/src__pages__setting__notifyLog.5ef5b578.async.js +1 -0
- package/static/dist/src__pages__setting__notifyLog.5ef5b578.async.js.gz +0 -0
- package/static/dist/{src__pages__setting__other.28ecea01.chunk.css → src__pages__setting__notifyLog.80b183a5.chunk.css} +1 -1
- package/static/dist/src__pages__setting__other.80b183a5.chunk.css +1 -0
- package/static/dist/src__pages__setting__other.e744c0d1.async.js +1 -0
- package/static/dist/src__pages__setting__other.e744c0d1.async.js.gz +0 -0
- package/static/dist/src__pages__setting__security.e2d71ebb.async.js.gz +0 -0
- package/static/dist/src__pages__setting__systemLog.000bcb5e.async.js +1 -0
- package/static/dist/src__pages__setting__systemLog.000bcb5e.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__index.f556ae4c.async.js +1 -0
- package/static/dist/src__pages__subscription__index.f556ae4c.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__logModal.cdba5139.async.js.gz +0 -0
- package/static/dist/src__pages__subscription__modal.8f04f506.async.js +1 -0
- package/static/dist/umi.a4d14b92.css.gz +0 -0
- package/static/dist/umi.cf08844a.js +1 -0
- package/static/dist/umi.cf08844a.js.gz +0 -0
- package/version.yaml +9 -14
- package/.dockerignore +0 -13
- package/AGENTS.md +0 -43
- package/SECURITY.md +0 -5
- package/back/protos/cron.proto +0 -33
- package/back/protos/health.proto +0 -22
- package/deploy/kubernetes/README.md +0 -81
- package/deploy/kubernetes/base/kustomization.yaml +0 -5
- package/deploy/kubernetes/base/qinglong.yaml +0 -95
- package/deploy/kubernetes/overlays/example/kustomization.yaml +0 -10
- package/docker/Dockerfile +0 -113
- package/docker/Dockerfile.310 +0 -113
- package/docker/Dockerfile.debian +0 -128
- package/docker/Dockerfile.debian310 +0 -130
- package/docker/build-manifest.cjs +0 -28
- package/docker/docker-compose.yml +0 -10
- package/docker/docker-entrypoint.sh +0 -147
- package/docker/verify-build.cjs +0 -49
- package/docs/PROJECT_ARCHITECTURE.md +0 -550
- package/docs/development/node-cron-migration.md +0 -49
- package/docs/development/task-startup.md +0 -78
- package/docs/releases/2.22.0-validation.md +0 -49
- package/docs/releases/2.22.0.md +0 -62
- package/docs/releases/2.23.0.md +0 -33
- package/docs/script-history.md +0 -53
- package/sample/tool.ts +0 -40
- package/scripts/benchmark-execution.cjs +0 -96
- package/scripts/benchmark-script-history.cjs +0 -39
- package/scripts/publish-static.sh +0 -34
- package/scripts/sync-static.sh +0 -20
- package/scripts/wait-for-mirror.sh +0 -214
- package/scripts/write-build-info.cjs +0 -27
- package/shell/pub.sh +0 -28
- package/static/dist/255.8a80b983.async.js +0 -1
- package/static/dist/2901.2ca95295.async.js +0 -1
- package/static/dist/292.264757f0.async.js +0 -1
- package/static/dist/3600.7637c822.async.js +0 -1
- package/static/dist/445.a65ff63b.async.js +0 -1
- package/static/dist/5970.d3a6e7bd.async.js +0 -1
- package/static/dist/6212.9e6d9913.async.js +0 -1
- package/static/dist/6431.4603ad0e.async.js +0 -1
- package/static/dist/9066.605168f8.async.js +0 -1
- package/static/dist/9313.37acaf13.async.js +0 -1
- package/static/dist/layouts__index.633d3553.async.js +0 -1
- package/static/dist/layouts__index.adf0692f.chunk.css +0 -1
- package/static/dist/preload_helper.01fcd534.js +0 -1
- package/static/dist/src__pages__404.771168fc.async.js +0 -1
- package/static/dist/src__pages__config__index.9aba4054.async.js +0 -1
- package/static/dist/src__pages__crontab__detail.86b2eebb.async.js +0 -1
- package/static/dist/src__pages__crontab__index.ae4e06f2.async.js +0 -1
- package/static/dist/src__pages__dashboard__index.243c5a35.async.js +0 -1
- package/static/dist/src__pages__dependence__index.874d501f.async.js +0 -1
- package/static/dist/src__pages__dependence__modal.0fa8b421.async.js +0 -1
- package/static/dist/src__pages__diff__index.b94e5dc5.async.js +0 -1
- package/static/dist/src__pages__env__index.fd6fd2b0.async.js +0 -1
- package/static/dist/src__pages__error__index.aae50c94.async.js +0 -1
- package/static/dist/src__pages__initialization__index.82a2e967.async.js +0 -1
- package/static/dist/src__pages__login__index.a0fd5ed8.async.js +0 -1
- package/static/dist/src__pages__script__editModal.afabf073.async.js +0 -1
- package/static/dist/src__pages__script__index.fc575945.async.js +0 -1
- package/static/dist/src__pages__setting__checkUpdate.d175b154.async.js +0 -1
- package/static/dist/src__pages__setting__dependence.9c0f749b.async.js +0 -1
- package/static/dist/src__pages__setting__index.cb397741.async.js +0 -1
- package/static/dist/src__pages__setting__loginLog.e0a1f54d.async.js +0 -1
- package/static/dist/src__pages__setting__other.3d0b8492.async.js +0 -1
- package/static/dist/src__pages__setting__systemLog.b3046955.async.js +0 -1
- package/static/dist/src__pages__subscription__index.43086a06.async.js +0 -1
- package/static/dist/src__pages__subscription__modal.30868ba8.async.js +0 -1
- package/static/dist/umi.3a24a9fa.js +0 -1
- package/test/back/advisory-input-security.test.cjs +0 -416
- package/test/back/auth-security.test.cjs +0 -74
- package/test/back/build-provenance.test.cjs +0 -150
- package/test/back/code-scanning-security.test.cjs +0 -189
- package/test/back/cron-log-name.test.cjs +0 -110
- package/test/back/cron-macros.test.cjs +0 -51
- package/test/back/cron-schedule-compatibility.test.cjs +0 -69
- package/test/back/cron-scheduler-routing.test.cjs +0 -59
- package/test/back/cron-validation.test.cjs +0 -45
- package/test/back/dashboard-failures.test.cjs +0 -173
- package/test/back/database-bootstrap.test.cjs +0 -193
- package/test/back/dependence-cache-status.test.cjs +0 -125
- package/test/back/deprecated-file-routes.test.cjs +0 -82
- package/test/back/draft-path-security.test.cjs +0 -235
- package/test/back/ecosystem.test.cjs +0 -28
- package/test/back/env-import-security.test.cjs +0 -91
- package/test/back/env-name-parsing.test.cjs +0 -96
- package/test/back/execution-lifecycle.test.cjs +0 -236
- package/test/back/file-access-scope.test.cjs +0 -180
- package/test/back/file-access-security.test.cjs +0 -47
- package/test/back/fileTreeListing.test.cjs +0 -57
- package/test/back/grpc-cron-response.test.cjs +0 -60
- package/test/back/grpc-mtls-security.test.cjs +0 -136
- package/test/back/http-exclusive-listen.test.cjs +0 -31
- package/test/back/http-security.test.cjs +0 -313
- package/test/back/legacy-cron-recovery.test.cjs +0 -76
- package/test/back/linux-mirror-result.test.cjs +0 -176
- package/test/back/listen-security.test.cjs +0 -68
- package/test/back/log-path-security.test.cjs +0 -158
- package/test/back/logReader.test.cjs +0 -72
- package/test/back/manual-execution.test.cjs +0 -85
- package/test/back/manual-stop-claim.test.cjs +0 -220
- package/test/back/metrics.test.cjs +0 -34
- package/test/back/mirror-status.test.cjs +0 -257
- package/test/back/monitoring.test.cjs +0 -73
- package/test/back/node-cron-migration.test.cjs +0 -65
- package/test/back/node-path-cache.test.cjs +0 -202
- package/test/back/node-path-lock.test.cjs +0 -182
- package/test/back/npm-publication.test.cjs +0 -70
- package/test/back/preload-lazy-notify.test.cjs +0 -168
- package/test/back/primary-apm.test.cjs +0 -24
- package/test/back/process-exit-state.test.cjs +0 -81
- package/test/back/process-stop-signal.test.cjs +0 -77
- package/test/back/protected-path-case.test.cjs +0 -58
- package/test/back/qlServiceLogCommand.test.cjs +0 -128
- package/test/back/queued-cron-invalidation.test.cjs +0 -98
- package/test/back/restart-instance-recovery.test.cjs +0 -116
- package/test/back/retention.test.cjs +0 -131
- package/test/back/role-loading.test.cjs +0 -118
- package/test/back/schedule-health.test.cjs +0 -86
- package/test/back/scheduler-bulk-recovery.test.cjs +0 -40
- package/test/back/scheduler-concurrency.test.cjs +0 -411
- package/test/back/scheduler-file-lock.test.cjs +0 -51
- package/test/back/scheduler-mutation.test.cjs +0 -312
- package/test/back/scheduler-readiness.test.cjs +0 -85
- package/test/back/scheduler-reconciliation.test.cjs +0 -206
- package/test/back/scheduler-rpc-timeout.test.cjs +0 -49
- package/test/back/schema-migrations.test.cjs +0 -127
- package/test/back/script-file-access.test.cjs +0 -210
- package/test/back/script-history-api.test.cjs +0 -551
- package/test/back/script-history.test.cjs +0 -383
- package/test/back/shell-api-parsing.test.cjs +0 -184
- package/test/back/shell-translation-output.test.cjs +0 -16
- package/test/back/shell-upgrade.test.cjs +0 -312
- package/test/back/shellApiToken.test.cjs +0 -151
- package/test/back/sock-polling.test.cjs +0 -297
- package/test/back/sock-security.test.cjs +0 -72
- package/test/back/ssh-config-home.test.cjs +0 -113
- package/test/back/start-env-preservation.test.cjs +0 -53
- package/test/back/static-mirror-trigger.test.cjs +0 -441
- package/test/back/static-mirror.test.cjs +0 -179
- package/test/back/stop-failure-feedback.test.cjs +0 -158
- package/test/back/stop-race.test.cjs +0 -171
- package/test/back/subscription-cleanup.test.cjs +0 -53
- package/test/back/subscription-mutation-lock.test.cjs +0 -83
- package/test/back/subscription-review-regression.test.cjs +0 -607
- package/test/back/subscription-stop-state.test.cjs +0 -66
- package/test/back/subscription-storage-regression.test.cjs +0 -553
- package/test/back/system-dependence-cache.test.cjs +0 -127
- package/test/back/system-export-history.test.cjs +0 -119
- package/test/back/systemTokenRenewal.test.cjs +0 -497
- package/test/back/task-shell-lifecycle.test.cjs +0 -194
- package/test/back/task-time.test.cjs +0 -116
- package/test/back/unique-constraint-error.test.cjs +0 -72
- package/test/back/upgrade-guards.test.cjs +0 -285
- package/test/back/upgrade-lifecycle.test.cjs +0 -288
- package/test/back/upgrade-transaction.test.cjs +0 -133
- package/test/back/user-api.test.cjs +0 -99
- package/test/back/user-security.test.cjs +0 -349
- package/test/back/worker-apm.test.cjs +0 -84
- package/test/back/wpush-grpc.test.cjs +0 -116
- package/test/fixtures/legacy-cron.json +0 -1371
- package/test/front/cron-log-pagination.test.cjs +0 -214
- package/test/front/diff-file-routing.test.cjs +0 -126
- package/test/front/http-auth.test.cjs +0 -152
- package/test/front/http-error.test.cjs +0 -29
- package/test/front/script-history-save.test.cjs +0 -121
- package/test/helpers/load-security-module.cjs +0 -42
- package/test/helpers/upgrade-fixture.cjs +0 -30
package/sample/notify.py
CHANGED
|
@@ -10,12 +10,19 @@ import threading
|
|
|
10
10
|
import time
|
|
11
11
|
import urllib.parse
|
|
12
12
|
import smtplib
|
|
13
|
+
import subprocess
|
|
14
|
+
from typing import Optional
|
|
13
15
|
from email.mime.text import MIMEText
|
|
14
16
|
from email.header import Header
|
|
15
17
|
from email.utils import formataddr
|
|
16
18
|
|
|
17
19
|
import requests
|
|
18
20
|
|
|
21
|
+
# 单次 HTTP 请求的默认超时(秒),避免推送服务无响应时永久阻塞
|
|
22
|
+
REQUEST_TIMEOUT = 10
|
|
23
|
+
# 等待推送线程结束的最长时间(秒),超时后跳过并继续退出
|
|
24
|
+
NOTIFY_JOIN_TIMEOUT = 30
|
|
25
|
+
|
|
19
26
|
# 原先的 print 函数和主线程的锁
|
|
20
27
|
_print = print
|
|
21
28
|
mutex = threading.Lock()
|
|
@@ -161,10 +168,11 @@ for k in push_config:
|
|
|
161
168
|
push_config[k] = v
|
|
162
169
|
|
|
163
170
|
|
|
164
|
-
def bark(title: str, content: str) ->
|
|
171
|
+
def bark(title: str, content: str) -> Optional[bool]:
|
|
165
172
|
"""
|
|
166
173
|
使用 bark 推送消息。
|
|
167
174
|
"""
|
|
175
|
+
audit_results = []
|
|
168
176
|
if not push_config.get("BARK_PUSH"):
|
|
169
177
|
return
|
|
170
178
|
print("bark 服务启动")
|
|
@@ -196,26 +204,32 @@ def bark(title: str, content: str) -> None:
|
|
|
196
204
|
data[bark_params.get(pair[0])] = pair[1]
|
|
197
205
|
headers = {"Content-Type": "application/json;charset=utf-8"}
|
|
198
206
|
response = requests.post(
|
|
199
|
-
url=url, data=json.dumps(data), headers=headers, timeout=
|
|
207
|
+
url=url, data=json.dumps(data), headers=headers, timeout=REQUEST_TIMEOUT
|
|
200
208
|
).json()
|
|
201
209
|
|
|
202
210
|
if response["code"] == 200:
|
|
211
|
+
audit_results.append(True)
|
|
203
212
|
print("bark 推送成功!")
|
|
204
213
|
else:
|
|
214
|
+
audit_results.append(False)
|
|
205
215
|
print("bark 推送失败!")
|
|
216
|
+
return all(audit_results) if audit_results else None
|
|
206
217
|
|
|
207
218
|
|
|
208
|
-
def console(title: str, content: str) ->
|
|
219
|
+
def console(title: str, content: str) -> Optional[bool]:
|
|
209
220
|
"""
|
|
210
221
|
使用 控制台 推送消息。
|
|
211
222
|
"""
|
|
223
|
+
audit_results = []
|
|
212
224
|
print(f"{title}\n\n{content}")
|
|
225
|
+
return True
|
|
213
226
|
|
|
214
227
|
|
|
215
|
-
def dingding_bot(title: str, content: str) ->
|
|
228
|
+
def dingding_bot(title: str, content: str) -> Optional[bool]:
|
|
216
229
|
"""
|
|
217
230
|
使用 钉钉机器人 推送消息。
|
|
218
231
|
"""
|
|
232
|
+
audit_results = []
|
|
219
233
|
if not push_config.get("DD_BOT_SECRET") or not push_config.get("DD_BOT_TOKEN"):
|
|
220
234
|
return
|
|
221
235
|
print("钉钉机器人 服务启动")
|
|
@@ -232,19 +246,23 @@ def dingding_bot(title: str, content: str) -> None:
|
|
|
232
246
|
headers = {"Content-Type": "application/json;charset=utf-8"}
|
|
233
247
|
data = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}}
|
|
234
248
|
response = requests.post(
|
|
235
|
-
url=url, data=json.dumps(data), headers=headers, timeout=
|
|
249
|
+
url=url, data=json.dumps(data), headers=headers, timeout=REQUEST_TIMEOUT
|
|
236
250
|
).json()
|
|
237
251
|
|
|
238
252
|
if not response["errcode"]:
|
|
253
|
+
audit_results.append(True)
|
|
239
254
|
print("钉钉机器人 推送成功!")
|
|
240
255
|
else:
|
|
256
|
+
audit_results.append(False)
|
|
241
257
|
print("钉钉机器人 推送失败!")
|
|
258
|
+
return all(audit_results) if audit_results else None
|
|
242
259
|
|
|
243
260
|
|
|
244
|
-
def feishu_bot(title: str, content: str) ->
|
|
261
|
+
def feishu_bot(title: str, content: str) -> Optional[bool]:
|
|
245
262
|
"""
|
|
246
263
|
使用 飞书机器人 推送消息。
|
|
247
264
|
"""
|
|
265
|
+
audit_results = []
|
|
248
266
|
if not push_config.get("FSKEY"):
|
|
249
267
|
return
|
|
250
268
|
print("飞书 服务启动")
|
|
@@ -265,35 +283,45 @@ def feishu_bot(title: str, content: str) -> None:
|
|
|
265
283
|
data["timestamp"] = timestamp
|
|
266
284
|
data["sign"] = sign
|
|
267
285
|
|
|
268
|
-
response = requests.post(
|
|
286
|
+
response = requests.post(
|
|
287
|
+
url, data=json.dumps(data), timeout=REQUEST_TIMEOUT
|
|
288
|
+
).json()
|
|
269
289
|
|
|
270
290
|
if response.get("StatusCode") == 0 or response.get("code") == 0:
|
|
291
|
+
audit_results.append(True)
|
|
271
292
|
print("飞书 推送成功!")
|
|
272
293
|
else:
|
|
294
|
+
audit_results.append(False)
|
|
273
295
|
print("飞书 推送失败!错误信息如下:\n", response)
|
|
296
|
+
return all(audit_results) if audit_results else None
|
|
274
297
|
|
|
275
298
|
|
|
276
|
-
def go_cqhttp(title: str, content: str) ->
|
|
299
|
+
def go_cqhttp(title: str, content: str) -> Optional[bool]:
|
|
277
300
|
"""
|
|
278
301
|
使用 go_cqhttp 推送消息。
|
|
279
302
|
"""
|
|
303
|
+
audit_results = []
|
|
280
304
|
if not push_config.get("GOBOT_URL") or not push_config.get("GOBOT_QQ"):
|
|
281
305
|
return
|
|
282
306
|
print("go-cqhttp 服务启动")
|
|
283
307
|
|
|
284
308
|
url = f'{push_config.get("GOBOT_URL")}?access_token={push_config.get("GOBOT_TOKEN")}&{push_config.get("GOBOT_QQ")}&message=标题:{title}\n内容:{content}'
|
|
285
|
-
response = requests.get(url).json()
|
|
309
|
+
response = requests.get(url, timeout=REQUEST_TIMEOUT).json()
|
|
286
310
|
|
|
287
311
|
if response["status"] == "ok":
|
|
312
|
+
audit_results.append(True)
|
|
288
313
|
print("go-cqhttp 推送成功!")
|
|
289
314
|
else:
|
|
315
|
+
audit_results.append(False)
|
|
290
316
|
print("go-cqhttp 推送失败!")
|
|
317
|
+
return all(audit_results) if audit_results else None
|
|
291
318
|
|
|
292
319
|
|
|
293
|
-
def gotify(title: str, content: str) ->
|
|
320
|
+
def gotify(title: str, content: str) -> Optional[bool]:
|
|
294
321
|
"""
|
|
295
322
|
使用 gotify 推送消息。
|
|
296
323
|
"""
|
|
324
|
+
audit_results = []
|
|
297
325
|
if not push_config.get("GOTIFY_URL") or not push_config.get("GOTIFY_TOKEN"):
|
|
298
326
|
return
|
|
299
327
|
print("gotify 服务启动")
|
|
@@ -304,18 +332,22 @@ def gotify(title: str, content: str) -> None:
|
|
|
304
332
|
"message": content,
|
|
305
333
|
"priority": push_config.get("GOTIFY_PRIORITY"),
|
|
306
334
|
}
|
|
307
|
-
response = requests.post(url, data=data).json()
|
|
335
|
+
response = requests.post(url, data=data, timeout=REQUEST_TIMEOUT).json()
|
|
308
336
|
|
|
309
337
|
if response.get("id"):
|
|
338
|
+
audit_results.append(True)
|
|
310
339
|
print("gotify 推送成功!")
|
|
311
340
|
else:
|
|
341
|
+
audit_results.append(False)
|
|
312
342
|
print("gotify 推送失败!")
|
|
343
|
+
return all(audit_results) if audit_results else None
|
|
313
344
|
|
|
314
345
|
|
|
315
|
-
def iGot(title: str, content: str) ->
|
|
346
|
+
def iGot(title: str, content: str) -> Optional[bool]:
|
|
316
347
|
"""
|
|
317
348
|
使用 iGot 推送消息。
|
|
318
349
|
"""
|
|
350
|
+
audit_results = []
|
|
319
351
|
if not push_config.get("IGOT_PUSH_KEY"):
|
|
320
352
|
return
|
|
321
353
|
print("iGot 服务启动")
|
|
@@ -323,18 +355,24 @@ def iGot(title: str, content: str) -> None:
|
|
|
323
355
|
url = f'https://push.hellyw.com/{push_config.get("IGOT_PUSH_KEY")}'
|
|
324
356
|
data = {"title": title, "content": content}
|
|
325
357
|
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
|
326
|
-
response = requests.post(
|
|
358
|
+
response = requests.post(
|
|
359
|
+
url, data=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
360
|
+
).json()
|
|
327
361
|
|
|
328
362
|
if response["ret"] == 0:
|
|
363
|
+
audit_results.append(True)
|
|
329
364
|
print("iGot 推送成功!")
|
|
330
365
|
else:
|
|
366
|
+
audit_results.append(False)
|
|
331
367
|
print(f'iGot 推送失败!{response["errMsg"]}')
|
|
368
|
+
return all(audit_results) if audit_results else None
|
|
332
369
|
|
|
333
370
|
|
|
334
|
-
def serverJ(title: str, content: str) ->
|
|
371
|
+
def serverJ(title: str, content: str) -> Optional[bool]:
|
|
335
372
|
"""
|
|
336
373
|
通过 serverJ 推送消息。
|
|
337
374
|
"""
|
|
375
|
+
audit_results = []
|
|
338
376
|
if not push_config.get("PUSH_KEY"):
|
|
339
377
|
return
|
|
340
378
|
print("serverJ 服务启动")
|
|
@@ -348,18 +386,22 @@ def serverJ(title: str, content: str) -> None:
|
|
|
348
386
|
else:
|
|
349
387
|
url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send'
|
|
350
388
|
|
|
351
|
-
response = requests.post(url, data=data).json()
|
|
389
|
+
response = requests.post(url, data=data, timeout=REQUEST_TIMEOUT).json()
|
|
352
390
|
|
|
353
391
|
if response.get("errno") == 0 or response.get("code") == 0:
|
|
392
|
+
audit_results.append(True)
|
|
354
393
|
print("serverJ 推送成功!")
|
|
355
394
|
else:
|
|
395
|
+
audit_results.append(False)
|
|
356
396
|
print(f'serverJ 推送失败!错误码:{response["message"]}')
|
|
397
|
+
return all(audit_results) if audit_results else None
|
|
357
398
|
|
|
358
399
|
|
|
359
|
-
def pushdeer(title: str, content: str) ->
|
|
400
|
+
def pushdeer(title: str, content: str) -> Optional[bool]:
|
|
360
401
|
"""
|
|
361
402
|
通过PushDeer 推送消息
|
|
362
403
|
"""
|
|
404
|
+
audit_results = []
|
|
363
405
|
if not push_config.get("DEER_KEY"):
|
|
364
406
|
return
|
|
365
407
|
print("PushDeer 服务启动")
|
|
@@ -373,35 +415,43 @@ def pushdeer(title: str, content: str) -> None:
|
|
|
373
415
|
if push_config.get("DEER_URL"):
|
|
374
416
|
url = push_config.get("DEER_URL")
|
|
375
417
|
|
|
376
|
-
response = requests.post(url, data=data).json()
|
|
418
|
+
response = requests.post(url, data=data, timeout=REQUEST_TIMEOUT).json()
|
|
377
419
|
|
|
378
420
|
if len(response.get("content").get("result")) > 0:
|
|
421
|
+
audit_results.append(True)
|
|
379
422
|
print("PushDeer 推送成功!")
|
|
380
423
|
else:
|
|
424
|
+
audit_results.append(False)
|
|
381
425
|
print("PushDeer 推送失败!错误信息:", response)
|
|
426
|
+
return all(audit_results) if audit_results else None
|
|
382
427
|
|
|
383
428
|
|
|
384
|
-
def chat(title: str, content: str) ->
|
|
429
|
+
def chat(title: str, content: str) -> Optional[bool]:
|
|
385
430
|
"""
|
|
386
431
|
通过Chat 推送消息
|
|
387
432
|
"""
|
|
433
|
+
audit_results = []
|
|
388
434
|
if not push_config.get("CHAT_URL") or not push_config.get("CHAT_TOKEN"):
|
|
389
435
|
return
|
|
390
436
|
print("chat 服务启动")
|
|
391
437
|
data = "payload=" + json.dumps({"text": title + "\n" + content})
|
|
392
438
|
url = push_config.get("CHAT_URL") + push_config.get("CHAT_TOKEN")
|
|
393
|
-
response = requests.post(url, data=data)
|
|
439
|
+
response = requests.post(url, data=data, timeout=REQUEST_TIMEOUT)
|
|
394
440
|
|
|
395
441
|
if response.status_code == 200:
|
|
442
|
+
audit_results.append(True)
|
|
396
443
|
print("Chat 推送成功!")
|
|
397
444
|
else:
|
|
445
|
+
audit_results.append(False)
|
|
398
446
|
print("Chat 推送失败!错误信息:", response)
|
|
447
|
+
return all(audit_results) if audit_results else None
|
|
399
448
|
|
|
400
449
|
|
|
401
|
-
def pushplus_bot(title: str, content: str) ->
|
|
450
|
+
def pushplus_bot(title: str, content: str) -> Optional[bool]:
|
|
402
451
|
"""
|
|
403
452
|
通过 pushplus 推送消息。
|
|
404
453
|
"""
|
|
454
|
+
audit_results = []
|
|
405
455
|
if not push_config.get("PUSH_PLUS_TOKEN"):
|
|
406
456
|
return
|
|
407
457
|
print("PUSHPLUS 服务启动")
|
|
@@ -420,11 +470,15 @@ def pushplus_bot(title: str, content: str) -> None:
|
|
|
420
470
|
}
|
|
421
471
|
body = json.dumps(data).encode(encoding="utf-8")
|
|
422
472
|
headers = {"Content-Type": "application/json"}
|
|
423
|
-
response = requests.post(
|
|
473
|
+
response = requests.post(
|
|
474
|
+
url=url, data=body, headers=headers, timeout=REQUEST_TIMEOUT
|
|
475
|
+
).json()
|
|
424
476
|
|
|
425
477
|
code = response["code"]
|
|
426
478
|
if code == 200:
|
|
479
|
+
audit_results.append(True)
|
|
427
480
|
print("PUSHPLUS 推送请求成功,可根据流水号查询推送结果:" + response["data"])
|
|
481
|
+
audit_results.append(True)
|
|
428
482
|
print(
|
|
429
483
|
"注意:请求成功并不代表推送成功,如未收到消息,请到pushplus官网使用流水号查询推送最终结果"
|
|
430
484
|
)
|
|
@@ -434,19 +488,25 @@ def pushplus_bot(title: str, content: str) -> None:
|
|
|
434
488
|
else:
|
|
435
489
|
url_old = "http://pushplus.hxtrip.com/send"
|
|
436
490
|
headers["Accept"] = "application/json"
|
|
437
|
-
response = requests.post(
|
|
491
|
+
response = requests.post(
|
|
492
|
+
url=url_old, data=body, headers=headers, timeout=REQUEST_TIMEOUT
|
|
493
|
+
).json()
|
|
438
494
|
|
|
439
495
|
if response["code"] == 200:
|
|
496
|
+
audit_results.append(True)
|
|
440
497
|
print("PUSHPLUS(hxtrip) 推送成功!")
|
|
441
498
|
|
|
442
499
|
else:
|
|
500
|
+
audit_results.append(False)
|
|
443
501
|
print("PUSHPLUS 推送失败!")
|
|
502
|
+
return all(audit_results) if audit_results else None
|
|
444
503
|
|
|
445
504
|
|
|
446
|
-
def weplus_bot(title: str, content: str) ->
|
|
505
|
+
def weplus_bot(title: str, content: str) -> Optional[bool]:
|
|
447
506
|
"""
|
|
448
507
|
通过 微加机器人 推送消息。
|
|
449
508
|
"""
|
|
509
|
+
audit_results = []
|
|
450
510
|
if not push_config.get("WE_PLUS_BOT_TOKEN"):
|
|
451
511
|
return
|
|
452
512
|
print("微加机器人 服务启动")
|
|
@@ -466,36 +526,48 @@ def weplus_bot(title: str, content: str) -> None:
|
|
|
466
526
|
}
|
|
467
527
|
body = json.dumps(data).encode(encoding="utf-8")
|
|
468
528
|
headers = {"Content-Type": "application/json"}
|
|
469
|
-
response = requests.post(
|
|
529
|
+
response = requests.post(
|
|
530
|
+
url=url, data=body, headers=headers, timeout=REQUEST_TIMEOUT
|
|
531
|
+
).json()
|
|
470
532
|
|
|
471
533
|
if response["code"] == 200:
|
|
534
|
+
audit_results.append(True)
|
|
472
535
|
print("微加机器人 推送成功!")
|
|
473
536
|
else:
|
|
537
|
+
audit_results.append(False)
|
|
474
538
|
print("微加机器人 推送失败!")
|
|
539
|
+
return all(audit_results) if audit_results else None
|
|
475
540
|
|
|
476
541
|
|
|
477
|
-
def qmsg_bot(title: str, content: str) ->
|
|
542
|
+
def qmsg_bot(title: str, content: str) -> Optional[bool]:
|
|
478
543
|
"""
|
|
479
544
|
使用 qmsg 推送消息。
|
|
480
545
|
"""
|
|
546
|
+
audit_results = []
|
|
481
547
|
if not push_config.get("QMSG_KEY") or not push_config.get("QMSG_TYPE"):
|
|
482
548
|
return
|
|
483
549
|
print("qmsg 服务启动")
|
|
484
550
|
|
|
485
551
|
url = f'https://qmsg.zendee.cn/{push_config.get("QMSG_TYPE")}/{push_config.get("QMSG_KEY")}'
|
|
486
552
|
payload = {"msg": f'{title}\n\n{content.replace("----", "-")}'.encode("utf-8")}
|
|
487
|
-
response = requests.post(
|
|
553
|
+
response = requests.post(
|
|
554
|
+
url=url, params=payload, timeout=REQUEST_TIMEOUT
|
|
555
|
+
).json()
|
|
488
556
|
|
|
489
557
|
if response["code"] == 0:
|
|
558
|
+
audit_results.append(True)
|
|
490
559
|
print("qmsg 推送成功!")
|
|
491
560
|
else:
|
|
561
|
+
audit_results.append(False)
|
|
492
562
|
print(f'qmsg 推送失败!{response["reason"]}')
|
|
563
|
+
return all(audit_results) if audit_results else None
|
|
493
564
|
|
|
494
565
|
|
|
495
|
-
def wecom_app(title: str, content: str) ->
|
|
566
|
+
def wecom_app(title: str, content: str) -> Optional[bool]:
|
|
496
567
|
"""
|
|
497
568
|
通过 企业微信 APP 推送消息。
|
|
498
569
|
"""
|
|
570
|
+
audit_results = []
|
|
499
571
|
if not push_config.get("QYWX_AM"):
|
|
500
572
|
return
|
|
501
573
|
QYWX_AM_AY = re.split(",", push_config.get("QYWX_AM"))
|
|
@@ -521,9 +593,12 @@ def wecom_app(title: str, content: str) -> None:
|
|
|
521
593
|
response = wx.send_mpnews(title, content, media_id, touser)
|
|
522
594
|
|
|
523
595
|
if response == "ok":
|
|
596
|
+
audit_results.append(True)
|
|
524
597
|
print("企业微信推送成功!")
|
|
525
598
|
else:
|
|
599
|
+
audit_results.append(False)
|
|
526
600
|
print("企业微信推送失败!错误信息如下:\n", response)
|
|
601
|
+
return all(audit_results) if audit_results else None
|
|
527
602
|
|
|
528
603
|
|
|
529
604
|
class WeCom:
|
|
@@ -541,7 +616,7 @@ class WeCom:
|
|
|
541
616
|
"corpid": self.CORPID,
|
|
542
617
|
"corpsecret": self.CORPSECRET,
|
|
543
618
|
}
|
|
544
|
-
req = requests.post(url, params=values)
|
|
619
|
+
req = requests.post(url, params=values, timeout=REQUEST_TIMEOUT)
|
|
545
620
|
data = json.loads(req.text)
|
|
546
621
|
return data["access_token"]
|
|
547
622
|
|
|
@@ -557,7 +632,9 @@ class WeCom:
|
|
|
557
632
|
"safe": "0",
|
|
558
633
|
}
|
|
559
634
|
send_msges = bytes(json.dumps(send_values), "utf-8")
|
|
560
|
-
respone = requests.post(
|
|
635
|
+
respone = requests.post(
|
|
636
|
+
send_url, send_msges, timeout=REQUEST_TIMEOUT
|
|
637
|
+
)
|
|
561
638
|
respone = respone.json()
|
|
562
639
|
return respone["errmsg"]
|
|
563
640
|
|
|
@@ -583,15 +660,18 @@ class WeCom:
|
|
|
583
660
|
},
|
|
584
661
|
}
|
|
585
662
|
send_msges = bytes(json.dumps(send_values), "utf-8")
|
|
586
|
-
respone = requests.post(
|
|
663
|
+
respone = requests.post(
|
|
664
|
+
send_url, send_msges, timeout=REQUEST_TIMEOUT
|
|
665
|
+
)
|
|
587
666
|
respone = respone.json()
|
|
588
667
|
return respone["errmsg"]
|
|
589
668
|
|
|
590
669
|
|
|
591
|
-
def wecom_bot(title: str, content: str) ->
|
|
670
|
+
def wecom_bot(title: str, content: str) -> Optional[bool]:
|
|
592
671
|
"""
|
|
593
672
|
通过 企业微信机器人 推送消息。
|
|
594
673
|
"""
|
|
674
|
+
audit_results = []
|
|
595
675
|
if not push_config.get("QYWX_KEY"):
|
|
596
676
|
return
|
|
597
677
|
print("企业微信机器人服务启动")
|
|
@@ -604,19 +684,23 @@ def wecom_bot(title: str, content: str) -> None:
|
|
|
604
684
|
headers = {"Content-Type": "application/json;charset=utf-8"}
|
|
605
685
|
data = {"msgtype": "text", "text": {"content": f"{title}\n\n{content}"}}
|
|
606
686
|
response = requests.post(
|
|
607
|
-
url=url, data=json.dumps(data), headers=headers, timeout=
|
|
687
|
+
url=url, data=json.dumps(data), headers=headers, timeout=REQUEST_TIMEOUT
|
|
608
688
|
).json()
|
|
609
689
|
|
|
610
690
|
if response["errcode"] == 0:
|
|
691
|
+
audit_results.append(True)
|
|
611
692
|
print("企业微信机器人推送成功!")
|
|
612
693
|
else:
|
|
694
|
+
audit_results.append(False)
|
|
613
695
|
print("企业微信机器人推送失败!")
|
|
696
|
+
return all(audit_results) if audit_results else None
|
|
614
697
|
|
|
615
698
|
|
|
616
|
-
def telegram_bot(title: str, content: str) ->
|
|
699
|
+
def telegram_bot(title: str, content: str) -> Optional[bool]:
|
|
617
700
|
"""
|
|
618
701
|
使用 telegram 机器人 推送消息。
|
|
619
702
|
"""
|
|
703
|
+
audit_results = []
|
|
620
704
|
if not push_config.get("TG_BOT_TOKEN") or not push_config.get("TG_USER_ID"):
|
|
621
705
|
return
|
|
622
706
|
print("tg 服务启动")
|
|
@@ -648,19 +732,27 @@ def telegram_bot(title: str, content: str) -> None:
|
|
|
648
732
|
)
|
|
649
733
|
proxies = {"http": proxyStr, "https": proxyStr}
|
|
650
734
|
response = requests.post(
|
|
651
|
-
url=url,
|
|
735
|
+
url=url,
|
|
736
|
+
headers=headers,
|
|
737
|
+
params=payload,
|
|
738
|
+
proxies=proxies,
|
|
739
|
+
timeout=REQUEST_TIMEOUT,
|
|
652
740
|
).json()
|
|
653
741
|
|
|
654
742
|
if response["ok"]:
|
|
743
|
+
audit_results.append(True)
|
|
655
744
|
print("tg 推送成功!")
|
|
656
745
|
else:
|
|
746
|
+
audit_results.append(False)
|
|
657
747
|
print("tg 推送失败!")
|
|
748
|
+
return all(audit_results) if audit_results else None
|
|
658
749
|
|
|
659
750
|
|
|
660
|
-
def aibotk(title: str, content: str) ->
|
|
751
|
+
def aibotk(title: str, content: str) -> Optional[bool]:
|
|
661
752
|
"""
|
|
662
753
|
使用 智能微秘书 推送消息。
|
|
663
754
|
"""
|
|
755
|
+
audit_results = []
|
|
664
756
|
if (
|
|
665
757
|
not push_config.get("AIBOTK_KEY")
|
|
666
758
|
or not push_config.get("AIBOTK_TYPE")
|
|
@@ -685,18 +777,24 @@ def aibotk(title: str, content: str) -> None:
|
|
|
685
777
|
}
|
|
686
778
|
body = json.dumps(data).encode(encoding="utf-8")
|
|
687
779
|
headers = {"Content-Type": "application/json"}
|
|
688
|
-
response = requests.post(
|
|
780
|
+
response = requests.post(
|
|
781
|
+
url=url, data=body, headers=headers, timeout=REQUEST_TIMEOUT
|
|
782
|
+
).json()
|
|
689
783
|
print(response)
|
|
690
784
|
if response["code"] == 0:
|
|
785
|
+
audit_results.append(True)
|
|
691
786
|
print("智能微秘书 推送成功!")
|
|
692
787
|
else:
|
|
788
|
+
audit_results.append(False)
|
|
693
789
|
print(f'智能微秘书 推送失败!{response["error"]}')
|
|
790
|
+
return all(audit_results) if audit_results else None
|
|
694
791
|
|
|
695
792
|
|
|
696
|
-
def smtp(title: str, content: str) ->
|
|
793
|
+
def smtp(title: str, content: str) -> Optional[bool]:
|
|
697
794
|
"""
|
|
698
795
|
使用 SMTP 邮件 推送消息。
|
|
699
796
|
"""
|
|
797
|
+
audit_results = []
|
|
700
798
|
if (
|
|
701
799
|
not push_config.get("SMTP_SERVER")
|
|
702
800
|
or not push_config.get("SMTP_SSL")
|
|
@@ -736,15 +834,19 @@ def smtp(title: str, content: str) -> None:
|
|
|
736
834
|
message.as_bytes(),
|
|
737
835
|
)
|
|
738
836
|
smtp_server.close()
|
|
837
|
+
audit_results.append(True)
|
|
739
838
|
print("SMTP 邮件 推送成功!")
|
|
740
839
|
except Exception as e:
|
|
840
|
+
audit_results.append(False)
|
|
741
841
|
print(f"SMTP 邮件 推送失败!{e}")
|
|
842
|
+
return all(audit_results) if audit_results else None
|
|
742
843
|
|
|
743
844
|
|
|
744
|
-
def pushme(title: str, content: str) ->
|
|
845
|
+
def pushme(title: str, content: str) -> Optional[bool]:
|
|
745
846
|
"""
|
|
746
847
|
使用 PushMe 推送消息。
|
|
747
848
|
"""
|
|
849
|
+
audit_results = []
|
|
748
850
|
if not push_config.get("PUSHME_KEY"):
|
|
749
851
|
return
|
|
750
852
|
print("PushMe 服务启动")
|
|
@@ -761,18 +863,22 @@ def pushme(title: str, content: str) -> None:
|
|
|
761
863
|
"date": push_config.get("date") if push_config.get("date") else "",
|
|
762
864
|
"type": push_config.get("type") if push_config.get("type") else "",
|
|
763
865
|
}
|
|
764
|
-
response = requests.post(url, data=data)
|
|
866
|
+
response = requests.post(url, data=data, timeout=REQUEST_TIMEOUT)
|
|
765
867
|
|
|
766
868
|
if response.status_code == 200 and response.text == "success":
|
|
869
|
+
audit_results.append(True)
|
|
767
870
|
print("PushMe 推送成功!")
|
|
768
871
|
else:
|
|
872
|
+
audit_results.append(False)
|
|
769
873
|
print(f"PushMe 推送失败!{response.status_code} {response.text}")
|
|
874
|
+
return all(audit_results) if audit_results else None
|
|
770
875
|
|
|
771
876
|
|
|
772
|
-
def chronocat(title: str, content: str) ->
|
|
877
|
+
def chronocat(title: str, content: str) -> Optional[bool]:
|
|
773
878
|
"""
|
|
774
879
|
使用 CHRONOCAT 推送消息。
|
|
775
880
|
"""
|
|
881
|
+
audit_results = []
|
|
776
882
|
if (
|
|
777
883
|
not push_config.get("CHRONOCAT_URL")
|
|
778
884
|
or not push_config.get("CHRONOCAT_QQ")
|
|
@@ -804,24 +910,32 @@ def chronocat(title: str, content: str) -> None:
|
|
|
804
910
|
}
|
|
805
911
|
],
|
|
806
912
|
}
|
|
807
|
-
response = requests.post(
|
|
913
|
+
response = requests.post(
|
|
914
|
+
url, headers=headers, data=json.dumps(data), timeout=REQUEST_TIMEOUT
|
|
915
|
+
)
|
|
808
916
|
if response.status_code == 200:
|
|
809
917
|
if chat_type == 1:
|
|
918
|
+
audit_results.append(True)
|
|
810
919
|
print(f"QQ个人消息:{ids}推送成功!")
|
|
811
920
|
else:
|
|
921
|
+
audit_results.append(True)
|
|
812
922
|
print(f"QQ群消息:{ids}推送成功!")
|
|
813
923
|
else:
|
|
814
924
|
if chat_type == 1:
|
|
925
|
+
audit_results.append(False)
|
|
815
926
|
print(f"QQ个人消息:{ids}推送失败!")
|
|
816
927
|
else:
|
|
928
|
+
audit_results.append(False)
|
|
817
929
|
print(f"QQ群消息:{ids}推送失败!")
|
|
930
|
+
return all(audit_results) if audit_results else None
|
|
818
931
|
|
|
819
932
|
|
|
820
|
-
def ntfy(title: str, content: str) ->
|
|
933
|
+
def ntfy(title: str, content: str) -> Optional[bool]:
|
|
821
934
|
"""
|
|
822
935
|
通过 Ntfy 推送消息
|
|
823
936
|
"""
|
|
824
937
|
|
|
938
|
+
audit_results = []
|
|
825
939
|
def encode_rfc2047(text: str) -> str:
|
|
826
940
|
"""将文本编码为符合 RFC 2047 标准的格式"""
|
|
827
941
|
encoded_bytes = base64.b64encode(text.encode("utf-8"))
|
|
@@ -851,14 +965,19 @@ def ntfy(title: str, content: str) -> None:
|
|
|
851
965
|
headers['Actions'] = encode_rfc2047(push_config.get("NTFY_ACTIONS"))
|
|
852
966
|
|
|
853
967
|
url = push_config.get("NTFY_URL") + "/" + push_config.get("NTFY_TOPIC")
|
|
854
|
-
response = requests.post(
|
|
968
|
+
response = requests.post(
|
|
969
|
+
url, data=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
970
|
+
)
|
|
855
971
|
if response.status_code == 200: # 使用 response.status_code 进行检查
|
|
972
|
+
audit_results.append(True)
|
|
856
973
|
print("Ntfy 推送成功!")
|
|
857
974
|
else:
|
|
975
|
+
audit_results.append(False)
|
|
858
976
|
print("Ntfy 推送失败!错误信息:", response.text)
|
|
977
|
+
return all(audit_results) if audit_results else None
|
|
859
978
|
|
|
860
979
|
|
|
861
|
-
def wxpusher_bot(title: str, content: str) ->
|
|
980
|
+
def wxpusher_bot(title: str, content: str) -> Optional[bool]:
|
|
862
981
|
"""
|
|
863
982
|
通过 wxpusher 推送消息。
|
|
864
983
|
支持的环境变量:
|
|
@@ -866,6 +985,7 @@ def wxpusher_bot(title: str, content: str) -> None:
|
|
|
866
985
|
- WXPUSHER_TOPIC_IDS: 主题ID, 多个用英文分号;分隔
|
|
867
986
|
- WXPUSHER_UIDS: 用户ID, 多个用英文分号;分隔
|
|
868
987
|
"""
|
|
988
|
+
audit_results = []
|
|
869
989
|
if not push_config.get("WXPUSHER_APP_TOKEN"):
|
|
870
990
|
return
|
|
871
991
|
|
|
@@ -906,20 +1026,26 @@ def wxpusher_bot(title: str, content: str) -> None:
|
|
|
906
1026
|
}
|
|
907
1027
|
|
|
908
1028
|
headers = {"Content-Type": "application/json"}
|
|
909
|
-
response = requests.post(
|
|
1029
|
+
response = requests.post(
|
|
1030
|
+
url=url, json=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
1031
|
+
).json()
|
|
910
1032
|
|
|
911
1033
|
if response.get("code") == 1000:
|
|
1034
|
+
audit_results.append(True)
|
|
912
1035
|
print("wxpusher 推送成功!")
|
|
913
1036
|
else:
|
|
1037
|
+
audit_results.append(False)
|
|
914
1038
|
print(f"wxpusher 推送失败!错误信息:{response.get('msg')}")
|
|
1039
|
+
return all(audit_results) if audit_results else None
|
|
915
1040
|
|
|
916
1041
|
|
|
917
|
-
def wxpusher_spt(title: str, content: str) ->
|
|
1042
|
+
def wxpusher_spt(title: str, content: str) -> Optional[bool]:
|
|
918
1043
|
"""
|
|
919
1044
|
通过 wxpusher 极简推送(SPT)推送消息。
|
|
920
1045
|
支持的环境变量:
|
|
921
1046
|
- WXPUSHER_SPT_LIST: SPT, 多个用英文逗号,分隔, 最多10个
|
|
922
1047
|
"""
|
|
1048
|
+
audit_results = []
|
|
923
1049
|
if not push_config.get("WXPUSHER_SPT_LIST"):
|
|
924
1050
|
return
|
|
925
1051
|
|
|
@@ -953,20 +1079,26 @@ def wxpusher_spt(title: str, content: str) -> None:
|
|
|
953
1079
|
data["sptList"] = spts
|
|
954
1080
|
|
|
955
1081
|
headers = {"Content-Type": "application/json"}
|
|
956
|
-
response = requests.post(
|
|
1082
|
+
response = requests.post(
|
|
1083
|
+
url=url, json=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
1084
|
+
).json()
|
|
957
1085
|
|
|
958
1086
|
if response.get("code") == 1000:
|
|
1087
|
+
audit_results.append(True)
|
|
959
1088
|
print("wxpusher SPT 推送成功!")
|
|
960
1089
|
else:
|
|
1090
|
+
audit_results.append(False)
|
|
961
1091
|
print(f"wxpusher SPT 推送失败!错误信息:{response.get('msg')}")
|
|
1092
|
+
return all(audit_results) if audit_results else None
|
|
962
1093
|
|
|
963
1094
|
|
|
964
1095
|
|
|
965
|
-
def wpush(title: str, content: str) ->
|
|
1096
|
+
def wpush(title: str, content: str) -> Optional[bool]:
|
|
966
1097
|
"""
|
|
967
1098
|
通过 WPUSH 推送消息。
|
|
968
1099
|
官方文档: https://wpush.cn/docs
|
|
969
1100
|
"""
|
|
1101
|
+
audit_results = []
|
|
970
1102
|
if not push_config.get("WPUSH_APIKEY"):
|
|
971
1103
|
return
|
|
972
1104
|
|
|
@@ -983,15 +1115,20 @@ def wpush(title: str, content: str) -> None:
|
|
|
983
1115
|
data["topic_code"] = push_config.get("WPUSH_TOPIC_CODE")
|
|
984
1116
|
|
|
985
1117
|
headers = {"Content-Type": "application/json"}
|
|
986
|
-
response = requests.post(
|
|
1118
|
+
response = requests.post(
|
|
1119
|
+
url=url, json=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
1120
|
+
).json()
|
|
987
1121
|
|
|
988
1122
|
if response.get("code") == 0:
|
|
1123
|
+
audit_results.append(True)
|
|
989
1124
|
print("WPUSH 推送成功!")
|
|
990
1125
|
else:
|
|
1126
|
+
audit_results.append(False)
|
|
991
1127
|
print(f'WPUSH 推送失败!错误信息:{response.get("message") or response}')
|
|
1128
|
+
return all(audit_results) if audit_results else None
|
|
992
1129
|
|
|
993
1130
|
|
|
994
|
-
def openilink(title: str, content: str) ->
|
|
1131
|
+
def openilink(title: str, content: str) -> Optional[bool]:
|
|
995
1132
|
"""
|
|
996
1133
|
通过 OpeniLink 推送消息。
|
|
997
1134
|
支持的环境变量:
|
|
@@ -999,6 +1136,7 @@ def openilink(title: str, content: str) -> None:
|
|
|
999
1136
|
- OPENILINK_HUB_URL: OpeniLink Hub 地址,默认为 https://hub.openilink.com
|
|
1000
1137
|
- OPENILINK_CONTEXT_TOKEN: 消息会话上下文 token,可从消息事件中获取
|
|
1001
1138
|
"""
|
|
1139
|
+
audit_results = []
|
|
1002
1140
|
if not push_config.get("OPENILINK_APP_TOKEN"):
|
|
1003
1141
|
return
|
|
1004
1142
|
|
|
@@ -1020,12 +1158,17 @@ def openilink(title: str, content: str) -> None:
|
|
|
1020
1158
|
if push_config.get("OPENILINK_CONTEXT_TOKEN"):
|
|
1021
1159
|
data["context_token"] = push_config.get("OPENILINK_CONTEXT_TOKEN")
|
|
1022
1160
|
|
|
1023
|
-
response = requests.post(
|
|
1161
|
+
response = requests.post(
|
|
1162
|
+
url=url, json=data, headers=headers, timeout=REQUEST_TIMEOUT
|
|
1163
|
+
).json()
|
|
1024
1164
|
|
|
1025
1165
|
if response.get("ok"):
|
|
1166
|
+
audit_results.append(True)
|
|
1026
1167
|
print("OpeniLink 推送成功!")
|
|
1027
1168
|
else:
|
|
1169
|
+
audit_results.append(False)
|
|
1028
1170
|
print(f'OpeniLink 推送失败!错误信息:{response.get("error")}')
|
|
1171
|
+
return all(audit_results) if audit_results else None
|
|
1029
1172
|
|
|
1030
1173
|
|
|
1031
1174
|
def parse_headers(headers):
|
|
@@ -1079,10 +1222,11 @@ def parse_body(body, content_type, value_format_fn=None):
|
|
|
1079
1222
|
return parsed
|
|
1080
1223
|
|
|
1081
1224
|
|
|
1082
|
-
def custom_notify(title: str, content: str) ->
|
|
1225
|
+
def custom_notify(title: str, content: str) -> Optional[bool]:
|
|
1083
1226
|
"""
|
|
1084
1227
|
通过 自定义通知 推送消息。
|
|
1085
1228
|
"""
|
|
1229
|
+
audit_results = []
|
|
1086
1230
|
if not push_config.get("WEBHOOK_URL") or not push_config.get("WEBHOOK_METHOD"):
|
|
1087
1231
|
return
|
|
1088
1232
|
|
|
@@ -1110,13 +1254,16 @@ def custom_notify(title: str, content: str) -> None:
|
|
|
1110
1254
|
"$title", urllib.parse.quote_plus(title)
|
|
1111
1255
|
).replace("$content", urllib.parse.quote_plus(content))
|
|
1112
1256
|
response = requests.request(
|
|
1113
|
-
method=WEBHOOK_METHOD, url=formatted_url, headers=headers, timeout=
|
|
1257
|
+
method=WEBHOOK_METHOD, url=formatted_url, headers=headers, timeout=REQUEST_TIMEOUT, data=body
|
|
1114
1258
|
)
|
|
1115
1259
|
|
|
1116
1260
|
if response.status_code == 200:
|
|
1261
|
+
audit_results.append(True)
|
|
1117
1262
|
print("自定义通知推送成功!")
|
|
1118
1263
|
else:
|
|
1264
|
+
audit_results.append(False)
|
|
1119
1265
|
print(f"自定义通知推送失败!{response.status_code} {response.text}")
|
|
1266
|
+
return all(audit_results) if audit_results else None
|
|
1120
1267
|
|
|
1121
1268
|
|
|
1122
1269
|
def one() -> str:
|
|
@@ -1125,7 +1272,7 @@ def one() -> str:
|
|
|
1125
1272
|
:return:
|
|
1126
1273
|
"""
|
|
1127
1274
|
url = "https://v1.hitokoto.cn/"
|
|
1128
|
-
res = requests.get(url).json()
|
|
1275
|
+
res = requests.get(url, timeout=REQUEST_TIMEOUT).json()
|
|
1129
1276
|
return res["hitokoto"] + " ----" + res["from"]
|
|
1130
1277
|
|
|
1131
1278
|
|
|
@@ -1204,6 +1351,43 @@ def add_notify_function():
|
|
|
1204
1351
|
return notify_function
|
|
1205
1352
|
|
|
1206
1353
|
|
|
1354
|
+
def report_notification(channel, title, content, success):
|
|
1355
|
+
report_notifications([(channel, success)], title, content)
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
def report_notifications(results, title, content):
|
|
1359
|
+
ql_dir = os.getenv("QL_DIR")
|
|
1360
|
+
if not ql_dir or not results:
|
|
1361
|
+
return
|
|
1362
|
+
payload = [{"title": str(title or "")[:512], "content": str(content or "")[:8192],
|
|
1363
|
+
"success": success, "notifyType": channel,
|
|
1364
|
+
"scriptName": os.path.basename(__import__("sys").argv[0]), "taskId": os.getenv("ID", "")}
|
|
1365
|
+
for channel, success in results]
|
|
1366
|
+
code = """const fs=require('node:fs'),path=require('node:path');
|
|
1367
|
+
const report=require(path.join(process.env.QL_DIR,'shell/preload/notificationAudit.js'));
|
|
1368
|
+
report(JSON.parse(fs.readFileSync(0,'utf8'))).catch(()=>{});"""
|
|
1369
|
+
try:
|
|
1370
|
+
# One Node startup/TLS connection per send, with room for cold startup
|
|
1371
|
+
# before the reporter's bounded RPC deadline on busy Alpine hosts.
|
|
1372
|
+
subprocess.run(["node", "-e", code], input=json.dumps(payload), text=True,
|
|
1373
|
+
capture_output=True, timeout=10)
|
|
1374
|
+
except Exception:
|
|
1375
|
+
pass # Audit availability never changes notification delivery.
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
def audited_notification(mode, title, content, results=None):
|
|
1379
|
+
result = None
|
|
1380
|
+
try:
|
|
1381
|
+
result = mode(title, content)
|
|
1382
|
+
except Exception:
|
|
1383
|
+
result = False
|
|
1384
|
+
print(f"{mode.__name__} 推送失败")
|
|
1385
|
+
if results is None:
|
|
1386
|
+
report_notification(mode.__name__, title, content, result is True)
|
|
1387
|
+
else:
|
|
1388
|
+
results.append((mode.__name__, result is True))
|
|
1389
|
+
|
|
1390
|
+
|
|
1207
1391
|
def send(title: str, content: str, ignore_default_config: bool = False, **kwargs):
|
|
1208
1392
|
if kwargs:
|
|
1209
1393
|
global push_config
|
|
@@ -1227,12 +1411,23 @@ def send(title: str, content: str, ignore_default_config: bool = False, **kwargs
|
|
|
1227
1411
|
content += "\n\n" + one() if hitokoto not in [False, "false"] else ""
|
|
1228
1412
|
|
|
1229
1413
|
notify_function = add_notify_function()
|
|
1414
|
+
results = []
|
|
1230
1415
|
ts = [
|
|
1231
|
-
threading.Thread(
|
|
1416
|
+
threading.Thread(
|
|
1417
|
+
target=audited_notification,
|
|
1418
|
+
args=(mode, title, content, results),
|
|
1419
|
+
name=mode.__name__,
|
|
1420
|
+
daemon=True,
|
|
1421
|
+
)
|
|
1232
1422
|
for mode in notify_function
|
|
1233
1423
|
]
|
|
1234
1424
|
[t.start() for t in ts]
|
|
1235
|
-
|
|
1425
|
+
for t in ts:
|
|
1426
|
+
t.join(timeout=NOTIFY_JOIN_TIMEOUT)
|
|
1427
|
+
if t.is_alive():
|
|
1428
|
+
results.append((t.name, False))
|
|
1429
|
+
print(f"{t.name} 推送超时(>{NOTIFY_JOIN_TIMEOUT}s),已跳过,任务继续结束")
|
|
1430
|
+
report_notifications(results, title, content)
|
|
1236
1431
|
|
|
1237
1432
|
|
|
1238
1433
|
def main():
|