luci-app-serverchan: bump to v1.63
This commit is contained in:
parent
b89a715c25
commit
a092c7d12b
@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-serverchan
|
||||
PKG_VERSION:=1.52
|
||||
PKG_VERSION:=1.63
|
||||
PKG_RELEASE:=7
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -18,11 +18,12 @@ s:tab("tab_basic", translate("基本设置"))
|
||||
s:tab("tab_basic2", translate("设备状态"))
|
||||
s:tab("tab_basic3", translate("定时推送"))
|
||||
s:tab("tab_basic4", translate("免打扰"))
|
||||
s:tab("tab_basic5", translate("高级设置"))
|
||||
s:tab("log",translate("客户端日志"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
--Base Setting
|
||||
--基本设置
|
||||
a=s:taboption("tab_basic", Flag,"serverchan_enable",translate("启用"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
@ -50,31 +51,7 @@ device_aliases.rmempty = true
|
||||
device_aliases.optional = true
|
||||
device_aliases.description = translate("<br/> 请输入设备 MAC 和设备别名,用“-”隔开,如:<br/> XX:XX:XX:XX:XX:XX-我的手机")
|
||||
|
||||
local logfile = "/tmp/serverchan/serverchan.log"
|
||||
|
||||
e=s:taboption("log",TextValue,"log")
|
||||
e:depends({debuglevel="1"})
|
||||
e:depends({debuglevel="2"})
|
||||
e.rows=26
|
||||
e.wrap="off"
|
||||
e.readonly=true
|
||||
e.cfgvalue=function(s,s)
|
||||
return fs.readfile(logfile)or""
|
||||
end
|
||||
e.write=function(e,e,e)
|
||||
end
|
||||
|
||||
e=s:taboption("log", Button,translate(""))
|
||||
e:depends({debuglevel="1"})
|
||||
e:depends({debuglevel="2"})
|
||||
e.inputtitle=translate("清理日志")
|
||||
e.inputstyle = "clean_log"
|
||||
function e.write(self, section)
|
||||
|
||||
luci.sys.call("cbi.clean_log")
|
||||
fs.writefile(logfile, "")
|
||||
end
|
||||
|
||||
--设备状态
|
||||
a=s:taboption("tab_basic2", ListValue,"serverchan_ipv4",translate("ipv4 变动通知"))
|
||||
a.default="disable"
|
||||
a:value("0",translate("关闭"))
|
||||
@ -147,59 +124,8 @@ a.default = "80"
|
||||
a.datatype="uinteger"
|
||||
a:depends({temperature_enable="1"})
|
||||
a.description = translate("<br/>设备报警只会在连续五分钟超过设定值时才会推送<br/>而且一个小时内不会再提醒第二次")
|
||||
a=s:taboption("tab_basic2", Flag,"err_enable",translate("无人值守任务"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("请确认脚本可以正常运行!!<br/>否则可能造成频繁重启等错误!")
|
||||
a=s:taboption("tab_basic2", Flag,"err_sheep_enable",translate("仅在免打扰时段重拨"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("避免白天重拨 ddns 域名等待解析<br/>此功能不影响断网检测")
|
||||
a:depends({err_enable="1"})
|
||||
device_aliases= s:taboption("tab_basic2", DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
device_aliases.rmempty = true
|
||||
device_aliases.optional = true
|
||||
device_aliases.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备十分钟低流量(约10kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) device_aliases :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
device_aliases:depends({err_enable="1"})
|
||||
a=s:taboption("tab_basic2", 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/serverchan/configbak 目录,并在失败后还原。<br/>自用于远程误操作无法连接,人在塔在请自行修复。<br/>【!!因为我无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
a=s:taboption("tab_basic2", 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:taboption("tab_basic2", Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="1"})
|
||||
a.description = translate("单位为小时")
|
||||
a= s:taboption("tab_basic2", Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:taboption("tab_basic2", 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:taboption("tab_basic2", Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype="uinteger"
|
||||
a:depends({public_ip_event="1"})
|
||||
|
||||
--定时推送
|
||||
e=s:taboption("tab_basic3", ListValue,"send_mode",translate("定时任务设定"))
|
||||
e.default=""
|
||||
e:value("",translate("关闭"))
|
||||
@ -275,15 +201,7 @@ luci.sys.call("cbi.apply")
|
||||
luci.sys.call("/usr/bin/serverchan/serverchan send &")
|
||||
end
|
||||
|
||||
up_timeout=s:taboption("tab_basic4", Value,"up_timeout",translate('设备上线检测超时'))
|
||||
up_timeout.default = "2"
|
||||
up_timeout.datatype="uinteger"
|
||||
|
||||
down_timeout=s:taboption("tab_basic4", Value,"down_timeout",translate('设备离线检测超时'))
|
||||
down_timeout.default = "10"
|
||||
down_timeout.datatype="uinteger"
|
||||
down_timeout.description = translate("如果遇到设备 wifi 休眠,频繁推送离线,可以把超时时间设置长一些")
|
||||
|
||||
--免打扰
|
||||
sheep=s:taboption("tab_basic4", ListValue,"serverchan_sheep",translate("免打扰时段设置"),translate("在指定整点时间段内,暂停推送消息<br/>免打扰时间中,定时推送也会被阻止。"))
|
||||
sheep:value("0",translate("关闭"))
|
||||
sheep:value("1",translate("模式一:脚本挂起,延迟发送"))
|
||||
@ -339,6 +257,114 @@ for _, iface in ipairs(ifaces) do
|
||||
end
|
||||
end
|
||||
|
||||
--高级设置
|
||||
a=s:taboption("tab_basic5", Value,"up_timeout",translate('设备上线检测超时'))
|
||||
a.default = "2"
|
||||
a.datatype="uinteger"
|
||||
a=s:taboption("tab_basic5", Value,"down_timeout",translate('设备离线检测超时'))
|
||||
a.default = "5"
|
||||
a.datatype="uinteger"
|
||||
a.description = translate("如果遇到设备 wifi 休眠,频繁推送离线,可以把超时时间设置长一些")
|
||||
|
||||
a=s:taboption("tab_basic5", Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("",translate("默认"))
|
||||
a:value("sensors",translate("sensors命令"))
|
||||
a.description = translate("请尽量避免使用特殊符号,如双引号、$、!等,执行结果需为数字,用于温度对比")
|
||||
|
||||
a=s:taboption("tab_basic5", Button,"soc",translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
luci.sys.call("/usr/bin/serverchan/serverchan soc")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","services","serverchan"))
|
||||
end
|
||||
|
||||
if nixio.fs.access("/tmp/serverchan/soc_tmp") then
|
||||
e=s:taboption("tab_basic5",TextValue,"soc_tmp")
|
||||
e.rows=2
|
||||
e.readonly=true
|
||||
e.cfgvalue = function()
|
||||
return luci.sys.exec("cat /tmp/serverchan/soc_tmp && rm -f /tmp/serverchan/soc_tmp")
|
||||
end
|
||||
end
|
||||
a=s:taboption("tab_basic5", Flag,"err_enable",translate("无人值守任务"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!<br/>如果你不了解这些选项的含义,请不要修改")
|
||||
a=s:taboption("tab_basic5", Flag,"err_sheep_enable",translate("仅在免打扰时段重拨"))
|
||||
a.default=0
|
||||
a.rmempty=true
|
||||
a.description = translate("避免白天重拨 ddns 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||
a:depends({err_enable="1"})
|
||||
device_aliases= s:taboption("tab_basic5", DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
device_aliases.rmempty = true
|
||||
device_aliases.optional = true
|
||||
device_aliases.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约10kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) device_aliases :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
device_aliases:depends({err_enable="1"})
|
||||
a=s:taboption("tab_basic5", 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/serverchan/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
a=s:taboption("tab_basic5", 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:taboption("tab_basic5", Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="1"})
|
||||
a.description = translate("单位为小时")
|
||||
a=s:taboption("tab_basic5", Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype="uinteger"
|
||||
a:depends({system_time_event="2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a=s:taboption("tab_basic5", 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:taboption("tab_basic5", Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype="uinteger"
|
||||
a:depends({public_ip_event="1"})
|
||||
|
||||
--客户端日志
|
||||
local logfile = "/tmp/serverchan/serverchan.log"
|
||||
e=s:taboption("log",TextValue,"log")
|
||||
e:depends({debuglevel="1"})
|
||||
e:depends({debuglevel="2"})
|
||||
e.rows=26
|
||||
e.wrap="off"
|
||||
e.readonly=true
|
||||
e.cfgvalue=function(s,s)
|
||||
return fs.readfile(logfile)or""
|
||||
end
|
||||
e.write=function(e,e,e)
|
||||
end
|
||||
|
||||
e=s:taboption("log", Button,translate(""))
|
||||
e:depends({debuglevel="1"})
|
||||
e:depends({debuglevel="2"})
|
||||
e.inputtitle=translate("清理日志")
|
||||
e.inputstyle = "clean_log"
|
||||
function e.write(self, section)
|
||||
|
||||
luci.sys.call("cbi.clean_log")
|
||||
fs.writefile(logfile, "")
|
||||
end
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
io.popen("/etc/init.d/serverchan start &")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user