diff --git a/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua b/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua index 526ac3ad..ed71adae 100644 --- a/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua +++ b/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua @@ -318,15 +318,40 @@ local function encode_ss(node) if node["udp-over-tcp"] then table.insert(p, "uot=1") end if node.plugin then - local plugin = node.plugin - if node["plugin-opts"] then + local plugin = (node.plugin == "obfs") and "obfs-local" or node.plugin + if plugin == "shadow-tls" then + local shadow_tls = base64(json.stringify(node["plugin-opts"] or {})) + table.insert(p, "shadow-tls=" .. urlencode(shadow_tls)) + else local opts = {} - for k, v in pairs(node["plugin-opts"]) do - table.insert(opts, k .. "=" .. v) + for k, v in pairs(node["plugin-opts"] or {}) do + if plugin == "obfs-local" then + if k == "mode" then k = "obfs" end + if k == "host" then k = "obfs-host" end + elseif plugin == "v2ray-plugin" then + if k == "mode" and v == "websocket" then + v = nil + elseif type(v) == "boolean" then + if v == true then + table.insert(opts, k) + end + v = nil + end + elseif plugin == "gost-plugin" then + if k == "mode" and v == "websocket" then v = "ws" end + if k == "host" then k = "serverName" end + if k == "headers" then v = nil end + end + if v ~= nil then + if type(v) == "boolean" then + v = v and "1" or "0" + end + table.insert(opts, k .. "=" .. v) + end end - plugin = plugin .. ";" .. table.concat(opts, ";") + if #opts > 0 then plugin = plugin .. ";" .. table.concat(opts, ";") end + table.insert(p, "plugin=" .. urlencode(plugin)) end - table.insert(p, "plugin=" .. urlencode(plugin)) end if #p > 0 then diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 9e9e527a..2f1fefee 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -809,7 +809,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) if result.type == 'Xray' then -- obfs-local插件转换成xray支持的格式 if result.plugin ~= "obfs-local" then - result.error_msg = "Xray 不支持 " .. result.plugin .. " 插件。" + result.error_msg = "Xray 不支持 SS " .. result.plugin .. " 插件。" else local obfs = result.plugin_opts:match("obfs=([^;]+)") or "" local obfs_host = result.plugin_opts:match("obfs%-host=([^;]+)") or "" @@ -829,6 +829,12 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.plugin = nil result.plugin_opts = nil end + elseif result.type == 'sing-box' then + if result.plugin ~= "obfs-local" and result.plugin ~= "v2ray-plugin" then + result.error_msg = "Sing-Box 不支持 SS " .. result.plugin .. " 插件。" + else + result.plugin_enabled = "1" + end else result.plugin_enabled = "1" end @@ -942,7 +948,7 @@ local function processData(szType, content, add_mode, group, sub_cfg) local insecure = params.allowinsecure or params.allowInsecure or params.insecure result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0") result.uot = params.udp - elseif (params.type ~= "tcp" and params.type ~= "raw") and (params.headerType and params.headerType ~= "none") then + else result.error_msg = "请更换 Xray 或 Sing-Box 来支持 SS 更多的传输方式。" end end