From 515e212ce3982f5671fdbbedc97573418211f8d7 Mon Sep 17 00:00:00 2001 From: action Date: Sun, 16 Aug 2026 04:15:50 +0800 Subject: [PATCH] update 2026-08-16 04:15:50 --- .../client/type/{ray.lua => 1_xray.lua} | 0 .../type/{sing-box.lua => 2_sing-box.lua} | 0 .../type/{hysteria2.lua => 3_hysteria2.lua} | 0 .../type/{ss-rust.lua => 4_ss-rust.lua} | 0 .../client/type/{ssr.lua => 5_ssr.lua} | 0 .../client/type/{naive.lua => 6_naive.lua} | 0 .../server/type/{ray.lua => 1_xray.lua} | 57 +++++++++++-------- .../type/{sing-box.lua => 2_sing-box.lua} | 57 +++++++++++-------- .../type/{hysteria2.lua => 3_hysteria2.lua} | 4 ++ .../type/{ss-rust.lua => 4_ss-rust.lua} | 4 ++ .../server/type/{ssr.lua => 5_ssr.lua} | 4 ++ luci-app-passwall2/luasrc/passwall2/api.lua | 1 + ...er_wireguard.htm => gen_wireguard_key.htm} | 2 +- .../root/usr/share/passwall2/subscribe.lua | 10 ++++ 14 files changed, 90 insertions(+), 49 deletions(-) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{ray.lua => 1_xray.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{sing-box.lua => 2_sing-box.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{hysteria2.lua => 3_hysteria2.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{ss-rust.lua => 4_ss-rust.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{ssr.lua => 5_ssr.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/{naive.lua => 6_naive.lua} (100%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/{ray.lua => 1_xray.lua} (95%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/{sing-box.lua => 2_sing-box.lua} (94%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/{hysteria2.lua => 3_hysteria2.lua} (95%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/{ss-rust.lua => 4_ss-rust.lua} (93%) rename luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/{ssr.lua => 5_ssr.lua} (94%) rename luci-app-passwall2/luasrc/view/passwall2/server/{server_wireguard.htm => gen_wireguard_key.htm} (96%) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/1_xray.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/1_xray.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/2_sing-box.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/2_sing-box.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/3_hysteria2.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/3_hysteria2.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ss-rust.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/4_ss-rust.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ss-rust.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/4_ss-rust.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ssr.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/5_ssr.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ssr.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/5_ssr.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/naive.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/6_naive.lua similarity index 100% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/naive.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/6_naive.lua diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/1_xray.lua similarity index 95% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/1_xray.lua index ae79afb3..48107b1b 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/1_xray.lua @@ -11,6 +11,10 @@ if not s1.fields["type"].default then s1.fields["type"].default = type_name end +if not s1.val["type"] then + s1.val["type"] = type_name +end + if s1.val["type"] and s1.val["type"] ~= type_name then return end @@ -29,6 +33,27 @@ local header_type_list = { o = s:option(Flag, "custom", translate("Use Custom Config")) +o = s:option(TextValue, "custom_config", translate("Custom Config") .. " (JSON)") +o.rows = 10 +o.wrap = "off" +o:depends({ custom = true }) +o.datatype = "json" +local o_validate = o.validate +o.validate = function(self, value) + local v = o_validate(self, value) + if v then return v end + return nil, translate("Custom Config") .. " " .. translate("Must be JSON text!") +end +o.custom_cfgvalue = function(self, section, value) + local config_str = m:get(section, "config_str") + if config_str then + return api.base64Decode(config_str) + end +end +o.custom_write = function(self, section, value) + m:set(section, "config_str", api.base64Encode(value) or "") +end + o = s:option(ListValue, "protocol", translate("Protocol")) o:value("vmess", "Vmess") o:value("vless", "VLESS") @@ -41,6 +66,12 @@ o:value("wireguard", "WireGuard") o:value("dokodemo-door", "dokodemo-door") o:depends({ custom = false }) +o = s:option(DummyValue, "is_endpoint", "") +o.not_rewrite = true +o.template = m:template_path("/cbi/hidevalue") +o.value = "1" +o:depends({ custom = false, protocol = "wireguard" }) + o = s:option(Value, "port", translate("Listen Port")) o.datatype = "port" o:depends({ custom = false }) @@ -385,7 +416,7 @@ end --[[acceptProxyProtocol]] o = s:option(Flag, "acceptProxyProtocol", translate("acceptProxyProtocol"), translate("Whether to receive PROXY protocol, when this node want to be fallback or forwarded by proxy, it must be enable, otherwise it cannot be used.")) o.default = "0" -o:depends({ custom = false }) +o:depends({ custom = false, is_endpoint = "" }) --[[Fast Open]] o = s:option(Flag, "tcp_fast_open", "TCP " .. translate("Fast Open")) @@ -444,8 +475,7 @@ o.datatype = "base64" o:depends({ protocol = "wireguard" }) o = s:option(DummyValue, "gen_wireguard_key") -o.prefix = option_prefix -o.template = m:template_path("/server/server_wireguard") +o.template = m:template_path("/server/gen_wireguard_key") o:depends({ protocol = "wireguard" }) o = s:option(Flag, "bind_local", translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) @@ -505,27 +535,6 @@ for _, d in ipairs(netdev_list) do o:value(d.name, d.label) end -o = s:option(TextValue, "custom_config", translate("Custom Config") .. " (JSON)") -o.rows = 10 -o.wrap = "off" -o:depends({ custom = true }) -o.datatype = "json" -local o_validate = o.validate -o.validate = function(self, value) - local v = o_validate(self, value) - if v then return v end - return nil, translate("Custom Config") .. " " .. translate("Must be JSON text!") -end -o.custom_cfgvalue = function(self, section, value) - local config_str = m:get(section, "config_str") - if config_str then - return api.base64Decode(config_str) - end -end -o.custom_write = function(self, section, value) - m:set(section, "config_str", api.base64Encode(value) or "") -end - o = s:option(Flag, "log", translate("Log")) o.default = "1" o.rmempty = false diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/2_sing-box.lua similarity index 94% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/sing-box.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/2_sing-box.lua index 59b772e3..0d5a713b 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/2_sing-box.lua @@ -13,6 +13,10 @@ if not s1.fields["type"].default then s1.fields["type"].default = type_name end +if not s1.val["type"] then + s1.val["type"] = type_name +end + if s1.val["type"] and s1.val["type"] ~= type_name then return end @@ -30,6 +34,27 @@ local ss_method_list = { o = s:option(Flag, "custom", translate("Use Custom Config")) +o = s:option(TextValue, "custom_config", translate("Custom Config") .. " (JSON)") +o.rows = 10 +o.wrap = "off" +o:depends({ custom = true }) +o.datatype = "json" +local o_validate = o.validate +o.validate = function(self, value) + local v = o_validate(self, value) + if v then return v end + return nil, translate("Custom Config") .. " " .. translate("Must be JSON text!") +end +o.custom_cfgvalue = function(self, section, value) + local config_str = m:get(section, "config_str") + if config_str then + return api.base64Decode(config_str) + end +end +o.custom_write = function(self, section, value) + m:set(section, "config_str", api.base64Encode(value) or "") +end + o = s:option(ListValue, "protocol", translate("Protocol")) o:value("mixed", "Mixed") o:value("socks", "Socks") @@ -55,6 +80,12 @@ end o:value("direct", "Direct") o:depends({ custom = false }) +o = s:option(DummyValue, "is_endpoint", "") +o.not_rewrite = true +o.template = m:template_path("/cbi/hidevalue") +o.value = "1" +o:depends({ custom = false, protocol = "wireguard" }) + o = s:option(Value, "port", translate("Listen Port")) o.datatype = "port" o:depends({ custom = false }) @@ -420,14 +451,13 @@ if singbox_tags:find("with_wireguard") then o:depends({ protocol = "wireguard" }) o = s:option(DummyValue, "gen_wireguard_key") - o.prefix = option_prefix - o.template = m:template_path("/server/server_wireguard") + o.template = m:template_path("/server/gen_wireguard_key") o:depends({ protocol = "wireguard" }) end o = s:option(Flag, "bind_local", translate("Bind Local"), translate("When selected, it can only be accessed localhost.")) o.default = "0" -o:depends({ custom = false }) +o:depends({ custom = false, is_endpoint = "" }) o = s:option(Flag, "accept_lan", translate("Accept LAN Access"), translate("When selected, it can accessed lan , this will not be safe!")) o.default = "0" @@ -482,27 +512,6 @@ for _, d in ipairs(netdev_list) do o:value(d.name, d.label) end -o = s:option(TextValue, "custom_config", translate("Custom Config") .. " (JSON)") -o.rows = 10 -o.wrap = "off" -o:depends({ custom = true }) -o.datatype = "json" -local o_validate = o.validate -o.validate = function(self, value) - local v = o_validate(self, value) - if v then return v end - return nil, translate("Custom Config") .. " " .. translate("Must be JSON text!") -end -o.custom_cfgvalue = function(self, section, value) - local config_str = m:get(section, "config_str") - if config_str then - return api.base64Decode(config_str) - end -end -o.custom_write = function(self, section, value) - m:set(section, "config_str", api.base64Encode(value) or "") -end - o = s:option(Flag, "log", translate("Log")) o.default = "1" o.rmempty = false diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/3_hysteria2.lua similarity index 95% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/3_hysteria2.lua index 8c6114e8..bd6c5c1d 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/hysteria2.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/3_hysteria2.lua @@ -8,6 +8,10 @@ local type_name = "Hysteria2" s1.fields["type"]:value(type_name, "Hysteria2") +if not s1.val["type"] then + s1.val["type"] = type_name +end + if s1.val["type"] and s1.val["type"] ~= type_name then return end diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ss-rust.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/4_ss-rust.lua similarity index 93% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ss-rust.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/4_ss-rust.lua index 1c7e88c0..80cb56c7 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ss-rust.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/4_ss-rust.lua @@ -8,6 +8,10 @@ local type_name = "SS-Rust" s1.fields["type"]:value(type_name, translate("Shadowsocks Rust")) +if not s1.val["type"] then + s1.val["type"] = type_name +end + if s1.val["type"] and s1.val["type"] ~= type_name then return end diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ssr.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/5_ssr.lua similarity index 94% rename from luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ssr.lua rename to luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/5_ssr.lua index 32494fb7..958c9812 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/ssr.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/server/type/5_ssr.lua @@ -8,6 +8,10 @@ local type_name = "SSR" s1.fields["type"]:value(type_name, translate("ShadowsocksR")) +if not s1.val["type"] then + s1.val["type"] = type_name +end + if s1.val["type"] and s1.val["type"] ~= type_name then return end diff --git a/luci-app-passwall2/luasrc/passwall2/api.lua b/luci-app-passwall2/luasrc/passwall2/api.lua index 533824f6..779bce87 100644 --- a/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/luci-app-passwall2/luasrc/passwall2/api.lua @@ -1554,6 +1554,7 @@ function luci_types(s, s2) for i, v in ipairs(s2.children) do local o = s2.children[i] o.config_option = o.option + o.option_prefix = option_prefix o.option = option_prefix .. o.option if not o.not_rewrite then o.cfgvalue = function(self, section) diff --git a/luci-app-passwall2/luasrc/view/passwall2/server/server_wireguard.htm b/luci-app-passwall2/luasrc/view/passwall2/server/gen_wireguard_key.htm similarity index 96% rename from luci-app-passwall2/luasrc/view/passwall2/server/server_wireguard.htm rename to luci-app-passwall2/luasrc/view/passwall2/server/gen_wireguard_key.htm index ff73bb97..1283e6f7 100644 --- a/luci-app-passwall2/luasrc/view/passwall2/server/server_wireguard.htm +++ b/luci-app-passwall2/luasrc/view/passwall2/server/gen_wireguard_key.htm @@ -1,7 +1,7 @@ <% local map = self.map local api = map.api -local prefix = self.prefix +local prefix = self.option_prefix or "" -%>
" data-index="<%=self.index%>" data-depends="<%=pcdata(self:deplist2json(section))%>"> diff --git a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua index c4f657b8..70bb852f 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua +++ b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua @@ -535,6 +535,7 @@ local function parseClashNode(node, add_mode, group, sub_cfg) result = set_ss_implementation(sub_ss_type, result) if not result then return nil end result.method = node.cipher + result.ss_method = node.cipher result.password = node.password if node.plugin == "obfs" then result.plugin = "obfs-local" @@ -1114,6 +1115,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) (_method == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or _method result.method = method + result.ss_method = method result.password = password result.tcp_fast_open = params.tfo result.use_finalmask = (params.fm and params.fm ~= "") and "1" or nil @@ -1482,6 +1484,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.port = content.port result.password = content.password result.method = content.encryption + result.ss_method = content.encryption result.plugin = content.plugin result.plugin_opts = content.plugin_options result.group = content.airport @@ -1770,6 +1773,13 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.finalmask = (params.fm and params.fm ~= "") and api.base64Encode(params.fm) or nil elseif has_hysteria2 then result.type = "Hysteria2" + for k1, v1 in pairs(result) do + if k1:find("hysteria2_") == 1 then + local s = split(k1, "hysteria2_") + result[s[2]] = v1 + result[k1] = nil + end + end else log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "Hysteria2", "Hysteria2")) return nil