parent
58275d3fc3
commit
c99634af74
@ -1,12 +1,24 @@
|
|||||||
<%+cbi/valueheader%>
|
<%+cbi/valueheader%>
|
||||||
<%
|
<%
|
||||||
local api = require "luci.passwall.api"
|
local api = require "luci.passwall.api"
|
||||||
|
local appname = 'passwall'
|
||||||
|
local uci = api.libuci
|
||||||
|
local ss_type = uci:get(appname, "@global_subscribe[0]", "ss_type") or "shadowsocks-libev"
|
||||||
|
local trojan_type = uci:get(appname, "@global_subscribe[0]", "trojan_type") or "trojan-plus"
|
||||||
|
local vmess_type = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
||||||
|
local vless_type = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
||||||
|
local hysteria2_type = uci:get(appname, "@global_subscribe[0]", "hysteria2_type") or "hysteria2"
|
||||||
-%>
|
-%>
|
||||||
<script src="<%=resource%>/qrcode.min.js"></script>
|
<script src="<%=resource%>/qrcode.min.js"></script>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
let has_singbox = "<%=api.finded_com("singbox")%>"
|
let has_singbox = "<%=api.finded_com("singbox")%>"
|
||||||
let has_xray = "<%=api.finded_com("xray")%>"
|
let has_xray = "<%=api.finded_com("xray")%>"
|
||||||
let has_hysteria2 = "<%=api.finded_com("hysteria")%>"
|
let has_hysteria2 = "<%=api.finded_com("hysteria")%>"
|
||||||
|
let ss_type = "<%=ss_type%>"
|
||||||
|
let trojan_type = "<%=trojan_type%>"
|
||||||
|
let vmess_type = "<%=vmess_type%>"
|
||||||
|
let vless_type = "<%=vless_type%>"
|
||||||
|
let hysteria2_type = "<%=hysteria2_type%>"
|
||||||
|
|
||||||
function padright(str, cnt, pad) {
|
function padright(str, cnt, pad) {
|
||||||
return str + Array(cnt + 1).join(pad);
|
return str + Array(cnt + 1).join(pad);
|
||||||
@ -719,7 +731,7 @@ local api = require "luci.passwall.api"
|
|||||||
}
|
}
|
||||||
if (sipIndex !== -1) {
|
if (sipIndex !== -1) {
|
||||||
// SIP002
|
// SIP002
|
||||||
var userInfo = b64decsafe(url0.substr(0, sipIndex));
|
var userInfo = b64decsafe(decodeURIComponent(url0.substr(0, sipIndex)));
|
||||||
var temp = url0.substr(sipIndex + 1).replace('/?', '?').split('?');
|
var temp = url0.substr(sipIndex + 1).replace('/?', '?').split('?');
|
||||||
var serverInfo = temp[0].split(":");
|
var serverInfo = temp[0].split(":");
|
||||||
var server = serverInfo[0];
|
var server = serverInfo[0];
|
||||||
@ -746,18 +758,20 @@ local api = require "luci.passwall.api"
|
|||||||
method = userInfo.substr(0, userInfoSplitIndex);
|
method = userInfo.substr(0, userInfoSplitIndex);
|
||||||
password = userInfo.substr(userInfoSplitIndex + 1);
|
password = userInfo.substr(userInfoSplitIndex + 1);
|
||||||
}
|
}
|
||||||
if (has_singbox) {
|
if (ss_type == "sing-box" && has_singbox) {
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
||||||
} else if (has_xray) {
|
} else if (ss_type == "xray" && has_xray) {
|
||||||
dom_prefix = "xray_"
|
dom_prefix = "xray_"
|
||||||
opt.set('type', "Xray");
|
opt.set('type', "Xray");
|
||||||
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
||||||
|
method = method.toLowerCase() === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : method;
|
||||||
} else {
|
} else {
|
||||||
if (["2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"].includes(method)) {
|
if (["2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"].includes(method)) {
|
||||||
dom_prefix = "ssrust_"
|
dom_prefix = "ssrust_"
|
||||||
opt.set('type', "SS-Rust");
|
opt.set('type', "SS-Rust");
|
||||||
|
method = method.toLowerCase() === "chacha20-poly1305" ? "chacha20-ietf-poly1305" : method;
|
||||||
} else {
|
} else {
|
||||||
dom_prefix = "ss_"
|
dom_prefix = "ss_"
|
||||||
opt.set('type', "SS");
|
opt.set('type', "SS");
|
||||||
@ -874,11 +888,11 @@ local api = require "luci.passwall.api"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (has_singbox) {
|
if (ss_type == "sing-box" && has_singbox) {
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
||||||
} else if (has_xray) {
|
} else if (ss_type == "xray" && has_xray) {
|
||||||
dom_prefix = "xray_"
|
dom_prefix = "xray_"
|
||||||
opt.set('type', "Xray");
|
opt.set('type', "Xray");
|
||||||
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
opt.set(dom_prefix + 'protocol', "shadowsocks");
|
||||||
@ -903,11 +917,11 @@ local api = require "luci.passwall.api"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssu[0] === "trojan" || ssu[0] === "trojan-plus") {
|
if (ssu[0] === "trojan" || ssu[0] === "trojan-plus") {
|
||||||
if (has_singbox) {
|
if (trojan_type == "sing-box" && has_singbox) {
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
opt.set(dom_prefix + 'protocol', "trojan");
|
opt.set(dom_prefix + 'protocol', "trojan");
|
||||||
} else if (has_xray) {
|
} else if (trojan_type == "xray" && has_xray) {
|
||||||
dom_prefix = "xray_"
|
dom_prefix = "xray_"
|
||||||
opt.set('type', "Xray");
|
opt.set('type', "Xray");
|
||||||
opt.set(dom_prefix + 'protocol', "trojan");
|
opt.set(dom_prefix + 'protocol', "trojan");
|
||||||
@ -1021,11 +1035,10 @@ local api = require "luci.passwall.api"
|
|||||||
if (ssu[0] === "vmess") {
|
if (ssu[0] === "vmess") {
|
||||||
var sstr = b64DecodeUnicode(ssu[1]);
|
var sstr = b64DecodeUnicode(ssu[1]);
|
||||||
var ploc = sstr.indexOf("/?");
|
var ploc = sstr.indexOf("/?");
|
||||||
if (has_singbox) {
|
if (vmess_type == "sing-box" && has_singbox) {
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
}
|
} else if (has_xray) {
|
||||||
if (has_xray) {
|
|
||||||
dom_prefix = "xray_"
|
dom_prefix = "xray_"
|
||||||
opt.set('type', "Xray");
|
opt.set('type', "Xray");
|
||||||
}
|
}
|
||||||
@ -1110,11 +1123,10 @@ local api = require "luci.passwall.api"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssu[0] === "vless") {
|
if (ssu[0] === "vless") {
|
||||||
if (has_singbox) {
|
if (vless_type == "sing-box" && has_singbox) {
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
}
|
} else if (has_xray) {
|
||||||
if (has_xray) {
|
|
||||||
dom_prefix = "xray_"
|
dom_prefix = "xray_"
|
||||||
opt.set('type', "Xray");
|
opt.set('type', "Xray");
|
||||||
}
|
}
|
||||||
@ -1266,7 +1278,7 @@ local api = require "luci.passwall.api"
|
|||||||
queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
|
queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (has_singbox) {
|
if (hysteria2_type == "sing-box" && has_singbox) {
|
||||||
opt.set('type', "sing-box");
|
opt.set('type', "sing-box");
|
||||||
dom_prefix = "singbox_"
|
dom_prefix = "singbox_"
|
||||||
opt.set(dom_prefix + 'protocol', "hysteria2");
|
opt.set(dom_prefix + 'protocol', "hysteria2");
|
||||||
@ -1275,8 +1287,7 @@ local api = require "luci.passwall.api"
|
|||||||
opt.set(dom_prefix + 'hysteria2_obfs_type', "salamander");
|
opt.set(dom_prefix + 'hysteria2_obfs_type', "salamander");
|
||||||
opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"]);
|
opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"]);
|
||||||
}
|
}
|
||||||
}
|
} else if (has_hysteria2) {
|
||||||
if (has_hysteria2) {
|
|
||||||
opt.set('type', "Hysteria2");
|
opt.set('type', "Hysteria2");
|
||||||
dom_prefix = "hysteria2_"
|
dom_prefix = "hysteria2_"
|
||||||
opt.set(dom_prefix + 'auth_password', decodeURIComponent(password));
|
opt.set(dom_prefix + 'auth_password', decodeURIComponent(password));
|
||||||
|
@ -593,7 +593,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||||||
info = info:sub(1, find_index - 1)
|
info = info:sub(1, find_index - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local hostInfo = split(base64Decode(info), "@")
|
local hostInfo = split(base64Decode(UrlDecode(info)), "@")
|
||||||
if hostInfo and #hostInfo > 0 then
|
if hostInfo and #hostInfo > 0 then
|
||||||
local host_port = hostInfo[#hostInfo]
|
local host_port = hostInfo[#hostInfo]
|
||||||
-- [2001:4860:4860::8888]:443
|
-- [2001:4860:4860::8888]:443
|
||||||
|
Loading…
Reference in New Issue
Block a user