mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 05:53:56 +08:00
🍓 Sync 2026-10-01 00:51:52
This commit is contained in:
1 parent
57dc97412f
commit
d45a1cb4ad
60 files changed
+2630
-1193
No files matched your search
@@ -900,7 +900,6 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
-- if ssr_group then result.ssr_group = ssr_group end
|
||||
result.remarks = base64Decode(params.remarks)
|
||||
elseif szType == 'vmess' then
|
||||
local info = jsonParse(content)
|
||||
if sub_vmess_type == "sing-box" and has_singbox then
|
||||
result.type = 'sing-box'
|
||||
elseif sub_vmess_type == "xray" and has_xray then
|
||||
@@ -909,6 +908,58 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "VMess", "VMess"))
|
||||
return nil
|
||||
end
|
||||
-- vmess://base64(json)
|
||||
local info = jsonParse(content)
|
||||
if not info then
|
||||
-- vmess://base64(auto:uuid@host:port)?tfo=1&remark=xxx&&alterId=0&obfs=websocket&path=%2F&obfsParam=host (obfs ~= ws obfsParam={})
|
||||
if content:find("?", 1, true) then
|
||||
info = {}
|
||||
local Info = split(content:gsub("/%?", "?"), "%?")
|
||||
local sp = split(base64Decode(Info[1]), "@")
|
||||
local id_info = split(sp[1], ":")
|
||||
info.security = (#id_info > 1 and id_info[1] ~= "") and id_info[1] or "auto"
|
||||
info.id = id_info[#id_info]
|
||||
|
||||
local addr, port = sp[2], "443"
|
||||
if api.is_ipv6addrport(addr) then
|
||||
local a, p = addr:match("^%[(.+)%]:(%d+)$")
|
||||
if a then addr, port = a, p end
|
||||
addr = api.get_ipv6_only(addr)
|
||||
else
|
||||
local host_port = split(addr, ":")
|
||||
addr = host_port[1]
|
||||
if #host_port > 1 then port = host_port[#host_port] end
|
||||
end
|
||||
info.add, info.port = addr, port
|
||||
|
||||
local params = {}
|
||||
for _, v in pairs(split(Info[2], '&')) do
|
||||
local s = v:find("=", 1, true)
|
||||
if s and s > 1 then
|
||||
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
info.ps = params.remark or params.remarks
|
||||
info.net = (params.obfs == "websocket") and "ws" or (params.obfs or "tcp")
|
||||
info.path = params.path
|
||||
info.aid = params.alterId or "0"
|
||||
info.tls = params.tls
|
||||
info.sni = params.peer
|
||||
info.tfo = params.tfo
|
||||
local op_info = jsonParse(params.obfsParam)
|
||||
if op_info then
|
||||
if op_info.header then info.type = op_info.header end
|
||||
if op_info.Host then info.host = op_info.Host end
|
||||
else
|
||||
info.host = params.obfsParam
|
||||
end
|
||||
info.allowinsecure = params.allowInsecure
|
||||
else
|
||||
log(2, i18n.translatef("Skipping %s node. This node URI format cannot be parsed."))
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
result.address = info.add
|
||||
result.port = info.port
|
||||
result.protocol = 'vmess'
|
||||
@@ -1068,6 +1119,11 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if idx_pn then
|
||||
result.plugin = plugin_info:sub(1, idx_pn - 1)
|
||||
result.plugin_opts = plugin_info:sub(idx_pn + 1, #plugin_info)
|
||||
-- Some ShadowTLS subscriptions utilize SIP003.
|
||||
result.plugin_opts = result.plugin_opts:gsub("^password=", "passwd=")
|
||||
result.plugin_opts = result.plugin_opts:gsub(";password=", ";passwd=")
|
||||
result.plugin_opts = result.plugin_opts:gsub("^version=([123])", "v%1=1")
|
||||
result.plugin_opts = result.plugin_opts:gsub(";version=([123])", ";v%1=1")
|
||||
else
|
||||
result.plugin = plugin_info
|
||||
end
|
||||
@@ -1174,10 +1230,22 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.plugin_opts = nil
|
||||
end
|
||||
elseif result.type == 'sing-box' then
|
||||
if result.plugin ~= "obfs-local" and result.plugin ~= "v2ray-plugin" then
|
||||
if result.plugin ~= "obfs-local" and result.plugin ~= "v2ray-plugin" and result.plugin ~= "shadow-tls" then
|
||||
result.error_msg = i18n.translatef("%s unsupport SS %s plugin.", "Sing-Box", result.plugin)
|
||||
else
|
||||
result.plugin_enabled = "1"
|
||||
-- Some ShadowTLS subscriptions utilize SIP003.
|
||||
if result.plugin == "shadow-tls" then
|
||||
for item in result.plugin_opts:gmatch("[^;]+") do
|
||||
local key, value = item:match("^([^=]+)=(.*)$")
|
||||
if key == "host" then result.shadowtls_serverName = value end
|
||||
if key == "passwd" then result.shadowtls_password = value end
|
||||
if key:match("^v[123]$") then result.shadowtls_version = key:sub(2) end
|
||||
end
|
||||
result.shadowtls = "1"
|
||||
result.plugin_opts = nil
|
||||
result.plugin_enabled = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
result.plugin_enabled = "1"
|
||||
@@ -1722,6 +1790,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.hysteria_auth_type = "string"
|
||||
result.hysteria_auth_password = params.auth
|
||||
result.tls_serverName = params.peer or params.sni or ""
|
||||
result.tls_pinSHA256 = params.pcs or params.pinSHA256
|
||||
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.alpn = params.alpn
|
||||
@@ -1845,6 +1914,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
end
|
||||
result.tls_serverName = params.sni
|
||||
result.tls_disable_sni = params.disable_sni
|
||||
result.tls_pinSHA256 = params.pcs or params.pinsha256
|
||||
result.tuic_alpn = params.alpn or "h3"
|
||||
result.tuic_congestion_control = params.congestion_control or "cubic"
|
||||
result.tuic_udp_relay_mode = params.udp_relay_mode or "native"
|
||||
@@ -1900,6 +1970,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if params.security == "tls" or params.security == "reality" then
|
||||
result.tls = "1"
|
||||
result.tls_serverName = params.sni or params.peer
|
||||
result.tls_pinSHA256 = params.pcs or params.pinsha256
|
||||
result.alpn = params.alpn
|
||||
if params.fp and params.fp ~= "" then
|
||||
result.utls = "1"
|
||||
@@ -2063,6 +2134,9 @@ local function curl(url, file, ua, mode, hwid)
|
||||
if hwid == "1" then
|
||||
curl_args[#curl_args + 1] = get_headers()
|
||||
end
|
||||
local cookie_file = "/tmp/cookie_" .. api.gen_random_char(5)
|
||||
curl_args[#curl_args + 1] = '-c "' .. cookie_file .. '" -b "' .. cookie_file .. '"'
|
||||
|
||||
local return_code, result
|
||||
if mode == "direct" then
|
||||
return_code, result = api.curl_direct(url, file, curl_args)
|
||||
@@ -2071,6 +2145,8 @@ local function curl(url, file, ua, mode, hwid)
|
||||
else
|
||||
return_code, result = api.curl_auto(url, file, curl_args)
|
||||
end
|
||||
luci.sys.call('rm -f "%s"' % cookie_file)
|
||||
|
||||
return return_code, tonumber(result)
|
||||
end
|
||||
|
||||
@@ -2599,7 +2675,7 @@ local execute = function()
|
||||
f:close()
|
||||
local raw_data = api.trim(stdout)
|
||||
local old_md5 = value.md5 or ""
|
||||
local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "")
|
||||
local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{printf \"%s\", $1}'")
|
||||
if not manual_sub and old_md5 == new_md5 then
|
||||
log(1, i18n.translatef("Subscription: [%s] No changes, no update required.", remark))
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user