Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/luci-app-passwall/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-passwall
PKG_VERSION:=26.2.6
PKG_VERSION:=26.2.14
PKG_RELEASE:=1

PKG_CONFIG_DEPENDS:= \
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if not data.node_id or not data.node then
end

local current_node_id = data.node_id
local node_list = data.node_list or api.get_node_list()

local function get_cfgvalue()
return function(self, section)
Expand Down Expand Up @@ -87,13 +88,6 @@ if data.node.type == "Xray" then
o:value("linear")
end

o = add_option(Flag, "preproxy_enabled", translate("Preproxy") .. " " .. translate("Main switch"))

main_node = add_option(ListValue, "main_node", string.format('<a style="color:red">%s</a>', translate("Preproxy Node")), translate("Set the node to be used as a pre-proxy. Each rule (including <code>Default</code>) has a separate switch that controls whether this rule uses the pre-proxy or not."))
add_depends(main_node, {["preproxy_enabled"] = true})
main_node.template = appname .. "/cbi/nodes_listvalue"
main_node.group = {}

o = add_option(Flag, "fakedns", '<a style="color:#FF8C00">FakeDNS</a>' .. " " .. translate("Main switch"), translate("Use FakeDNS work in the domain that proxy.") .. "<br>" ..
translate("Suitable scenarios for let the node servers get the target domain names.") .. "<br>" ..
translate("Such as: DNS unlocking of streaming media, reducing DNS query latency, etc."))
Expand Down Expand Up @@ -160,73 +154,36 @@ o.remove = function(self, section)
return m:del(current_node_id, shunt_rules[section]["_fakedns_option"])
end

o = s2:option(ListValue, "_proxy_tag", string.format('<a style="color:red">%s</a>', translate("Preproxy")))
--TODO Choose any node as a pre-proxy. Instead of main node.
o.template = appname .. "/cbi/nodes_listvalue"
o.group = {"",""}
o:value("", translate("Close (Not use)"))
o:value("main", translate("Use preproxy node"))
o.cfgvalue = function(self, section)
proxy_tag_node = s2:option(ListValue, "_proxy_tag", string.format('<a style="color:red" title="%s">%s</a>',
translate("Set the node to be used as a pre-proxy.") .. "\n" .. translate("Each rule has a separate switch that controls whether this rule uses the pre-proxy or not."),
translate("Preproxy")))
proxy_tag_node.template = appname .. "/cbi/nodes_listvalue"
proxy_tag_node.group = {""}
proxy_tag_node:value("", translate("Close (Not use)"))
proxy_tag_node.cfgvalue = function(self, section)
return m:get(current_node_id, shunt_rules[section]["_proxy_tag_option"])
end
o.write = function(self, section, value)
proxy_tag_node.write = function(self, section, value)
return m:set(current_node_id, shunt_rules[section]["_proxy_tag_option"], value)
end
o.remove = function(self, section)
proxy_tag_node.remove = function(self, section)
return m:del(current_node_id, shunt_rules[section]["_proxy_tag_option"])
end

if data.socks_list then
for k, v in pairs(data.socks_list) do
main_node:value(v.id, v.remark)
main_node.group[#main_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")

_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
end
end
if data.urltest_list then
for k, v in pairs(data.urltest_list) do
main_node:value(v.id, v.remark)
main_node.group[#main_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")

_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
end
end
if data.balancing_list then
for k, v in pairs(data.balancing_list) do
main_node:value(v.id, v.remark)
main_node.group[#main_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")

_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
end
end
if data.iface_list then
for k, v in pairs(data.iface_list) do
main_node:value(v.id, v.remark)
main_node.group[#main_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")

_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
end
end
if data.normal_list then
for k, v in pairs(data.normal_list) do
main_node:value(v.id, v.remark)
main_node.group[#main_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
for k1, v1 in pairs(node_list) do
if k1 ~= "shunt_list" then
for i, v in ipairs(v1) do
_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")

_node:value(v.id, v.remark)
_node.group[#_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
proxy_tag_node:value(v.id, v.remark)
proxy_tag_node.group[#proxy_tag_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
end
end
end

if #main_node.keylist > 0 then
main_node.default = main_node.keylist[1]
end

local footer = Template(appname .. "/include/shunt_options")
footer.api = api
footer.id = current_node_id
footer.normal_list = api.jsonc.stringify(node_list.normal_list)
m:append(footer)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ m:append(header)
m:append(Template(appname .. "/cbi/nodes_multivalue_com"))
m:append(Template(appname .. "/cbi/nodes_listvalue_com"))

groups = {}
m.uci:foreach(appname, "nodes", function(s)
if s[".name"] ~= arg[1] then
if s.group and s.group ~= "" then
groups[s.group] = true
end
end
end)

s = m:section(NamedSection, arg[1], "nodes", "")
s.addremove = false
s.dynamic = false
Expand All @@ -33,14 +42,6 @@ o.rmempty = false
o = s:option(Value, "group", translate("Group Name"))
o.default = ""
o:value("", translate("default"))
local groups = {}
m.uci:foreach(appname, "nodes", function(s)
if s[".name"] ~= arg[1] then
if s.group and s.group ~= "" then
groups[s.group] = true
end
end
end)
for k, v in pairs(groups) do
o:value(k)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ o.write = function(self, section, value)
if e["group"] and e["group"]:lower() == old:lower() then
m.uci:set(appname, e[".name"], "group", value)
end
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
local gs = ""
for g in e["node_group"]:gmatch("%S+") do
if api.UrlEncode(old) == g then
gs = gs .. " " .. api.UrlEncode(value)
else
gs = gs .. " " .. g
end
end
gs = api.trim(gs)
m.uci:set(appname, e[".name"], "node_group", gs)
end
end)
end
return Value.write(self, section, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ o.write = function(self, section, value)
if e["group"] and e["group"]:lower() == old:lower() then
m.uci:set(appname, e[".name"], "group", value)
end
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
local gs = ""
for g in e["node_group"]:gmatch("%S+") do
if api.UrlEncode(old) == g then
gs = gs .. " " .. api.UrlEncode(value)
else
gs = gs .. " " .. g
end
end
gs = api.trim(gs)
m.uci:set(appname, e[".name"], "node_group", gs)
end
end)
end
return Value.write(self, section, value)
Expand Down
Loading