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 @@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-passwall
PKG_VERSION:=26.1.1
PKG_VERSION:=26.1.13
PKG_RELEASE:=1

PKG_CONFIG_DEPENDS:= \
Expand Down
9 changes: 2 additions & 7 deletions applications/luci-app-passwall/luasrc/controller/passwall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,7 @@ function connect_status()
local proxy_mode = uci:get(appname, "@global[0]", "tcp_proxy_mode") or "proxy"
local localhost_proxy = uci:get(appname, "@global[0]", "localhost_proxy") or "1"
local socks_server = (localhost_proxy == "0") and api.get_cache_var("GLOBAL_TCP_SOCKS_server") or ""

-- 兼容 curl 8.6 time_starttransfer 错误
local curl_ver = api.get_bin_version_cache("/usr/bin/curl", "-V 2>/dev/null | head -n 1 | awk '{print $2}' | cut -d. -f1,2 | tr -d ' \n'") or "0"
url = (curl_ver == "8.6") and "-w %{http_code}:%{time_appconnect} https://" .. url
or "-w %{http_code}:%{time_starttransfer} http://" .. url

url = "-w %{http_code}:%{time_starttransfer} " .. url
if socks_server and socks_server ~= "" then
if (chn_list == "proxy" and gfw_list == "0" and proxy_mode ~= "proxy" and baidu ~= nil) or (chn_list == "0" and gfw_list == "0" and proxy_mode == "proxy") then
-- 中国列表+百度 or 全局
Expand All @@ -349,7 +344,7 @@ function connect_status()
url = "-x socks5h://" .. socks_server .. " " .. url
end
end
local result = luci.sys.exec('/usr/bin/curl --max-time 5 -o /dev/null -I -sk ' .. url)
local result = luci.sys.exec('/usr/bin/curl --connect-timeout 3 --max-time 5 -o /dev/null -I -sk ' .. url)
local code = tonumber(luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $1}'") or "0")
if code ~= 0 then
local use_time_str = luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $2}'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remark)
o.group[#o.group+1] = (v1.group and v1.group ~= "") and v1.group or translate("default")
pt:depends({ [node_option] = v1.id, [vid .. "-preproxy_enabled"] = "1" })
if not api.is_local_ip(v1.address) then --本地节点禁止使用前置
pt:depends({ [node_option] = v1.id, [vid .. "-preproxy_enabled"] = "1" })
end
end
end
end)
Expand Down Expand Up @@ -273,7 +275,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
o:value("", translate("Close"))
o:value("main", translate("Preproxy Node"))
for k1, v1 in pairs(normal_list) do
if v1.protocol ~= "_balancing" and v1.protocol ~= "_urltest" then
if v1.protocol ~= "_balancing" and v1.protocol ~= "_urltest" and not api.is_local_ip(v1.address) then
o:depends({ [vid .. "-default_node"] = v1.id, [vid .. "-preproxy_enabled"] = "1" })
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ o:depends("balancing_enable", true)

---- Passwall Inner implement Probe URL
o = s:option(Value, "health_probe_url", translate("Probe URL"))
o.default = "https://www.google.com/generate_204"
o:value("https://cp.cloudflare.com/", "Cloudflare")
o:value("https://www.gstatic.com/generate_204", "Gstatic")
o:value("https://www.google.com/generate_204", "Google")
o:value("https://www.youtube.com/generate_204", "YouTube")
o:value("https://connect.rom.miui.com/generate_204", "MIUI (CN)")
o:value("https://connectivitycheck.platform.hicloud.com/generate_204", "HiCloud (CN)")
o.default = o.keylist[3]
o.description = translate("The URL used to detect the connection status.")
o:depends("health_check_type", "passwall_logic")

Expand Down Expand Up @@ -166,6 +166,6 @@ o:value(0, translate("Primary"))
o:value(1, translate("Standby"))
o.rmempty = false

s:append(Template(appname .. "/haproxy/js"))
m:append(Template(appname .. "/haproxy/js"))

return m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ o:value("tcping", "TCP Ping")
o = s:option(Flag, "show_node_info", translate("Show server address and port"))
o.default = "0"

o = s:option(Value, "url_test_url", translate("URL Test Address"))
o:value("https://cp.cloudflare.com/", "Cloudflare")
o:value("https://www.gstatic.com/generate_204", "Gstatic")
o:value("https://www.google.com/generate_204", "Google")
o:value("https://www.youtube.com/generate_204", "YouTube")
o:value("https://connect.rom.miui.com/generate_204", "MIUI (CN)")
o:value("https://connectivitycheck.platform.hicloud.com/generate_204", "HiCloud (CN)")
o.default = o.keylist[3]

