mirror of
https://github.com/kenzok8/openwrt-packages
synced 2025-01-09 04:37:38 +08:00
update 2022-06-01 20:21:23
This commit is contained in:
parent
50b7241ed8
commit
9c17b2cff7
@ -1,7 +1,6 @@
|
|||||||
module("luci.controller.serverchan", package.seeall)
|
module("luci.controller.serverchan", package.seeall)
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
|
|
||||||
if not nixio.fs.access("/etc/config/serverchan") then
|
if not nixio.fs.access("/etc/config/serverchan") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -1,124 +1,124 @@
|
|||||||
local nt = require "luci.sys".net
|
local nt = require "luci.sys".net
|
||||||
local fs=require"nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
|
|
||||||
m=Map("serverchan",translate("提示:"),
|
m = Map("serverchan", translate("提示:"))
|
||||||
translate("如果你不了解这些选项的含义,请不要修改这些选项"))
|
m.description = translate("如果你不了解这些选项的含义,请不要修改这些选项")
|
||||||
|
|
||||||
s = m:section(TypedSection, "serverchan", "高级设置")
|
s = m:section(TypedSection, "serverchan", "高级设置")
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
s.addremove = false
|
s.addremove = false
|
||||||
|
|
||||||
a=s:option(Value,"up_timeout",translate('设备上线检测超时(s)'))
|
a = s:option(Value, "up_timeout", translate('设备上线检测超时(s)'))
|
||||||
a.default = "2"
|
a.default = "2"
|
||||||
a.optional=false
|
a.optional = false
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
|
|
||||||
a=s:option(Value,"down_timeout",translate('设备离线检测超时(s)'))
|
a = s:option(Value, "down_timeout", translate('设备离线检测超时(s)'))
|
||||||
a.default = "20"
|
a.default = "20"
|
||||||
a.optional=false
|
a.optional = false
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
|
|
||||||
a=s:option(Value,"timeout_retry_count",translate('离线检测次数'))
|
a = s:option(Value, "timeout_retry_count", translate('离线检测次数'))
|
||||||
a.default = "2"
|
a.default = "2"
|
||||||
a.optional=false
|
a.optional = false
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
||||||
|
|
||||||
a=s:option(Value,"thread_num",translate('最大并发进程数'))
|
a = s:option(Value, "thread_num", translate('最大并发进程数'))
|
||||||
a.default = "3"
|
a.default = "3"
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
|
|
||||||
a=s:option(Value, "soc_code", "自定义温度读取命令")
|
a = s:option(Value, "soc_code", "自定义温度读取命令")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:value("",translate("默认"))
|
a:value("", translate("默认"))
|
||||||
a:value("pve",translate("PVE 虚拟机"))
|
a:value("pve", translate("PVE 虚拟机"))
|
||||||
a.description = translate("自定义命令如需使用特殊符号,如引号、$、!等,则需要自行转义,并在保存后查看 /etc/config/serverchan 文件 soc_code 设置项是否保存正确<br/>可以使用 eval `echo $(uci get serverchan.serverchan.soc_code)` 命令查看命令输出及错误信息<br/>执行结果需为纯数字(可带小数),用于温度对比")
|
a.description = translate("自定义命令如需使用特殊符号,如引号、$、!等,则需要自行转义,并在保存后查看 /etc/config/serverchan 文件 soc_code 设置项是否保存正确<br/>可以使用 eval `echo $(uci get serverchan.serverchan.soc_code)` 命令查看命令输出及错误信息<br/>执行结果需为纯数字(可带小数),用于温度对比")
|
||||||
|
|
||||||
a=s:option(Value,"server_host",translate("宿主机地址"))
|
a = s:option(Value, "server_host", translate("宿主机地址"))
|
||||||
a.rmempty=true
|
a.rmempty = true
|
||||||
a.default="10.0.0.2"
|
a.default = "10.0.0.2"
|
||||||
a.description = translate("")
|
a.description = translate("")
|
||||||
a:depends({soc_code="pve"})
|
a:depends({soc_code = "pve"})
|
||||||
|
|
||||||
a=s:option(Value,"server_port",translate("宿主机 SSH 端口"))
|
a = s:option(Value, "server_port", translate("宿主机 SSH 端口"))
|
||||||
a.rmempty=true
|
a.rmempty = true
|
||||||
a.default="22"
|
a.default = "22"
|
||||||
a.description = translate("SSH 端口默认为 22,如有自定义,请填写自定义 SSH 端口<br/>请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!<br/>PVE 安装 sensors 命令自行百度<br/>密钥登陆例(自行修改地址与端口号):<br/>opkg update #更新列表<br/>opkg install openssh-client openssh-keygen #安装openssh客户端<br/>echo -e \"\\n\" | ssh-keygen -t rsa # 生成密钥文件(空密码)<br/>pve_host=`uci get serverchan.serverchan.server_host` || pve_host=\"10.0.0.3\" # 读取配置文件中的 pve 主机地址,如果不存在请自行填写 <br/>pve_port=`uci get serverchan.serverchan.server_port` || pve_host=\"22\" # 读取配置文件中的 pve 主机 ssh 端口号,,如果不存在请自行填写 <br/>ssh root@${pve_host} -p ${pve_port} \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE<br/>ssh root@${pve_host} -p ${pve_port} \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE<br/>ssh -i /root/.ssh/id_rsa root@${pve_host} -p ${pve_port} sensors # 使用私钥连接 PVE 测试温度命令<br/>刷机党自行将 /root/.ssh/ 加入备份列表,避免重复操作")
|
a.description = translate("SSH 端口默认为 22,如有自定义,请填写自定义 SSH 端口<br/>请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!<br/>PVE 安装 sensors 命令自行百度<br/>密钥登陆例(自行修改地址与端口号):<br/>opkg update #更新列表<br/>opkg install openssh-client openssh-keygen #安装openssh客户端<br/>echo -e \"\\n\" | ssh-keygen -t rsa # 生成密钥文件(空密码)<br/>pve_host=`uci get serverchan.serverchan.server_host` || pve_host=\"10.0.0.3\" # 读取配置文件中的 pve 主机地址,如果不存在请自行填写 <br/>pve_port=`uci get serverchan.serverchan.server_port` || pve_host=\"22\" # 读取配置文件中的 pve 主机 ssh 端口号,,如果不存在请自行填写 <br/>ssh root@${pve_host} -p ${pve_port} \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE<br/>ssh root@${pve_host} -p ${pve_port} \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE<br/>ssh -i /root/.ssh/id_rsa root@${pve_host} -p ${pve_port} sensors # 使用私钥连接 PVE 测试温度命令<br/>刷机党自行将 /root/.ssh/ 加入备份列表,避免重复操作")
|
||||||
a:depends({soc_code="pve"})
|
a:depends({soc_code = "pve"})
|
||||||
|
|
||||||
a=s:option(Button,"soc",translate("测试温度命令"))
|
a = s:option(Button, "soc", translate("测试温度命令"))
|
||||||
a.inputtitle = translate("输出信息")
|
a.inputtitle = translate("输出信息")
|
||||||
a.write = function()
|
a.write = function()
|
||||||
luci.sys.call("/usr/bin/serverchan/serverchan soc")
|
luci.sys.call("/usr/bin/serverchan/serverchan soc")
|
||||||
luci.http.redirect(luci.dispatcher.build_url("admin","services","serverchan","advanced"))
|
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "serverchan", "advanced"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if nixio.fs.access("/tmp/serverchan/soc_tmp") then
|
if nixio.fs.access("/tmp/serverchan/soc_tmp") then
|
||||||
e=s:option(TextValue,"soc_tmp")
|
e = s:option(TextValue,"soc_tmp")
|
||||||
e.rows=2
|
e.rows = 2
|
||||||
e.readonly=true
|
e.readonly = true
|
||||||
e.cfgvalue = function()
|
e.cfgvalue = function()
|
||||||
return luci.sys.exec("cat /tmp/serverchan/soc_tmp && rm -f /tmp/serverchan/soc_tmp")
|
return luci.sys.exec("cat /tmp/serverchan/soc_tmp && rm -f /tmp/serverchan/soc_tmp")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
a=s:option(Flag,"err_enable",translate("无人值守任务"))
|
a = s:option(Flag, "err_enable", translate("无人值守任务"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty=true
|
a.rmempty = true
|
||||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
||||||
|
|
||||||
a=s:option(Flag,"err_sheep_enable",translate("仅在免打扰时段重拨"))
|
a = s:option(Flag, "err_sheep_enable", translate("仅在免打扰时段重拨"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty=true
|
a.rmempty = true
|
||||||
a.description = translate("避免白天重拨 DDNS 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
a.description = translate("避免白天重拨 DDNS 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||||
a:depends({err_enable="1"})
|
a:depends({err_enable = "1"})
|
||||||
|
|
||||||
a= s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
a = s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
||||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a:depends({err_enable="1"})
|
a:depends({err_enable = "1"})
|
||||||
|
|
||||||
a=s:option(ListValue,"network_err_event",translate("网络断开时"))
|
a = s:option(ListValue, "network_err_event", translate("网络断开时"))
|
||||||
a.default=""
|
a.default = ""
|
||||||
a:depends({err_enable="1"})
|
a:depends({err_enable = "1"})
|
||||||
a:value("",translate("无操作"))
|
a:value("", translate("无操作"))
|
||||||
a:value("1",translate("重启路由器"))
|
a:value("1", translate("重启路由器"))
|
||||||
a:value("2",translate("重新拨号"))
|
a:value("2", translate("重新拨号"))
|
||||||
a:value("3",translate("修改相关设置项,尝试自动修复网络"))
|
a:value("3", translate("修改相关设置项,尝试自动修复网络"))
|
||||||
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/bin/serverchan/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/bin/serverchan/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||||
|
|
||||||
a=s:option(ListValue,"system_time_event",translate("定时重启"))
|
a = s:option(ListValue, "system_time_event", translate("定时重启"))
|
||||||
a.default=""
|
a.default = ""
|
||||||
a:depends({err_enable="1"})
|
a:depends({err_enable = "1"})
|
||||||
a:value("",translate("无操作"))
|
a:value("", translate("无操作"))
|
||||||
a:value("1",translate("重启路由器"))
|
a:value("1", translate("重启路由器"))
|
||||||
a:value("2",translate("重新拨号"))
|
a:value("2", translate("重新拨号"))
|
||||||
|
|
||||||
a= s:option(Value, "autoreboot_time", "系统运行时间大于")
|
a = s:option(Value, "autoreboot_time", "系统运行时间大于")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default = "24"
|
a.default = "24"
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
a:depends({system_time_event="1"})
|
a:depends({system_time_event = "1"})
|
||||||
a.description = translate("单位为小时")
|
a.description = translate("单位为小时")
|
||||||
|
|
||||||
a=s:option(Value, "network_restart_time", "网络在线时间大于")
|
a = s:option(Value, "network_restart_time", "网络在线时间大于")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default = "24"
|
a.default = "24"
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
a:depends({system_time_event="2"})
|
a:depends({system_time_event = "2"})
|
||||||
a.description = translate("单位为小时")
|
a.description = translate("单位为小时")
|
||||||
|
|
||||||
a=s:option(Flag,"public_ip_event",translate("重拨尝试获取公网 IP"))
|
a = s:option(Flag, "public_ip_event", translate("重拨尝试获取公网 IP"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty=true
|
a.rmempty = true
|
||||||
a:depends({err_enable="1"})
|
a:depends({err_enable = "1"})
|
||||||
a.description = translate("重拨时不会推送 IP 变动通知,并会导致你的域名无法及时更新 IP 地址<br/>请确认你可以通过重拨获取公网 IP,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
a.description = translate("重拨时不会推送 IP 变动通知,并会导致你的域名无法及时更新 IP 地址<br/>请确认你可以通过重拨获取公网 IP,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
||||||
|
|
||||||
a= s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
a = s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default = "10"
|
a.default = "10"
|
||||||
a.datatype="uinteger"
|
a.datatype = "uinteger"
|
||||||
a:depends({public_ip_event="1"})
|
a:depends({public_ip_event = "1"})
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -3,4 +3,5 @@ luci.sys.call("/usr/bin/serverchan/serverchan client")
|
|||||||
f.reset = false
|
f.reset = false
|
||||||
f.submit = false
|
f.submit = false
|
||||||
f:append(Template("serverchan/serverchan_client"))
|
f:append(Template("serverchan/serverchan_client"))
|
||||||
|
|
||||||
return f
|
return f
|
||||||
|
@ -2,4 +2,5 @@ f = SimpleForm("serverchan")
|
|||||||
f.reset = false
|
f.reset = false
|
||||||
f.submit = false
|
f.submit = false
|
||||||
f:append(Template("serverchan/serverchan_log"))
|
f:append(Template("serverchan/serverchan_log"))
|
||||||
|
|
||||||
return f
|
return f
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
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()
|
||||||
local net = require "luci.model.network".init()
|
local net = require "luci.model.network".init()
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
local ifaces = sys.net:devices()
|
local ifaces = sys.net:devices()
|
||||||
|
|
||||||
m=Map("serverchan",translate("ServerChan"),
|
m = Map("serverchan", translate("ServerChan"),
|
||||||
translate("「Server酱」,英文名「ServerChan」,是一款从服务器推送报警信息和日志到微信的工具。<br /><br />如果你在使用中遇到问题,请到这里提交:")
|
translate("「Server酱」,英文名「ServerChan」,是一款从服务器推送报警信息和日志到微信的工具。<br /><br />如果你在使用中遇到问题,请到这里提交:")
|
||||||
.. [[<a href="https://github.com/tty228/luci-app-serverchan" target="_blank">]]
|
.. [[<a href="https://github.com/tty228/luci-app-serverchan" target="_blank">]]
|
||||||
.. translate("GitHub 项目地址")
|
.. translate("GitHub 项目地址")
|
||||||
@ -15,7 +14,7 @@ translate("「Server酱」,英文名「ServerChan」,是一款从服务器
|
|||||||
|
|
||||||
m:section(SimpleSection).template = "serverchan/serverchan_status"
|
m:section(SimpleSection).template = "serverchan/serverchan_status"
|
||||||
|
|
||||||
s=m:section(NamedSection,"serverchan","serverchan",translate(""))
|
s = m:section(NamedSection, "serverchan", "serverchan", translate(""))
|
||||||
s:tab("basic", translate("基本设置"))
|
s:tab("basic", translate("基本设置"))
|
||||||
s:tab("content", translate("推送内容"))
|
s:tab("content", translate("推送内容"))
|
||||||
s:tab("crontab", translate("定时推送"))
|
s:tab("crontab", translate("定时推送"))
|
||||||
@ -24,7 +23,7 @@ s.addremove = false
|
|||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
|
|
||||||
--基本设置
|
--基本设置
|
||||||
a=s:taboption("basic", Flag,"serverchan_enable",translate("启用"))
|
a = s:taboption("basic", Flag, "serverchan_enable", translate("启用"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a = s:taboption("basic", MultiValue, "lite_enable", translate("精简模式"))
|
a = s:taboption("basic", MultiValue, "lite_enable", translate("精简模式"))
|
||||||
@ -35,132 +34,139 @@ a.widget = "checkbox"
|
|||||||
a.default = nil
|
a.default = nil
|
||||||
a.optional = true
|
a.optional = true
|
||||||
|
|
||||||
a=s:taboption("basic", ListValue,"jsonpath",translate("推送模式"))
|
a = s:taboption("basic", ListValue, "jsonpath", translate("推送模式"))
|
||||||
a.default="/usr/bin/serverchan/api/serverchan.json"
|
a.default = "/usr/bin/serverchan/api/serverchan.json"
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:value("/usr/bin/serverchan/api/serverchan.json",translate("微信 Server酱"))
|
a:value("/usr/bin/serverchan/api/serverchan.json", translate("微信 Server酱"))
|
||||||
a:value("/usr/bin/serverchan/api/qywx_mpnews.json",translate("企业微信 图文消息"))
|
a:value("/usr/bin/serverchan/api/qywx_mpnews.json", translate("企业微信 图文消息"))
|
||||||
a:value("/usr/bin/serverchan/api/qywx_markdown.json",translate("企业微信 markdown版(不支持公众号)"))
|
a:value("/usr/bin/serverchan/api/qywx_markdown.json", translate("企业微信 markdown版(不支持公众号)"))
|
||||||
a:value("/usr/bin/serverchan/api/wxpusher.json",translate("微信 wxpusher"))
|
a:value("/usr/bin/serverchan/api/wxpusher.json", translate("微信 wxpusher"))
|
||||||
a:value("/usr/bin/serverchan/api/pushplus.json",translate("微信 pushplus"))
|
a:value("/usr/bin/serverchan/api/pushplus.json", translate("微信 pushplus"))
|
||||||
a:value("/usr/bin/serverchan/api/telegram.json",translate("Telegram"))
|
a:value("/usr/bin/serverchan/api/telegram.json", translate("Telegram"))
|
||||||
a:value("/usr/bin/serverchan/api/diy.json",translate("自定义推送"))
|
a:value("/usr/bin/serverchan/api/diy.json", translate("自定义推送"))
|
||||||
|
|
||||||
a=s:taboption("basic", Value,"sckey",translate('微信推送/新旧共用'), translate("").."Server酱 sendkey <a href='https://sct.ftqq.com/' target='_blank'>点击这里</a><br>")
|
a = s:taboption("basic", Value, "sckey", translate('微信推送/新旧共用'), translate("").."Server酱 sendkey <a href='https://sct.ftqq.com/' target='_blank'>点击这里</a><br>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/serverchan.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/serverchan.json")
|
||||||
|
|
||||||
a=s:taboption("basic", Value,"corpid",translate('企业ID(corpid)'),translate("").."获取说明 <a href='https://work.weixin.qq.com/api/doc/10013' target='_blank'>点击这里</a>")
|
a = s:taboption("basic", Value, "corpid", translate('企业ID(corpid)'), translate("").."获取说明 <a href='https://work.weixin.qq.com/api/doc/10013' target='_blank'>点击这里</a>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_mpnews.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_mpnews.json")
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_markdown.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_markdown.json")
|
||||||
a=s:taboption("basic", Value,"userid",translate('帐号(userid)'))
|
|
||||||
|
a = s:taboption("basic", Value, "userid", translate('帐号(userid)'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.description = translate("群发到应用请填入 @all ")
|
a.description = translate("群发到应用请填入 @all ")
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_mpnews.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_mpnews.json")
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_markdown.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_markdown.json")
|
||||||
a=s:taboption("basic", Value,"agentid",translate('应用id(agentid)'))
|
|
||||||
|
a = s:taboption("basic", Value, "agentid", translate('应用id(agentid)'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_mpnews.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_mpnews.json")
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_markdown.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_markdown.json")
|
||||||
a=s:taboption("basic", Value,"corpsecret",translate('应用密钥(Secret)'))
|
|
||||||
|
a = s:taboption("basic", Value, "corpsecret", translate('应用密钥(Secret)'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_mpnews.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_mpnews.json")
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_markdown.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_markdown.json")
|
||||||
a=s:taboption("basic", Value,"mediapath",translate('图片缩略图文件路径'))
|
|
||||||
|
a = s:taboption("basic", Value, "mediapath", translate('图片缩略图文件路径'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default = "/usr/bin/serverchan/api/logo.jpg"
|
a.default = "/usr/bin/serverchan/api/logo.jpg"
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/qywx_mpnews.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/qywx_mpnews.json")
|
||||||
a.description = translate("只支持 2MB 以内 JPG,PNG 格式 <br> 900*383 或 2.35:1 为佳 ")
|
a.description = translate("只支持 2MB 以内 JPG,PNG 格式 <br> 900*383 或 2.35:1 为佳 ")
|
||||||
|
|
||||||
a=s:taboption("basic",Value,"wxpusher_apptoken",translate('appToken'),translate("").."获取 appToken <a href='https://wxpusher.zjiecode.com/docs/#/?id=%e5%bf%ab%e9%80%9f%e6%8e%a5%e5%85%a5' target='_blank'>点击这里</a><br>")
|
a = s:taboption("basic", Value, "wxpusher_apptoken", translate('appToken'), translate("").."获取 appToken <a href='https://wxpusher.zjiecode.com/docs/#/?id=%e5%bf%ab%e9%80%9f%e6%8e%a5%e5%85%a5' target='_blank'>点击这里</a><br>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/wxpusher.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/wxpusher.json")
|
||||||
a=s:taboption("basic", Value,"wxpusher_uids",translate('uids'))
|
|
||||||
a.rmempty = true
|
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/wxpusher.json")
|
|
||||||
a=s:taboption("basic",Value,"wxpusher_topicIds",translate('topicIds(群发)'),translate("").."接口说明 <a href='https://wxpusher.zjiecode.com/docs/#/?id=%e5%8f%91%e9%80%81%e6%b6%88%e6%81%af-1'target='_blank'>点击这里</a><br>")
|
|
||||||
a.rmempty = true
|
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/wxpusher.json")
|
|
||||||
|
|
||||||
a=s:taboption("basic",Value,"pushplus_token",translate('pushplus_token'),translate("").."获取pushplus_token <a href='http://www.pushplus.plus/' target='_blank'>点击这里</a><br>")
|
a = s:taboption("basic", Value,"wxpusher_uids",translate('uids'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/pushplus.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/wxpusher.json")
|
||||||
|
|
||||||
a=s:taboption("basic", Value, "tg_token", translate("TG_token"),translate("").."获取机器人<a href='https://t.me/BotFather' target='_blank'>点击这里</a><br>与创建的机器人发一条消息,开启对话<br>")
|
a = s:taboption("basic", Value, "wxpusher_topicIds", translate('topicIds(群发)'), translate("").."接口说明 <a href='https://wxpusher.zjiecode.com/docs/#/?id=%e5%8f%91%e9%80%81%e6%b6%88%e6%81%af-1'target='_blank'>点击这里</a><br>")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/telegram.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/wxpusher.json")
|
||||||
a=s:taboption("basic", Value,"chat_id",translate('TG_chatid'),translate("").."获取 chat_id <a href='https://t.me/getuserIDbot' target='_blank'>点击这里</a>")
|
|
||||||
a.rmempty = true
|
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/telegram.json")
|
|
||||||
|
|
||||||
a=s:taboption("basic", TextValue, "diy_json", translate("自定义推送"))
|
a = s:taboption("basic", Value, "pushplus_token", translate('pushplus_token'), translate("").."获取pushplus_token <a href='http://www.pushplus.plus/' target='_blank'>点击这里</a><br>")
|
||||||
|
a.rmempty = true
|
||||||
|
a:depends("jsonpath", "/usr/bin/serverchan/api/pushplus.json")
|
||||||
|
|
||||||
|
a = s:taboption("basic", Value, "tg_token", translate("TG_token"), translate("").."获取机器人<a href='https://t.me/BotFather' target='_blank'>点击这里</a><br>与创建的机器人发一条消息,开启对话<br>")
|
||||||
|
a.rmempty = true
|
||||||
|
a:depends("jsonpath", "/usr/bin/serverchan/api/telegram.json")
|
||||||
|
|
||||||
|
a = s:taboption("basic", Value, "chat_id", translate('TG_chatid'), translate("").."获取 chat_id <a href='https://t.me/getuserIDbot' target='_blank'>点击这里</a>")
|
||||||
|
a.rmempty = true
|
||||||
|
a:depends("jsonpath", "/usr/bin/serverchan/api/telegram.json")
|
||||||
|
|
||||||
|
a = s:taboption("basic", TextValue, "diy_json", translate("自定义推送"))
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.rows = 28
|
a.rows = 28
|
||||||
a.wrap = "soft"
|
a.wrap = "soft"
|
||||||
a.cfgvalue = function(self, section)
|
a.cfgvalue = function(self, section)
|
||||||
return fs.readfile("/usr/bin/serverchan/api/diy.json")
|
return fs.readfile("/usr/bin/serverchan/api/diy.json")
|
||||||
end
|
end
|
||||||
a.write = function(self, section, value)
|
a.write = function(self, section, value)
|
||||||
fs.writefile("/usr/bin/serverchan/api/diy.json", value:gsub("\r\n", "\n"))
|
fs.writefile("/usr/bin/serverchan/api/diy.json", value:gsub("\r\n", "\n"))
|
||||||
end
|
end
|
||||||
a:depends("jsonpath","/usr/bin/serverchan/api/diy.json")
|
a:depends("jsonpath", "/usr/bin/serverchan/api/diy.json")
|
||||||
|
|
||||||
a=s:taboption("basic", Button,"__add",translate("发送测试"))
|
a = s:taboption("basic", Button, "__add", translate("发送测试"))
|
||||||
a.inputtitle=translate("发送")
|
a.inputtitle = translate("发送")
|
||||||
a.inputstyle = "apply"
|
a.inputstyle = "apply"
|
||||||
function a.write(self, section)
|
function a.write(self, section)
|
||||||
luci.sys.call("cbi.apply")
|
luci.sys.call("cbi.apply")
|
||||||
luci.sys.call("/usr/bin/serverchan/serverchan test &")
|
luci.sys.call("/usr/bin/serverchan/serverchan test &")
|
||||||
end
|
end
|
||||||
|
|
||||||
a=s:taboption("basic", Value,"device_name",translate('本设备名称'))
|
a = s:taboption("basic", Value, "device_name", translate('本设备名称'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.description = translate("在推送信息标题中会标识本设备名称,用于区分推送信息的来源设备")
|
a.description = translate("在推送信息标题中会标识本设备名称,用于区分推送信息的来源设备")
|
||||||
|
|
||||||
a=s:taboption("basic", Value,"sleeptime",translate('检测时间间隔(s)'))
|
a = s:taboption("basic", Value, "sleeptime", translate('检测时间间隔(s)'))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.default = "60"
|
a.default = "60"
|
||||||
a.datatype="and(uinteger,min(10))"
|
a.datatype = "and(uinteger,min(10))"
|
||||||
a.description = translate("越短的时间时间响应越及时,但会占用更多的系统资源")
|
a.description = translate("越短的时间时间响应越及时,但会占用更多的系统资源")
|
||||||
|
|
||||||
a=s:taboption("basic", ListValue,"oui_data",translate("MAC设备信息数据库"))
|
a = s:taboption("basic", ListValue, "oui_data", translate("MAC设备信息数据库"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default=""
|
a.default = ""
|
||||||
a:value("",translate("关闭"))
|
a:value("", translate("关闭"))
|
||||||
a:value("1",translate("简化版"))
|
a:value("1", translate("简化版"))
|
||||||
a:value("2",translate("完整版"))
|
a:value("2", translate("完整版"))
|
||||||
a:value("3",translate("网络查询"))
|
a:value("3", translate("网络查询"))
|
||||||
a.description = translate("需下载 4.36 MB 原始数据,处理后完整版约 1.2 MB,简化版约 250 kB <br/>若无梯子,请勿使用网络查询")
|
a.description = translate("需下载 4.36 MB 原始数据,处理后完整版约 1.2 MB,简化版约 250 kB <br/>若无梯子,请勿使用网络查询")
|
||||||
|
|
||||||
a=s:taboption("basic", Flag,"oui_dir",translate("下载到内存"))
|
a = s:taboption("basic", Flag, "oui_dir", translate("下载到内存"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("oui_data","1")
|
a:depends("oui_data", "1")
|
||||||
a:depends("oui_data","2")
|
a:depends("oui_data", "2")
|
||||||
a.description = translate("懒得做自动更新了,下载到内存中,重启会重新下载 <br/>若无梯子,还是下到机身吧")
|
a.description = translate("懒得做自动更新了,下载到内存中,重启会重新下载 <br/>若无梯子,还是下到机身吧")
|
||||||
|
|
||||||
a=s:taboption("basic", Flag,"reset_regularly",translate("每天零点重置流量数据"))
|
a = s:taboption("basic", Flag, "reset_regularly", translate("每天零点重置流量数据"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("basic", Flag,"debuglevel",translate("开启日志"))
|
a = s:taboption("basic", Flag, "debuglevel", translate("开启日志"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a= s:taboption("basic", DynamicList, "device_aliases", translate("设备别名"))
|
a = s:taboption("basic", DynamicList, "device_aliases", translate("设备别名"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.description = translate("<br/> 请输入设备 MAC 和设备别名,用“-”隔开,如:<br/> XX:XX:XX:XX:XX:XX-我的手机")
|
a.description = translate("<br/> 请输入设备 MAC 和设备别名,用“-”隔开,如:<br/> XX:XX:XX:XX:XX:XX-我的手机")
|
||||||
|
|
||||||
--设备状态
|
--设备状态
|
||||||
a=s:taboption("content", ListValue,"serverchan_ipv4",translate("IPv4 变动通知"))
|
a = s:taboption("content", ListValue, "serverchan_ipv4", translate("IPv4 变动通知"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default=""
|
a.default = ""
|
||||||
a:value("",translate("关闭"))
|
a:value("", translate("关闭"))
|
||||||
a:value("1",translate("通过接口获取"))
|
a:value("1", translate("通过接口获取"))
|
||||||
a:value("2",translate("通过URL获取"))
|
a:value("2", translate("通过URL获取"))
|
||||||
|
|
||||||
a = s:taboption("content", ListValue, "ipv4_interface", translate("接口名称"))
|
a = s:taboption("content", ListValue, "ipv4_interface", translate("接口名称"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({serverchan_ipv4="1"})
|
a:depends({serverchan_ipv4 = "1"})
|
||||||
for _, iface in ipairs(ifaces) do
|
for _, iface in ipairs(ifaces) do
|
||||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||||
local nets = net:get_interface(iface)
|
local nets = net:get_interface(iface)
|
||||||
@ -174,29 +180,29 @@ for _, iface in ipairs(ifaces) do
|
|||||||
end
|
end
|
||||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||||
|
|
||||||
a=s:taboption("content", TextValue, "ipv4_list", translate("IPv4 API列表"))
|
a = s:taboption("content", TextValue, "ipv4_list", translate("IPv4 API列表"))
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.rows = 8
|
a.rows = 8
|
||||||
a.wrap = "soft"
|
a.wrap = "soft"
|
||||||
a.cfgvalue = function(self, section)
|
a.cfgvalue = function(self, section)
|
||||||
return fs.readfile("/usr/bin/serverchan/api/ipv4.list")
|
return fs.readfile("/usr/bin/serverchan/api/ipv4.list")
|
||||||
end
|
end
|
||||||
a.write = function(self, section, value)
|
a.write = function(self, section, value)
|
||||||
fs.writefile("/usr/bin/serverchan/api/ipv4.list", value:gsub("\r\n", "\n"))
|
fs.writefile("/usr/bin/serverchan/api/ipv4.list", value:gsub("\r\n", "\n"))
|
||||||
end
|
end
|
||||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>如接口可以正常获取 IP,不推荐使用<br/>从以上列表中随机地址访问")
|
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>如接口可以正常获取 IP,不推荐使用<br/>从以上列表中随机地址访问")
|
||||||
a:depends({serverchan_ipv4="2"})
|
a:depends({serverchan_ipv4 = "2"})
|
||||||
|
|
||||||
a=s:taboption("content", ListValue,"serverchan_ipv6",translate("IPv6 变动通知"))
|
a = s:taboption("content", ListValue, "serverchan_ipv6", translate("IPv6 变动通知"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default="disable"
|
a.default = "disable"
|
||||||
a:value("0",translate("关闭"))
|
a:value("0", translate("关闭"))
|
||||||
a:value("1",translate("通过接口获取"))
|
a:value("1", translate("通过接口获取"))
|
||||||
a:value("2",translate("通过URL获取"))
|
a:value("2", translate("通过URL获取"))
|
||||||
|
|
||||||
a = s:taboption("content", ListValue, "ipv6_interface", translate("接口名称"))
|
a = s:taboption("content", ListValue, "ipv6_interface", translate("接口名称"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({serverchan_ipv6="1"})
|
a:depends({serverchan_ipv6 = "1"})
|
||||||
for _, iface in ipairs(ifaces) do
|
for _, iface in ipairs(ifaces) do
|
||||||
if not (iface == "lo" or iface:match("^ifb.*")) then
|
if not (iface == "lo" or iface:match("^ifb.*")) then
|
||||||
local nets = net:get_interface(iface)
|
local nets = net:get_interface(iface)
|
||||||
@ -210,107 +216,106 @@ for _, iface in ipairs(ifaces) do
|
|||||||
end
|
end
|
||||||
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
a.description = translate("<br/>一般选择 wan 接口,多拨环境请自行选择")
|
||||||
|
|
||||||
a=s:taboption("content", TextValue, "ipv6_list", translate("IPv6 API列表"))
|
a = s:taboption("content", TextValue, "ipv6_list", translate("IPv6 API列表"))
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.rows = 8
|
a.rows = 8
|
||||||
a.wrap = "soft"
|
a.wrap = "soft"
|
||||||
a.cfgvalue = function(self, section)
|
a.cfgvalue = function(self, section)
|
||||||
return fs.readfile("/usr/bin/serverchan/api/ipv6.list")
|
return fs.readfile("/usr/bin/serverchan/api/ipv6.list")
|
||||||
end
|
end
|
||||||
a.write = function(self, section, value)
|
a.write = function(self, section, value)
|
||||||
fs.writefile("/usr/bin/serverchan/api/ipv6.list", value:gsub("\r\n", "\n"))
|
fs.writefile("/usr/bin/serverchan/api/ipv6.list", value:gsub("\r\n", "\n"))
|
||||||
end
|
end
|
||||||
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>如接口可以正常获取 IP,不推荐使用<br/>从以上列表中随机地址访问")
|
a.description = translate("<br/>会因服务器稳定性、连接频繁等原因导致获取失败<br/>如接口可以正常获取 IP,不推荐使用<br/>从以上列表中随机地址访问")
|
||||||
a:depends({serverchan_ipv6="2"})
|
a:depends({serverchan_ipv6 = "2"})
|
||||||
|
|
||||||
|
a = s:taboption("content", Flag, "serverchan_up", translate("设备上线通知"))
|
||||||
a=s:taboption("content", Flag,"serverchan_up",translate("设备上线通知"))
|
a.default = 1
|
||||||
a.default=1
|
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"serverchan_down",translate("设备下线通知"))
|
a = s:taboption("content", Flag, "serverchan_down", translate("设备下线通知"))
|
||||||
a.default=1
|
a.default = 1
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"cpuload_enable",translate("CPU 负载报警"))
|
a = s:taboption("content", Flag, "cpuload_enable", translate("CPU 负载报警"))
|
||||||
a.default=1
|
a.default = 1
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a= s:taboption("content", Value, "cpuload", "负载报警阈值")
|
a = s:taboption("content", Value, "cpuload", "负载报警阈值")
|
||||||
a.default = 2
|
a.default = 2
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({cpuload_enable="1"})
|
a:depends({cpuload_enable = "1"})
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"temperature_enable",translate("CPU 温度报警"))
|
a = s:taboption("content", Flag, "temperature_enable", translate("CPU 温度报警"))
|
||||||
a.default=1
|
a.default = 1
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.description = translate("请确认设备可以获取温度,如需修改命令,请移步高级设置")
|
a.description = translate("请确认设备可以获取温度,如需修改命令,请移步高级设置")
|
||||||
|
|
||||||
a= s:taboption("content", Value, "temperature", "温度报警阈值")
|
a = s:taboption("content", Value, "temperature", "温度报警阈值")
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default = "80"
|
a.default = "80"
|
||||||
a.datatype="and(uinteger,min(1))"
|
a.datatype = "and(uinteger,min(1))"
|
||||||
a:depends({temperature_enable="1"})
|
a:depends({temperature_enable = "1"})
|
||||||
a.description = translate("<br/>设备报警只会在连续五分钟超过设定值时才会推送<br/>而且一个小时内不会再提醒第二次")
|
a.description = translate("<br/>设备报警只会在连续五分钟超过设定值时才会推送<br/>而且一个小时内不会再提醒第二次")
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"client_usage",translate("设备异常流量"))
|
a = s:taboption("content", Flag, "client_usage", translate("设备异常流量"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a= s:taboption("content", Value, "client_usage_max", "每分钟流量限制")
|
a = s:taboption("content", Value, "client_usage_max", "每分钟流量限制")
|
||||||
a.default = "10M"
|
a.default = "10M"
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({client_usage="1"})
|
a:depends({client_usage = "1"})
|
||||||
a.description = translate("设备异常流量警报(byte),你可以追加 K 或者 M")
|
a.description = translate("设备异常流量警报(byte),你可以追加 K 或者 M")
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"client_usage_disturb",translate("异常流量免打扰"))
|
a = s:taboption("content", Flag, "client_usage_disturb", translate("异常流量免打扰"))
|
||||||
a.default=1
|
a.default = 1
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({client_usage="1"})
|
a:depends({client_usage = "1"})
|
||||||
|
|
||||||
a = s:taboption("content", DynamicList, "client_usage_whitelist", translate("异常流量关注列表"))
|
a = s:taboption("content", DynamicList, "client_usage_whitelist", translate("异常流量关注列表"))
|
||||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({client_usage_disturb="1"})
|
a:depends({client_usage_disturb = "1"})
|
||||||
a.description = translate("请输入设备 MAC")
|
a.description = translate("请输入设备 MAC")
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"web_logged",translate("web 登录提醒"))
|
a = s:taboption("content", Flag, "web_logged", translate("web 登录提醒"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"ssh_logged",translate("ssh 登录提醒"))
|
a = s:taboption("content", Flag, "ssh_logged", translate("ssh 登录提醒"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"web_login_failed",translate("web 错误尝试提醒"))
|
a = s:taboption("content", Flag, "web_login_failed", translate("web 错误尝试提醒"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"ssh_login_failed",translate("ssh 错误尝试提醒"))
|
a = s:taboption("content", Flag, "ssh_login_failed", translate("ssh 错误尝试提醒"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a= s:taboption("content", Value, "login_max_num", "错误尝试次数")
|
a = s:taboption("content", Value, "login_max_num", "错误尝试次数")
|
||||||
a.default = "3"
|
a.default = "3"
|
||||||
a.datatype="and(uinteger,min(1))"
|
a.datatype = "and(uinteger,min(1))"
|
||||||
a:depends("web_login_failed","1")
|
a:depends("web_login_failed", "1")
|
||||||
a:depends("ssh_login_failed","1")
|
a:depends("ssh_login_failed", "1")
|
||||||
a.description = translate("超过次数后推送提醒")
|
a.description = translate("超过次数后推送提醒")
|
||||||
|
|
||||||
a=s:taboption("content", Flag,"web_login_black",translate("自动拉黑"))
|
a = s:taboption("content", Flag, "web_login_black", translate("自动拉黑"))
|
||||||
a.default=0
|
a.default = 0
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends("web_login_failed","1")
|
a:depends("web_login_failed", "1")
|
||||||
a:depends("ssh_login_failed","1")
|
a:depends("ssh_login_failed", "1")
|
||||||
a.description = translate("直到重启前都不会重置次数,请先添加白名单")
|
a.description = translate("直到重启前都不会重置次数,请先添加白名单")
|
||||||
|
|
||||||
a= s:taboption("content", Value, "ip_black_timeout", "拉黑时间(秒)")
|
a = s:taboption("content", Value, "ip_black_timeout", "拉黑时间(秒)")
|
||||||
a.default = "86400"
|
a.default = "86400"
|
||||||
a.datatype="and(uinteger,min(0))"
|
a.datatype = "and(uinteger,min(0))"
|
||||||
a:depends("web_login_black","1")
|
a:depends("web_login_black", "1")
|
||||||
a.description = translate("0 为永久拉黑,慎用<br>如不幸误操作,请更改设备 IP 进入 LUCI 界面清空规则")
|
a.description = translate("0 为永久拉黑,慎用<br>如不幸误操作,请更改设备 IP 进入 LUCI 界面清空规则")
|
||||||
|
|
||||||
a=s:taboption("content", DynamicList, "ip_white_list", translate("白名单 IP 列表"))
|
a = s:taboption("content", DynamicList, "ip_white_list", translate("白名单 IP 列表"))
|
||||||
a.datatype = "ipaddr"
|
a.datatype = "ipaddr"
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
luci.ip.neighbors({family = 4}, function(entry)
|
luci.ip.neighbors({family = 4}, function(entry)
|
||||||
@ -318,13 +323,13 @@ luci.ip.neighbors({family = 4}, function(entry)
|
|||||||
a:value(entry.dest:string())
|
a:value(entry.dest:string())
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
a:depends("web_logged","1")
|
a:depends("web_logged", "1")
|
||||||
a:depends("ssh_logged","1")
|
a:depends("ssh_logged", "1")
|
||||||
a:depends("web_login_failed","1")
|
a:depends("web_login_failed", "1")
|
||||||
a:depends("ssh_login_failed","1")
|
a:depends("ssh_login_failed", "1")
|
||||||
a.description = translate("忽略白名单登陆提醒和拉黑操作,暂不支持掩码位表示")
|
a.description = translate("忽略白名单登陆提醒和拉黑操作,暂不支持掩码位表示")
|
||||||
|
|
||||||
a=s:taboption("content", TextValue, "ip_black_list", translate("IP 黑名单列表"))
|
a = s:taboption("content", TextValue, "ip_black_list", translate("IP 黑名单列表"))
|
||||||
a.optional = false
|
a.optional = false
|
||||||
a.rows = 8
|
a.rows = 8
|
||||||
a.wrap = "soft"
|
a.wrap = "soft"
|
||||||
@ -334,142 +339,143 @@ end
|
|||||||
a.write = function(self, section, value)
|
a.write = function(self, section, value)
|
||||||
fs.writefile("/usr/bin/serverchan/api/ip_blacklist", value:gsub("\r\n", "\n"))
|
fs.writefile("/usr/bin/serverchan/api/ip_blacklist", value:gsub("\r\n", "\n"))
|
||||||
end
|
end
|
||||||
a:depends("web_login_black","1")
|
a:depends("web_login_black", "1")
|
||||||
|
|
||||||
--定时推送
|
--定时推送
|
||||||
a=s:taboption("crontab", ListValue,"crontab",translate("定时任务设定"))
|
a = s:taboption("crontab", ListValue, "crontab", translate("定时任务设定"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a.default=""
|
a.default = ""
|
||||||
a:value("",translate("关闭"))
|
a:value("", translate("关闭"))
|
||||||
a:value("1",translate("定时发送"))
|
a:value("1", translate("定时发送"))
|
||||||
a:value("2",translate("间隔发送"))
|
a:value("2", translate("间隔发送"))
|
||||||
|
|
||||||
a=s:taboption("crontab", ListValue,"regular_time",translate("发送时间"))
|
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")
|
||||||
|
|
||||||
a=s:taboption("crontab", ListValue,"regular_time_2",translate("发送时间"))
|
a = s:taboption("crontab", ListValue, "regular_time_2", translate("发送时间"))
|
||||||
a.rmempty = true
|
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")
|
||||||
|
|
||||||
a=s:taboption("crontab", ListValue,"regular_time_3",translate("发送时间"))
|
a = s:taboption("crontab", ListValue, "regular_time_3", translate("发送时间"))
|
||||||
a.rmempty = true
|
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")
|
||||||
|
|
||||||
a=s:taboption("crontab", ListValue,"interval_time",translate("发送间隔"))
|
a = s:taboption("crontab", ListValue, "interval_time", translate("发送间隔"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
for t=1,23 do
|
for t = 1, 23 do
|
||||||
a:value(t,translate(t.."小时"))
|
a:value(t, translate(t.."小时"))
|
||||||
end
|
end
|
||||||
a.default=6
|
a.default = 6
|
||||||
a.datatype=uinteger
|
a.datatype = uinteger
|
||||||
a:depends("crontab","2")
|
a:depends("crontab", "2")
|
||||||
a.description = translate("<br/>从 00:00 开始,每 * 小时发送一次")
|
a.description = translate("<br/>从 00:00 开始,每 * 小时发送一次")
|
||||||
|
|
||||||
a= s:taboption("crontab", Value, "send_title", translate("微信推送标题"))
|
a = s:taboption("crontab", Value, "send_title", translate("微信推送标题"))
|
||||||
a:depends("crontab","1")
|
a:depends("crontab", "1")
|
||||||
a:depends("crontab","2")
|
a:depends("crontab", "2")
|
||||||
a.placeholder = "OpenWrt By tty228 路由状态:"
|
a.placeholder = "OpenWrt By tty228 路由状态:"
|
||||||
a.description = translate("<br/>使用特殊符号可能会造成发送失败")
|
a.description = translate("<br/>使用特殊符号可能会造成发送失败")
|
||||||
|
|
||||||
a=s:taboption("crontab", Flag,"router_status",translate("系统运行情况"))
|
a = s:taboption("crontab", Flag, "router_status", 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_temp",translate("设备温度"))
|
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")
|
||||||
a:depends("crontab","2")
|
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")
|
||||||
|
|
||||||
e=s:taboption("crontab", Button,"_add",translate("手动发送"))
|
e = s:taboption("crontab", Button, "_add", translate("手动发送"))
|
||||||
e.inputtitle=translate("发送")
|
e.inputtitle = translate("发送")
|
||||||
e:depends("crontab","1")
|
e:depends("crontab", "1")
|
||||||
e:depends("crontab","2")
|
e:depends("crontab", "2")
|
||||||
e.inputstyle = "apply"
|
e.inputstyle = "apply"
|
||||||
function e.write(self, section)
|
function e.write(self, section)
|
||||||
luci.sys.call("cbi.apply")
|
luci.sys.call("cbi.apply")
|
||||||
luci.sys.call("/usr/bin/serverchan/serverchan send &")
|
luci.sys.call("/usr/bin/serverchan/serverchan send &")
|
||||||
end
|
end
|
||||||
|
|
||||||
--免打扰
|
--免打扰
|
||||||
a=s:taboption("disturb", ListValue,"serverchan_sheep",translate("免打扰时段设置"),translate("在指定整点时间段内,暂停推送消息<br/>免打扰时间中,定时推送也会被阻止。"))
|
a = s:taboption("disturb", ListValue, "serverchan_sheep", translate("免打扰时段设置"), translate("在指定整点时间段内,暂停推送消息<br/>免打扰时间中,定时推送也会被阻止。"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
a:value("", translate("关闭"))
|
||||||
a:value("",translate("关闭"))
|
a:value("1", translate("模式一:脚本挂起"))
|
||||||
a:value("1",translate("模式一:脚本挂起"))
|
a:value("2", translate("模式二:静默模式"))
|
||||||
a:value("2",translate("模式二:静默模式"))
|
|
||||||
a.description = translate("模式一停止一切检测,包括无人值守。")
|
a.description = translate("模式一停止一切检测,包括无人值守。")
|
||||||
a=s:taboption("disturb", ListValue,"starttime",translate("免打扰开始时间"))
|
|
||||||
|
a = s:taboption("disturb", ListValue, "starttime", 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=0
|
a.default = 0
|
||||||
a.datatype=uinteger
|
a.datatype = uinteger
|
||||||
a:depends({serverchan_sheep="1"})
|
a:depends({serverchan_sheep = "1"})
|
||||||
a:depends({serverchan_sheep="2"})
|
a:depends({serverchan_sheep = "2"})
|
||||||
a=s:taboption("disturb", ListValue,"endtime",translate("免打扰结束时间"))
|
|
||||||
|
a = s:taboption("disturb", ListValue, "endtime", 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({serverchan_sheep="1"})
|
a:depends({serverchan_sheep = "1"})
|
||||||
a:depends({serverchan_sheep="2"})
|
a:depends({serverchan_sheep = "2"})
|
||||||
|
|
||||||
a=s:taboption("disturb", ListValue,"macmechanism",translate("MAC过滤"))
|
a = s:taboption("disturb", ListValue, "macmechanism", translate("MAC过滤"))
|
||||||
a:value("",translate("disable"))
|
a:value("", translate("disable"))
|
||||||
a:value("allow",translate("忽略列表内设备"))
|
a:value("allow", translate("忽略列表内设备"))
|
||||||
a:value("block",translate("仅通知列表内设备"))
|
a:value("block", translate("仅通知列表内设备"))
|
||||||
a:value("interface",translate("仅通知此接口设备"))
|
a:value("interface", translate("仅通知此接口设备"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a = s:taboption("disturb", DynamicList, "serverchan_whitelist", translate("忽略列表"))
|
a = s:taboption("disturb", DynamicList, "serverchan_whitelist", translate("忽略列表"))
|
||||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({macmechanism="allow"})
|
a:depends({macmechanism = "allow"})
|
||||||
a.description = translate("AA:AA:AA:AA:AA:AA\\|BB:BB:BB:BB:BB:B 可以将多个 MAC 视为同一用户<br/>任一设备在线后不再推送,设备全部离线时才会推送,避免双 wifi 频繁推送")
|
a.description = translate("AA:AA:AA:AA:AA:AA\\|BB:BB:BB:BB:BB:B 可以将多个 MAC 视为同一用户<br/>任一设备在线后不再推送,设备全部离线时才会推送,避免双 wifi 频繁推送")
|
||||||
|
|
||||||
a = s:taboption("disturb", DynamicList, "serverchan_blacklist", translate("关注列表"))
|
a = s:taboption("disturb", DynamicList, "serverchan_blacklist", translate("关注列表"))
|
||||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({macmechanism="block"})
|
a:depends({macmechanism = "block"})
|
||||||
a.description = translate("AA:AA:AA:AA:AA:AA\\|BB:BB:BB:BB:BB:B 可以将多个 MAC 视为同一用户<br/>任一设备在线后不再推送,设备全部离线时才会推送,避免双 wifi 频繁推送")
|
a.description = translate("AA:AA:AA:AA:AA:AA\\|BB:BB:BB:BB:BB:B 可以将多个 MAC 视为同一用户<br/>任一设备在线后不再推送,设备全部离线时才会推送,避免双 wifi 频繁推送")
|
||||||
|
|
||||||
a = s:taboption("disturb", ListValue, "serverchan_interface", translate("接口名称"))
|
a = s:taboption("disturb", ListValue, "serverchan_interface", translate("接口名称"))
|
||||||
a:depends({macmechanism="interface"})
|
a:depends({macmechanism = "interface"})
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
for _, iface in ipairs(ifaces) do
|
for _, iface in ipairs(ifaces) do
|
||||||
@ -484,20 +490,20 @@ for _, iface in ipairs(ifaces) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
a=s:taboption("disturb", ListValue,"macmechanism2",translate("MAC过滤2"))
|
a = s:taboption("disturb", ListValue, "macmechanism2", translate("MAC过滤2"))
|
||||||
a:value("",translate("disable"))
|
a:value("", translate("disable"))
|
||||||
a:value("MAC_online",translate("列表内任意设备在线时免打扰"))
|
a:value("MAC_online", translate("列表内任意设备在线时免打扰"))
|
||||||
a:value("MAC_offline",translate("列表内设备都离线后免打扰"))
|
a:value("MAC_offline", translate("列表内设备都离线后免打扰"))
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
|
|
||||||
a = s:taboption("disturb", DynamicList, "MAC_online_list", translate("在线免打扰列表"))
|
a = s:taboption("disturb", DynamicList, "MAC_online_list", translate("在线免打扰列表"))
|
||||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({macmechanism2="MAC_online"})
|
a:depends({macmechanism2 = "MAC_online"})
|
||||||
|
|
||||||
a = s:taboption("disturb", DynamicList, "MAC_offline_list", translate("任意离线免打扰列表"))
|
a = s:taboption("disturb", DynamicList, "MAC_offline_list", translate("任意离线免打扰列表"))
|
||||||
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
nt.mac_hints(function(mac, name) a:value(mac, "%s (%s)" %{ mac, name }) end)
|
||||||
a.rmempty = true
|
a.rmempty = true
|
||||||
a:depends({macmechanism2="MAC_offline"})
|
a:depends({macmechanism2 = "MAC_offline"})
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
Loading…
Reference in New Issue
Block a user