mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 22:25:13 +08:00
update 2026-05-22 22:28:32
This commit is contained in:
1 parent
7a23c054ab
commit
3cb04f969c
2 files changed
+37
-38
No files matched your search
@@ -254,60 +254,55 @@ local tls_flows = {
|
|||||||
"none"
|
"none"
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[
|
|
||||||
local function migrate_xray_protocol_nodes()
|
local function migrate_xray_protocol_nodes()
|
||||||
local changed = false
|
local changed = false
|
||||||
|
|
||||||
uci:foreach("shadowsocksr", "servers", function(section)
|
uci:foreach("shadowsocksr", "servers", function(section)
|
||||||
if section.type == "ss" or section.type == "ss-libev" then
|
local sid = section[".name"]
|
||||||
|
local stype = section.type
|
||||||
|
local proto = section.v2ray_protocol
|
||||||
|
local escaped_sid = luci.util.shellquote(sid)
|
||||||
|
|
||||||
|
if stype == "ss" or stype == "ss-libev" then
|
||||||
if has_mihomo then
|
if has_mihomo then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "ss")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='ss'", escaped_sid))
|
||||||
changed = true
|
changed = true
|
||||||
elseif has_ss_rust then
|
elseif has_ss_rust then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "ss-rust")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='ss-rust'", escaped_sid))
|
||||||
changed = true
|
changed = true
|
||||||
elseif has_xray then
|
elseif has_xray then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "v2ray")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='v2ray' && " .. "uci set shadowsocksr.%s.v2ray_protocol='shadowsocks'", escaped_sid, escaped_sid))
|
||||||
uci:set("shadowsocksr", section[".name"], "v2ray_protocol", "shadowsocks")
|
|
||||||
changed = true
|
changed = true
|
||||||
end
|
end
|
||||||
elseif section.type == "v2ray" and section.v2ray_protocol == "shadowsocks" and has_mihomo then
|
elseif stype == "v2ray" and proto == "shadowsocks" and has_mihomo then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "ss")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='ss' && " .. "uci delete shadowsocksr.%s.v2ray_protocol", escaped_sid, escaped_sid))
|
||||||
uci:delete("shadowsocksr", section[".name"], "v2ray_protocol")
|
|
||||||
changed = true
|
changed = true
|
||||||
end
|
end
|
||||||
if section.type == "hysteria2" then
|
if stype == "hysteria2" then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "v2ray")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='v2ray' && " .. "uci set shadowsocksr.%s.v2ray_protocol='hysteria2'", escaped_sid, escaped_sid))
|
||||||
uci:set("shadowsocksr", section[".name"], "v2ray_protocol", "hysteria2")
|
|
||||||
changed = true
|
changed = true
|
||||||
elseif section.type == "trojan" then
|
elseif stype == "trojan" then
|
||||||
uci:set("shadowsocksr", section[".name"], "type", "v2ray")
|
luci.sys.call(string.format("uci set shadowsocksr.%s.type='v2ray' && " .. "uci set shadowsocksr.%s.v2ray_protocol='trojan'", escaped_sid, escaped_sid))
|
||||||
uci:set("shadowsocksr", section[".name"], "v2ray_protocol", "trojan")
|
|
||||||
changed = true
|
changed = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local subscribe_sid = uci:get_first("shadowsocksr", "server_subscribe")
|
local subscribe_sid = uci:get_first("shadowsocksr", "server_subscribe")
|
||||||
if subscribe_sid and uci:get("shadowsocksr", subscribe_sid, "xray_hy2_type") then
|
if subscribe_sid then
|
||||||
uci:delete("shadowsocksr", subscribe_sid, "xray_hy2_type")
|
local old_options = {"xray_hy2_type", "xray_tj_type", "ss_type"}
|
||||||
changed = true
|
local escaped_sub_sid = luci.util.shellquote(subscribe_sid)
|
||||||
|
for _, opt in ipairs(old_options) do
|
||||||
|
if uci:get("shadowsocksr", subscribe_sid, opt) then
|
||||||
|
luci.sys.call(string.format("uci delete shadowsocksr.%s.%s", escaped_sub_sid, opt))
|
||||||
|
changed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if subscribe_sid and uci:get("shadowsocksr", subscribe_sid, "xray_tj_type") then
|
|
||||||
uci:delete("shadowsocksr", subscribe_sid, "xray_tj_type")
|
|
||||||
changed = true
|
|
||||||
end
|
|
||||||
if subscribe_sid and uci:get("shadowsocksr", subscribe_sid, "ss_type") then
|
|
||||||
uci:delete("shadowsocksr", subscribe_sid, "ss_type")
|
|
||||||
changed = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if changed then
|
if changed then
|
||||||
uci:commit("shadowsocksr")
|
luci.sys.call("uci commit shadowsocksr")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
migrate_xray_protocol_nodes()
|
migrate_xray_protocol_nodes()
|
||||||
]]--
|
|
||||||
|
|
||||||
m = Map("shadowsocksr", translate("Edit ShadowSocksR Server"))
|
m = Map("shadowsocksr", translate("Edit ShadowSocksR Server"))
|
||||||
m.redirect = url("servers")
|
m.redirect = url("servers")
|
||||||
|
|||||||
@@ -321,18 +321,22 @@ local function migrate_legacy_subscribe_urls()
|
|||||||
for index, url in ipairs(legacy_urls) do
|
for index, url in ipairs(legacy_urls) do
|
||||||
local trimmed = trim(url)
|
local trimmed = trim(url)
|
||||||
if trimmed ~= "" then
|
if trimmed ~= "" then
|
||||||
local sid = uci:add("shadowsocksr", "server_subscribe_item")
|
local sid_output = luci.sys.exec("uci add shadowsocksr server_subscribe_item")
|
||||||
if sid then
|
local sid = sid_output:match("%S+")
|
||||||
uci:set("shadowsocksr", sid, "enabled", "1")
|
if sid and sid ~= "" then
|
||||||
uci:set("shadowsocksr", sid, "alias", string.format("Subscribe %d", index))
|
local escaped_sid = luci.util.shellquote(sid)
|
||||||
uci:set("shadowsocksr", sid, "url", trimmed)
|
local alias = string.format("Subscribe %d", index)
|
||||||
|
local escaped_alias = luci.util.shellquote(alias)
|
||||||
|
local escaped_url = luci.util.shellquote(trimmed)
|
||||||
|
luci.sys.call("uci set shadowsocksr." .. escaped_sid .. ".enabled=1")
|
||||||
|
luci.sys.call("uci set shadowsocksr." .. escaped_sid .. ".alias=" .. escaped_alias)
|
||||||
|
luci.sys.call("uci set shadowsocksr." .. escaped_sid .. ".url=" .. escaped_url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
uci:delete("shadowsocksr", subscribe_sid, "subscribe_url")
|
luci.sys.call("uci delete shadowsocksr." .. subscribe_sid .. ".subscribe_url")
|
||||||
uci:save("shadowsocksr")
|
luci.sys.call("uci commit shadowsocksr")
|
||||||
uci:commit("shadowsocksr")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clash_host_port(clash_url)
|
local function clash_host_port(clash_url)
|
||||||
|
|||||||
Reference in new issue
Block a user