mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 16:44:45 +08:00
update 2026-05-10 09:48:30
This commit is contained in:
1 parent
95ac96413e
commit
0b362674f1
6244 files changed
+2992248
No files matched your search
@@ -0,0 +1,49 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Advancedplus
|
||||
Copyright (C) 2022-2024 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-advancedplus
|
||||
]]--
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local http = require "luci.http"
|
||||
local uci = require"luci.model.uci".cursor()
|
||||
local name = 'advancedplus'
|
||||
module("luci.controller.advancedplus", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/advancedplus") then
|
||||
return
|
||||
end
|
||||
|
||||
local page
|
||||
page = entry({"admin","system","advancedplus"},alias("admin","system","advancedplus","advancededit"),_("Advanced plus"),61)
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-advancedplus" }
|
||||
|
||||
entry({"admin","system","advancedplus","advancededit"},cbi("advancedplus/advancededit"),_("Advanced Edit"),10).leaf = true
|
||||
entry({"admin","system","advancedplus","advancedset"},cbi("advancedplus/advancedset"),_("Advanced Setting"),20).leaf = true
|
||||
entry({"admin","system","advancedplus","advancedipk"},cbi("advancedplus/advancedipk", {hideapplybtn=true, hidesavebtn=true, hideresetbtn=true}),_("Loading plugins"),30).leaf = true
|
||||
entry({"admin", "system", "advancedplus", "advancedrun"}, call("advanced_run"))
|
||||
entry({"admin", "system", "advancedplus", "check"}, call("act_check"))
|
||||
end
|
||||
|
||||
function act_check()
|
||||
http.prepare_content("text/plain; charset=utf-8")
|
||||
local f=io.open("/tmp/advancedplus.log", "r+")
|
||||
local fdp=fs.readfile("/tmp/advancedpos") or 0
|
||||
f:seek("set",fdp)
|
||||
local a=f:read(2048000) or ""
|
||||
fdp=f:seek()
|
||||
fs.writefile("/tmp/advancedpos",tostring(fdp))
|
||||
f:close()
|
||||
http.write(a)
|
||||
end
|
||||
|
||||
function advanced_run()
|
||||
local selectipk = luci.http.formvalue('select_ipk')
|
||||
uci:set(name, 'advancedplus', 'select_ipk', selectipk)
|
||||
uci:commit(name)
|
||||
fs.writefile("/tmp/advancedpos","0")
|
||||
http.prepare_content("application/json")
|
||||
http.write('')
|
||||
luci.sys.exec(string.format("bash /usr/bin/advancedplusipk " ..selectipk.. " > /tmp/advancedplus.log 2>&1 &" ))
|
||||
end
|
||||
@@ -0,0 +1,407 @@
|
||||
local e=require"nixio.fs"
|
||||
local t=require"luci.sys"
|
||||
local t=luci.model.uci.cursor()
|
||||
m=Map("advancedplus",translate("Advanced Edit"),translate("<font color=\"Red\"><strong>Configuration documents are directly edited unless you know what you are doing, please do not easily modify these configuration documents. Incorrect configuration may result in errors such as inability to power on</strong></font><br/>"))
|
||||
m.apply_on_parse=true
|
||||
s=m:section(TypedSection,"basic")
|
||||
s.anonymous=true
|
||||
|
||||
if nixio.fs.access("/etc/dnsmasq.conf")then
|
||||
|
||||
s:tab("dnsmasqconf",translate("dnsmasq"),translate("This page is about configuration")..translate("/etc/dnsmasq.conf")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
|
||||
conf=s:taboption("dnsmasqconf",Value,"dnsmasqconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/dnsmasq.conf")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/dnsmasq.conf",t)
|
||||
if(luci.sys.call("cmp -s /tmp/dnsmasq.conf /etc/dnsmasq.conf")==1)then
|
||||
e.writefile("/etc/dnsmasq.conf",t)
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/dnsmasq.conf")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/network")then
|
||||
s:tab("netwrokconf",translate("network"),translate("This page is about configuration")..translate("/etc/config/network")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("netwrokconf",Value,"netwrokconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/network")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/network",t)
|
||||
if(luci.sys.call("cmp -s /tmp/network /etc/config/network")==1)then
|
||||
e.writefile("/etc/config/network",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/network")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/wireless")then
|
||||
s:tab("wirelessconf",translate("wireless"), translate("This page is about configuration")..translate("/etc/config/wireless")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
|
||||
conf=s:taboption("wirelessconf",Value,"wirelessconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/wireless")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/etc/config/wireless.tmp",t)
|
||||
if(luci.sys.call("cmp -s /etc/config/wireless.tmp /etc/config/wireless")==1)then
|
||||
e.writefile("/etc/config/wireless",t)
|
||||
luci.sys.call("wifi reload >/dev/null &")
|
||||
end
|
||||
e.remove("/tmp//tmp/wireless.tmp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/hosts")then
|
||||
s:tab("hostsconf",translate("hosts"), translate("This page is about configuration")..translate("/etc/hosts")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
|
||||
conf=s:taboption("hostsconf",Value,"hostsconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/hosts")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/hosts.tmp",t)
|
||||
if(luci.sys.call("cmp -s /tmp/hosts.tmp /etc/hosts")==1)then
|
||||
e.writefile("/etc/hosts",t)
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/hosts.tmp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/arpbind")then
|
||||
s:tab("arpbindconf",translate("arpbind"),translate("This page is about configuration")..translate("/etc/config/arpbind")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("arpbindconf",Value,"arpbindconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/arpbind")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/arpbind",t)
|
||||
if(luci.sys.call("cmp -s /tmp/arpbind /etc/config/arpbind")==1)then
|
||||
e.writefile("/etc/config/arpbind",t)
|
||||
luci.sys.call("/etc/init.d/arpbind restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/arpbind")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/firewall")then
|
||||
s:tab("firewallconf",translate("firewall"),translate("This page is about configuration")..translate("/etc/config/firewall")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("firewallconf",Value,"firewallconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/firewall")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/firewall",t)
|
||||
if(luci.sys.call("cmp -s /tmp/firewall /etc/config/firewall")==1)then
|
||||
e.writefile("/etc/config/firewall",t)
|
||||
luci.sys.call("/etc/init.d/firewall restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/firewall")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/mwan3")then
|
||||
s:tab("mwan3conf",translate("mwan3"),translate("This page is about configuration")..translate("/etc/config/mwan3")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("mwan3conf",Value,"mwan3conf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/mwan3")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/mwan3",t)
|
||||
if(luci.sys.call("cmp -s /tmp/mwan3 /etc/config/mwan3")==1)then
|
||||
e.writefile("/etc/config/mwan3",t)
|
||||
luci.sys.call("/etc/init.d/mwan3 restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/mwan3")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/dhcp")then
|
||||
s:tab("dhcpconf",translate("DHCP"),translate("This page is about configuration")..translate("/etc/config/dhcp")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("dhcpconf",Value,"dhcpconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/dhcp")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/dhcp",t)
|
||||
if(luci.sys.call("cmp -s /tmp/dhcp /etc/config/dhcp")==1)then
|
||||
e.writefile("/etc/config/dhcp",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/dhcp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/ddns")then
|
||||
s:tab("ddnsconf",translate("DDNS"),translate("This page is about configuration")..translate("/etc/config/ddns")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("ddnsconf",Value,"ddnsconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/ddns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/ddns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/ddns /etc/config/ddns")==1)then
|
||||
e.writefile("/etc/config/ddns",t)
|
||||
luci.sys.call("/etc/init.d/ddns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/ddns")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/parentcontrol")then
|
||||
s:tab("parentcontrolconf",translate("parentcontrol"),translate("This page is about configuration")..translate("/etc/config/parentcontrol")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("parentcontrolconf",Value,"parentcontrolconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/parentcontrol")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/parentcontrol",t)
|
||||
if(luci.sys.call("cmp -s /tmp/parentcontrol /etc/config/parentcontrol")==1)then
|
||||
e.writefile("/etc/config/parentcontrol",t)
|
||||
luci.sys.call("/etc/init.d/parentcontrol restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/parentcontrol")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/autotimeset")then
|
||||
s:tab("autotimesetconf",translate("autotimeset"),translate("This page is about configuration")..translate("/etc/config/autotimeset")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("autotimesetconf",Value,"autotimesetconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/autotimeset")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/autotimeset",t)
|
||||
if(luci.sys.call("cmp -s /tmp/autotimeset /etc/config/autotimeset")==1)then
|
||||
e.writefile("/etc/config/autotimeset",t)
|
||||
luci.sys.call("/etc/init.d/autotimeset restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/autotimeset")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/wolplus")then
|
||||
s:tab("wolplusconf",translate("wolplus"),translate("This page is about configuration")..translate("/etc/config/wolplus")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("wolplusconf",Value,"wolplusconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/wolplus")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/wolplus",t)
|
||||
if(luci.sys.call("cmp -s /tmp/wolplus /etc/config/wolplus")==1)then
|
||||
e.writefile("/etc/config/wolplus",t)
|
||||
luci.sys.call("/etc/init.d/wolplus restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/wolplus")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/socat")then
|
||||
s:tab("socatconf",translate("socat"),translate("This page is about configuration")..translate("/etc/config/socat")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("socatconf",Value,"socatconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/socat")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/socat",t)
|
||||
if(luci.sys.call("cmp -s /tmp/socat /etc/config/socat")==1)then
|
||||
e.writefile("/etc/config/socat",t)
|
||||
luci.sys.call("/etc/init.d/socat restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/socat")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/nginx")then
|
||||
s:tab("nginxconf",translate("NGINX"),translate("This page is about configuration")..translate("/etc/config/nginx")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("nginxconf",Value,"nginxconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/nginx")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/nginx",t)
|
||||
if(luci.sys.call("cmp -s /tmp/nginx /etc/config/nginx")==1)then
|
||||
e.writefile("/etc/config/nginx",t)
|
||||
luci.sys.call("/etc/init.d/nginx restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/nginx")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/ddns-go/ddns-go-config.yaml")then
|
||||
s:tab("ddnsgoconf",translate("DDNS-GO"),translate("This page is about configuration")..translate("ddns-go-config.yaml")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("ddnsgoconf",Value,"ddnsgoconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/ddns-go/ddns-go-config.yaml")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/ddnsgo",t)
|
||||
if(luci.sys.call("cmp -s /tmp/ddns-go /etc/ddns-go/ddns-go-config.yaml")==1)then
|
||||
e.writefile("/etc/ddns-go/ddns-go-config.yaml",t)
|
||||
luci.sys.call("/etc/init.d/ddns-go restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/ddnsgo")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/smartdns")then
|
||||
s:tab("smartdnsconf",translate("SMARTDNS"),translate("This page is about configuration")..translate("/etc/config/smartdns")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("smartdnsconf",Value,"smartdnsconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/smartdns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/smartdns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/smartdns /etc/config/smartdns")==1)then
|
||||
e.writefile("/etc/config/smartdns",t)
|
||||
luci.sys.call("/etc/init.d/smartdns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/smartdns")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/bypass")then
|
||||
s:tab("bypassconf",translate("BYPASS"),translate("This page is about configuration")..translate("/etc/config/bypass")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("bypassconf",Value,"bypassconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/bypass")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/bypass",t)
|
||||
if(luci.sys.call("cmp -s /tmp/bypass /etc/config/bypass")==1)then
|
||||
e.writefile("/etc/config/bypass",t)
|
||||
luci.sys.call("/etc/init.d/bypass restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/bypass")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/openclash")then
|
||||
s:tab("openclashconf",translate("openclash"),translate("This page is about configuration")..translate("/etc/config/openclash")..translate("Document content. Automatic restart takes effect after saving the application"))
|
||||
conf=s:taboption("openclashconf",Value,"openclashconf",nil,translate("The starting number symbol (#) or each line of the semicolon (;) is considered a comment; Remove (;) and enable the specified option."))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/openclash")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/openclash",t)
|
||||
if(luci.sys.call("cmp -s /tmp/openclash /etc/config/openclash")==1)then
|
||||
e.writefile("/etc/config/openclash",t)
|
||||
luci.sys.call("/etc/init.d/openclash restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/openclash")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,30 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
Copyright (C) 2022-2024 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-advancedplus
|
||||
]]--
|
||||
|
||||
luci.sys.exec("echo '-' >/tmp/advancedplus.log&&echo 1 > /tmp/advancedpos" )
|
||||
local fs = require "nixio.fs"
|
||||
local uci=luci.model.uci.cursor()
|
||||
local m,s,e
|
||||
|
||||
m = Map("advancedplus")
|
||||
m.title = translate("Loading plugins")
|
||||
m.description = translate("Choose to load and install the app store, DOCKER, all drivers, etc")..
|
||||
translate("</br>For specific usage, see:")..translate("<a href=\'https://github.com/sirpdboy/luci-app-advancedplus.git' target=\'_blank\'>GitHub @sirpdboy/luci-app-advancedplus </a>")
|
||||
m.apply_on_parse=true
|
||||
|
||||
s=m:section(TypedSection, "basic", "")
|
||||
s.anonymous=true
|
||||
|
||||
e=s:option(ListValue,'select_ipk', translate('Select the type of loading'))
|
||||
e:value("istore", translate("Install iStore"))
|
||||
e:value("docker", translate("Install Docker"))
|
||||
e:value("drv", translate("Install All drives"))
|
||||
e.default="istore"
|
||||
|
||||
e=s:option(Button, "restart", translate("Perform operation"))
|
||||
e.inputtitle=translate("Click to execute")
|
||||
e.template ='advancedplus/advanced'
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local uci=luci.model.uci.cursor()
|
||||
local a, t, e
|
||||
a = Map("advancedplus")
|
||||
a.title = translate("Advanced Setting")
|
||||
a.description = translate("The enhanced version of the original advanced settings can set some supporting services and functions of the firmware")..
|
||||
translate("</br>For specific usage, see:")..translate("<a href=\'https://github.com/sirpdboy/luci-app-advancedplus.git' target=\'_blank\'>GitHub @advancedplus </a>")
|
||||
|
||||
t = a:section(TypedSection, "basic", translate("Settings"))
|
||||
t.anonymous = true
|
||||
|
||||
e = t:option(Flag, "usshmenu",translate('No backend menu required'), translate('OPENWRT backend and SSH login do not display shortcut menus'))
|
||||
|
||||
e = t:option(Flag, "set_login",translate('Console account password login'))
|
||||
e.default = "0"
|
||||
|
||||
e = t:option(Flag, "wizard",translate('Hide Wizard'), translate('Show or hide the setup wizard menu'))
|
||||
e.default = "0"
|
||||
e.rmempty = false
|
||||
|
||||
--e = t:option(Flag, "tsoset",translate('TSO optimization for network card interruption'), translate('Turn off the TSO parameters of the INTEL225 network card to improve network interruption'))
|
||||
--e.default = "1"
|
||||
--e.rmempty = false
|
||||
|
||||
e = t:option(Flag, "uhttpd",translate('Prevent uhttpd from exiting web services'))
|
||||
e.default = "1"
|
||||
e.rmempty = false
|
||||
|
||||
-- e = t:option(ListValue, "set_firewall_wan",translate('Set up firewall for external network access'))
|
||||
-- e:value('ACCEPT', translate('accept'))
|
||||
-- e:value('DROP', translate('drop'))
|
||||
-- e:value('REJECT', translate('reject'))
|
||||
-- e.default = 'ACCEPT'
|
||||
|
||||
e = t:option(Flag, "dhcp_domain",translate('Add Android host name mapping'), translate('Resolve the issue of Android native TV not being able to connect to WiFi for the first time'))
|
||||
e.default = "0"
|
||||
e.rmempty = false
|
||||
|
||||
a.apply_on_parse = true
|
||||
a.on_after_apply = function(self,map)
|
||||
luci.sys.exec("/etc/init.d/advancedplus start >/dev/null 2>&1")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin","system","advancedplus","advancedset"))
|
||||
end
|
||||
|
||||
|
||||
return a
|
||||
@@ -0,0 +1,89 @@
|
||||
<%#
|
||||
Copyright (C) 2022-2024 sirpdboy <herboy2008@gmail.com>
|
||||
-%>
|
||||
<%+cbi/valueheader%>
|
||||
<%local fs=require"nixio.fs"%>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_run_button" value="<%:Click to execute%>" onclick=" return apply_run(this) "/>
|
||||
<div id="logview" style="display:none">
|
||||
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:block;" data-update="change" rows="30" cols="60" readonly="readonly" > </textarea>
|
||||
</div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
var checkbtn = document.getElementById('apply_run_button');
|
||||
|
||||
function apply_run(btn){
|
||||
var sid='cfg018967'
|
||||
var opt={
|
||||
base:"cbid.advancedplus."+sid,
|
||||
get:function(opt){
|
||||
var id=this.base+'.'+opt;
|
||||
var obj=document.getElementsByName(id)[0] || document.getElementsByClassName(id)[0] || document.getElementById(id)
|
||||
if (obj){
|
||||
return obj;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getlist:function(opt){
|
||||
var id=this.base+'.'+opt;
|
||||
var objs=document.getElementsByName(id) || document.getElementsByClassName(id);
|
||||
var ret=[];
|
||||
if (objs){
|
||||
for (var i=0;i < objs.length;i++){
|
||||
ret[i]=objs[i].value;
|
||||
}
|
||||
}else{
|
||||
alert("<%:Fatal on get option,please help in debug%>:"+opt);
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
query:function(param,src,tval="1",fval="0"){
|
||||
var ret="&"+param+"=";
|
||||
var obj=this.get(src);
|
||||
if (obj){
|
||||
if (obj.type=="checkbox"){
|
||||
return ret+(obj.checked==true ? tval:fval);
|
||||
}else{
|
||||
return ret+encodeURIComponent(obj.value);
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
btn.value='<%:Waiting,(executing)...%>';
|
||||
btn.disabled=true;
|
||||
var select_ipk=opt.get("select_ipk").value;
|
||||
console.log(select_ipk);
|
||||
XHR.get('<%=url([[admin]], [[system]], [[advancedplus]], [[advancedrun]])%>',{
|
||||
select_ipk: select_ipk
|
||||
},function(x){});
|
||||
poll_check();
|
||||
return
|
||||
}
|
||||
|
||||
function poll_check(){
|
||||
var tag = document.getElementById('logview');
|
||||
tag.style.display="block"
|
||||
XHR.poll(3, '<%=url([[admin]], [[system]], [[advancedplus]], [[check]])%>', null,
|
||||
function(x, data) {
|
||||
var lv = document.getElementById('cbid.logview.1.conf');
|
||||
if (x.responseText && lv) {
|
||||
if (x.responseText=="\u0000"){
|
||||
for(j = 0,len=this.XHR._q.length; j < len; j++) {
|
||||
if (this.XHR._q[j].url == '<%=url([[admin]], [[system]], [[advancedplus]], [[check]])%>'){
|
||||
this.XHR._q.splice(j,1);
|
||||
checkbtn.disabled = false;
|
||||
checkbtn.value = '<%:Click to execute%>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
lv.innerHTML += x.responseText;
|
||||
}
|
||||
}
|
||||
);}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
||||
Reference in new issue
Block a user