mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
Fix Pushbot symbols (#7659)
This commit is contained in:
parent
e80af1955e
commit
ed865731cc
@ -1,34 +1,34 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-pushbot
|
||||
PKG_VERSION:=3.12
|
||||
PKG_RELEASE:=9
|
||||
|
||||
PKG_MAINTAINER:=tty228 zzsj0928
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
DEPENDS:=+iputils-arping +curl
|
||||
TITLE:=LuCI support for Pushbot
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/pushbot
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/
|
||||
cp -pR ./root/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-pushbot
|
||||
PKG_VERSION:=3.12
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_MAINTAINER:=tty228 zzsj0928
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
DEPENDS:=+iputils-arping +curl
|
||||
TITLE:=LuCI support for Pushbot
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/pushbot
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/
|
||||
cp -pR ./root/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
@ -1,90 +1,90 @@
|
||||
# 改名公告
|
||||
#### 2021年04月25日 起luci-app-serverchand 改名为 luci-app-pushbot
|
||||
|
||||
如需拉取编译
|
||||
请把:
|
||||
|
||||
`# git clone https://github.com/zzsj0928/luci-app-serverchand package/luci-app-serverchand`
|
||||
|
||||
改为
|
||||
|
||||
`git clone https://github.com/zzsj0928/luci-app-pushbot package/luci-app-pushbot`
|
||||
|
||||
并把 .config 中
|
||||
|
||||
`CONFIG_PACKAGE_luci-app-serverchand=y`
|
||||
|
||||
改为
|
||||
|
||||
`CONFIG_PACKAGE_luci-app-pushbot=y`
|
||||
|
||||
注意:本次改名需要提前备份serverchand配置,并于PushBot中重新配置。
|
||||
|
||||
再次谢谢各位支持
|
||||
|
||||
# 申明
|
||||
- 本插件由[tty228/luci-app-serverchan](https://github.com/tty228/luci-app-serverchan)原创.
|
||||
- 因微信推送存在诸多弊端(无法分开聊天工具与功能性消息推送,通知内不显示内容,内容需要点开才能查看等),
|
||||
- 故由 然后七年 @zzsj0928 重新修改为本插件,为钉钉机器人API使用。
|
||||
- 本插件工作在:openwrt
|
||||
- 本插件支持:钉钉推送,企业微信推送,PushPlus推送,微信推送,企业微信应用推送,飞书推送,钉钉机器人推送,企业微信机器人推送,飞书机器人推送,一对多推送,Bark推送(仅iOS)
|
||||
# 显示效果
|
||||
## 通知栏:直接显示推送主题,一目了然,按设备不同,分组显示
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/Msg.Notification.jpg" width="500">
|
||||
|
||||
## 消息列表:直接显示最新推送的标题
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/Msg.List.jpg" width="500">
|
||||
|
||||
## 消息内容:直接显示所有推送信息,不用二次点开再查看
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/MsgContentDetials.jpeg" width="500">
|
||||
|
||||
# 下载
|
||||
- [luci-app-pushbot](https://github.com/zzsj0928/luci-app-pushbot/releases)
|
||||
|
||||
|
||||
-----------------------------------------------------
|
||||
#####################################################
|
||||
-----------------------------------------------------
|
||||
|
||||
# 以下为原插件简介:
|
||||
|
||||
# 简介
|
||||
- 用于 OpenWRT/LEDE 路由器上进行 Server酱 微信/Telegram 推送的插件
|
||||
- 基于 serverchan 提供的接口发送信息,Server酱说明:http://sc.ftqq.com/1.version
|
||||
- **基于斐讯 k3 制作,不同系统不同设备,请自行修改部分代码,无测试条件无法重现的 bug 不考虑修复**
|
||||
- 依赖 iputils-arping + curl 命令,安装前请 `opkg update`,小内存路由谨慎安装
|
||||
- 使用主动探测设备连接的方式检测设备在线状态,以避免WiFi休眠机制,主动探测较为耗时,**如遇设备休眠频繁,请自行调整超时设置**
|
||||
- 流量统计功能依赖 wrtbwmon ,自行选装或编译,该插件与 Routing/NAT 、Flow Offloading 冲突,开启无法获取流量,自行选择,L大版本直接编译 luci-app-wrtbwmon
|
||||
|
||||
#### 主要功能
|
||||
- 路由 ip/ipv6 变动推送
|
||||
- 设备别名
|
||||
- 设备上线推送
|
||||
- 设备离线推送及流量使用情况
|
||||
- CPU 负载、温度监视
|
||||
- 定时推送设备运行状态
|
||||
- MAC 白名单、黑名单、按接口检测设备
|
||||
- 免打扰
|
||||
- 无人值守任务
|
||||
|
||||
#### 说明
|
||||
- 潘多拉系统、或不支持 sh 的系统,请将脚本开头 `#!/bin/sh` 改为 `#!/bin/bash`,或手动安装 `sh`
|
||||
- 追新是没有意义的,没有问题没必要更新,上班事情忙完了,摸鱼又不会摸,只能靠写几行 bug ,才能缓解无聊这样子
|
||||
|
||||
#### 已知问题
|
||||
- 直接关闭接口时,该接口的离线设备会忽略检测
|
||||
- 部分设备无法读取到设备名,脚本使用 `cat /var/dhcp.leases` 命令读取设备名,如果 dhcp 中不存在设备名,则无法读取设备名(如二级路由设备、静态ip设备),请使用设备名备注
|
||||
|
||||
# Download
|
||||
- [luci-app-serverchan](https://github.com/tty228/luci-app-serverchan/releases)
|
||||
- [wrtbwmon](https://github.com/brvphoenix/wrtbwmon)
|
||||
- [luci-app-wrtbwmon](https://github.com/brvphoenix/luci-app-wrtbwmon)
|
||||
|
||||
#### ps
|
||||
- 新功能看情况开发
|
||||
- 王者荣耀新赛季,不思进取中
|
||||
- 欢迎各种代码提交
|
||||
- 提交bug时请尽量带上设备信息,日志与描述(如执行`/usr/bin/serverchan/serverchan`后的提示、日志信息、/tmp/serverchan/ipAddress 文件信息)
|
||||
- 三言两句恕我无能为力
|
||||
- 武汉加油
|
||||
|
||||
# 改名公告
|
||||
#### 2021年04月25日 起luci-app-serverchand 改名为 luci-app-pushbot
|
||||
|
||||
如需拉取编译
|
||||
请把:
|
||||
|
||||
`# git clone https://github.com/zzsj0928/luci-app-serverchand package/luci-app-serverchand`
|
||||
|
||||
改为
|
||||
|
||||
`git clone https://github.com/zzsj0928/luci-app-pushbot package/luci-app-pushbot`
|
||||
|
||||
并把 .config 中
|
||||
|
||||
`CONFIG_PACKAGE_luci-app-serverchand=y`
|
||||
|
||||
改为
|
||||
|
||||
`CONFIG_PACKAGE_luci-app-pushbot=y`
|
||||
|
||||
注意:本次改名需要提前备份serverchand配置,并于PushBot中重新配置。
|
||||
|
||||
再次谢谢各位支持
|
||||
|
||||
# 申明
|
||||
- 本插件由[tty228/luci-app-serverchan](https://github.com/tty228/luci-app-serverchan)原创.
|
||||
- 因微信推送存在诸多弊端(无法分开聊天工具与功能性消息推送,通知内不显示内容,内容需要点开才能查看等),
|
||||
- 故由 然后七年 @zzsj0928 重新修改为本插件,为钉钉机器人API使用。
|
||||
- 本插件工作在:openwrt
|
||||
- 本插件支持:钉钉推送,企业微信推送,PushPlus推送,微信推送,企业微信应用推送,飞书推送,钉钉机器人推送,企业微信机器人推送,飞书机器人推送,一对多推送,Bark推送(仅iOS)
|
||||
# 显示效果
|
||||
## 通知栏:直接显示推送主题,一目了然,按设备不同,分组显示
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/Msg.Notification.jpg" width="500">
|
||||
|
||||
## 消息列表:直接显示最新推送的标题
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/Msg.List.jpg" width="500">
|
||||
|
||||
## 消息内容:直接显示所有推送信息,不用二次点开再查看
|
||||
<img src="https://raw.githubusercontent.com/zzsj0928/ReadmeContents/main/Serverchand/MsgContentDetials.jpeg" width="500">
|
||||
|
||||
# 下载
|
||||
- [luci-app-pushbot](https://github.com/zzsj0928/luci-app-pushbot/releases)
|
||||
|
||||
|
||||
-----------------------------------------------------
|
||||
#####################################################
|
||||
-----------------------------------------------------
|
||||
|
||||
# 以下为原插件简介:
|
||||
|
||||
# 简介
|
||||
- 用于 OpenWRT/LEDE 路由器上进行 Server酱 微信/Telegram 推送的插件
|
||||
- 基于 serverchan 提供的接口发送信息,Server酱说明:http://sc.ftqq.com/1.version
|
||||
- **基于斐讯 k3 制作,不同系统不同设备,请自行修改部分代码,无测试条件无法重现的 bug 不考虑修复**
|
||||
- 依赖 iputils-arping + curl 命令,安装前请 `opkg update`,小内存路由谨慎安装
|
||||
- 使用主动探测设备连接的方式检测设备在线状态,以避免WiFi休眠机制,主动探测较为耗时,**如遇设备休眠频繁,请自行调整超时设置**
|
||||
- 流量统计功能依赖 wrtbwmon ,自行选装或编译,该插件与 Routing/NAT 、Flow Offloading 冲突,开启无法获取流量,自行选择,L大版本直接编译 luci-app-wrtbwmon
|
||||
|
||||
#### 主要功能
|
||||
- 路由 ip/ipv6 变动推送
|
||||
- 设备别名
|
||||
- 设备上线推送
|
||||
- 设备离线推送及流量使用情况
|
||||
- CPU 负载、温度监视
|
||||
- 定时推送设备运行状态
|
||||
- MAC 白名单、黑名单、按接口检测设备
|
||||
- 免打扰
|
||||
- 无人值守任务
|
||||
|
||||
#### 说明
|
||||
- 潘多拉系统、或不支持 sh 的系统,请将脚本开头 `#!/bin/sh` 改为 `#!/bin/bash`,或手动安装 `sh`
|
||||
- 追新是没有意义的,没有问题没必要更新,上班事情忙完了,摸鱼又不会摸,只能靠写几行 bug ,才能缓解无聊这样子
|
||||
|
||||
#### 已知问题
|
||||
- 直接关闭接口时,该接口的离线设备会忽略检测
|
||||
- 部分设备无法读取到设备名,脚本使用 `cat /var/dhcp.leases` 命令读取设备名,如果 dhcp 中不存在设备名,则无法读取设备名(如二级路由设备、静态ip设备),请使用设备名备注
|
||||
|
||||
# Download
|
||||
- [luci-app-serverchan](https://github.com/tty228/luci-app-serverchan/releases)
|
||||
- [wrtbwmon](https://github.com/brvphoenix/wrtbwmon)
|
||||
- [luci-app-wrtbwmon](https://github.com/brvphoenix/luci-app-wrtbwmon)
|
||||
|
||||
#### ps
|
||||
- 新功能看情况开发
|
||||
- 王者荣耀新赛季,不思进取中
|
||||
- 欢迎各种代码提交
|
||||
- 提交bug时请尽量带上设备信息,日志与描述(如执行`/usr/bin/serverchan/serverchan`后的提示、日志信息、/tmp/serverchan/ipAddress 文件信息)
|
||||
- 三言两句恕我无能为力
|
||||
- 武汉加油
|
||||
|
||||
|
@ -1,32 +1,32 @@
|
||||
module("luci.controller.pushbot",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/pushbot") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "pushbot"}, alias("admin", "services", "pushbot", "setting"),_("全能推送"), 30).dependent = true
|
||||
entry({"admin", "services", "pushbot", "setting"}, cbi("pushbot/setting"),_("配置"), 40).leaf = true
|
||||
entry({"admin", "services", "pushbot", "advanced"}, cbi("pushbot/advanced"),_("高级设置"), 50).leaf = true
|
||||
entry({"admin", "services", "pushbot", "client"}, form("pushbot/client"), "在线设备", 80)
|
||||
entry({"admin", "services", "pushbot", "log"}, form("pushbot/log"),_("日志"), 99).leaf = true
|
||||
entry({"admin", "services", "pushbot", "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", "pushbot", "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", "pushbot", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("busybox ps|grep -v grep|grep -c pushbot >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec(
|
||||
"[ -f '/tmp/pushbot/pushbot.log' ] && cat /tmp/pushbot/pushbot.log"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("echo '' > /tmp/pushbot/pushbot.log")
|
||||
end
|
||||
module("luci.controller.pushbot",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/pushbot") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "pushbot"}, alias("admin", "services", "pushbot", "setting"),_("全能推送"), 30).dependent = true
|
||||
entry({"admin", "services", "pushbot", "setting"}, cbi("pushbot/setting"),_("配置"), 40).leaf = true
|
||||
entry({"admin", "services", "pushbot", "advanced"}, cbi("pushbot/advanced"),_("高级设置"), 50).leaf = true
|
||||
entry({"admin", "services", "pushbot", "client"}, form("pushbot/client"), "在线设备", 80)
|
||||
entry({"admin", "services", "pushbot", "log"}, form("pushbot/log"),_("日志"), 99).leaf = true
|
||||
entry({"admin", "services", "pushbot", "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", "pushbot", "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", "pushbot", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("busybox ps|grep -v grep|grep -c pushbot >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec(
|
||||
"[ -f '/tmp/pushbot/pushbot.log' ] && cat /tmp/pushbot/pushbot.log"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("echo '' > /tmp/pushbot/pushbot.log")
|
||||
end
|
||||
|
@ -1,112 +1,112 @@
|
||||
local nt = require "luci.sys".net
|
||||
local fs=require"nixio.fs"
|
||||
|
||||
m=Map("pushbot",translate("提示:"),
|
||||
translate("如果你不了解这些选项的含义,请不要修改这些选项"))
|
||||
|
||||
s = m:section(TypedSection, "pushbot", "高级设置")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
a=s:option(Value,"up_timeout",translate('设备上线检测超时(s)'))
|
||||
a.default = "2"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value,"down_timeout",translate('设备离线检测超时(s)'))
|
||||
a.default = "20"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value,"timeout_retry_count",translate('离线检测次数'))
|
||||
a.default = "2"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
||||
|
||||
a=s:option(Value,"thread_num",translate('最大并发进程数'))
|
||||
a.default = "3"
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("",translate("默认"))
|
||||
a:value("sensors",translate("sensors命令"))
|
||||
a.description = translate("请尽量避免使用特殊符号,如双引号、$、!等,执行结果需为数字,用于温度对比")
|
||||
|
||||
a=s:option(Button,"soc",translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot soc")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","services","pushbot","advanced"))
|
||||
end
|
||||
|
||||
if nixio.fs.access("/tmp/pushbot/soc_tmp") then
|
||||
e=s:option(TextValue,"soc_tmp")
|
||||
e.rows=2
|
||||
e.readonly=true
|
||||
e.cfgvalue = function()
|
||||
return luci.sys.exec("cat /tmp/pushbot/soc_tmp && rm -f /tmp/pushbot/soc_tmp")
|
||||
end
|
||||
end
|
||||
|
||||
a=s:option(Flag,"err_enable",translate("无人值守任务"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
||||
|
||||
a=s:option(Flag,"err_sheep_enable",translate("仅在免打扰时段重拨"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("避免白天重拨 ddns 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||
a:depends({err_enable="1"})
|
||||
|
||||
a= s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
a.rmempty = true
|
||||
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a:depends({err_enable="1"})
|
||||
|
||||
a=s:option(ListValue,"network_err_event",translate("网络断开时"))
|
||||
a.default=""
|
||||
a:depends({err_enable="1"})
|
||||
a:value("",translate("无操作"))
|
||||
a:value("1",translate("重启路由器"))
|
||||
a:value("2",translate("重新拨号"))
|
||||
a:value("3",translate("修改相关设置项,尝试自动修复网络"))
|
||||
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/bin/pushbot/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
|
||||
a=s:option(ListValue,"system_time_event",translate("定时重启"))
|
||||
a.default=""
|
||||
a:depends({err_enable="1"})
|
||||
a:value("",translate("无操作"))
|
||||
a:value("1",translate("重启路由器"))
|
||||
a:value("2",translate("重新拨号"))
|
||||
|
||||
a= s:option(Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="1"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:option(Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:option(Flag,"public_ip_event",translate("重拨尝试获取公网 ip"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a:depends({err_enable="1"})
|
||||
a.description = translate("重拨时不会推送 ip 变动通知,并会导致你的域名无法及时更新 ip 地址<br/>请确认你可以通过重拨获取公网 ip,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
||||
|
||||
a= s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype="uinteger"
|
||||
a:depends({public_ip_event="1"})
|
||||
|
||||
return m
|
||||
local nt = require "luci.sys".net
|
||||
local fs=require"nixio.fs"
|
||||
|
||||
m=Map("pushbot",translate("提示"),
|
||||
translate("如果你不了解这些选项的含义,请不要修改这些选项。"))
|
||||
|
||||
s = m:section(TypedSection, "pushbot", "高级设置")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
a=s:option(Value,"up_timeout",translate('设备上线检测超时(s)'))
|
||||
a.default = "2"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value,"down_timeout",translate('设备离线检测超时(s)'))
|
||||
a.default = "20"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value,"timeout_retry_count",translate('离线检测次数'))
|
||||
a.default = "2"
|
||||
a.optional=false
|
||||
a.datatype="uinteger"
|
||||
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
||||
|
||||
a=s:option(Value,"thread_num",translate('最大并发进程数'))
|
||||
a.default = "3"
|
||||
a.datatype="uinteger"
|
||||
|
||||
a=s:option(Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("",translate("默认"))
|
||||
a:value("sensors",translate("sensors命令"))
|
||||
a.description = translate("请尽量避免使用特殊符号,如双引号、$、!等,执行结果需为数字,用于温度对比")
|
||||
|
||||
a=s:option(Button,"soc",translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot soc")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","services","pushbot","advanced"))
|
||||
end
|
||||
|
||||
if nixio.fs.access("/tmp/pushbot/soc_tmp") then
|
||||
e=s:option(TextValue,"soc_tmp")
|
||||
e.rows=2
|
||||
e.readonly=true
|
||||
e.cfgvalue = function()
|
||||
return luci.sys.exec("cat /tmp/pushbot/soc_tmp && rm -f /tmp/pushbot/soc_tmp")
|
||||
end
|
||||
end
|
||||
|
||||
a=s:option(Flag,"err_enable",translate("无人值守任务"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
||||
|
||||
a=s:option(Flag,"err_sheep_enable",translate("仅在免打扰时段重拨"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("避免白天重拨 ddns 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||
a:depends({err_enable="1"})
|
||||
|
||||
a= s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
a.rmempty = true
|
||||
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a:depends({err_enable="1"})
|
||||
|
||||
a=s:option(ListValue,"network_err_event",translate("网络断开时"))
|
||||
a.default=""
|
||||
a:depends({err_enable="1"})
|
||||
a:value("",translate("无操作"))
|
||||
a:value("1",translate("重启路由器"))
|
||||
a:value("2",translate("重新拨号"))
|
||||
a:value("3",translate("修改相关设置项,尝试自动修复网络"))
|
||||
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/bin/pushbot/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
|
||||
a=s:option(ListValue,"system_time_event",translate("定时重启"))
|
||||
a.default=""
|
||||
a:depends({err_enable="1"})
|
||||
a:value("",translate("无操作"))
|
||||
a:value("1",translate("重启路由器"))
|
||||
a:value("2",translate("重新拨号"))
|
||||
|
||||
a= s:option(Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="1"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:option(Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:option(Flag,"public_ip_event",translate("重拨尝试获取公网 ip"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a:depends({err_enable="1"})
|
||||
a.description = translate("重拨时不会推送 ip 变动通知,并会导致你的域名无法及时更新 ip 地址<br/>请确认你可以通过重拨获取公网 ip,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
||||
|
||||
a= s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype="uinteger"
|
||||
a:depends({public_ip_event="1"})
|
||||
|
||||
return m
|
||||
|
@ -1,6 +1,6 @@
|
||||
f = SimpleForm("pushbot")
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot client")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("pushbot/client"))
|
||||
return f
|
||||
f = SimpleForm("pushbot")
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot client")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("pushbot/client"))
|
||||
return f
|
||||
|
@ -1,5 +1,5 @@
|
||||
f = SimpleForm("pushbot")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("pushbot/log"))
|
||||
return f
|
||||
f = SimpleForm("pushbot")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("pushbot/log"))
|
||||
return f
|
||||
|
@ -1,404 +1,404 @@
|
||||
|
||||
local nt = require "luci.sys".net
|
||||
local fs=require"nixio.fs"
|
||||
local e=luci.model.uci.cursor()
|
||||
local net = require "luci.model.network".init()
|
||||
local sys = require "luci.sys"
|
||||
local ifaces = sys.net:devices()
|
||||
|
||||
m=Map("pushbot",translate("PushBot"),
|
||||
translate("「全能推送」,英文名「PushBot」,是一款从服务器推送报警信息和日志到各平台的工具。<br>支持钉钉推送,企业微信推送,PushPlus推送。<br>本插件由tty228/luci-app-serverchan创建,然后七年修改为全能推送自用。<br /><br />如果你在使用中遇到问题,请到这里提交:")
|
||||
.. [[<a href="https://github.com/zzsj0928/luci-app-pushbot" target="_blank">]]
|
||||
.. translate("github 项目地址")
|
||||
.. [[</a>]]
|
||||
)
|
||||
|
||||
m:section(SimpleSection).template = "pushbot/pushbot_status"
|
||||
|
||||
s=m:section(NamedSection,"pushbot","pushbot",translate(""))
|
||||
s:tab("basic", translate("基本设置"))
|
||||
s:tab("content", translate("推送内容"))
|
||||
s:tab("crontab", translate("定时推送"))
|
||||
s:tab("disturb", translate("免打扰"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
--基本设置
|
||||
a=s:taboption("basic", Flag,"pushbot_enable",translate("启用"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
--精简模式
|
||||
a=s:taboption("basic", Flag,"lite_enable",translate("精简模式"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("basic", Flag, "content_current_device", "精简当前设备列表")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a= s:taboption("basic", Flag, "content_nowtime", "精简当前时间")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a= s:taboption("basic", Flag, "content_content", "只推送标题")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a=s:taboption("basic", ListValue,"send_we",translate("推送模式"))
|
||||
a.default=""
|
||||
a.rmempty = true
|
||||
a:value("",translate("钉钉"))
|
||||
a:value("1",translate("企业微信"))
|
||||
a:value("3",translate("飞书"))
|
||||
a:value("4",translate("Bark"))
|
||||
a:value("2",translate("PushPlus"))
|
||||
|
||||
a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook").."<br>调用代码获取<a href='https://ding-doc.dingtalk.com/' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","")
|
||||
|
||||
a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook").."<br>调用代码获取<a href='https://www.baidu.com/s?wd=%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%20%E6%B7%BB%E5%8A%A0%E6%9C%BA%E5%99%A8%E4%BA%BA' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","1")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_token",translate('PushPlus Token'), translate("PushPlus Token").."<br>调用代码获取<a href='http://pushplus.plus/doc/' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","2")
|
||||
|
||||
a=s:taboption("basic", ListValue,"pp_channel",translate('PushPlus Channel'))
|
||||
a.rmempty = true
|
||||
a:depends("send_we","2")
|
||||
a:value("wechat",translate("wechat:PushPlus微信公众号"))
|
||||
a:value("cp",translate("cp:企业微信应用"))
|
||||
a:value("webhook",translate("webhook:第三方webhook"))
|
||||
a:value("sms",translate("sms:短信"))
|
||||
a:value("mail",translate("mail:邮箱"))
|
||||
a.description = translate("第三方webhook:企业微信、钉钉、飞书、server酱<br>sms短信/mail邮箱:PushPlus暂未开放<br>具体channel设定参见:<a href='http://pushplus.plus/doc/extend/webhook.html' target='_blank'>点击这里</a>")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_webhook",translate('PushPlus Custom Webhook'), translate("PushPlus 自定义Webhook").."<br>第三方webhook或企业微信调用<br>具体自定义Webhook设定参见:<a href='http://pushplus.plus/doc/extend/webhook.html' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("pp_channel","cp")
|
||||
a:depends("pp_channel","webhook")
|
||||
|
||||
a=s:taboption("basic", Flag,"pp_topic_enable",translate("PushPlus 一对多推送"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
a:depends("pp_channel","wechat")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_topic",translate('PushPlus Topic'), translate("PushPlus 群组编码").."<br>一对多推送时指定的群组编码<br>具体群组编码Topic设定参见:<a href='http://www.pushplus.plus/push2.html' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("pp_topic_enable","1")
|
||||
|
||||
a=s:taboption("basic", Value,"fs_webhook",translate('WebHook'), translate("飞书 WebHook").."<br>调用代码获取<a href='https://www.feishu.cn/hc/zh-CN/articles/360024984973' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","3")
|
||||
|
||||
a=s:taboption("basic", Value,"bark_token",translate('Bark Token'), translate("Bark Token").."<br>调用代码获取<a href='https://github.com/Finb/Bark' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","4")
|
||||
|
||||
a=s:taboption("basic", Flag,"bark_srv_enable",translate("自建 Bark 服务器"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
a:depends("send_we","4")
|
||||
|
||||
a=s:taboption("basic", Value,"bark_srv",translate('Bark Server'), translate("Bark 自建服务器地址").."<br>如https://your.domain:port<br>具体自建服务器设定参见:<a href='https://github.com/Finb/Bark' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("bark_srv_enable","1")
|
||||
|
||||
a=s:taboption("basic", Value,"device_name",translate('本设备名称'))
|
||||
a.rmempty = true
|
||||
a.description = translate("在推送信息标题中会标识本设备名称,用于区分推送信息的来源设备")
|
||||
|
||||
a=s:taboption("basic", Value,"sleeptime",translate('检测时间间隔'))
|
||||
a.rmempty = true
|
||||
a.optional = false
|
||||
a.default = "60"
|
||||
a.description = translate("越短的时间时间响应越及时,但会占用更多的系统资源")
|
||||
|
||||
a=s:taboption("basic", ListValue,"oui_data",translate("MAC设备信息数据库"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("简化版"))
|
||||
a:value("2",translate("完整版"))
|
||||
a:value("3",translate("网络查询"))
|
||||
a.description = translate("需下载 4.36m 原始数据,处理后完整版约 1.2M,简化版约 250kb <br/>若无梯子,请勿使用网络查询")
|
||||
|
||||
a=s:taboption("basic", Flag,"oui_dir",translate("下载到内存"))
|
||||
a.rmempty = true
|
||||
a:depends("oui_data","1")
|
||||
a:depends("oui_data","2")
|
||||
a.description = translate("懒得做自动更新了,下载到内存中,重启会重新下载 <br/>若无梯子,还是下到机身吧")
|
||||
|
||||
a=s:taboption("basic", Flag,"reset_regularly",translate("每天零点重置流量数据"))
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("basic", Flag,"debuglevel",translate("开启日志"))
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("basic", DynamicList, "device_aliases", translate("设备别名"))
|
||||
a.rmempty = true
|
||||
a.description = translate("<br/> 请输入设备 MAC 和设备别名,用“-”隔开,如:<br/> XX:XX:XX:XX:XX:XX-我的手机")
|
||||
|
||||
--设备状态
|
||||
a=s:taboption("content", ListValue,"pushbot_ipv4",translate("ipv4 变动通知"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("通过接口获取"))
|
||||
a:value("2",translate("通过URL获取"))
|
||||
|
||||
a = s:taboption("content", ListValue, "ipv4_interface", translate("接口名称"))
|
||||
a.rmempty = true
|
||||
a:depends({pushbot_ipv4="1"})
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||
|
||||
a= s:taboption("content", DynamicList, "ipv4_URL", "URL 地址")
|
||||
a.rmempty = true
|
||||
|
||||
a:depends({pushbot_ipv4="2"})
|
||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>从以上列表中随机一个地址,留空使用默认地址")
|
||||
|
||||
a=s:taboption("content", ListValue,"pushbot_ipv6",translate("ipv6 变动通知"))
|
||||
a.rmempty = true
|
||||
a.default="disable"
|
||||
a:value("0",translate("关闭"))
|
||||
a:value("1",translate("通过接口获取"))
|
||||
a:value("2",translate("通过URL获取"))
|
||||
|
||||
a = s:taboption("content", ListValue, "ipv6_interface", translate("接口名称"))
|
||||
a.rmempty = true
|
||||
a:depends({pushbot_ipv6="1"})
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||
|
||||
a= s:taboption("content", DynamicList, "ipv6_URL", "URL 地址")
|
||||
a.rmempty = true
|
||||
|
||||
a:depends({pushbot_ipv6="2"})
|
||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>从以上列表中随机一个地址,留空使用默认地址")
|
||||
|
||||
a=s:taboption("content", Flag,"pushbot_up",translate("设备上线通知"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("content", Flag,"pushbot_down",translate("设备下线通知"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("content", Flag,"cpuload_enable",translate("CPU 负载报警"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("content", Value, "cpuload", "负载报警阈值")
|
||||
a.default = 2
|
||||
a.rmempty = true
|
||||
a:depends({cpuload_enable="1"})
|
||||
|
||||
a=s:taboption("content", Flag,"temperature_enable",translate("CPU 温度报警"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
a.description = translate("请确认设备可以获取温度,如需修改命令,请移步高级设置")
|
||||
|
||||
a= s:taboption("content", Value, "temperature", "温度报警阈值")
|
||||
a.rmempty = true
|
||||
a.default = "80"
|
||||
a.datatype="uinteger"
|
||||
a:depends({temperature_enable="1"})
|
||||
a.description = translate("<br/>设备报警只会在连续五分钟超过设定值时才会推送<br/>而且一个小时内不会再提醒第二次")
|
||||
|
||||
a=s:taboption("content", Flag,"client_usage",translate("设备异常流量"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("content", Value, "client_usage_max", "每分钟流量限制")
|
||||
a.default = "10M"
|
||||
a.rmempty = true
|
||||
a:depends({client_usage="1"})
|
||||
a.description = translate("设备异常流量警报(byte),你可以追加 K 或者 M")
|
||||
|
||||
a=s:taboption("content", Flag,"client_usage_disturb",translate("异常流量免打扰"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
a:depends({client_usage="1"})
|
||||
|
||||
a = s:taboption("content", DynamicList, "client_usage_whitelist", translate("异常流量关注列表"))
|
||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({client_usage_disturb="1"})
|
||||
a.description = translate("请输入设备 MAC")
|
||||
|
||||
--定时推送
|
||||
a=s:taboption("crontab", ListValue,"send_mode",translate("定时任务设定"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("定时发送"))
|
||||
a:value("2",translate("间隔发送"))
|
||||
|
||||
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
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"regular_time_2",translate("发送时间"))
|
||||
a.rmempty = true
|
||||
a:value("",translate("关闭"))
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default="关闭"
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"regular_time_3",translate("发送时间"))
|
||||
a.rmempty = true
|
||||
|
||||
a:value("",translate("关闭"))
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default="关闭"
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"interval_time",translate("发送间隔"))
|
||||
a.rmempty = true
|
||||
for t=1,23 do
|
||||
a:value(t,translate(t.."小时"))
|
||||
end
|
||||
a.default=6
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","2")
|
||||
a.description = translate("<br/>从 00:00 开始,每 * 小时发送一次")
|
||||
|
||||
a= s:taboption("crontab", Value, "send_title", translate("推送标题"))
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
a.placeholder = "OpenWrt By tty228 路由状态:"
|
||||
a.description = translate("<br/>使用特殊符号可能会造成发送失败")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_status",translate("系统运行情况"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_temp",translate("设备温度"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_wan",translate("WAN信息"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"client_list",translate("客户端列表"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
e=s:taboption("crontab", Button,"_add",translate("手动发送"))
|
||||
e.inputtitle=translate("发送")
|
||||
e:depends("send_mode","1")
|
||||
e:depends("send_mode","2")
|
||||
e.inputstyle = "apply"
|
||||
function e.write(self, section)
|
||||
luci.sys.call("cbi.apply")
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot send &")
|
||||
end
|
||||
|
||||
--免打扰
|
||||
a=s:taboption("disturb", ListValue,"pushbot_sheep",translate("免打扰时段设置"),translate("在指定整点时间段内,暂停推送消息<br/>免打扰时间中,定时推送也会被阻止。"))
|
||||
a.rmempty = true
|
||||
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("模式一:脚本挂起"))
|
||||
a:value("2",translate("模式二:静默模式"))
|
||||
a.description = translate("模式一停止一切检测,包括无人值守。")
|
||||
a=s:taboption("disturb", ListValue,"starttime",translate("免打扰开始时间"))
|
||||
a.rmempty = true
|
||||
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default=0
|
||||
a.datatype=uinteger
|
||||
a:depends({pushbot_sheep="1"})
|
||||
a:depends({pushbot_sheep="2"})
|
||||
a=s:taboption("disturb", ListValue,"endtime",translate("免打扰结束时间"))
|
||||
a.rmempty = true
|
||||
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default=8
|
||||
a.datatype=uinteger
|
||||
a:depends({pushbot_sheep="1"})
|
||||
a:depends({pushbot_sheep="2"})
|
||||
|
||||
a=s:taboption("disturb", ListValue,"macmechanism",translate("MAC过滤"))
|
||||
a:value("",translate("disable"))
|
||||
a:value("allow",translate("忽略列表内设备"))
|
||||
a:value("block",translate("仅通知列表内设备"))
|
||||
a:value("interface",translate("仅通知此接口设备"))
|
||||
a.rmempty = true
|
||||
|
||||
|
||||
a = s:taboption("disturb", DynamicList, "pushbot_whitelist", translate("忽略列表"))
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({macmechanism="allow"})
|
||||
|
||||
a = s:taboption("disturb", DynamicList, "pushbot_blacklist", translate("关注列表"))
|
||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({macmechanism="block"})
|
||||
|
||||
a = s:taboption("disturb", ListValue, "pushbot_interface", translate("接口名称"))
|
||||
a:depends({macmechanism="interface"})
|
||||
a.rmempty = true
|
||||
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
||||
local nt = require "luci.sys".net
|
||||
local fs=require"nixio.fs"
|
||||
local e=luci.model.uci.cursor()
|
||||
local net = require "luci.model.network".init()
|
||||
local sys = require "luci.sys"
|
||||
local ifaces = sys.net:devices()
|
||||
|
||||
m=Map("pushbot",translate("PushBot"),
|
||||
translate("「全能推送」,英文名「PushBot」,是一款从服务器推送报警信息和日志到各平台的工具。<br>支持钉钉推送,企业微信推送,PushPlus推送。<br>本插件由tty228/luci-app-serverchan创建,然后七年修改为全能推送自用。<br /><br />如果你在使用中遇到问题,请到这里提交:")
|
||||
.. [[<a href="https://github.com/zzsj0928/luci-app-pushbot" target="_blank">]]
|
||||
.. translate("github 项目地址")
|
||||
.. [[</a>]]
|
||||
)
|
||||
|
||||
m:section(SimpleSection).template = "pushbot/pushbot_status"
|
||||
|
||||
s=m:section(NamedSection,"pushbot","pushbot",translate(""))
|
||||
s:tab("basic", translate("基本设置"))
|
||||
s:tab("content", translate("推送内容"))
|
||||
s:tab("crontab", translate("定时推送"))
|
||||
s:tab("disturb", translate("免打扰"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
--基本设置
|
||||
a=s:taboption("basic", Flag,"pushbot_enable",translate("启用"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
--精简模式
|
||||
a=s:taboption("basic", Flag,"lite_enable",translate("精简模式"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("basic", Flag, "content_current_device", "精简当前设备列表")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a= s:taboption("basic", Flag, "content_nowtime", "精简当前时间")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a= s:taboption("basic", Flag, "content_content", "只推送标题")
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({lite_enable="1"})
|
||||
|
||||
a=s:taboption("basic", ListValue,"send_we",translate("推送模式"))
|
||||
a.default=""
|
||||
a.rmempty = true
|
||||
a:value("",translate("钉钉"))
|
||||
a:value("1",translate("企业微信"))
|
||||
a:value("3",translate("飞书"))
|
||||
a:value("4",translate("Bark"))
|
||||
a:value("2",translate("PushPlus"))
|
||||
|
||||
a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook").."<br>调用代码获取<a href='https://ding-doc.dingtalk.com/' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","")
|
||||
|
||||
a=s:taboption("basic", Value, "we_webhook", translate("Webhook"),translate("企业微信机器人 Webhook").."<br>调用代码获取<a href='https://www.baidu.com/s?wd=%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%20%E6%B7%BB%E5%8A%A0%E6%9C%BA%E5%99%A8%E4%BA%BA' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","1")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_token",translate('PushPlus Token'), translate("PushPlus Token").."<br>调用代码获取<a href='http://pushplus.plus/doc/' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","2")
|
||||
|
||||
a=s:taboption("basic", ListValue,"pp_channel",translate('PushPlus Channel'))
|
||||
a.rmempty = true
|
||||
a:depends("send_we","2")
|
||||
a:value("wechat",translate("wechat:PushPlus微信公众号"))
|
||||
a:value("cp",translate("cp:企业微信应用"))
|
||||
a:value("webhook",translate("webhook:第三方webhook"))
|
||||
a:value("sms",translate("sms:短信"))
|
||||
a:value("mail",translate("mail:邮箱"))
|
||||
a.description = translate("第三方webhook:企业微信、钉钉、飞书、server酱<br>sms短信/mail邮箱:PushPlus暂未开放<br>具体channel设定参见:<a href='http://pushplus.plus/doc/extend/webhook.html' target='_blank'>点击这里</a>")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_webhook",translate('PushPlus Custom Webhook'), translate("PushPlus 自定义Webhook").."<br>第三方webhook或企业微信调用<br>具体自定义Webhook设定参见:<a href='http://pushplus.plus/doc/extend/webhook.html' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("pp_channel","cp")
|
||||
a:depends("pp_channel","webhook")
|
||||
|
||||
a=s:taboption("basic", Flag,"pp_topic_enable",translate("PushPlus 一对多推送"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
a:depends("pp_channel","wechat")
|
||||
|
||||
a=s:taboption("basic", Value,"pp_topic",translate('PushPlus Topic'), translate("PushPlus 群组编码").."<br>一对多推送时指定的群组编码<br>具体群组编码Topic设定参见:<a href='http://www.pushplus.plus/push2.html' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("pp_topic_enable","1")
|
||||
|
||||
a=s:taboption("basic", Value,"fs_webhook",translate('WebHook'), translate("飞书 WebHook").."<br>调用代码获取<a href='https://www.feishu.cn/hc/zh-CN/articles/360024984973' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","3")
|
||||
|
||||
a=s:taboption("basic", Value,"bark_token",translate('Bark Token'), translate("Bark Token").."<br>调用代码获取<a href='https://github.com/Finb/Bark' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("send_we","4")
|
||||
|
||||
a=s:taboption("basic", Flag,"bark_srv_enable",translate("自建 Bark 服务器"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
a:depends("send_we","4")
|
||||
|
||||
a=s:taboption("basic", Value,"bark_srv",translate('Bark Server'), translate("Bark 自建服务器地址").."<br>如https://your.domain:port<br>具体自建服务器设定参见:<a href='https://github.com/Finb/Bark' target='_blank'>点击这里</a><br><br>")
|
||||
a.rmempty = true
|
||||
a:depends("bark_srv_enable","1")
|
||||
|
||||
a=s:taboption("basic", Value,"device_name",translate('本设备名称'))
|
||||
a.rmempty = true
|
||||
a.description = translate("在推送信息标题中会标识本设备名称,用于区分推送信息的来源设备")
|
||||
|
||||
a=s:taboption("basic", Value,"sleeptime",translate('检测时间间隔'))
|
||||
a.rmempty = true
|
||||
a.optional = false
|
||||
a.default = "60"
|
||||
a.description = translate("越短的时间时间响应越及时,但会占用更多的系统资源")
|
||||
|
||||
a=s:taboption("basic", ListValue,"oui_data",translate("MAC设备信息数据库"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("简化版"))
|
||||
a:value("2",translate("完整版"))
|
||||
a:value("3",translate("网络查询"))
|
||||
a.description = translate("需下载 4.36m 原始数据,处理后完整版约 1.2M,简化版约 250kb <br/>若无梯子,请勿使用网络查询")
|
||||
|
||||
a=s:taboption("basic", Flag,"oui_dir",translate("下载到内存"))
|
||||
a.rmempty = true
|
||||
a:depends("oui_data","1")
|
||||
a:depends("oui_data","2")
|
||||
a.description = translate("懒得做自动更新了,下载到内存中,重启会重新下载 <br/>若无梯子,还是下到机身吧")
|
||||
|
||||
a=s:taboption("basic", Flag,"reset_regularly",translate("每天零点重置流量数据"))
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("basic", Flag,"debuglevel",translate("开启日志"))
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("basic", DynamicList, "device_aliases", translate("设备别名"))
|
||||
a.rmempty = true
|
||||
a.description = translate("<br/> 请输入设备 MAC 和设备别名,用“-”隔开,如:<br/> XX:XX:XX:XX:XX:XX-我的手机")
|
||||
|
||||
--设备状态
|
||||
a=s:taboption("content", ListValue,"pushbot_ipv4",translate("ipv4 变动通知"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("通过接口获取"))
|
||||
a:value("2",translate("通过URL获取"))
|
||||
|
||||
a = s:taboption("content", ListValue, "ipv4_interface", translate("接口名称"))
|
||||
a.rmempty = true
|
||||
a:depends({pushbot_ipv4="1"})
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||
|
||||
a= s:taboption("content", DynamicList, "ipv4_URL", "URL 地址")
|
||||
a.rmempty = true
|
||||
|
||||
a:depends({pushbot_ipv4="2"})
|
||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>从以上列表中随机一个地址,留空使用默认地址")
|
||||
|
||||
a=s:taboption("content", ListValue,"pushbot_ipv6",translate("ipv6 变动通知"))
|
||||
a.rmempty = true
|
||||
a.default="disable"
|
||||
a:value("0",translate("关闭"))
|
||||
a:value("1",translate("通过接口获取"))
|
||||
a:value("2",translate("通过URL获取"))
|
||||
|
||||
a = s:taboption("content", ListValue, "ipv6_interface", translate("接口名称"))
|
||||
a.rmempty = true
|
||||
a:depends({pushbot_ipv6="1"})
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||
|
||||
a= s:taboption("content", DynamicList, "ipv6_URL", "URL 地址")
|
||||
a.rmempty = true
|
||||
|
||||
a:depends({pushbot_ipv6="2"})
|
||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>从以上列表中随机一个地址,留空使用默认地址")
|
||||
|
||||
a=s:taboption("content", Flag,"pushbot_up",translate("设备上线通知"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("content", Flag,"pushbot_down",translate("设备下线通知"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a=s:taboption("content", Flag,"cpuload_enable",translate("CPU 负载报警"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("content", Value, "cpuload", "负载报警阈值")
|
||||
a.default = 2
|
||||
a.rmempty = true
|
||||
a:depends({cpuload_enable="1"})
|
||||
|
||||
a=s:taboption("content", Flag,"temperature_enable",translate("CPU 温度报警"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
a.description = translate("请确认设备可以获取温度,如需修改命令,请移步高级设置")
|
||||
|
||||
a= s:taboption("content", Value, "temperature", "温度报警阈值")
|
||||
a.rmempty = true
|
||||
a.default = "80"
|
||||
a.datatype="uinteger"
|
||||
a:depends({temperature_enable="1"})
|
||||
a.description = translate("<br/>设备报警只会在连续五分钟超过设定值时才会推送<br/>而且一个小时内不会再提醒第二次")
|
||||
|
||||
a=s:taboption("content", Flag,"client_usage",translate("设备异常流量"))
|
||||
a.default=0
|
||||
a.rmempty = true
|
||||
|
||||
a= s:taboption("content", Value, "client_usage_max", "每分钟流量限制")
|
||||
a.default = "10M"
|
||||
a.rmempty = true
|
||||
a:depends({client_usage="1"})
|
||||
a.description = translate("设备异常流量警报(byte),你可以追加 K 或者 M")
|
||||
|
||||
a=s:taboption("content", Flag,"client_usage_disturb",translate("异常流量免打扰"))
|
||||
a.default=1
|
||||
a.rmempty = true
|
||||
a:depends({client_usage="1"})
|
||||
|
||||
a = s:taboption("content", DynamicList, "client_usage_whitelist", translate("异常流量关注列表"))
|
||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({client_usage_disturb="1"})
|
||||
a.description = translate("请输入设备 MAC")
|
||||
|
||||
--定时推送
|
||||
a=s:taboption("crontab", ListValue,"send_mode",translate("定时任务设定"))
|
||||
a.rmempty = true
|
||||
a.default=""
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("定时发送"))
|
||||
a:value("2",translate("间隔发送"))
|
||||
|
||||
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
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"regular_time_2",translate("发送时间"))
|
||||
a.rmempty = true
|
||||
a:value("",translate("关闭"))
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default="关闭"
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"regular_time_3",translate("发送时间"))
|
||||
a.rmempty = true
|
||||
|
||||
a:value("",translate("关闭"))
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default="关闭"
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","1")
|
||||
|
||||
a=s:taboption("crontab", ListValue,"interval_time",translate("发送间隔"))
|
||||
a.rmempty = true
|
||||
for t=1,23 do
|
||||
a:value(t,translate(t.."小时"))
|
||||
end
|
||||
a.default=6
|
||||
a.datatype=uinteger
|
||||
a:depends("send_mode","2")
|
||||
a.description = translate("<br/>从 00:00 开始,每 * 小时发送一次")
|
||||
|
||||
a= s:taboption("crontab", Value, "send_title", translate("推送标题"))
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
a.placeholder = "OpenWrt By tty228 路由状态:"
|
||||
a.description = translate("<br/>使用特殊符号可能会造成发送失败")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_status",translate("系统运行情况"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_temp",translate("设备温度"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"router_wan",translate("WAN信息"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
a=s:taboption("crontab", Flag,"client_list",translate("客户端列表"))
|
||||
a.default=1
|
||||
a:depends("send_mode","1")
|
||||
a:depends("send_mode","2")
|
||||
|
||||
e=s:taboption("crontab", Button,"_add",translate("手动发送"))
|
||||
e.inputtitle=translate("发送")
|
||||
e:depends("send_mode","1")
|
||||
e:depends("send_mode","2")
|
||||
e.inputstyle = "apply"
|
||||
function e.write(self, section)
|
||||
luci.sys.call("cbi.apply")
|
||||
luci.sys.call("/usr/bin/pushbot/pushbot send &")
|
||||
end
|
||||
|
||||
--免打扰
|
||||
a=s:taboption("disturb", ListValue,"pushbot_sheep",translate("免打扰时段设置"),translate("在指定整点时间段内,暂停推送消息<br/>免打扰时间中,定时推送也会被阻止。"))
|
||||
a.rmempty = true
|
||||
|
||||
a:value("",translate("关闭"))
|
||||
a:value("1",translate("模式一:脚本挂起"))
|
||||
a:value("2",translate("模式二:静默模式"))
|
||||
a.description = translate("模式一停止一切检测,包括无人值守。")
|
||||
a=s:taboption("disturb", ListValue,"starttime",translate("免打扰开始时间"))
|
||||
a.rmempty = true
|
||||
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default=0
|
||||
a.datatype=uinteger
|
||||
a:depends({pushbot_sheep="1"})
|
||||
a:depends({pushbot_sheep="2"})
|
||||
a=s:taboption("disturb", ListValue,"endtime",translate("免打扰结束时间"))
|
||||
a.rmempty = true
|
||||
|
||||
for t=0,23 do
|
||||
a:value(t,translate("每天"..t.."点"))
|
||||
end
|
||||
a.default=8
|
||||
a.datatype=uinteger
|
||||
a:depends({pushbot_sheep="1"})
|
||||
a:depends({pushbot_sheep="2"})
|
||||
|
||||
a=s:taboption("disturb", ListValue,"macmechanism",translate("MAC过滤"))
|
||||
a:value("",translate("disable"))
|
||||
a:value("allow",translate("忽略列表内设备"))
|
||||
a:value("block",translate("仅通知列表内设备"))
|
||||
a:value("interface",translate("仅通知此接口设备"))
|
||||
a.rmempty = true
|
||||
|
||||
|
||||
a = s:taboption("disturb", DynamicList, "pushbot_whitelist", translate("忽略列表"))
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({macmechanism="allow"})
|
||||
|
||||
a = s:taboption("disturb", DynamicList, "pushbot_blacklist", translate("关注列表"))
|
||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a.rmempty = true
|
||||
a:depends({macmechanism="block"})
|
||||
|
||||
a = s:taboption("disturb", ListValue, "pushbot_interface", translate("接口名称"))
|
||||
a:depends({macmechanism="interface"})
|
||||
a.rmempty = true
|
||||
|
||||
for _, iface in ipairs(ifaces) do
|
||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||
local nets = net:get_interface(iface)
|
||||
nets = nets and nets:get_networks() or {}
|
||||
for k, v in pairs(nets) do
|
||||
nets[k] = nets[k].sid
|
||||
end
|
||||
nets = table.concat(nets, ",")
|
||||
a:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface))
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
|
@ -1,33 +1,33 @@
|
||||
<%
|
||||
local dsp = require "luci.dispatcher"
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clearlog(btn) {
|
||||
XHR.get('<%=dsp.build_url("admin/services/pushbot/clear_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
XHR.poll(2, '<%=dsp.build_url("admin/services/pushbot/get_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200 && document.getElementById("checkbox1").checked == true) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input type="checkbox" id="checkbox1" style="vertical-align:middle;height: auto;"checked><%:自动刷新%></input>
|
||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clearlog()" value="<%:Clear logs%>" />
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: 100%;margin-top: 10px;" data-update="change" rows="30" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
||||
<%
|
||||
local dsp = require "luci.dispatcher"
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clearlog(btn) {
|
||||
XHR.get('<%=dsp.build_url("admin/services/pushbot/clear_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
XHR.poll(2, '<%=dsp.build_url("admin/services/pushbot/get_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200 && document.getElementById("checkbox1").checked == true) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input type="checkbox" id="checkbox1" style="vertical-align:middle;height: auto;"checked><%:自动刷新%></input>
|
||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clearlog()" value="<%:清除日志%>" />
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: 100%;margin-top: 10px;" data-update="change" rows="30" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
||||
|
@ -1,22 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[pushbot]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('pushbot_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>pushbot <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>pushbot <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="pushbot_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[pushbot]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('pushbot_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>pushbot <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>pushbot <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="pushbot_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
config pushbot 'pushbot'
|
||||
option pushbot_enable '0'
|
||||
option sleeptime '60'
|
||||
option pushbot_ipv6 '0'
|
||||
option pushbot_up '1'
|
||||
option pushbot_down '1'
|
||||
option cpuload_enable '1'
|
||||
option cpuload '2'
|
||||
option temperature_enable '0'
|
||||
|
||||
|
||||
config pushbot 'pushbot'
|
||||
option pushbot_enable '0'
|
||||
option sleeptime '60'
|
||||
option pushbot_ipv6 '0'
|
||||
option pushbot_up '1'
|
||||
option pushbot_down '1'
|
||||
option cpuload_enable '1'
|
||||
option cpuload '2'
|
||||
option temperature_enable '0'
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
start() {
|
||||
state=`pgrep -f "/usr/bin/pushbot/pushbot"`
|
||||
if [ ! -z "$state" ]; then
|
||||
restart
|
||||
else
|
||||
/usr/bin/pushbot/pushbot &
|
||||
fi
|
||||
echo "pushbot is starting now ..."
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill -9 `pgrep -f "/usr/bin/pushbot/pushbot"` 2>/dev/null
|
||||
echo "pushbot exit ..."
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
echo "restarted."
|
||||
}
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
start() {
|
||||
state=`pgrep -f "/usr/bin/pushbot/pushbot"`
|
||||
if [ ! -z "$state" ]; then
|
||||
restart
|
||||
else
|
||||
/usr/bin/pushbot/pushbot &
|
||||
fi
|
||||
echo "pushbot is starting now ..."
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill -9 `pgrep -f "/usr/bin/pushbot/pushbot"` 2>/dev/null
|
||||
echo "pushbot exit ..."
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
echo "restarted."
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@pushbot[-1]
|
||||
add ucitrack pushbot
|
||||
set ucitrack.@pushbot[-1].init=pushbot
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@pushbot[-1]
|
||||
add ucitrack pushbot
|
||||
set ucitrack.@pushbot[-1].init=pushbot
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
{
|
||||
"luci-app-pushbot": {
|
||||
"description": "Grant UCI access for luci-app-pushbot",
|
||||
"read": {
|
||||
"uci": [ "pushbot" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "pushbot" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"luci-app-pushbot": {
|
||||
"description": "Grant UCI access for luci-app-pushbot",
|
||||
"read": {
|
||||
"uci": [ "pushbot" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "pushbot" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user