mirror of
https://github.com/bolucat/Archive.git
synced 2025-12-24 13:28:37 +08:00
Update On Thu Oct 30 19:42:26 CET 2025
This commit is contained in:
@@ -8,6 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=25.9.23
|
||||
PKG_RELEASE:=1
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||
|
||||
@@ -3,9 +3,28 @@ local appname = "passwall"
|
||||
local datatypes = api.datatypes
|
||||
|
||||
m = Map(appname, "Sing-Box/Xray " .. translate("Shunt Rule"))
|
||||
m.redirect = api.url()
|
||||
m.redirect = api.url("rule")
|
||||
api.set_apply_on_parse(m)
|
||||
|
||||
if not arg[1] or not m:get(arg[1]) then
|
||||
luci.http.redirect(m.redirect)
|
||||
end
|
||||
|
||||
-- Add inline CSS to map description
|
||||
m.description = (m.description or "") .. "\n" .. [[
|
||||
<style>
|
||||
div[id^="cbid.passwall."] .cbi-value-field {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1em;
|
||||
}
|
||||
div[id^="cbid.passwall."] .cbi-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
]]
|
||||
|
||||
function clean_text(text)
|
||||
local nbsp = string.char(0xC2, 0xA0) -- 不间断空格(U+00A0)
|
||||
local fullwidth_space = string.char(0xE3, 0x80, 0x80) -- 全角空格(U+3000)
|
||||
@@ -31,10 +50,14 @@ protocol = s:option(MultiValue, "protocol", translate("Protocol"))
|
||||
protocol:value("http")
|
||||
protocol:value("tls")
|
||||
protocol:value("bittorrent")
|
||||
protocol.widget = "checkbox"
|
||||
protocol.default = nil
|
||||
|
||||
o = s:option(MultiValue, "inbound", translate("Inbound Tag"))
|
||||
o:value("tproxy", translate("Transparent proxy"))
|
||||
o:value("socks", "Socks")
|
||||
o.widget = "checkbox"
|
||||
o.default = nil
|
||||
|
||||
network = s:option(ListValue, "network", translate("Network"))
|
||||
network:value("tcp,udp", "TCP UDP")
|
||||
|
||||
@@ -411,22 +411,13 @@ function is_special_node(e)
|
||||
end
|
||||
|
||||
function is_ip(val)
|
||||
if is_ipv6(val) then
|
||||
val = get_ipv6_only(val)
|
||||
end
|
||||
return datatypes.ipaddr(val)
|
||||
local str = val:match("%[(.-)%]") or val
|
||||
return datatypes.ipaddr(str) or false
|
||||
end
|
||||
|
||||
function is_ipv6(val)
|
||||
local str = val
|
||||
local address = val:match('%[(.*)%]')
|
||||
if address then
|
||||
str = address
|
||||
end
|
||||
if datatypes.ip6addr(str) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
local str = val:match("%[(.-)%]") or val
|
||||
return datatypes.ip6addr(str) or false
|
||||
end
|
||||
|
||||
function is_local_ip(ip)
|
||||
@@ -442,22 +433,18 @@ function is_local_ip(ip)
|
||||
end
|
||||
|
||||
function is_ipv6addrport(val)
|
||||
if is_ipv6(val) then
|
||||
local address, port = val:match('%[(.*)%]:([^:]+)$')
|
||||
if port then
|
||||
return datatypes.port(port)
|
||||
end
|
||||
local address, port = val:match("%[(.-)%]:([0-9]+)$")
|
||||
if address and datatypes.ip6addr(address) and datatypes.port(port) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function get_ipv6_only(val)
|
||||
local result = ""
|
||||
if is_ipv6(val) then
|
||||
result = val
|
||||
if val:match('%[(.*)%]') then
|
||||
result = val:match('%[(.*)%]')
|
||||
end
|
||||
local inner = val:match("%[(.-)%]") or val
|
||||
if datatypes.ip6addr(inner) then
|
||||
result = inner
|
||||
end
|
||||
return result
|
||||
end
|
||||
@@ -466,7 +453,7 @@ function get_ipv6_full(val)
|
||||
local result = ""
|
||||
if is_ipv6(val) then
|
||||
result = val
|
||||
if not val:match('%[(.*)%]') then
|
||||
if not val:match("%[.-%]") then
|
||||
result = "[" .. result .. "]"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user