-- [[ Add the node via the link ]]--
s:append(Template(appname .. "/node_list/link_add_node"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ if has_hysteria2 then
end

m = Map(appname)
api.set_apply_on_parse(m)

function m.commit_handler(self)
function m.on_before_save(self)
if self.no_commit then
return
end
Expand All @@ -55,21 +56,6 @@ function m.commit_handler(self)
end)
end

if api.is_js_luci() then
m.apply_on_parse = false
m.on_after_apply = function(self)
uci:foreach(appname, "subscribe_list", function(e)
uci:delete(appname, e[".name"], "md5")
end)
uci:commit(appname)
api.showMsg_Redirect()
end
m.render = function(self, ...)
Map.render(self, ...)
api.optimize_cbi_ui()
end
end

-- [[ Subscribe Settings ]]--
s = m:section(TypedSection, "global_subscribe", "")
s.anonymous = true
Expand Down Expand Up @@ -243,6 +229,6 @@ o.cfgvalue = function(self, section)
section, translate("Manual subscription"))
end

s:append(Template(appname .. "/node_subscribe/js"))
m:append(Template(appname .. "/node_subscribe/js"))

return m
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,18 @@ local appname = "passwall"

m = Map(appname)
m.redirect = api.url("node_subscribe")
api.set_apply_on_parse(m)

if not arg[1] or not m:get(arg[1]) then
luci.http.redirect(m.redirect)
end

function m.commit_handler(self)
function m.on_before_save(self)
self:del(arg[1], "md5")
end

m:append(Template(appname .. "/cbi/nodes_listvalue_com"))

if api.is_js_luci() then
m.apply_on_parse = false
m.on_after_apply = function(self)
uci:delete(appname, arg[1], "md5")
uci:commit(appname)
api.showMsg_Redirect(self.redirect, 3000)
end
m.render = function(self, ...)
Map.render(self, ...)
api.optimize_cbi_ui()
end
end

local has_ss = api.is_finded("ss-redir")
local has_ss_rust = api.is_finded("sslocal")
local has_trojan_plus = api.is_finded("trojan-plus")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ o.validate = port_validate

---- TCP Redir Ports
o = s:option(Value, "tcp_redir_ports", translate("TCP Redir Ports"))
o.default = "22,25,53,80,143,443,465,587,853,873,993,995,5222,8080,8443,9418"
o:value("1:65535", translate("All"))
o:value("22,25,53,80,143,443,465,587,853,873,993,995,5222,8080,8443,9418", translate("Common Use"))
o:value("80,443", translate("Only Web"))
o.default = o.keylist[2]
o.validate = port_validate

---- UDP Redir Ports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ o:value("https://cdn.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/
o:value("https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
o.default = "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt"
o.default = o.keylist[2]

----chnroute URL
o = s:option(DynamicList, "chnroute_url", translate("China IPs(chnroute) Update URL"))
Expand Down Expand Up @@ -57,24 +57,26 @@ if has_xray or has_singbox then
o:value("https://github.com/MetaCubeX/meta-rules-dat/releases/latest/download/geoip.dat", translate("MetaCubeX/geoip"))
o:value("https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/geoip.dat", translate("Loyalsoldier/geoip (CDN)"))
o:value("https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat", translate("MetaCubeX/geoip (CDN)"))
o.default = "https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip.dat"
o.default = o.keylist[1]

o = s:option(ListValue, "geosite_url", translate("Geosite Update URL"))
o:value("https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat", translate("Loyalsoldier/geosite"))
o:value("https://github.com/MetaCubeX/meta-rules-dat/releases/latest/download/geosite.dat", translate("MetaCubeX/geosite"))
o:value("https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat", translate("Loyalsoldier/geosite (CDN)"))
o:value("https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat", translate("MetaCubeX/geosite (CDN)"))
o.default = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
o.default = o.keylist[1]

o = s:option(Value, "v2ray_location_asset", translate("Location of Geo rule files"), translate("This variable specifies a directory where geoip.dat and geosite.dat files are."))
o.default = "/usr/share/v2ray/"
o.placeholder = "/usr/share/v2ray/"
o.rmempty = false

if api.is_finded("geoview") then
o = s:option(Flag, "geo2rule", translate("Generate Rule List from Geo"), translate("Generate rule lists such as GFW, China domains, and China IP ranges based on Geo files."))
o = s:option(Flag, "geo2rule", translate("Generate Rule List from Geo"))
o.default = 0
o.rmempty = false
o.description = translate("Generate rule lists such as GFW, China domains, and China IP ranges based on Geo files.") .. "<br><font color='red'>" ..
translate("When manually updating with this option enabled, rules will be regenerated from existing Geo files even if no new version is available.") .. "</font>"

o = s:option(Flag, "enable_geoview", translate("Enable Geo Data Parsing"))
o.default = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,8 @@ if api.finded_com("geoview") and fs.access(geosite_path) and fs.access(geoip_pat
end
end

function m.on_before_save(self)
m.on_before_save = function(self)
m:set("@global[0]", "flush_set", "1")
end

if api.is_js_luci() then
function m.on_before_save(self)
api.sh_uci_set(appname, "@global[0]", "flush_set", "1", true)
end
m.apply_on_parse = true
function m.on_apply(self)
luci.sys.call("/etc/init.d/passwall reload > /dev/null 2>&1 &")
end
end

return m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if not arg[1] or not m:get(arg[1]) then
luci.http.redirect(m.redirect)
end

function m.on_before_save(self)
m.on_before_save = function(self)
m:set("@global[0]", "flush_set", "1")
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ o = s:option(Flag, "autoswitch_restore_switch", translate("Restore Switch"), tra
o:depends("enable_autoswitch", true)

o = s:option(Value, "autoswitch_probe_url", translate("Probe URL"), translate("The URL used to detect the connection status."))
o.default = "https://www.google.com/generate_204"
o:value("https://cp.cloudflare.com/", "Cloudflare")
o:value("https://www.gstatic.com/generate_204", "Gstatic")
o:value("https://www.google.com/generate_204", "Google")
o:value("https://www.youtube.com/generate_204", "YouTube")
o:value("https://connect.rom.miui.com/generate_204", "MIUI (CN)")
o:value("https://connectivitycheck.platform.hicloud.com/generate_204", "HiCloud (CN)")
o.default = o.keylist[3]
o:depends("enable_autoswitch", true)

o = s:option(DummyValue, "btn", " ")
o = s:option(DummyValue, "btn")
o.template = appname .. "/socks_auto_switch/btn"
o:depends("enable_autoswitch", true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
id = e[".name"],
remark = e["remark"],
type = e["type"],
address = e["address"],
chain_proxy = e["chain_proxy"],
group = e["group"]
}
Expand Down Expand Up @@ -192,7 +193,7 @@ o:value("https://www.google.com/generate_204", "Google")
o:value("https://www.youtube.com/generate_204", "YouTube")
o:value("https://connect.rom.miui.com/generate_204", "MIUI (CN)")
o:value("https://connectivitycheck.platform.hicloud.com/generate_204", "HiCloud (CN)")
o.default = "https://www.google.com/generate_204"
o.default = o.keylist[3]
o.description = translate("The URL used to detect the connection status.")

-- 探测间隔
Expand Down Expand Up @@ -268,7 +269,9 @@ m.uci:foreach(appname, "shunt_rules", function(e)
for k, v in pairs(nodes_table) do
o:value(v.id, v.remark)
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id })
if not api.is_local_ip(v.address) then --本地节点禁止使用前置
pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id })
end
end
end
end
Expand Down Expand Up @@ -308,7 +311,9 @@ if #nodes_table > 0 then
for k, v in pairs(nodes_table) do
o:value(v.id, v.remark)
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id })
if not api.is_local_ip(v.address) then
dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id })
end
end
end

