mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 14:23:56 +08:00
update 2026-09-10 16:35:06
This commit is contained in:
1 parent
52a65b099b
commit
11dbae0135
1963 files changed
+1523488
-129
No files matched your search
@@ -160,14 +160,10 @@ o:depends("mode", "1")
|
||||
o:depends("mode", "2")
|
||||
o.validate = port_validate
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_show_tcp_redir", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_show_tcp_redir")
|
||||
o:depends({ tcp_no_redir_ports = "1:65535", ['!reverse'] = true })
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_show_udp_redir", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_show_udp_redir")
|
||||
o:depends({ udp_no_redir_ports = "1:65535", ['!reverse'] = true })
|
||||
|
||||
o = s:taboption("Proxy", Value, "tcp_redir_ports", translate("TCP Redir Ports"))
|
||||
@@ -195,15 +191,11 @@ end
|
||||
o:depends("mode", "1")
|
||||
o:depends("mode", "2")
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_no_proxy", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_no_proxy")
|
||||
o:depends("mode", "0")
|
||||
o:depends({ tcp_no_redir_ports = "1:65535", udp_no_redir_ports = "1:65535" })
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_show_node_option", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_show_node_option")
|
||||
o:depends({ mode = "1", _no_proxy = "" })
|
||||
|
||||
o = s:taboption("Main", ListValue, "node", "<a style='color: red'>" .. translate("Node") .. "</a>")
|
||||
@@ -218,24 +210,17 @@ if node_value then
|
||||
end
|
||||
current_node = current_node_id and m:get(current_node_id) or {}
|
||||
|
||||
o = s:taboption("Main", DummyValue, "node_save_before", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o = s:taboption("Main", HideValue, "node_save_before")
|
||||
o.value = current_node[".name"]
|
||||
o.cbid = function(self, section) return "node_save_before" end
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_node", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_node")
|
||||
o:depends({ node = "", ['!reverse'] = true })
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_is_singbox", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_is_singbox")
|
||||
o:depends("_hide", "1")
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_is_xray", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_is_xray")
|
||||
o:depends("_hide", "1")
|
||||
|
||||
o = s:taboption("Log", Flag, "log", translate("Enable Node Log"))
|
||||
@@ -267,9 +252,7 @@ o.cfgvalue = function(t, n)
|
||||
end
|
||||
o:depends("log", "1")
|
||||
|
||||
o = s:taboption("DNS", DummyValue, "_show_dns_option", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("DNS", HideValue, "_show_dns_option")
|
||||
o:depends({ mode = "1", _node = "1" })
|
||||
|
||||
o = s:taboption("DNS", ListValue, "direct_dns_query_strategy", translate("Direct Query Strategy"))
|
||||
|
||||
@@ -85,14 +85,10 @@ o.template = m:template_path("/cbi/nodes_listvalue")
|
||||
o:value("", translate("Close"))
|
||||
o.group = {""}
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_node", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_node")
|
||||
o:depends({ node = "", ['!reverse'] = true })
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_is_singbox", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o = s:taboption("Main", HideValue, "_is_singbox")
|
||||
o:depends("_hide", "1")
|
||||
|
||||
current_node_id = m:get(s.section, "node")
|
||||
@@ -102,8 +98,7 @@ if node_value then
|
||||
end
|
||||
current_node = current_node_id and m:get(current_node_id) or {}
|
||||
|
||||
o = s:taboption("Main", DummyValue, "node_save_before", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o = s:taboption("Main", HideValue, "node_save_before")
|
||||
o.value = current_node[".name"]
|
||||
o.cbid = function(self, section) return "node_save_before" end
|
||||
|
||||
|
||||
@@ -1537,11 +1537,99 @@ function set_default_cbi()
|
||||
return cbi.AbstractValue.write(self, section, new_val)
|
||||
end
|
||||
end
|
||||
if true then
|
||||
--HideValue
|
||||
local HideValue = util.class(cbi.DummyValue)
|
||||
function HideValue.__init__(self, ...)
|
||||
cbi.DummyValue.__init__(self, ...)
|
||||
self.template = self.map:template_path("/cbi/hidevalue")
|
||||
self.value = "1"
|
||||
end
|
||||
cbi.HideValue = HideValue
|
||||
end
|
||||
end
|
||||
|
||||
function set_type_cbi(s)
|
||||
local cbi = require "luci.cbi"
|
||||
local s1 = s.parent
|
||||
function s.option(s_self, class, option, ...)
|
||||
local obj = class(s_self.map, s_self, option, ...)
|
||||
obj.config_option = option
|
||||
obj.option_prefix = s_self.option_prefix
|
||||
obj.option = s_self.option_prefix .. option
|
||||
obj.cfgvalue = function(self, section)
|
||||
return self.map:get(section, self.config_option)
|
||||
end
|
||||
obj.write = function(self, section, value)
|
||||
if s1.fields["type"]:formvalue(s_self.section) == s_self.type_name then
|
||||
local new_val = value
|
||||
if util.instanceof(self, cbi.DynamicList) then
|
||||
local new_t = {}
|
||||
if type(value) == "table" then
|
||||
new_t = table_remove_duplicates(value)
|
||||
else
|
||||
new_t = { value }
|
||||
end
|
||||
if self.cast == "string" then
|
||||
new_val = table.concat(new_t, " ")
|
||||
else
|
||||
new_val = new_t
|
||||
end
|
||||
end
|
||||
self.map:set(section, self.config_option, new_val)
|
||||
end
|
||||
end
|
||||
obj.remove = function(self, section)
|
||||
if s1.fields["type"]:formvalue(s_self.section) == s_self.type_name then
|
||||
self.map:del(section, self.config_option)
|
||||
end
|
||||
end
|
||||
obj.deplist2json = function(self, section, deplist)
|
||||
local deps, i, d = { }
|
||||
if type(self.deps) == "table" then
|
||||
if not next(self.deps) then
|
||||
self:depends({ type = s.type_name })
|
||||
end
|
||||
local list = deplist or self.deps
|
||||
for i, d in ipairs(list) do
|
||||
if s.type_name and not d["type"] then
|
||||
d["type"] = s.type_name
|
||||
end
|
||||
local a, k, v = { }
|
||||
for k, v in pairs(d) do
|
||||
if k:find("!", 1, true) then
|
||||
a[k] = v
|
||||
elseif k:find("^", 1, true) then
|
||||
a[k:sub(2)] = v
|
||||
elseif k:find(".", 1, true) then
|
||||
a['cbid%s' % k] = v
|
||||
elseif s_self.fields[k] then
|
||||
a['cbid.%s.%s.%s' %{ self.config, section, s_self.fields[k].option }] = v
|
||||
else
|
||||
a['cbid.%s.%s.%s' %{ self.config, section, k }] = v
|
||||
end
|
||||
end
|
||||
deps[#deps+1] = a
|
||||
end
|
||||
end
|
||||
return util.serialize_json(deps)
|
||||
end
|
||||
s_self:append(obj)
|
||||
s_self.fields[option] = obj
|
||||
return obj
|
||||
end
|
||||
end
|
||||
|
||||
function type_cbi_section(s, s2)
|
||||
for i, v in ipairs(s2.children) do
|
||||
local o = s2.children[i]
|
||||
s:append(o)
|
||||
s.fields[o.option] = o
|
||||
end
|
||||
end
|
||||
|
||||
function return_map(map)
|
||||
local cbi = require "luci.cbi"
|
||||
local api = require "luci.passwall2.api"
|
||||
if true then
|
||||
-- header
|
||||
local header = cbi.Template(appname .. "/cbi/header")
|
||||
@@ -1557,91 +1645,6 @@ function return_map(map)
|
||||
return map
|
||||
end
|
||||
|
||||
function set_type_cbi(s)
|
||||
local cbi = require "luci.cbi"
|
||||
local s1 = s.parent
|
||||
function s.option(self, class, option, ...)
|
||||
local obj = class(self.map, self, option, ...)
|
||||
obj.config_option = option
|
||||
obj.option_prefix = self.option_prefix
|
||||
obj.option = self.option_prefix .. option
|
||||
obj.cfgvalue = function(o_self, section)
|
||||
if o_self.rewrite_option then
|
||||
return o_self.map:get(section, o_self.rewrite_option)
|
||||
else
|
||||
return o_self.map:get(section, o_self.config_option)
|
||||
end
|
||||
end
|
||||
obj.write = function(o_self, section, value)
|
||||
if s1.fields["type"]:formvalue(self.section) == self.type_name then
|
||||
local new_val = value
|
||||
if util.instanceof(o_self, cbi.DynamicList) then
|
||||
local new_t = {}
|
||||
if type(value) == "table" then
|
||||
new_t = table_remove_duplicates(value)
|
||||
else
|
||||
new_t = { value }
|
||||
end
|
||||
if o_self.cast == "string" then
|
||||
new_val = table.concat(new_t, " ")
|
||||
else
|
||||
new_val = new_t
|
||||
end
|
||||
end
|
||||
if o_self.rewrite_option then
|
||||
o_self.map:set(section, o_self.rewrite_option, new_val)
|
||||
else
|
||||
o_self.map:set(section, o_self.config_option, new_val)
|
||||
end
|
||||
end
|
||||
end
|
||||
obj.remove = function(o_self, section)
|
||||
if s1.fields["type"]:formvalue(self.section) == self.type_name then
|
||||
if o_self.rewrite_option then
|
||||
o_self.map:del(section, o_self.rewrite_option)
|
||||
else
|
||||
o_self.map:del(section, o_self.config_option)
|
||||
end
|
||||
end
|
||||
end
|
||||
obj.depends = function(o_self, field, value)
|
||||
local deps
|
||||
if type(field) == "string" then
|
||||
deps = {}
|
||||
deps[field] = value
|
||||
else
|
||||
deps = field
|
||||
end
|
||||
local new_deps = {}
|
||||
for k, v in pairs(deps) do
|
||||
local n_k = k
|
||||
if self.fields[k] then
|
||||
n_k = self.fields[k].option
|
||||
end
|
||||
new_deps[n_k] = v
|
||||
end
|
||||
new_deps["type"] = self.type_name
|
||||
if next(new_deps) then
|
||||
table.insert(o_self.deps, new_deps)
|
||||
end
|
||||
end
|
||||
self:append(obj)
|
||||
self.fields[option] = obj
|
||||
return obj
|
||||
end
|
||||
end
|
||||
|
||||
function type_cbi_section(s, s2)
|
||||
for i, v in ipairs(s2.children) do
|
||||
local o = s2.children[i]
|
||||
if #o.deps == 0 then
|
||||
o:depends({ type = s2.type_name })
|
||||
end
|
||||
s:append(o)
|
||||
s.fields[o.option] = o
|
||||
end
|
||||
end
|
||||
|
||||
function format_go_time(input, default)
|
||||
input = input and trim(input)
|
||||
local N = 0
|
||||
|
||||
Reference in new issue
Block a user