From 3b419bd4ad8d263cc6532d7d537be216c83c46a2 Mon Sep 17 00:00:00 2001 From: actions Date: Thu, 1 Feb 2024 17:00:10 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream --- .../model/cbi/passwall2/client/type/sing-box.lua | 14 ++++++++++++++ .../luasrc/passwall2/util_sing-box.lua | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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/sing-box.lua index 786d1cddc..afd7c59f2 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -611,4 +611,18 @@ if singbox_tags:find("with_utls") then o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_utls")] = true }) end +-- [[ SIP003 plugin ]]-- +o = s:option(Flag, option_name("plugin_enabled"), translate("plugin")) +o.default = 0 +o:depends({ [option_name("protocol")] = "shadowsocks" }) + +o = s:option(ListValue, option_name("plugin"), "SIP003 " .. translate("plugin")) +o.default = "obfs-local" +o:depends({ [option_name("plugin_enabled")] = true }) +o:value("obfs-local") +o:value("v2ray-plugin") + +o = s:option(Value, option_name("plugin_opts"), translate("opts")) +o:depends({ [option_name("plugin_enabled")] = true }) + api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 76cbafc5a..0182d7141 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -205,8 +205,8 @@ function gen_outbound(flag, node, tag, proxy_table) protocol_table = { method = node.method or nil, password = node.password or "", - plugin = node.plugin and nil, - plugin_opts = node.plugin_opts and nil, + plugin = (node.plugin_enabled and node.plugin) or nil, + plugin_opts = (node.plugin_enabled and node.plugin_opts) or nil, udp_over_tcp = node.uot == "1" and { enabled = true, version = 2