Expand Down Expand Up @@ -392,8 +397,7 @@ o = s:option(ListValue, _n("flow"), translate("flow"))
o.default = ""
o:value("", translate("Disable"))
o:value("xtls-rprx-vision")
o:depends({ [_n("protocol")] = "vless", [_n("transport")] = "raw" })
o:depends({ [_n("protocol")] = "vless", [_n("transport")] = "xhttp" })
o:depends({ [_n("protocol")] = "vless" })

o = s:option(Flag, _n("tls"), translate("TLS"))
o.default = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
id = e[".name"],
remark = e["remark"],
type = e["type"],
address = e["address"],
chain_proxy = e["chain_proxy"],
group = e["group"]
}
Expand Down Expand Up @@ -155,7 +156,7 @@ o:value("https://www.google.com/generate_204", "Google")
o:value("https://www.youtube.com/generate_204", "YouTube")
o:value("https://connect.rom.miui.com/generate_204", "MIUI (CN)")
o:value("https://connectivitycheck.platform.hicloud.com/generate_204", "HiCloud (CN)")
o.default = "https://www.gstatic.com/generate_204"
o.default = o.keylist[3]
o.description = translate("The URL used to detect the connection status.")

o = s:option(Value, _n("urltest_interval"), translate("Test interval"))
Expand Down Expand Up @@ -242,7 +243,9 @@ m.uci:foreach(appname, "shunt_rules", function(e)
for k, v in pairs(nodes_table) do
o:value(v.id, v.remark)
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id })
if not api.is_local_ip(v.address) then --本地节点禁止使用前置
pt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n(e[".name"])] = v.id })
end
end
end
end
Expand Down Expand Up @@ -282,7 +285,9 @@ if #nodes_table > 0 then
for k, v in pairs(nodes_table) do
o:value(v.id, v.remark)
o.group[#o.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id })
if not api.is_local_ip(v.address) then
dpt:depends({ [_n("protocol")] = "_shunt", [_n("preproxy_enabled")] = true, [_n("default_node")] = v.id })
end
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ o = s:option(ListValue, _n("flow"), translate("flow"))
o.default = ""
o:value("", translate("Disable"))
o:value("xtls-rprx-vision")
o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "raw" })
o:depends({ [_n("protocol")] = "vless", [_n("tls")] = true, [_n("transport")] = "xhttp" })
o:depends({ [_n("protocol")] = "vless" })

o = s:option(Flag, _n("tls"), translate("TLS"))
o.default = 0
Expand Down
Loading