diff --git a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/setting.lua b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/setting.lua index a8379f03f..048989797 100644 --- a/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/setting.lua +++ b/package/lean/luci-app-pushbot/luasrc/model/cbi/pushbot/setting.lua @@ -1,4 +1,4 @@ - + local nt = require "luci.sys".net local fs=require"nixio.fs" local e=luci.model.uci.cursor() @@ -48,11 +48,11 @@ a:value("/usr/bin/pushbot/api/bark.json",translate("Bark")) a:value("/usr/bin/pushbot/api/pushplus.json",translate("PushPlus")) a:value("/usr/bin/pushbot/api/diy.json",translate("自定义推送")) -a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook").."只输入aaccess_token=后面的即可
调用代码获取点击这里

") +a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook")..",只输入access_token=后面的即可
调用代码获取点击这里

") a.rmempty = true a:depends("jsonpath","/usr/bin/pushbot/api/dingding.json") -a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook").."
调用代码获取点击这里

") +a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook")..",只输入key=后面的即可
调用代码获取点击这里

") a.rmempty = true a:depends("jsonpath","/usr/bin/pushbot/api/ent_wechat.json") @@ -101,6 +101,26 @@ a=s:taboption("basic", Value,"bark_srv",translate('Bark Server'), translate("Bar a.rmempty = true a:depends("bark_srv_enable","1") +a=s:taboption("basic", Value,"bark_sound",translate('Bark Sound'), translate("Bark 通知声音").."
如silence.caf
具体设定参见:点击这里

") +a.rmempty = true +a.default = "silence.caf" +a:depends("jsonpath","/usr/bin/pushbot/api/bark.json") + +a=s:taboption("basic", Flag,"bark_icon_enable",translate(" Bark 通知图标")) +a.default=0 +a.rmempty = true +a:depends("jsonpath","/usr/bin/pushbot/api/bark.json") + +a=s:taboption("basic", Value,"bark_icon",translate('Bark Icon'), translate("Bark 通知图标").."(仅 iOS15 或以上支持)
如http://day.app/assets/images/avatar.jpg
具体设定参见:点击这里

") +a.rmempty = true +a.default = "http://day.app/assets/images/avatar.jpg" +a:depends("bark_icon_enable","1") + +a=s:taboption("basic", Value,"bark_level",translate('Bark Level'), translate("Bark 时效性通知").."
可选参数值:
active:不设置时的默认值,系统会立即亮屏显示通知。
timeSensitive:时效性通知,可在专注状态下显示通知。
passive:仅将通知添加到通知列表,不会亮屏提醒。") +a.rmempty = true +a.default = "active" +a:depends("jsonpath","/usr/bin/pushbot/api/bark.json") + a=s:taboption("basic", TextValue, "diy_json", translate("自定义推送")) a.optional = false a.rows = 28 @@ -355,8 +375,8 @@ a=s:taboption("crontab", ListValue,"regular_time",translate("发送时间")) a.rmempty = true for t=0,23 do a:value(t,translate("每天"..t.."点")) -end -a.default=8 +end +a.default=8 a.datatype=uinteger a:depends("crontab","1") @@ -365,7 +385,7 @@ a.rmempty = true a:value("",translate("关闭")) for t=0,23 do a:value(t,translate("每天"..t.."点")) -end +end a.default="关闭" a.datatype=uinteger a:depends("crontab","1") @@ -376,7 +396,7 @@ a.rmempty = true a:value("",translate("关闭")) for t=0,23 do a:value(t,translate("每天"..t.."点")) -end +end a.default="关闭" a.datatype=uinteger a:depends("crontab","1") @@ -406,7 +426,7 @@ a=s:taboption("crontab", Flag,"router_temp",translate("设备温度")) a.default=1 a:depends("crontab","1") a:depends("crontab","2") - + a=s:taboption("crontab", Flag,"router_wan",translate("WAN信息")) a.default=1 a:depends("crontab","1") @@ -415,7 +435,14 @@ a:depends("crontab","2") a=s:taboption("crontab", Flag,"client_list",translate("客户端列表")) a.default=1 a:depends("crontab","1") -a:depends("crontab","2") +a:depends("crontab","2") + +a=s:taboption("crontab", Value,"google_check_timeout",translate("全球互联检测超时时间")) +a.rmempty = true +a.optional = false +a.default = "10" +a.datatype = "and(uinteger,min(3))" +a.description = translate("过短的时间可能导致检测不准确") e=s:taboption("crontab", Button,"_add",translate("手动发送")) e.inputtitle=translate("发送") diff --git a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/bark.json b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/bark.json index ee2ef9813..8d1f73aba 100644 --- a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/bark.json +++ b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/api/bark.json @@ -21,14 +21,16 @@ "font_end2": "", "percentsym": "", "boldstar": "", - "type": - { - "device_key": "\"${bark_token}\"", - "title": "\"${1}\"", - "body": "\"${nowtime}${str_linefeed}${2}\"", - "ext_params": { - "group": "\"${device_name}\"", - "isArchive": "1" - } -} -} + "type": { + "device_key": "\"${bark_token}\"", + "title": "\"${1}\"", + "body": "\"${nowtime}${str_linefeed}${2}\"", + "ext_params": { + "group": "\"${device_name}\"", + "isArchive": "1", + "icon": "\"${bark_icon}\"", + "level": "\"${bark_level}\"" + }, + "sound": "\"${bark_sound}\"" + } +} \ No newline at end of file diff --git a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot index 67df37801..a0e1162ac 100755 --- a/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot +++ b/package/lean/luci-app-pushbot/root/usr/bin/pushbot/pushbot @@ -18,7 +18,7 @@ function read_config(){ "pushbot_sheep" "starttime" "endtime" "pushbot_whitelist" "pushbot_blacklist" "pushbot_interface" "MAC_online_list" "MAC_offline_list" \ "up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "pve_host" "pve_port"\ "err_enable" "err_sheep_enable" "err_device_aliases" "network_err_event" "system_time_event" "autoreboot_time" "network_restart_time" "public_ip_event" "public_ip_retry_count" \ - "jsonpath" "dd_webhook" "we_webhook" "pp_token" "pp_channel" "pp_webhook" "pp_topic_enable" "pp_topic" "fs_webhook" "bark_srv_enable" "bark_srv" "bark_token" + "jsonpath" "dd_webhook" "we_webhook" "pp_token" "pp_channel" "pp_webhook" "pp_topic_enable" "pp_topic" "fs_webhook" "bark_srv_enable" "bark_srv" "bark_token" "bark_sound" "bark_icon" "bark_icon_enable" "bark_level" for str_version in "wrtbwmon" "iputils-arping" "curl" "iw"; do eval `echo ${str_version:0:2}"_version"`=`opkg list-installed|grep -w ^${str_version}|awk '{print $3}'` 2>/dev/null @@ -1109,9 +1109,10 @@ function add_ip_black(){ function send(){ echo "`date "+%Y-%m-%d %H:%M:%S"` 【定时数据】创建定时任务" >> ${logfile} pushbot_disturb;local send_disturb=$? - get_config "send_title" "router_status" "router_temp" "router_wan" "client_list" + get_config "send_title" "router_status" "router_temp" "router_wan" "client_list" "google_check_timeout" [ -z "$send_title" ] && local send_title="路由状态:" + [ -z "$google_check_timeout" ] && local google_check_timeout="10" [ ! -z "$1" ] && local send_title="发送测试:" && local send_content="${str_splitline}${str_title_start}内容1${str_title_end}${str_linefeed}${str_tab}设备1${str_linefeed}${str_tab}设备2${str_splitline}${str_title_start}内容2${str_title_end}${str_linefeed}${str_tab}设备3${str_linefeed}${str_tab}设备4" [ -z "$1" ] && [ ! -z "$client_list" ] && [ "$client_list" -eq "1" ] && > ${dir}send_enable.lock && pushbot_first & @@ -1119,7 +1120,7 @@ function send(){ local systemload=`cat /proc/loadavg|awk '{print $1" "$2" "$3}'` local cpuload=`getcpu` local ramload=`free -m|sed -n '2p'|awk '{printf "%.2f%%\n",($3/$2)*100}'` - local Qwai=`curl -o /dev/null --connect-timeout 5 -s -w %{http_code} www.google.com` + local Qwai=`curl -o /dev/null --connect-timeout ${google_check_timeout} -s -w %{http_code} www.google.com` if [[ "$Qwai" -eq "200" ]] || [[ "$Qwai" -eq "301" ]] || [[ "$Qwai" -eq "302" ]]; then local Qwai_status="已连通!" else