mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
luci-app-pushbot: sync upstream (#8649)
Co-authored-by: zzsj0928 <69092025+zzsj0928@users.noreply.github.com>
This commit is contained in:
parent
a32407cdaf
commit
7222de0754
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
local nt = require "luci.sys".net
|
local nt = require "luci.sys".net
|
||||||
local fs=require"nixio.fs"
|
local fs=require"nixio.fs"
|
||||||
local e=luci.model.uci.cursor()
|
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/pushplus.json",translate("PushPlus"))
|
||||||
a:value("/usr/bin/pushbot/api/diy.json",translate("自定义推送"))
|
a:value("/usr/bin/pushbot/api/diy.json",translate("自定义推送"))
|
||||||
|
|
||||||
a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook").."只输入aaccess_token=后面的即可<br>调用代码获取<a href='https://developers.dingtalk.com/document/robots/custom-robot-access' target='_blank'>点击这里</a><br><br>")
|
a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook")..",只输入access_token=后面的即可<br>调用代码获取<a href='https://developers.dingtalk.com/document/robots/custom-robot-access' target='_blank'>点击这里</a><br><br>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/pushbot/api/dingding.json")
|
a:depends("jsonpath","/usr/bin/pushbot/api/dingding.json")
|
||||||
|
|
||||||
a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook").."<br>调用代码获取<a href='https://work.weixin.qq.com/api/doc/90000/90136/91770' target='_blank'>点击这里</a><br><br>")
|
a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook")..",只输入key=后面的即可<br>调用代码获取<a href='https://work.weixin.qq.com/api/doc/90000/90136/91770' target='_blank'>点击这里</a><br><br>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/pushbot/api/ent_wechat.json")
|
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.rmempty = true
|
||||||
a:depends("bark_srv_enable","1")
|
a:depends("bark_srv_enable","1")
|
||||||
|
|
||||||
|
a=s:taboption("basic", Value,"bark_sound",translate('Bark Sound'), translate("Bark 通知声音").."<br>如silence.caf<br>具体设定参见:<a href='https://github.com/Finb/Bark/tree/master/Sounds' target='_blank'>点击这里</a><br><br>")
|
||||||
|
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 或以上支持)<br>如http://day.app/assets/images/avatar.jpg<br>具体设定参见:<a href='https://github.com/Finb/Bark#%E5%85%B6%E4%BB%96%E5%8F%82%E6%95%B0' target='_blank'>点击这里</a><br><br>")
|
||||||
|
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 时效性通知").."<br>可选参数值:<br/>active:不设置时的默认值,系统会立即亮屏显示通知。<br/>timeSensitive:时效性通知,可在专注状态下显示通知。<br/>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=s:taboption("basic", TextValue, "diy_json", translate("自定义推送"))
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.rows = 28
|
a.rows = 28
|
||||||
@ -355,8 +375,8 @@ a=s:taboption("crontab", ListValue,"regular_time",translate("发送时间"))
|
|||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
for t=0,23 do
|
for t=0,23 do
|
||||||
a:value(t,translate("每天"..t.."点"))
|
a:value(t,translate("每天"..t.."点"))
|
||||||
end
|
end
|
||||||
a.default=8
|
a.default=8
|
||||||
a.datatype=uinteger
|
a.datatype=uinteger
|
||||||
a:depends("crontab","1")
|
a:depends("crontab","1")
|
||||||
|
|
||||||
@ -365,7 +385,7 @@ a.rmempty = true
|
|||||||
a:value("",translate("关闭"))
|
a:value("",translate("关闭"))
|
||||||
for t=0,23 do
|
for t=0,23 do
|
||||||
a:value(t,translate("每天"..t.."点"))
|
a:value(t,translate("每天"..t.."点"))
|
||||||
end
|
end
|
||||||
a.default="关闭"
|
a.default="关闭"
|
||||||
a.datatype=uinteger
|
a.datatype=uinteger
|
||||||
a:depends("crontab","1")
|
a:depends("crontab","1")
|
||||||
@ -376,7 +396,7 @@ a.rmempty = true
|
|||||||
a:value("",translate("关闭"))
|
a:value("",translate("关闭"))
|
||||||
for t=0,23 do
|
for t=0,23 do
|
||||||
a:value(t,translate("每天"..t.."点"))
|
a:value(t,translate("每天"..t.."点"))
|
||||||
end
|
end
|
||||||
a.default="关闭"
|
a.default="关闭"
|
||||||
a.datatype=uinteger
|
a.datatype=uinteger
|
||||||
a:depends("crontab","1")
|
a:depends("crontab","1")
|
||||||
@ -406,7 +426,7 @@ a=s:taboption("crontab", Flag,"router_temp",translate("设备温度"))
|
|||||||
a.default=1
|
a.default=1
|
||||||
a:depends("crontab","1")
|
a:depends("crontab","1")
|
||||||
a:depends("crontab","2")
|
a:depends("crontab","2")
|
||||||
|
|
||||||
a=s:taboption("crontab", Flag,"router_wan",translate("WAN信息"))
|
a=s:taboption("crontab", Flag,"router_wan",translate("WAN信息"))
|
||||||
a.default=1
|
a.default=1
|
||||||
a:depends("crontab","1")
|
a:depends("crontab","1")
|
||||||
@ -415,7 +435,14 @@ a:depends("crontab","2")
|
|||||||
a=s:taboption("crontab", Flag,"client_list",translate("客户端列表"))
|
a=s:taboption("crontab", Flag,"client_list",translate("客户端列表"))
|
||||||
a.default=1
|
a.default=1
|
||||||
a:depends("crontab","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=s:taboption("crontab", Button,"_add",translate("手动发送"))
|
||||||
e.inputtitle=translate("发送")
|
e.inputtitle=translate("发送")
|
||||||
|
@ -21,14 +21,16 @@
|
|||||||
"font_end2": "",
|
"font_end2": "",
|
||||||
"percentsym": "",
|
"percentsym": "",
|
||||||
"boldstar": "",
|
"boldstar": "",
|
||||||
"type":
|
"type": {
|
||||||
{
|
"device_key": "\"${bark_token}\"",
|
||||||
"device_key": "\"${bark_token}\"",
|
"title": "\"${1}\"",
|
||||||
"title": "\"${1}\"",
|
"body": "\"${nowtime}${str_linefeed}${2}\"",
|
||||||
"body": "\"${nowtime}${str_linefeed}${2}\"",
|
"ext_params": {
|
||||||
"ext_params": {
|
"group": "\"${device_name}\"",
|
||||||
"group": "\"${device_name}\"",
|
"isArchive": "1",
|
||||||
"isArchive": "1"
|
"icon": "\"${bark_icon}\"",
|
||||||
}
|
"level": "\"${bark_level}\""
|
||||||
}
|
},
|
||||||
}
|
"sound": "\"${bark_sound}\""
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,7 @@ function read_config(){
|
|||||||
"pushbot_sheep" "starttime" "endtime" "pushbot_whitelist" "pushbot_blacklist" "pushbot_interface" "MAC_online_list" "MAC_offline_list" \
|
"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"\
|
"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" \
|
"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
|
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
|
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(){
|
function send(){
|
||||||
echo "`date "+%Y-%m-%d %H:%M:%S"` 【定时数据】创建定时任务" >> ${logfile}
|
echo "`date "+%Y-%m-%d %H:%M:%S"` 【定时数据】创建定时任务" >> ${logfile}
|
||||||
pushbot_disturb;local send_disturb=$?
|
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 "$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" ] && 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 &
|
[ -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 systemload=`cat /proc/loadavg|awk '{print $1" "$2" "$3}'`
|
||||||
local cpuload=`getcpu`
|
local cpuload=`getcpu`
|
||||||
local ramload=`free -m|sed -n '2p'|awk '{printf "%.2f%%\n",($3/$2)*100}'`
|
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
|
if [[ "$Qwai" -eq "200" ]] || [[ "$Qwai" -eq "301" ]] || [[ "$Qwai" -eq "302" ]]; then
|
||||||
local Qwai_status="已连通!"
|
local Qwai_status="已连通!"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user