mirror of
https://github.com/fw876/helloworld.git
synced 2026-12-05 16:02:13 +00:00
luci-app-ssr-plus: drop Shadowsocks Libev support
This commit is contained in:
1 parent
579d793328
commit
e7cef6abda
10 files changed
+422
-503
No files matched your search
@@ -21,10 +21,8 @@ PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Simple_Obfs \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_V2ray_Plugin \
|
||||
@@ -43,9 +41,6 @@ LUCI_DEPENDS:= \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadow_TLS:shadow-tls \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server:shadowsocks-libev-ss-server \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client:shadowsocks-rust-sslocal \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server:shadowsocks-rust-ssserver \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Simple_Obfs:simple-obfs-client \
|
||||
@@ -86,14 +81,11 @@ endchoice
|
||||
choice
|
||||
prompt "Shadowsocks Client Selection"
|
||||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client if aarch64 || loongarch64 || x86_64
|
||||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client
|
||||
default PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client
|
||||
bool "None"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client
|
||||
bool "Shadowsocks-libev"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client
|
||||
bool "Shadowsocks-rust"
|
||||
depends on aarch64||arm||i386||loongarch64||riscv64||x86_64
|
||||
@@ -107,9 +99,6 @@ choice
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Server
|
||||
bool "None"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server
|
||||
bool "Shadowsocks-libev"
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server
|
||||
bool "Shadowsocks-rust"
|
||||
depends on aarch64||arm||i386||loongarch64||riscv64||x86_64
|
||||
|
||||
@@ -148,7 +148,6 @@ local function set_apply_on_parse(map)
|
||||
end
|
||||
|
||||
local has_ss_rust = is_finded("sslocal") or is_finded("ssserver")
|
||||
local has_ss_libev = is_finded("ss-redir") or is_finded("ss-local")
|
||||
local has_xray = is_finded("xray")
|
||||
|
||||
local server_table = {}
|
||||
@@ -258,6 +257,16 @@ local function migrate_xray_protocol_nodes()
|
||||
local changed = false
|
||||
|
||||
uci:foreach("shadowsocksr", "servers", function(section)
|
||||
if section.type == "ss" or section.type == "ss-libev" then
|
||||
if has_ss_rust then
|
||||
uci:set("shadowsocksr", section[".name"], "type", "ss-rust")
|
||||
changed = true
|
||||
elseif has_xray then
|
||||
uci:set("shadowsocksr", section[".name"], "type", "v2ray")
|
||||
uci:set("shadowsocksr", section[".name"], "v2ray_protocol", "shadowsocks")
|
||||
changed = true
|
||||
end
|
||||
end
|
||||
if section.type == "hysteria2" then
|
||||
uci:set("shadowsocksr", section[".name"], "type", "v2ray")
|
||||
uci:set("shadowsocksr", section[".name"], "v2ray_protocol", "hysteria2")
|
||||
@@ -325,49 +334,34 @@ end
|
||||
if is_finded("ssr-redir") then
|
||||
o:value("ssr", translate("ShadowsocksR"))
|
||||
end
|
||||
if has_ss_rust or has_ss_libev then
|
||||
o:value("ss", translate("ShadowSocks"))
|
||||
if has_ss_rust then
|
||||
o:value("ss-rust", translate("ShadowSocks"))
|
||||
end
|
||||
if is_finded("naive") then
|
||||
o:value("naiveproxy", translate("NaiveProxy"))
|
||||
end
|
||||
if is_finded("mihomo") then
|
||||
o:value("clash", translate("Clash/Mihomo"))
|
||||
end
|
||||
if is_finded("mihomo") then
|
||||
o:value("tuic", translate("TUIC"))
|
||||
end
|
||||
if is_finded("shadow-tls") and is_finded("sslocal") then
|
||||
o:value("shadowtls", translate("Shadow-TLS"))
|
||||
end
|
||||
if is_finded("ipt2socks") then
|
||||
o:value("socks5", translate("Socks5"))
|
||||
end
|
||||
local old_cfgvalue = o.cfgvalue
|
||||
if is_finded("naive") then
|
||||
o:value("naiveproxy", translate("NaiveProxy"))
|
||||
end
|
||||
if is_finded("mihomo") then
|
||||
o:value("clash", translate("Clash/Mihomo"))
|
||||
end
|
||||
if is_finded("mihomo") then
|
||||
o:value("tuic", translate("TUIC"))
|
||||
end
|
||||
if is_finded("shadow-tls") and is_finded("sslocal") then
|
||||
o:value("shadowtls", translate("Shadow-TLS"))
|
||||
end
|
||||
if is_finded("ipt2socks") then
|
||||
o:value("socks5", translate("Socks5"))
|
||||
end
|
||||
local old_cfgvalue = o.cfgvalue
|
||||
o.cfgvalue = function(self, section)
|
||||
local val = self.map.uci:get("shadowsocksr", section, "type")
|
||||
if val == "ss-rust" or val == "ss-libev" then
|
||||
return "ss"
|
||||
end
|
||||
if old_cfgvalue then
|
||||
local val = self.map.uci:get("shadowsocksr", section, "type")
|
||||
if old_cfgvalue then
|
||||
return old_cfgvalue(self, section)
|
||||
end
|
||||
return val
|
||||
end
|
||||
-- 重写 write,当用户选择 "ss" 时不写入(由 _ss_core 负责写入具体核心)
|
||||
local old_write = o.write
|
||||
o.write = function(self, section, value)
|
||||
if value == "ss" then
|
||||
return -- 不做任何写入,等待 _ss_core 写入
|
||||
end
|
||||
if old_write then
|
||||
old_write(self, section, value)
|
||||
else
|
||||
self.map.uci:set("shadowsocksr", section, "type", value)
|
||||
end
|
||||
end
|
||||
return val
|
||||
end
|
||||
|
||||
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
|
||||
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
|
||||
|
||||
o = s:option(Value, "alias", translate("Alias(optional)"))
|
||||
|
||||
@@ -405,40 +399,6 @@ end
|
||||
o.rmempty = false
|
||||
o:depends("type", "clash")
|
||||
|
||||
-- 新增一个选择框,用于选择 Shadowsocks 具体版本(仅当节点类型为 ss 或其具体子类型时显示)
|
||||
o = s:option(ListValue, "_ss_core", string.format("<b><span style='color:red;'>%s</span></b>", translatef("%s Node Use Version", "ShadowSocks")))
|
||||
o.description = translate("Selection ShadowSocks Node Use Version.")
|
||||
if has_ss_rust then
|
||||
o:value("ss-rust", translate("ShadowSocks-rust Version"))
|
||||
end
|
||||
if has_ss_libev then
|
||||
o:value("ss-libev", translate("ShadowSocks-libev Version"))
|
||||
end
|
||||
o.cfgvalue = function(self, section)
|
||||
-- 读取当前节点的 type 值,如果已经是具体核心则显示对应的选项
|
||||
local node_type = self.map.uci:get("shadowsocksr", section, "type")
|
||||
if node_type == "ss-rust" or node_type == "ss-libev" then
|
||||
return node_type
|
||||
end
|
||||
-- 节点 type 为旧的 "ss" 时,按本地可用核心自动优先选择
|
||||
if has_ss_rust then
|
||||
return "ss-rust"
|
||||
end
|
||||
if has_ss_libev then
|
||||
return "ss-libev"
|
||||
end
|
||||
return nil
|
||||
end
|
||||
-- 显示条件:当节点类型为 "ss" 或其具体核心时显示
|
||||
o:depends("type", "ss")
|
||||
o.rmempty = true
|
||||
-- 保存时,将选择的值直接写入当前节点的 type 字段
|
||||
o.write = function(self, section, value)
|
||||
if value and value ~= "" then
|
||||
self.map.uci:set("shadowsocksr", section, "type", value)
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "v2ray_protocol", translate("V2Ray/XRay protocol"))
|
||||
o:value("vless", translate("VLESS"))
|
||||
o:value("vmess", translate("VMess"))
|
||||
@@ -454,12 +414,12 @@ o:value("socks", translate("Socks"))
|
||||
o:value("http", translate("HTTP"))
|
||||
o:depends("type", "v2ray")
|
||||
|
||||
o = s:option(Value, "server", translate("Server Address"))
|
||||
o.datatype = "or(host,ip6addr)"
|
||||
o.rmempty = false
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "v2ray")
|
||||
o = s:option(Value, "server", translate("Server Address"))
|
||||
o.datatype = "or(host,ip6addr)"
|
||||
o.rmempty = false
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria2")
|
||||
@@ -467,12 +427,12 @@ o:depends("type", "trojan")
|
||||
o:depends("type", "shadowtls")
|
||||
o:depends("type", "socks5")
|
||||
|
||||
o = s:option(Value, "server_port", translate("Server Port"))
|
||||
o.datatype = "port"
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "v2ray")
|
||||
o = s:option(Value, "server_port", translate("Server Port"))
|
||||
o.datatype = "port"
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria2")
|
||||
@@ -494,12 +454,12 @@ o:depends({type = "socks5", auth_enable = true})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "http", auth_enable = true})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "socks", auth_enable = true})
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "trojan")
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "shadowtls")
|
||||
o:depends({type = "socks5", auth_enable = true})
|
||||
@@ -515,7 +475,7 @@ end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
|
||||
o = s:option(ListValue, "encrypt_method_ss", translate("Encrypt Method"))
|
||||
o = s:option(ListValue, "encrypt_method_ss", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ss) do
|
||||
if v == "none" then
|
||||
o.default = "none"
|
||||
@@ -524,9 +484,9 @@ for _, v in ipairs(encrypt_methods_ss) do
|
||||
o:value(v, translate(v))
|
||||
end
|
||||
end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
|
||||
|
||||
o = s:option(Flag, "uot", translate("UDP over TCP"))
|
||||
o.description = translate("Enable the SUoT protocol, requires server support.")
|
||||
@@ -540,10 +500,10 @@ o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
|
||||
o.default = "1"
|
||||
|
||||
-- [[ Enable Shadowsocks Plugin ]]--
|
||||
o = s:option(Flag, "enable_plugin", translate("Enable Plugin"))
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
o.default = "0"
|
||||
o = s:option(Flag, "enable_plugin", translate("Enable Plugin"))
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss-rust")
|
||||
o.default = "0"
|
||||
|
||||
-- Shadowsocks Plugin
|
||||
o = s:option(ListValue, "plugin", translate("Obfs"))
|
||||
@@ -1645,7 +1605,7 @@ o = s:option(Flag, "fast_open", translate("TCP Fast Open"), translate("Enabling
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "hysteria2")
|
||||
o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "xhttp"})
|
||||
@@ -1660,23 +1620,23 @@ if is_finded("kcptun-client") then
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
|
||||
o = s:option(Value, "kcp_port", translate("KcpTun Port"))
|
||||
o.datatype = "portrange"
|
||||
o.default = 4000
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
|
||||
o = s:option(Value, "kcp_password", translate("KcpTun Password"))
|
||||
o.password = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
|
||||
o = s:option(Value, "kcp_param", translate("KcpTun Param"))
|
||||
o.default = "--nocomp"
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -85,7 +85,7 @@ o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "type", translate("Server Type"))
|
||||
o:value("socks5", translate("Socks5"))
|
||||
if nixio.fs.access("/usr/bin/ssserver") or nixio.fs.access("/usr/bin/ss-server") then
|
||||
if nixio.fs.access("/usr/bin/ssserver") or nixio.fs.access("/usr/libexec/ssserver") then
|
||||
o:value("ss", translate("ShadowSocks"))
|
||||
end
|
||||
if nixio.fs.access("/usr/bin/ssr-server") then
|
||||
|
||||
@@ -4,7 +4,6 @@ local map = self.map
|
||||
local xray_hy2_type = map:get("@server_subscribe[0]", "xray_hy2_type")
|
||||
|
||||
local has_ss_rust = luci.sys.exec('type -t -p sslocal 2>/dev/null || type -t -p ssserver 2>/dev/null') ~= ""
|
||||
local has_ss_libev = luci.sys.exec('type -t -p ss-redir 2>/dev/null || type -t -p ss-local 2>/dev/null') ~= ""
|
||||
local has_hysteria = luci.sys.exec('type -t -p hysteria 2>/dev/null') ~= ""
|
||||
local has_xray = luci.sys.exec('type -t -p xray 2>/dev/null') ~= ""
|
||||
-%>
|
||||
@@ -12,7 +11,6 @@ local has_xray = luci.sys.exec('type -t -p xray 2>/dev/null') ~= ""
|
||||
//<![CDATA[
|
||||
let xray_hy2_type = "<%=xray_hy2_type%>"
|
||||
let has_ss_rust = "<%=has_ss_rust%>"
|
||||
let has_ss_libev = "<%=has_ss_libev%>"
|
||||
let has_hysteria = "<%=has_hysteria%>"
|
||||
let has_xray = "<%=has_xray%>"
|
||||
|
||||
@@ -249,9 +247,9 @@ function import_ssr_url(btn, urlname, sid) {
|
||||
|
||||
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
|
||||
return false;
|
||||
case "ss":
|
||||
var url0 = (ssu[1] || "");
|
||||
var param = "";
|
||||
case "ss":
|
||||
var url0 = (ssu[1] || "");
|
||||
var param = "";
|
||||
|
||||
// 先分离 #(alias)
|
||||
var hashIndex = url0.indexOf("#");
|
||||
@@ -268,345 +266,338 @@ function import_ssr_url(btn, urlname, sid) {
|
||||
url0 = url0.substring(0, queryIndex);
|
||||
}
|
||||
|
||||
var params = Object.fromEntries(new URLSearchParams(query));
|
||||
var params = Object.fromEntries(new URLSearchParams(query));
|
||||
|
||||
function importAsNormalSS() {
|
||||
// 普通 SS 导入逻辑
|
||||
// 判断是否 SIP002 格式(即含 @)
|
||||
if (url0.indexOf("@") !== -1) {
|
||||
// === SIP002 格式 ===
|
||||
var sipIndex = url0.indexOf("@");
|
||||
// 先 URL 解码 base64 再解码
|
||||
var userInfoB64 = decodeURIComponent(url0.substring(0, sipIndex));
|
||||
// console.log("userInfoB64:", userInfoB64);
|
||||
var userInfo = b64decsafe(userInfoB64);
|
||||
if (userInfo && userInfo.indexOf(":") !== -1) {
|
||||
var userInfo = userInfo;
|
||||
} else {
|
||||
var userInfo = userInfoB64;
|
||||
function decodeURIComponentSafe(value) {
|
||||
try {
|
||||
return decodeURIComponent(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
// 如果没有冒号,且不是 base64 格式,我们可以尝试补齐它
|
||||
if (userInfo.indexOf(":") === -1) {
|
||||
userInfo = "none:" + userInfo;
|
||||
}
|
||||
// console.log("userInfo after decode:", userInfo);
|
||||
var userInfoSplitIndex = userInfo.indexOf(":");
|
||||
if(userInfoSplitIndex < 0) {
|
||||
// 格式错误
|
||||
s.innerHTML = "<font style='color:red'><%:Userinfo format error.%></font>";
|
||||
return false;
|
||||
}
|
||||
var method = userInfo.substring(0, userInfoSplitIndex);
|
||||
// console.log("method:", method);
|
||||
var password = userInfo.substring(userInfoSplitIndex + 1);
|
||||
// console.log("password:", password);
|
||||
var serverPart = url0.substring(sipIndex + 1);
|
||||
var serverInfo = serverPart.split(":");
|
||||
}
|
||||
|
||||
var server = serverInfo[0];
|
||||
var port = serverInfo[1];
|
||||
function decodeBase64Safe(value) {
|
||||
try {
|
||||
return b64decsafe(value);
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function parseSSHostPort(serverPart) {
|
||||
serverPart = (serverPart || "").trim();
|
||||
var ipv6Match = serverPart.match(/^\[([^\]]+)\]:(\d+)$/);
|
||||
if (ipv6Match) {
|
||||
return { server: ipv6Match[1], port: ipv6Match[2] };
|
||||
}
|
||||
|
||||
var colonIndex = serverPart.lastIndexOf(":");
|
||||
if (colonIndex > 0 && serverPart.indexOf(":") === colonIndex) {
|
||||
return {
|
||||
server: serverPart.substring(0, colonIndex),
|
||||
port: serverPart.substring(colonIndex + 1)
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseSSPluginInfo() {
|
||||
var plugin = "";
|
||||
var pluginOpts = "";
|
||||
|
||||
var plugin = "", pluginOpts = "";
|
||||
if (params.plugin) {
|
||||
var pluginParams = decodeURIComponent(params.plugin).split(";");
|
||||
plugin = pluginParams.shift();
|
||||
pluginOpts = pluginParams.join(";");
|
||||
}
|
||||
} else {
|
||||
// === Base64 SS2022 / 普通格式 的整体编码格式 ===
|
||||
// 先 URL 解码整个字符串
|
||||
var decodedUrl0 = decodeURIComponent(url0);
|
||||
var sstr = b64decsafe(decodedUrl0);
|
||||
if (!sstr) {
|
||||
s.innerHTML = "<font style='color:red'><%:Base64 sstr failed.%></font>";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 支持 SS2022 / 普通格式
|
||||
var regex2022 = /^([^:]+):([^:]+):([^@]+)@([^:]+):(\d+)$/;
|
||||
var regexNormal = /^([^:]+):([^@]+)@([^:]+):(\d+)$/;
|
||||
|
||||
var m2022 = sstr.match(regex2022);
|
||||
var mNormal = sstr.match(regexNormal);
|
||||
|
||||
if (m2022) {
|
||||
var method = m2022[1];
|
||||
var password = m2022[2] + ":" + m2022[3];
|
||||
var server = m2022[4];
|
||||
var port = m2022[5];
|
||||
} else if (mNormal) {
|
||||
var method = mNormal[1];
|
||||
var password = mNormal[2];
|
||||
var server = mNormal[3];
|
||||
var port = mNormal[4];
|
||||
} else {
|
||||
s.innerHTML = "<font style='color:red'><%:SS URL base64 sstr format not recognized.%></font>";
|
||||
return false;
|
||||
}
|
||||
|
||||
var plugin = "", pluginOpts = "";
|
||||
if (params["shadow-tls"]) {
|
||||
var pluginInfo = decodeURIComponentSafe(params.plugin);
|
||||
var pluginParts = pluginInfo.split(";");
|
||||
plugin = pluginParts.shift() || "";
|
||||
pluginOpts = pluginParts.join(";");
|
||||
if (plugin === "simple-obfs") {
|
||||
plugin = "obfs-local";
|
||||
}
|
||||
} else if (params["shadow-tls"]) {
|
||||
try {
|
||||
var decoded_tls = JSON.parse(atob(decodeURIComponent(params["shadow-tls"])));
|
||||
var decodedTls = JSON.parse(b64decsafe(decodeURIComponentSafe((params["shadow-tls"] || "").replace(/ /g, "+"))));
|
||||
plugin = "shadow-tls";
|
||||
var versionFlag = "";
|
||||
if (decoded_tls.version && !isNaN(decoded_tls.version)) {
|
||||
versionFlag = "v" + decoded_tls.version + "=1;";
|
||||
if (decodedTls.version && !isNaN(decodedTls.version)) {
|
||||
versionFlag = "v" + decodedTls.version + "=1;";
|
||||
}
|
||||
pluginOpts = versionFlag + "host=" + (decoded_tls.host || "") + ";passwd=" + (decoded_tls.password || "");
|
||||
pluginOpts = versionFlag + "host=" + (decodedTls.host || "") + ";passwd=" + (decodedTls.password || "");
|
||||
} catch (e) {
|
||||
console.log("shadow-tls decode failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
plugin: plugin,
|
||||
pluginOpts: pluginOpts
|
||||
};
|
||||
}
|
||||
|
||||
// 判断密码是否经过url编码
|
||||
const isURLEncodedPassword = function(pwd) {
|
||||
if (!/%[0-9A-Fa-f]{2}/.test(pwd)) return false;
|
||||
try {
|
||||
const decoded = decodeURIComponent(pwd.replace(/\+/g, "%20"));
|
||||
const reencoded = encodeURIComponent(decoded);
|
||||
return reencoded === pwd;
|
||||
} catch (e) {
|
||||
return false;
|
||||
function parseSSNode() {
|
||||
var userInfo = "";
|
||||
var serverPart = "";
|
||||
var atIndex = url0.lastIndexOf("@");
|
||||
|
||||
if (atIndex !== -1) {
|
||||
var rawUserInfo = decodeURIComponentSafe(url0.substring(0, atIndex));
|
||||
var decodedUserInfo = decodeBase64Safe(rawUserInfo);
|
||||
userInfo = decodedUserInfo && decodedUserInfo.indexOf(":") !== -1 ? decodedUserInfo : rawUserInfo;
|
||||
serverPart = url0.substring(atIndex + 1);
|
||||
} else {
|
||||
var decodedUrl0 = decodeBase64Safe(decodeURIComponentSafe(url0));
|
||||
if (!decodedUrl0) {
|
||||
return { error: "<%:Base64 sstr failed.%>" };
|
||||
}
|
||||
atIndex = decodedUrl0.lastIndexOf("@");
|
||||
if (atIndex === -1) {
|
||||
return { error: "<%:SS URL base64 sstr format not recognized.%>" };
|
||||
}
|
||||
userInfo = decodedUrl0.substring(0, atIndex);
|
||||
serverPart = decodedUrl0.substring(atIndex + 1);
|
||||
}
|
||||
}
|
||||
if (isURLEncodedPassword(password)) {
|
||||
password = decodeURIComponent(password); // 解码URL编码
|
||||
} else {
|
||||
password = password; // 保持原始值
|
||||
}
|
||||
|
||||
// === 填充配置项 ===
|
||||
var ssCore = has_ss_rust ? "ss-rust" : "ss-libev";
|
||||
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].value = ssu[0];
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].dispatchEvent(event);
|
||||
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '._ss_core')[0].value = ssCore;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '._ss_core')[0].dispatchEvent(event);
|
||||
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = server;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = port;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.password')[0].value = password || "";
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.encrypt_method_ss')[0].value = method;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.encrypt_method_ss')[0].dispatchEvent(event);
|
||||
|
||||
if (plugin && plugin !== "none") {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].checked = true; // 设置 enable_plugin 为 true
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].dispatchEvent(event); // 触发事件
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin')[0].value = plugin;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin')[0].dispatchEvent(event);
|
||||
if (plugin !== undefined) {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin_opts')[0].value = pluginOpts || "";
|
||||
if (userInfo.indexOf(":") === -1) {
|
||||
userInfo = "none:" + userInfo;
|
||||
}
|
||||
} else {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].checked = false;
|
||||
}
|
||||
|
||||
//if (params.udp === "1") {
|
||||
// document.getElementsByName('cbid.shadowsocksr.' + sid + '.uot')[0].checked = true; // 设置 uot 为 true
|
||||
// document.getElementsByName('cbid.shadowsocksr.' + sid + '.uot')[0].dispatchEvent(event); // 触发事件
|
||||
//}
|
||||
var userInfoSplitIndex = userInfo.indexOf(":");
|
||||
if (userInfoSplitIndex < 0) {
|
||||
return { error: "<%:Userinfo format error.%>" };
|
||||
}
|
||||
|
||||
if (params.tfo === "1") {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.fast_open')[0].checked = true; // 设置 fast_open 为 true
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.fast_open')[0].dispatchEvent(event); // 触发事件
|
||||
}
|
||||
var method = userInfo.substring(0, userInfoSplitIndex);
|
||||
var password = userInfo.substring(userInfoSplitIndex + 1);
|
||||
var serverInfo = parseSSHostPort(serverPart);
|
||||
if (!serverInfo) {
|
||||
return { error: "SS server address format error." };
|
||||
}
|
||||
|
||||
if (param != undefined) {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.alias')[0].value = decodeURIComponent(param);
|
||||
}
|
||||
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
|
||||
return true;
|
||||
}
|
||||
|
||||
function importAsXraySS() {
|
||||
try {
|
||||
// Xray SS 导入逻辑
|
||||
// 拆分 @,判断是否是 base64 userinfo 的格式
|
||||
var parts = url0.split("@");
|
||||
if (parts.length > 1) {
|
||||
// @ 前是 base64(method:password),后面是 server:port?params
|
||||
var userinfo = b64decsafe(parts[0]);
|
||||
var sepIndex = userinfo.indexOf(":");
|
||||
if (sepIndex > -1) {
|
||||
method = userinfo.slice(0, sepIndex);
|
||||
password = userinfo.slice(sepIndex + 1); //一些链接用明文uuid做密码
|
||||
const isURLEncodedPassword = function(pwd) {
|
||||
if (!/%[0-9A-Fa-f]{2}/.test(pwd)) return false;
|
||||
try {
|
||||
const decoded = decodeURIComponent(pwd.replace(/\+/g, "%20"));
|
||||
const reencoded = encodeURIComponent(decoded);
|
||||
return reencoded === pwd;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 已编码的别名
|
||||
// var url = new URL("http://" + url0 + (param ? "#" + encodeURIComponent(param) : ""));
|
||||
// 未编码的别名
|
||||
// var url = new URL("http://" + url0 + (param ? "#" + param : ""));
|
||||
// 兼容已编码和未编码的别名
|
||||
var remarks = param ? decodeURIComponent(param) : "";
|
||||
var encodedremarks = encodeURIComponent(remarks);
|
||||
var url = new URL("http://" + url0 + (encodedremarks ? "#" + encodedremarks : ""));
|
||||
if (isURLEncodedPassword(password)) {
|
||||
password = decodeURIComponent(password);
|
||||
}
|
||||
|
||||
} catch(e) {
|
||||
alert(e);
|
||||
var pluginInfo = parseSSPluginInfo();
|
||||
return {
|
||||
method: method,
|
||||
password: password,
|
||||
server: normalizeHost(serverInfo.server),
|
||||
port: serverInfo.port,
|
||||
plugin: pluginInfo.plugin,
|
||||
pluginOpts: pluginInfo.pluginOpts,
|
||||
alias: param != undefined ? decodeURIComponentSafe(param) : ""
|
||||
};
|
||||
}
|
||||
|
||||
function importAsNormalSS(ssNode) {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].value = "ss-rust";
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.type')[0].dispatchEvent(event);
|
||||
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = ssNode.server;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = ssNode.port;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.password')[0].value = ssNode.password || "";
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.encrypt_method_ss')[0].value = ssNode.method;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.encrypt_method_ss')[0].dispatchEvent(event);
|
||||
|
||||
if (ssNode.plugin && ssNode.plugin !== "none") {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].checked = true;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].dispatchEvent(event);
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin')[0].value = ssNode.plugin;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin')[0].dispatchEvent(event);
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.plugin_opts')[0].value = ssNode.pluginOpts || "";
|
||||
} else {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].checked = false;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_plugin')[0].dispatchEvent(event);
|
||||
}
|
||||
|
||||
if (params.tfo === "1") {
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.fast_open')[0].checked = true;
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.fast_open')[0].dispatchEvent(event);
|
||||
}
|
||||
|
||||
document.getElementsByName('cbid.shadowsocksr.' + sid + '.alias')[0].value = ssNode.alias;
|
||||
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
|
||||
return true;
|
||||
}
|
||||
|
||||
function importAsXraySS(ssNode) {
|
||||
function setElementValue(name, value) {
|
||||
const element = document.getElementsByName(name)[0];
|
||||
if (element) {
|
||||
if (typeof value === 'boolean') {
|
||||
element.checked = value;
|
||||
} else {
|
||||
element.value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
function dispatchEventIfExists(name, event) {
|
||||
const element = document.getElementsByName(name)[0];
|
||||
if (element) {
|
||||
element.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.alias', ssNode.alias);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.type', "v2ray");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.type', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.v2ray_protocol', "shadowsocks");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.v2ray_protocol', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.server', ssNode.server);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.server_port', ssNode.port || "80");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.password', ssNode.password || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.transport',
|
||||
params.type === "http" ? "h2" :
|
||||
(["xhttp", "splithttp"].includes(params.type) ? "xhttp" :
|
||||
(["tcp", "raw"].includes(params.type) ? "raw" :
|
||||
(params.type || "raw")))
|
||||
);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.transport', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.encrypt_method_ss', ssNode.method || params.encryption || "none");
|
||||
if (params.udp === "1") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.uot', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.uot', event);
|
||||
}
|
||||
if (params.fm && params.fm.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_finalmask', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_finalmask', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.finalmask', params.fm || "");
|
||||
}
|
||||
if (params.tfo === "1") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.fast_open', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.fast_open', event);
|
||||
}
|
||||
if ([ "tls", "xtls", "reality" ].includes(params.security)) {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.' + params.security, true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.' + params.security, event);
|
||||
|
||||
if (params.security === "tls") {
|
||||
if (params.ech && params.ech.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_ech', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_ech', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ech_config', params.ech || "");
|
||||
}
|
||||
var allowInsecureValue = params.allowInsecure || params.insecure;
|
||||
if (allowInsecureValue === "1" || allowInsecureValue === "true") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.insecure', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.insecure', event);
|
||||
}
|
||||
if (params.pcs && params.pcs.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertSha', params.pcs);
|
||||
}
|
||||
if (params.vcn && params.vcn.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertByName', params.vcn);
|
||||
}
|
||||
}
|
||||
if (params.security === "reality") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_publickey', params.pbk ? decodeURIComponentSafe(params.pbk) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_shortid', params.sid || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_spiderx', params.spx ? decodeURIComponentSafe(params.spx) : "");
|
||||
if (params.pqv && params.pqv.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_mldsa65verify', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_mldsa65verify', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_mldsa65verify', params.pqv || "");
|
||||
}
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_flow', params.flow || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tls_flow', event);
|
||||
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_alpn', params.alpn || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.fingerprint', params.fp || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_host', params.sni || "");
|
||||
}
|
||||
switch (params.type) {
|
||||
case "ws":
|
||||
if (params.security !== "tls") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ws_host', params.host ? decodeURIComponentSafe(params.host) : "");
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ws_path', params.path ? decodeURIComponentSafe(params.path) : "/");
|
||||
break;
|
||||
case "httpupgrade":
|
||||
if (params.security !== "tls") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_host', params.host ? decodeURIComponentSafe(params.host) : "");
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_path', params.path ? decodeURIComponentSafe(params.path) : "/");
|
||||
break;
|
||||
case "xhttp":
|
||||
case "splithttp":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_mode', params.mode || "auto");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.host ? decodeURIComponentSafe(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_path', params.path ? decodeURIComponentSafe(params.path) : "/");
|
||||
if (params.extra && params.extra.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_extra', params.extra || "");
|
||||
}
|
||||
break;
|
||||
case "kcp":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.headerType || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.kcp_guise', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.kcp_domain', params.host || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.seed || "");
|
||||
break;
|
||||
case "http":
|
||||
case "h2":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.h2_host', params.host ? decodeURIComponentSafe(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.h2_path', params.path ? decodeURIComponentSafe(params.path) : "");
|
||||
break;
|
||||
case "quic":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_guise', params.headerType || "none");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_security', params.quicSecurity || "none");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_key', params.key || "");
|
||||
break;
|
||||
case "grpc":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.serviceName', params.serviceName || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.grpc_mode', params.mode || "gun");
|
||||
break;
|
||||
case "tcp":
|
||||
case "raw":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tcp_guise', params.headerType || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tcp_guise', event);
|
||||
if (params.headerType === "http") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.http_host', params.host ? decodeURIComponentSafe(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.http_path', params.path ? decodeURIComponentSafe(params.path) : "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
|
||||
return true;
|
||||
}
|
||||
|
||||
function preferredSSBackend() {
|
||||
if (has_ss_rust === "true") return "ss-rust";
|
||||
if (has_xray === "true") return "v2ray";
|
||||
return null;
|
||||
}
|
||||
|
||||
var ssNode = parseSSNode();
|
||||
if (ssNode.error) {
|
||||
s.innerHTML = "<font style='color:red'>" + ssNode.error + "</font>";
|
||||
return false;
|
||||
}
|
||||
// Check if the elements exist before trying to modify them
|
||||
function setElementValue(name, value) {
|
||||
const element = document.getElementsByName(name)[0];
|
||||
if (element) {
|
||||
if (typeof value === 'boolean') {
|
||||
element.checked = value;
|
||||
} else {
|
||||
element.value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
function dispatchEventIfExists(name, event) {
|
||||
const element = document.getElementsByName(name)[0];
|
||||
if (element) {
|
||||
element.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.alias', url.hash ? decodeURIComponent(url.hash.slice(1)) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.type', "v2ray");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.type', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.v2ray_protocol', "shadowsocks");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.v2ray_protocol', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.server', normalizeHost(url.hostname));
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.server_port', url.port || "80");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.password', password || url.username);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.transport',
|
||||
params.type === "http" ? "h2" :
|
||||
(["xhttp", "splithttp"].includes(params.type) ? "xhttp" :
|
||||
(["tcp", "raw"].includes(params.type) ? "raw" :
|
||||
(params.type || "raw")))
|
||||
);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.transport', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.encrypt_method_ss', method || params.encryption || "none");
|
||||
if (params.udp === "1") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.uot', true); // 设置 uot 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.uot', event); // 触发事件
|
||||
}
|
||||
if (params.fm && params.fm.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_finalmask', true); // 设置 enable_finalmask 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_finalmask', event); // 触发事件
|
||||
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.finalmask', params.fm || "");
|
||||
let finalSSBackend = preferredSSBackend();
|
||||
if (finalSSBackend === null) {
|
||||
s.innerHTML = "<font style=\'color:red\'><%:No available core (Shadowsocks or Xray) to import this node.%></font>";
|
||||
return false;
|
||||
}
|
||||
if (params.tfo === "1") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.fast_open', true); // 设置 fast_open 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.fast_open', event); // 触发事件
|
||||
if (finalSSBackend === "v2ray" && ssNode.plugin && ssNode.plugin !== "none") {
|
||||
s.innerHTML = "<font style='color:red'>Xray fallback does not support importing Shadowsocks links with SIP003 plugins.</font>";
|
||||
return false;
|
||||
}
|
||||
if ([ "tls", "xtls", "reality" ].includes(params.security)) {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.' + params.security, true);
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.' + params.security, event);
|
||||
|
||||
if (params.security === "tls") {
|
||||
if (params.ech && params.ech.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_ech', true); // 设置 enable_ech 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_ech', event); // 触发事件
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ech_config', params.ech || "");
|
||||
}
|
||||
var allowInsecureValue = params.allowInsecure || params.insecure;
|
||||
if (allowInsecureValue === "1" || allowInsecureValue === "true") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.insecure', true); // 设置 insecure 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.insecure', event); // 触发事件
|
||||
}
|
||||
if (params.pcs && params.pcs.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertSha', params.pcs);
|
||||
}
|
||||
if (params.vcn && params.vcn.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertByName', params.vcn);
|
||||
}
|
||||
}
|
||||
if (params.security === "reality") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_publickey', params.pbk ? decodeURIComponent(params.pbk) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_shortid', params.sid || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_spiderx', params.spx ? decodeURIComponent(params.spx) : "");
|
||||
if (params.pqv && params.pqv.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_mldsa65verify', true); // 设置 enable_mldsa65verify 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_mldsa65verify', event); // 触发事件
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.reality_mldsa65verify', params.pqv || "");
|
||||
}
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_flow', params.flow || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tls_flow', event);
|
||||
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_alpn', params.alpn || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.fingerprint', params.fp || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tls_host', params.sni || "");
|
||||
}
|
||||
switch (params.type) {
|
||||
case "ws":
|
||||
if (params.security !== "tls") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ws_host', params.host ? decodeURIComponent(params.host) : "");
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.ws_path', params.path ? decodeURIComponent(params.path) : "/");
|
||||
break;
|
||||
case "httpupgrade":
|
||||
if (params.security !== "tls") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_host', params.host ? decodeURIComponent(params.host) : "");
|
||||
}
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.httpupgrade_path', params.path ? decodeURIComponent(params.path) : "/");
|
||||
break;
|
||||
case "xhttp":
|
||||
case "splithttp":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_mode', params.mode || "auto");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.host ? decodeURIComponent(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_path', params.path ? decodeURIComponent(params.path) : "/");
|
||||
if (params.extra && params.extra.trim() !== "") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', true); // 设置 enable_xhttp_extra 为 true
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', event); // 触发事件
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_extra', params.extra || "");
|
||||
}
|
||||
break;
|
||||
case "kcp":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.headerType || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.kcp_guise', event);
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.kcp_domain', params.host || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.seed || "");
|
||||
break;
|
||||
case "http":
|
||||
/* this is non-standard, bullshit */
|
||||
case "h2":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.h2_host', params.host ? decodeURIComponent(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.h2_path', params.path ? decodeURIComponent(params.path) : "");
|
||||
break;
|
||||
case "quic":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_guise', params.headerType || "none");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_security', params.quicSecurity || "none");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.quic_key', params.key || "");
|
||||
break;
|
||||
case "grpc":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.serviceName', params.serviceName || "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.grpc_mode', params.mode || "gun");
|
||||
break;
|
||||
case "tcp":
|
||||
case "raw":
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.tcp_guise', params.headerType || "none");
|
||||
dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tcp_guise', event);
|
||||
if (params.headerType === "http") {
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.http_host', params.host ? decodeURIComponent(params.host) : "");
|
||||
setElementValue('cbid.shadowsocksr.' + sid + '.http_path', params.path ? decodeURIComponent(params.path) : "");
|
||||
}
|
||||
break;
|
||||
}
|
||||
s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";
|
||||
return true;
|
||||
}
|
||||
|
||||
function preferredSSBackend() {
|
||||
if (has_ss_rust === "true") return "ss-rust";
|
||||
if (has_ss_libev === "true") return "ss-libev";
|
||||
if (has_xray === "true") return "v2ray";
|
||||
return null;
|
||||
}
|
||||
let finalSSBackend = preferredSSBackend();
|
||||
if (finalSSBackend === null) {
|
||||
s.innerHTML = "<font style=\'color:red\'><%:No available core (Shadowsocks or Xray) to import this node.%></font>";
|
||||
if (finalSSBackend === "v2ray") importAsXraySS(ssNode);
|
||||
else importAsNormalSS(ssNode);
|
||||
return false;
|
||||
}
|
||||
if (finalSSBackend === "v2ray") importAsXraySS();
|
||||
else importAsNormalSS();
|
||||
return false;
|
||||
case "ssr":
|
||||
var sstr = b64decsafe((ssu[1] || "").replace(/#.*/, "").trim());
|
||||
var ploc = sstr.indexOf("/?");
|
||||
|
||||
@@ -15,11 +15,6 @@ msgstr ""
|
||||
msgid "%s Node Use Type"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:409
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:227
|
||||
msgid "%s Node Use Version"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server.lua:103
|
||||
msgid "0"
|
||||
msgstr ""
|
||||
@@ -1974,11 +1969,6 @@ msgstr ""
|
||||
msgid "Select DNS parse Mode"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:410
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:228
|
||||
msgid "Selection ShadowSocks Node Use Version."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:1593
|
||||
msgid "Self-signed Certificate"
|
||||
msgstr ""
|
||||
@@ -2050,11 +2040,6 @@ msgstr ""
|
||||
msgid "ShadowSocks"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:415
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:101
|
||||
msgid "ShadowSocks-libev Version"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:412
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:749
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:98
|
||||
|
||||
@@ -17,11 +17,6 @@ msgstr ""
|
||||
msgid "%s Node Use Type"
|
||||
msgstr "%s 节点使用类型"
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:409
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:227
|
||||
msgid "%s Node Use Version"
|
||||
msgstr "%s 节点使用版本"
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server.lua:103
|
||||
msgid "0"
|
||||
msgstr ""
|
||||
@@ -2136,11 +2131,6 @@ msgstr "正在保存新的顺序…"
|
||||
msgid "Select DNS parse Mode"
|
||||
msgstr "选择 DNS 解析方式"
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:410
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:228
|
||||
msgid "Selection ShadowSocks Node Use Version."
|
||||
msgstr "选择 ShadowSocks 节点使用版本。"
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:1593
|
||||
msgid "Self-signed Certificate"
|
||||
msgstr "自签证书"
|
||||
@@ -2212,11 +2202,6 @@ msgstr "代理链类型"
|
||||
msgid "ShadowSocks"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:415
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:101
|
||||
msgid "ShadowSocks-libev Version"
|
||||
msgstr "ShadowSocks-libev 版本"
|
||||
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:412
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua:749
|
||||
#: applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua:98
|
||||
|
||||
@@ -933,16 +933,16 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 chain6 threads5
|
||||
start_udp() {
|
||||
local udp_relay_server_type=$(uci_get_by_name $UDP_RELAY_SERVER type)
|
||||
local type=$udp_relay_server_type
|
||||
if [ "$udp_relay_server_type" = "ss-rust" ] || [ "$udp_relay_server_type" = "ss-libev" ]; then
|
||||
if [ "$udp_relay_server_type" = "ss-rust" ]; then
|
||||
type="ss"
|
||||
fi
|
||||
redir_udp=1
|
||||
case "$type" in
|
||||
ss | ssr)
|
||||
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
|
||||
if [ "$udp_relay_server_type" = "ss-libev" ] || [ "$udp_relay_server_type" = "ssr" ]; then
|
||||
if [ "$udp_relay_server_type" = "ssr" ]; then
|
||||
ss_program="$(first_type ${type}-redir)"
|
||||
elif [ "$udp_relay_server_type" = "ss-rust" ]; then
|
||||
elif [ "$udp_relay_server_type" = "ss-rust" ] || [ "$udp_relay_server_type" = "ss" ]; then
|
||||
ss_program="$(first_type ${type}local)"
|
||||
fi
|
||||
echolog "$(get_name $type) program is: $ss_program"
|
||||
@@ -1016,15 +1016,15 @@ start_local() {
|
||||
local local_port="${1:-$(uci_get_by_type socks5_proxy local_port)}"
|
||||
local local_server_type=$(uci_get_by_name $LOCAL_SERVER type)
|
||||
local type=$local_server_type
|
||||
if [ "$local_server_type" = "ss-rust" ] || [ "$local_server_type" = "ss-libev" ]; then
|
||||
if [ "$local_server_type" = "ss-rust" ]; then
|
||||
type="ss"
|
||||
fi
|
||||
case "$type" in
|
||||
ss | ssr)
|
||||
gen_config_file $LOCAL_SERVER $type 4 $local_port
|
||||
if [ "$local_server_type" = "ss-libev" ] || [ "$local_server_type" = "ssr" ]; then
|
||||
if [ "$local_server_type" = "ssr" ]; then
|
||||
ss_program="$(first_type ${type}-local)"
|
||||
elif [ "$local_server_type" = "ss-rust" ]; then
|
||||
elif [ "$local_server_type" = "ss-rust" ] || [ "$local_server_type" = "ss" ]; then
|
||||
ss_program="$(first_type ${type}local)"
|
||||
fi
|
||||
echolog "$(get_name $type) program is: $ss_program"
|
||||
@@ -1252,7 +1252,7 @@ get_udp_relay_mode() {
|
||||
local socks_ver
|
||||
|
||||
type=$(uci_get_by_name "$node" type)
|
||||
[ "$type" = "ss-rust" ] || [ "$type" = "ss-libev" ] && type="ss"
|
||||
[ "$type" = "ss-rust" ] && type="ss"
|
||||
|
||||
case "$type" in
|
||||
ss|ssr|hysteria2)
|
||||
@@ -1325,15 +1325,15 @@ Start_Run() {
|
||||
local tcp_port=$(get_default_node_local_port)
|
||||
local global_server_type=$(uci_get_by_name $GLOBAL_SERVER type)
|
||||
local type=$global_server_type
|
||||
if [ "$global_server_type" = "ss-rust" ] || [ "$global_server_type" = "ss-libev" ]; then
|
||||
if [ "$global_server_type" = "ss-rust" ]; then
|
||||
type="ss"
|
||||
fi
|
||||
case "$type" in
|
||||
ss | ssr)
|
||||
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
|
||||
if [ "$global_server_type" = "ss-libev" ] || [ "$global_server_type" = "ssr" ]; then
|
||||
if [ "$global_server_type" = "ssr" ]; then
|
||||
ss_program="$(first_type ${type}-redir)"
|
||||
elif [ "$global_server_type" = "ss-rust" ]; then
|
||||
elif [ "$global_server_type" = "ss-rust" ] || [ "$global_server_type" = "ss" ]; then
|
||||
ss_program="$(first_type ${type}local)"
|
||||
fi
|
||||
echolog "$(get_name $type) program is: $ss_program"
|
||||
@@ -1563,19 +1563,19 @@ start_server() {
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
local node_type=$(uci_get_by_name $1 type)
|
||||
local type=$node_type
|
||||
if [ "$node_type" = "ss-rust" ] || [ "$node_type" = "ss-libev" ]; then
|
||||
type="ss"
|
||||
fi
|
||||
case "$type" in
|
||||
ss | ssr)
|
||||
gen_service_file ${type} $1 $TMP_PATH/ssr-server$server_count.json
|
||||
if [ "$node_type" = "ss-libev" ] || [ "$node_type" = "ssr" ]; then
|
||||
ss_program="$(first_type ${type}-server)"
|
||||
elif [ "$node_type" = "ss-rust" ]; then
|
||||
ss_program="$(first_type ${type}server)"
|
||||
local node_type=$(uci_get_by_name $1 type)
|
||||
local type=$node_type
|
||||
if [ "$node_type" = "ss-rust" ]; then
|
||||
type="ss"
|
||||
fi
|
||||
case "$type" in
|
||||
ss | ssr)
|
||||
gen_service_file ${type} $1 $TMP_PATH/ssr-server$server_count.json
|
||||
if [ "$node_type" = "ssr" ]; then
|
||||
ss_program="$(first_type ${type}-server)"
|
||||
elif [ "$node_type" = "ss-rust" ] || [ "$node_type" = "ss" ]; then
|
||||
ss_program="$(first_type ${type}server)"
|
||||
fi
|
||||
# 获取当前软链接指向的执行文件路径
|
||||
old_ss_program=$(readlink -f "$TMP_PATH/bin/${type}-server" 2>/dev/null)
|
||||
# **当新旧执行文件路径不同时,删除旧链接**
|
||||
|
||||
@@ -79,16 +79,34 @@ if [ -s "/etc/config/shadowsocksr" ]; then
|
||||
uci -q delete shadowsocksr.@global[0].mosdns_ipv6
|
||||
fi
|
||||
|
||||
if ! uci -q get shadowsocksr.@http_proxy[0] > /dev/null; then
|
||||
uci -q add shadowsocksr http_proxy
|
||||
uci -q set shadowsocksr.@http_proxy[0].server='nil'
|
||||
uci -q set shadowsocksr.@http_proxy[0].local_port='3128'
|
||||
uci -q set shadowsocksr.@http_proxy[0].socks_port='1081'
|
||||
uci -q set shadowsocksr.@http_proxy[0].http_auth='none'
|
||||
fi
|
||||
if ! uci -q get shadowsocksr.@http_proxy[0] > /dev/null; then
|
||||
uci -q add shadowsocksr http_proxy
|
||||
uci -q set shadowsocksr.@http_proxy[0].server='nil'
|
||||
uci -q set shadowsocksr.@http_proxy[0].local_port='3128'
|
||||
uci -q set shadowsocksr.@http_proxy[0].socks_port='1081'
|
||||
uci -q set shadowsocksr.@http_proxy[0].http_auth='none'
|
||||
fi
|
||||
|
||||
uci -q commit shadowsocksr
|
||||
fi
|
||||
ss_rust_bin="$(command -v ssserver 2>/dev/null)"
|
||||
[ -n "$ss_rust_bin" ] || [ ! -x /usr/libexec/ssserver ] || ss_rust_bin="/usr/libexec/ssserver"
|
||||
xray_bin="$(command -v xray 2>/dev/null)"
|
||||
[ -n "$xray_bin" ] || [ ! -x /usr/libexec/xray ] || xray_bin="/usr/libexec/xray"
|
||||
for section in $(uci -q show shadowsocksr | sed -n "s/^shadowsocksr\\.\\([^.=][^.=]*\\)=servers$/\\1/p"); do
|
||||
node_type="$(uci -q get shadowsocksr.${section}.type)"
|
||||
case "$node_type" in
|
||||
ss|ss-libev)
|
||||
if [ -n "$ss_rust_bin" ]; then
|
||||
uci -q set shadowsocksr.${section}.type='ss-rust'
|
||||
elif [ -n "$xray_bin" ]; then
|
||||
uci -q set shadowsocksr.${section}.type='v2ray'
|
||||
uci -q set shadowsocksr.${section}.v2ray_protocol='shadowsocks'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
uci -q commit shadowsocksr
|
||||
fi
|
||||
|
||||
[ -s "/etc/config/shadowsocksr" ] || /etc/init.d/shadowsocksr reset
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ local b64decode = nixio.bin.b64decode
|
||||
local b64encode = nixio.bin.b64encode
|
||||
local effective_node_local_port = tonumber(server.local_port) or tonumber(default_node_local_port) or 1234
|
||||
|
||||
if server.type == "ss-rust" or server.type == "ss-libev" then
|
||||
if server.type == "ss-rust" then
|
||||
server.type = "ss"
|
||||
end
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ local local_clash_dir = "/etc/ssrplus/clash"
|
||||
local target_subscribe_sid = tostring(arg and arg[1] or ""):gsub("^%s*(.-)%s*$", "%1")
|
||||
|
||||
local has_ss_rust = luci.sys.exec('type -t -p sslocal 2>/dev/null || type -t -p ssserver 2>/dev/null') ~= ""
|
||||
local has_ss_libev = luci.sys.exec('type -t -p ss-redir 2>/dev/null || type -t -p ss-local 2>/dev/null') ~= ""
|
||||
local has_xray = luci.sys.exec('type -t -p xray 2>/dev/null') ~= ""
|
||||
|
||||
local tuic_type = luci.sys.exec('type -t -p mihomo -p /usr/libexec/mihomo 2>/dev/null') ~= "" and "tuic"
|
||||
@@ -45,9 +44,6 @@ local function preferred_ss_backend()
|
||||
if has_ss_rust then
|
||||
return "ss-rust"
|
||||
end
|
||||
if has_ss_libev then
|
||||
return "ss-libev"
|
||||
end
|
||||
if has_xray then
|
||||
return "v2ray"
|
||||
end
|
||||
@@ -993,7 +989,7 @@ local function processData(szType, content, cfgid)
|
||||
if result.plugin ~= "none" and result.plugin ~= "" then
|
||||
result.enable_plugin = 1
|
||||
end
|
||||
elseif selected_ss_backend ~= "ss-libev" then
|
||||
else
|
||||
if params["shadow-tls"] then
|
||||
-- 特别处理 shadow-tls 作为插件
|
||||
-- log("原始 shadow-tls 参数:", params["shadow-tls"])
|
||||
@@ -1019,11 +1015,6 @@ local function processData(szType, content, cfgid)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if params["shadow-tls"] then
|
||||
log("错误:ShadowSocks-libev 不支持使用 shadow-tls 插件")
|
||||
return nil, "ShadowSocks-libev 不支持使用 shadow-tls 插件"
|
||||
end
|
||||
end
|
||||
|
||||
-- 检查加密方法是否受支持
|
||||
|
||||
Reference in new issue
Block a user