From 4a3ac7dc4bd838e09729b6227a62dd4a4178b347 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 5 Nov 2023 01:02:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=9A=8F=E6=9C=BA=E5=BB=B6?= =?UTF-8?q?=E8=BF=9F=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E5=8F=8A=20ProxyU?= =?UTF-8?q?rl=20=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=8B=89=E5=BA=93=E9=80=9A=E7=9F=A5=E5=8F=AF=E8=83=BD=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 1 - back/services/notify.ts | 2 +- sample/config.sample.sh | 25 ++++++++----------------- shell/api.sh | 8 ++++---- shell/share.sh | 6 +----- shell/update.sh | 2 +- 6 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.npmrc b/.npmrc index dfccb54b..fa4e0952 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1 @@ -sentrycli_cdnurl=https://npmmirror.com/mirrors/sentry-cli/ strict-peer-dependencies=false \ No newline at end of file diff --git a/back/services/notify.ts b/back/services/notify.ts index 896cf40c..f80c0b98 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -57,7 +57,7 @@ export default class NotificationService { try { return await notificationModeAction?.call(this); } catch (error: any) { - return false; + throw error; } } return false; diff --git a/sample/config.sample.sh b/sample/config.sample.sh index fa955e63..baa6d63a 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -10,9 +10,6 @@ DefaultCronRule="" ## ql repo命令拉取脚本时需要拉取的文件后缀,直接写文件后缀名即可 RepoFileExtensions="js py" -## 代理地址,支持HTTP/SOCK5,例如 http://127.0.0.1:7890 -ProxyUrl="" - ## 资源告警阙值,默认CPU 80%、内存80%、磁盘90% CpuWarn=80 MemoryWarn=80 @@ -21,20 +18,20 @@ DiskWarn=90 ## 设置定时任务执行的超时时间,例如1h,后缀"s"代表秒(默认值), "m"代表分, "h"代表小时, "d"代表天 CommandTimeoutTime="" -## 在运行 task 命令时,随机延迟启动任务的最大延迟时间 +## 在使用 task 命令执行 JavaScript 脚本1时,随机延迟启动任务的最大延迟时间 ## 默认给javascript任务加随机延迟,如 RandomDelay="300" ,表示任务将在 1-300 秒内随机延迟一个秒数,然后再运行,取消延迟赋值为空 -RandomDelay="300" +RandomDelay="" ## 需要随机延迟运行任务的文件后缀,直接写后缀名即可,多个后缀用空格分开,例如: js py ts ## 默认仅给javascript任务加随机延迟,其它任务按定时规则准点运行。全部任务随机延迟赋值为空 -RandomDelayFileExtensions="js" +RandomDelayFileExtensions="" ## 每小时的第几分钟准点运行任务,当在这些时间运行任务时将忽略 RandomDelay 配置,不会被随机延迟 ## 默认是第0分钟和第30分钟,例如21:00或21:30分的任务将会准点运行。不需要准点运行赋值为空 -RandomDelayIgnoredMinutes="0 30" +RandomDelayIgnoredMinutes="" -## 如果你自己会写shell脚本,并且希望在每次运行 ql update 命令时,额外运行你的 shell 脚本,请赋值为 "true",默认为true -EnableExtraShell="true" +## 如果你自己会写shell脚本,并且希望在每次容器启动时,额外运行你的 shell 脚本,请赋值为 "true",默认为true +EnableExtraShell="" ## 是否自动启动bot,默认不启动,设置为true时自动启动,目前需要自行克隆bot仓库所需代码,存到ql/repo目录下,文件夹命名为dockerbot AutoStartBot="" @@ -42,12 +39,6 @@ AutoStartBot="" ## 是否使用第三方bot,默认不使用,使用时填入仓库地址,存到ql/repo目录下,文件夹命名为diybot BotRepoUrl="" -## 安装python依赖时指定pip源 -PipMirror="https://pypi.doubanio.com/simple/" - -## 安装node依赖时指定npm源 -NpmMirror="https://registry.npmmirror.com" - ## 通知环境变量 ## 1. Server酱 ## https://sct.ftqq.com @@ -178,8 +169,8 @@ export PUSHME_KEY="" ## CHRONOCAT_TOKEN 填写在CHRONOCAT文件生成的访问密钥 ## CHRONOCAT_QQ 个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx ## CHRONOCAT相关API https://chronocat.vercel.app/install/docker/official/ -export CHRONOCAT_URL="" -export CHRONOCAT_QQ="" # +export CHRONOCAT_URL="" +export CHRONOCAT_QQ="" export CHRONOCAT_TOKEN="" ## 其他需要的变量,脚本中需要的变量使用 export 变量名= 声明即可 diff --git a/shell/api.sh b/shell/api.sh index a7128726..1e20d050 100755 --- a/shell/api.sh +++ b/shell/api.sh @@ -49,7 +49,7 @@ add_cron_api() { -H "Origin: http://0.0.0.0:5700" \ -H "Referer: http://0.0.0.0:5700/crontab" \ -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ - --data-raw "{\"name\":\"$name\",\"command\":\"$command\",\"schedule\":\"$schedule\",\"sub_id\":$sub_id}" \ + --data-raw "{\"name\":\"${name//\"/\\\"}\",\"command\":\"${command//\"/\\\"}\",\"schedule\":\"$schedule\",\"sub_id\":$sub_id}" \ --compressed ) code=$(echo "$api" | jq -r .code) @@ -85,7 +85,7 @@ update_cron_api() { -H "Origin: http://0.0.0.0:5700" \ -H "Referer: http://0.0.0.0:5700/crontab" \ -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ - --data-raw "{\"name\":\"$name\",\"command\":\"$command\",\"schedule\":\"$schedule\",\"id\":\"$id\"}" \ + --data-raw "{\"name\":\"${name//\"/\\\"}\",\"command\":\"${command//\"/\\\"}\",\"schedule\":\"$schedule\",\"id\":\"$id\"}" \ --compressed ) code=$(echo "$api" | jq -r .code) @@ -117,7 +117,7 @@ update_cron_command_api() { -H "Origin: http://0.0.0.0:5700" \ -H "Referer: http://0.0.0.0:5700/crontab" \ -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ - --data-raw "{\"command\":\"$command\",\"id\":\"$id\"}" \ + --data-raw "{\"command\":\"${command//\"/\\\"}\",\"id\":\"$id\"}" \ --compressed ) code=$(echo "$api" | jq -r .code) @@ -196,7 +196,7 @@ notify_api() { -H "Origin: http://0.0.0.0:5700" \ -H "Referer: http://0.0.0.0:5700/crontab" \ -H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \ - --data-raw "{\"title\":\"$title\",\"content\":\"$content\"}" \ + --data-raw "{\"title\":\"${title//\"/\\\"}\",\"content\":\"${content//\"/\\\"}\"}" \ --compressed ) code=$(echo "$api" | jq -r .code) diff --git a/shell/share.sh b/shell/share.sh index d1f57c40..1d440236 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -70,7 +70,6 @@ import_config() { ql_base_url=${QlBaseUrl:-"/"} ql_port=${QlPort:-"5700"} command_timeout_time=${CommandTimeoutTime:-""} - proxy_url=${ProxyUrl:-""} file_extensions=${RepoFileExtensions:-"js py"} current_branch=${QL_BRANCH} @@ -88,9 +87,6 @@ import_config() { set_proxy() { local proxy="$1" if [[ $proxy ]]; then - proxy_url="$proxy" - fi - if [[ $proxy_url ]]; then export http_proxy="${proxy_url}" export https_proxy="${proxy_url}" fi @@ -293,7 +289,7 @@ git_clone_scripts() { set_proxy "$proxy" - git clone --depth=1 $part_cmd $url $dir 2>&1 + git clone --depth=1 $part_cmd $url $dir exit_status=$? unset_proxy diff --git a/shell/update.sh b/shell/update.sh index 33f1b3b9..3cf21f91 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -138,7 +138,7 @@ update_repo() { echo -e "\n拉取 ${uniq_path} 成功...\n" diff_scripts "$repo_path" "$author" "$path" "$blackword" "$dependence" "$extensions" "$autoAddCron" "$autoDelCron" else - echo -e "\n拉取 ${uniq_path} 失败,请检查网络...\n" + echo -e "\n拉取 ${uniq_path} 失败,请检查日志...\n" fi }