diff --git a/scripts/menu.sh b/scripts/menu.sh index 0f32bef..9e084d0 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -460,6 +460,31 @@ log_pusher() { #日志菜单 sleep 1 log_pusher ;; + # 在menu.sh的case $num in代码块中添加 + 7) + echo ----------------------------------------------- + if [ -n "$push_Gotify" ]; then + read -p "确认关闭Gotify日志推送?(1/0) > " res + [ "$res" = 1 ] && { + push_Gotify= + setconfig push_Gotify + } + else + echo -e "请先通过Gotify服务器获取推送URL" + echo -e "格式示例: https://gotify.example.com/message?token=你的应用令牌" + echo ----------------------------------------------- + read -p "请输入你的Gotify推送URL > " url + if [ -n "$url" ]; then + push_Gotify=$url + setconfig push_Gotify "$url" + ${CRASHDIR}/start.sh logger "已完成Gotify日志推送设置!" 32 + else + echo -e "\033[31m输入错误,请重新输入!\033[0m" + fi + fi + sleep 1 + log_pusher + ;; b) [ "$task_push" = 1 ] && task_push='' || task_push=1 setconfig task_push $task_push diff --git a/scripts/start.sh b/scripts/start.sh index b6ab4cc..5887015 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -148,6 +148,12 @@ logger() { #日志工具 content="{\"token\":\"${push_PP}\",\"title\":\"ShellCrash日志推送\",\"content\":\"$log_text\"}" webpush "$url" "$content" & } + # 新增Gotify推送 + [ -n "$push_Gotify" ] && { + url="${push_Gotify}" + content="{\"title\":\"ShellCrash日志推送\",\"message\":\"$log_text\",\"priority\":5}" + webpush "$url" "$content" & + } [ -n "$push_SynoChat" ] && { url="${push_ChatURL}/webapi/entry.cgi?api=SYNO.Chat.External&method=chatbot&version=2&token=${push_ChatTOKEN}" content="payload={\"text\":\"${log_text}\", \"user_ids\":[${push_ChatUSERID}]}"