From 7b417b13785f28654ac7586ce7cf991239133d40 Mon Sep 17 00:00:00 2001
From: fightroad <39027157+fightroad@users.noreply.github.com>
Date: Fri, 13 Sep 2024 10:26:51 +0800
Subject: [PATCH] Update Shadowsocks.asp
---
.../www/n56u_ribbon_fixed/Shadowsocks.asp | 978 +++++++++---------
1 file changed, 481 insertions(+), 497 deletions(-)
diff --git a/trunk/user/www/n56u_ribbon_fixed/Shadowsocks.asp b/trunk/user/www/n56u_ribbon_fixed/Shadowsocks.asp
index 7dae97db3c..f909a2a579 100644
--- a/trunk/user/www/n56u_ribbon_fixed/Shadowsocks.asp
+++ b/trunk/user/www/n56u_ribbon_fixed/Shadowsocks.asp
@@ -30,7 +30,7 @@
<% shadowsocks_status(); %>
<% dns2tcp_status(); %>
<% rules_count(); %>
- node_global_max = 0;
+ node_global_max = 0;
editing_ss_id = 0;
var $j = jQuery.noConflict();
$j(document).ready(function () {
@@ -68,51 +68,51 @@
$j("#btn_aping_link").click(function () {
aping_dlink();
});
- $j("#s5_aut").change(function () {
- if ($j("#s5_aut").is(':checked')) {
- document.getElementById('s5_aut').value = 1;
- } else {
- document.getElementById('s5_aut').value = 0;
- }
- });
- $j("#v2_tls").change(function () {
- if ($j("#v2_tls").val() != '0') {
- showhide_div('row_tj_tls_host', 1);
- } else {
- showhide_div('row_tj_tls_host', 0);
- }
+ $j("#s5_aut").change(function() {
+ if($j("#s5_aut").is(':checked')){
+ document.getElementById('s5_aut').value=1;
+ }else{
+ document.getElementById('s5_aut').value=0;
+ }
+ });
+ $j("#v2_tls").change(function() {
+ if(document.getElementById('v2_tls').value != '0'){
+ showhide_div('row_tj_tls_host', 1);
+ }else{
+ showhide_div('row_tj_tls_host', 0);
+ }
});
- $j("#v2_mux").change(function () {
- if ($j("#v2_mux").is(':checked')) {
- document.getElementById('v2_mux').value = 1;
- } else {
- document.getElementById('v2_mux').value = 0;
- }
+ $j("#v2_mux").change(function() {
+ if($j("#v2_mux").is(':checked')){
+ document.getElementById('v2_mux').value=1;
+ }else{
+ document.getElementById('v2_mux').value=0;
+ }
});
- $j("#ssp_insecure").change(function () {
- if ($j("#ssp_insecure").is(':checked')) {
- document.getElementById('ssp_insecure').value = 1;
- } else {
- document.getElementById('ssp_insecure').value = 0;
- }
+ $j("#ssp_insecure").change(function() {
+ if($j("#ssp_insecure").is(':checked')){
+ document.getElementById('ssp_insecure').value=1;
+ }else{
+ document.getElementById('ssp_insecure').value=0;
+ }
});
});
- function ctime() {
- var t = 0;
- c = null;
- document.getElementById('btn_ctime').value = '正在运行脚本:0s';
- document.getElementById('btn_ctime').style.display = "inline";
- c = setInterval(function () {
- t = t + 1
- //document.getElementById("ctime").value=t + "秒";
- document.getElementById('btn_ctime').value = '正在运行脚本:' + t + "s";
- }, 1000);
- }
- function dtime() {
- clearInterval(c);
- document.getElementById('btn_ctime').value = '脚本运行完成!';
- setTimeout('document.getElementById("btn_ctime").style.display="none";', 1000);
- }
+function ctime() {
+var t=0;
+c=null;
+document.getElementById('btn_ctime').value='正在运行脚本:0s';
+document.getElementById('btn_ctime').style.display="inline";
+ c=setInterval(function(){
+ t=t+1
+ //document.getElementById("ctime").value=t + "秒";
+ document.getElementById('btn_ctime').value='正在运行脚本:' + t +"s";
+ },1000);
+}
+function dtime() {
+clearInterval(c);
+document.getElementById('btn_ctime').value='脚本运行完成!';
+setTimeout('document.getElementById("btn_ctime").style.display="none";',1000);
+}
function initial() {
show_banner(2);
show_menu(13, 13, 0);
@@ -305,7 +305,7 @@
showhide_div('row_quic_key', 1);
showhide_div('row_quic_header', 1);
}
-
+
}
function switch_dns() {
var b = document.form.pdnsd_enable.value;
@@ -353,7 +353,7 @@
success: function (response) {
alert("脚本执行成功...")
},
- complete: function (xhr, ts) {
+ complete: function(xhr, ts) {
hideLoading();
}
});
@@ -419,10 +419,10 @@
}
//订阅节点
function dlink() {
- ctime();
+ ctime();
var ns = {};
ns[1] = "dlink";
- document.getElementById("btn_update_link").value = "正在更新订阅节点";
+ document.getElementById("btn_update_link").value="正在更新订阅节点";
$j.ajax({
url: "/applydb.cgi?usedlink=1&p=ss",
type: 'POST',
@@ -433,16 +433,16 @@
alert("脚本执行失败!!!")
},
success: function (response) {
- setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_update_link').value='更新所有订阅服务器节点';", 1000);
+ setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_update_link').value='更新所有订阅服务器节点';",1000);
}
});
}
//清空节点
function ddlink() {
- ctime();
+ ctime();
var ns = {};
ns[1] = "ddlink";
- document.getElementById("btn_rest_link").value = "正在清空节点";
+ document.getElementById("btn_rest_link").value="正在清空节点";
$j.ajax({
url: "/applydb.cgi?useddlink=1&p=ss",
type: 'POST',
@@ -453,176 +453,165 @@
alert("脚本执行失败!!!")
},
success: function (response) {
- node_global_max = 0;
- setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_rest_link').value='清空所有节点';", 1000);
+ node_global_max=0;
+ setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_rest_link').value='清空所有节点';",1000);
}
});
}
function showMRULESList() {
- $j('#table99').bootstrapTable({
- //data: myss,
- striped: true,
- pageNumber: 1,
- pagination: true,
- sortable: true,
- sortName: 'ids',
- sortOrder: "desc",
- sidePagination: 'client',
- pageSize: 15,
- pageList: [15, 25, 35, 50], // 分页显示记录数
- uniqueId: "ids",
- ajax: function (request) {
- $j.ajax({
- url: "/dbconf?p=ss&v=<% uptime(); %>",
- type: "get",
- success: function (data) {
+ $j('#table99').bootstrapTable({
+ //data: myss,
+ striped: true,
+ pageNumber: 1,
+ pagination: true,
+ sortable: true,
+ sortName: 'ids',
+ sortOrder: "desc",
+ sidePagination: 'client',
+ pageSize: 15,
+ pageList: [15, 25, 35, 50], // 分页显示记录数
+ uniqueId: "ids",
+ ajax:function(request) {
+ $j.ajax({
+ url:"/dbconf?p=ss&v=<% uptime(); %>",
+ type:"get",
+ success:function(data){
request.success({
- row: data
+ row : data
});
//显示节点下拉列表 by 花妆男
- // 渲染父节点 obj 需要渲染的数据 keyStr key需要去除的字符串
- var keyStr = "ssconf_basic_json_",
- nodeList = document.getElementById("nodeList"),//获取节点
- unodeList = document.getElementById("u_nodeList"),//获取节点
- s5nodeList = document.getElementById("s5_nodeList");//获取节点
- $j(nodeList).find("option:gt(0)").remove();
- $j(unodeList).find("option:gt(1)").remove();
- $j(s5nodeList).find("option:gt(1)").remove();
- for (var key in db_ss) { // 遍历对象
- var optionObj = null;
- try {
- optionObj = JSON.parse(removeUselessChars(db_ss[key]));//字符串转为对象
- } catch (e) {
- optionObj = null;
- }
- if (optionObj == null) continue;
- var text = '[ ' + (optionObj.type ? optionObj.type : "类型获取失败") + ' ] ' + (optionObj.alias ? optionObj.alias : "名字获取失败"); // 判断下怕获取失败 ,括号是运算的问题
- // 添加
- nodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
- unodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
- s5nodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
- $j('#nodeList>option').sort(function (a, b) {
- var aText = $j(a).val() * 1;
- var bText = $j(b).val() * 1;
- if (aText > bText) return -1;
- if (aText < bText) return 1;
- return 0;
- }).appendTo('#nodeList');
- $j('#nodeList>option').eq(0).attr("selected", "selected");
- //udp列表
- $j('#u_nodeList>option').sort(function (a, b) {
- var aText = $j(a).val() * 1;
- var bText = $j(b).val() * 1;
- if (aText > bText) return -1;
- if (aText < bText) return 1;
- return 0;
- }).appendTo('#u_nodeList');
- $j('#u_nodeList>option').eq(0).attr("selected", "selected");
- //s5列表
- $j('#s5_nodeList>option').sort(function (a, b) {
- var aText = $j(a).val() * 1;
- var bText = $j(b).val() * 1;
- if (aText > bText) return -1;
- if (aText < bText) return 1;
- return 0;
- }).appendTo('#s5_nodeList');
- $j('#s5_nodeList>option').eq(0).attr("selected", "selected");
- //$j('#nodeList').selectpicker('val', '<% nvram_get_x("","global_server"); %>'); //主服务器列表默认
- //$j('#u_nodeList').selectpicker('val', '<% nvram_get_x("","udp_relay_server"); %>'); //UDP服务器列表默认
- document.form.global_server.value = '<% nvram_get_x("","global_server"); %>';
- document.form.udp_relay_server.value = '<% nvram_get_x("","udp_relay_server"); %>';
- document.form.socks5_enable.value = '<% nvram_get_x("","socks5_enable"); %>';
- //}
- }
- //订阅节点表格
- var myss = [],
- i = 0;
- for (var key in db_ss) { // 遍历对象
- var dbss = null;
- try {
- dbss = JSON.parse(removeUselessChars(db_ss[key]));//字符串转为对象
- } catch (e) {
- dbss = null;
- }
- if (dbss == null) continue;
- dbss.ids = key.replace("ssconf_basic_json_", '');
- myss[i] = dbss;
- i = i + 1;
- if (myss != null) {
- var node_i = parseInt(key.replace("ssconf_basic_json_", ''));
- if (node_i > node_global_max) {
- node_global_max = node_i;
- }
- }
+ // 渲染父节点 obj 需要渲染的数据 keyStr key需要去除的字符串
+ var keyStr = "ssconf_basic_json_";
+ var nodeList = document.getElementById("nodeList"); // 获取TCP节点
+ var unodeList = document.getElementById("u_nodeList"); // 获取UDP节点
+ var s5nodeList = document.getElementById("s5_nodeList"); // 获取SOCK5节点
+ nodeList.options.length=1; // 清除TCP旧节点,准备获取新列表信息
+ unodeList.options.length=1;// 清除UDP旧节点,准备获取新列表信息
+ s5nodeList.options.length=1;// 清除SOCK5旧节点,准备获取新列表信息
+ for (var key in db_ss) { // 遍历对象
+ var optionObj = JSON.parse(db_ss[key]); // 字符串转为对象
+ //if(optionObj.ping != "failed"){ //过滤ping不通的节点
+ var text = '[ ' + (optionObj.type ? optionObj.type : "类型获取失败") + ' ] ' + (optionObj.alias ? optionObj.alias : "名字获取失败"); // 判断下怕获取失败 ,括号是运算的问题
+ // 添加
+ nodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
+ unodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
+ s5nodeList.options.add(new Option(text, key.replace(keyStr, ''))); // 通过 replacce把不要的字符去掉
+ $j('#nodeList>option').sort(function (a, b) {
+ var aText = $j(a).val() * 1;
+ var bText = $j(b).val() * 1;
+ if (aText > bText) return -1;
+ if (aText < bText) return 1;
+ return 0;
+ }).appendTo('#nodeList');
+ $j('#nodeList>option').eq(0).attr("selected", "selected");
+ //udp列表
+ $j('#u_nodeList>option').sort(function (a, b) {
+ var aText = $j(a).val() * 1;
+ var bText = $j(b).val() * 1;
+ if (aText > bText) return -1;
+ if (aText < bText) return 1;
+ return 0;
+ }).appendTo('#u_nodeList');
+ $j('#u_nodeList>option').eq(0).attr("selected", "selected");
+ //s5列表
+ $j('#s5_nodeList>option').sort(function (a, b) {
+ var aText = $j(a).val() * 1;
+ var bText = $j(b).val() * 1;
+ if (aText > bText) return -1;
+ if (aText < bText) return 1;
+ return 0;
+ }).appendTo('#s5_nodeList');
+ $j('#s5_nodeList>option').eq(0).attr("selected", "selected");
+ //$j('#nodeList').selectpicker('val', '<% nvram_get_x("","global_server"); %>'); //主服务器列表默认
+ //$j('#u_nodeList').selectpicker('val', '<% nvram_get_x("","udp_relay_server"); %>'); //UDP服务器列表默认
+ document.form.global_server.value = '<% nvram_get_x("","global_server"); %>';
+ document.form.udp_relay_server.value = '<% nvram_get_x("","udp_relay_server"); %>';
+ document.form.socks5_enable.value = '<% nvram_get_x("","socks5_enable"); %>';
+ //}
+ }
+ //订阅节点表格
+ var myss = new Array();
+ var i = 0;
+ for (var key in db_ss) { // 遍历对象
+ var dbss = JSON.parse(db_ss[key])
+ dbss.ids = key.replace("ssconf_basic_json_", '');
+ myss[i] = dbss;
+ i = i + 1;
+ if (myss != null) {
+ var node_i = parseInt(key.replace("ssconf_basic_json_", ''));
+ if (node_i > node_global_max) {
+ node_global_max = node_i;
}
+ }
+ }
$j('#table99').bootstrapTable('load', myss);
- },
- error: function (error) {
+ },
+ error:function(error){
console.log(error);
- }
- })
- },
- columns: [{
- field: 'delete',
- title: '删除',
- checkbox: true,
- width: '30px'
- }, {
- field: 'ids',
- title: '序号',
- width: '30px',
- align: 'center',
- valign: 'middle',
- sortable: true
- }, {
- field: 'type',
- title: '类型',
- align: 'center',
- valign: 'middle',
- width: '10px'
- }, {
- field: 'alias',
- cellStyle: formatTableUnit,
- formatter: paramsMatter,
- title: '别名',
- align: 'center',
- valign: 'middle',
- width: '230px'
- }, {
- field: 'server',
- cellStyle: formatTableUnit,
- formatter: paramsMatter,
- title: '服务器地址',
- align: 'center',
- valign: 'middle',
- width: '150px'
- }, {
- field: 'ping',
- title: 'ping',
- align: 'center',
- valign: 'middle',
- width: '50px',
- cellStyle: cellStylesales,
- formatter: actionFormatter2,
- sortable: true
- }, {
- field: 'lost',
- title: '丢包',
- align: 'center',
- valign: 'middle',
- width: '50px'
- }, {
- field: 'operate',
- title: '操作',
- width: '200px',
- align: 'center',
- valign: 'middle',
- events: window.operateEvents,
- formatter: actionFormatter
- }]
- });
-
-
+ }
+ })
+ },
+ columns: [{
+ field: 'delete',
+ title: '删除',
+ checkbox: true,
+ width: '30px'
+ }, {
+ field: 'ids',
+ title: '序号',
+ width: '30px',
+ align: 'center',
+ valign: 'middle',
+ sortable: true
+ }, {
+ field: 'type',
+ title: '类型',
+ align: 'center',
+ valign: 'middle',
+ width: '10px'
+ }, {
+ field: 'alias',
+ cellStyle: formatTableUnit,
+ formatter: paramsMatter,
+ title: '别名',
+ align: 'center',
+ valign: 'middle',
+ width: '230px'
+ }, {
+ field: 'server',
+ cellStyle: formatTableUnit,
+ formatter: paramsMatter,
+ title: '服务器地址',
+ align: 'center',
+ valign: 'middle',
+ width: '150px'
+ }, {
+ field: 'ping',
+ title: 'ping',
+ align: 'center',
+ valign: 'middle',
+ width: '50px',
+ cellStyle: cellStylesales,
+ formatter: actionFormatter2,
+ sortable: true
+ }, {
+ field: 'lost',
+ title: '丢包',
+ align: 'center',
+ valign: 'middle',
+ width: '50px'
+ }, {
+ field: 'operate',
+ title: '操作',
+ width: '200px',
+ align: 'center',
+ valign: 'middle',
+ events: window.operateEvents,
+ formatter: actionFormatter
+ }]
+ });
+
+
}
function cellStylesales(value, row, index) {
var ping = row.ping
@@ -704,10 +693,10 @@
document.getElementById("ss_obfs_param").value = '';
//v2
document.getElementById("ssp_insecure").value = 0;
- document.getElementById("ssp_insecure").checked = false;
+ document.getElementById("ssp_insecure").checked = false;
document.getElementById("v2_mux").value = 0;
document.getElementById("v2_mux").checked = false;
- document.getElementById("v2_security").value = 'none';
+ document.getElementById("v2_security").value = 'zero';
document.getElementById("v2_vmess_id").value = '';
document.getElementById("v2_alter_id").value = '';
document.getElementById("v2_transport").value = 'tcp';
@@ -765,9 +754,9 @@
} else if (type == "v2ray" || type == "xray") {
var transport = getProperty(ss, 'transport', 'tcp');
document.getElementById("ssp_insecure").value = getProperty(ss, 'insecure', 0);
- document.getElementById("ssp_insecure").checked = document.getElementById("ssp_insecure").value != 0;
+ document.getElementById("ssp_insecure").checked = document.getElementById("ssp_insecure").value != 0;
document.getElementById("v2_mux").value = getProperty(ss, 'mux', 0);
- document.getElementById("v2_mux").checked = document.getElementById("v2_mux").value != 0;
+ document.getElementById("v2_mux").checked = document.getElementById("v2_mux").value != 0;
document.getElementById("v2_security").value = getProperty(ss, 'security', 'auto');
document.getElementById("v2_vmess_id").value = getProperty(ss, 'vmess_id', '');
document.getElementById("v2_alter_id").value = getProperty(ss, 'alter_id', '');
@@ -800,9 +789,9 @@
}
} else if (type == "trojan") {
document.getElementById("ssp_insecure").value = getProperty(ss, 'insecure', 0);
- document.getElementById("ssp_insecure").checked = document.getElementById("ssp_insecure").value != 0;
+ document.getElementById("ssp_insecure").checked = document.getElementById("ssp_insecure").value != 0;
document.getElementById("v2_tls").value = 1;
- //document.getElementById("v2_tls").checked = document.getElementById("v2_tls") != 0;
+ //document.getElementById("v2_tls").checked = document.getElementById("v2_tls") != 0;
document.getElementById("ssp_tls_host").value = getProperty(ss, 'tls_host', '');
} else if (type == "socks5") {
//
@@ -812,7 +801,7 @@
}
//单项删除
function del(id) {
- ctime();
+ ctime();
var p = "ssconf_basic";
var ns = {};
ns[p + "_json_" + id] = "deleting";
@@ -826,21 +815,22 @@
alert("删除失败,请重试!")
},
success: function (response) {
- dtime();
+ dtime();
$j('#table99').bootstrapTable('refresh');
}
});
}
//批量删除
function del_dlink() {
- ctime();
+ ctime();
var row = $j("#table99").bootstrapTable('getSelections');
var p = "ssconf_basic";
var ns = {};
for (var key in row) {
ns[p + "_json_" + row[key].ids] = "deleting";
}
- document.getElementById("btn_del_link").value = "正在删除节点";
+ //console.log(ns)
+ document.getElementById("btn_del_link").value="正在删除节点";
$j.ajax({
url: "/applydb.cgi?userm1=del&p=ss",
type: 'POST',
@@ -851,13 +841,13 @@
alert("删除失败,请重试!")
},
success: function (response) {
- setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_del_link').value='批量删除节点';", 1000);
+ setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_del_link').value='批量删除节点';",1000);
}
});
}
//ping节点
function ping_dlink() {
- ctime();
+ ctime();
var row = $j("#table99").bootstrapTable('getSelections');
var p = "ssconf_basic";
var ns = {};
@@ -865,7 +855,7 @@
ns[row[key].ids] = "ping";
}
//showLoading();
- document.getElementById("btn_ping_link").value = "正在ping节点";
+ document.getElementById("btn_ping_link").value="正在ping节点";
$j.ajax({
url: "/applydb.cgi?useping=1&p=ss",
type: 'POST',
@@ -876,17 +866,17 @@
alert("脚本执行失败!!!")
},
success: function (response) {
- setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_ping_link').value='ping节点';", 2000);
-
+ setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_ping_link').value='ping节点';",2000);
+
}
});
}
//ping全部节点
function aping_dlink() {
- ctime();
+ ctime();
var ns = {};
ns[1] = "allping";
- document.getElementById("btn_aping_link").value = "正在ping全部节点";
+ document.getElementById("btn_aping_link").value="正在ping全部节点";
$j.ajax({
url: "/applydb.cgi?useping=1&p=ss",
type: 'POST',
@@ -897,7 +887,7 @@
alert("脚本执行失败!!!")
},
success: function (response) {
- setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_aping_link').value='ping全部节点';", 2000);
+ setTimeout("dtime();$j('#table99').bootstrapTable('refresh');document.getElementById('btn_aping_link').value='ping全部节点';",2000);
}
});
}
@@ -973,7 +963,9 @@
}
initSSParams();
s.innerHTML = "";
+ //var ssu = ssrurl.match(/ssr:\/\/([A-Za-z0-9_-]+)/i);
var ssu = ssrurl.split('://');
+ //console.log(ssu.length);
if ((ssu[0] != "ssr" && ssu[0] != "ss" && ssu[0] != "vmess" && ssu[0] != "vless" && ssu[0] != "trojan") || ssu[1] == "") {
s.innerHTML = "无效格式";
return false;
@@ -1026,51 +1018,51 @@
url0 = ssu[1]
}
if (sipIndex != -1) {
- var userInfo = b64decsafe(url0.substr(0, sipIndex));
- var temp = url0.substr(sipIndex + 1).split("/?");
- var serverInfo = temp[0].split(":");
- var server = serverInfo[0];
- var port = serverInfo[1].replace("/", "");
- var method, password, plugin, pluginOpts;
- if (temp[1]) {
- var pluginInfo = decodeURIComponent(temp[1]);
- var pluginIndex = pluginInfo.indexOf(";");
- var pluginNameInfo = pluginInfo.substr(0, pluginIndex);
- plugin = pluginNameInfo.substr(pluginNameInfo.indexOf("=") + 1);
- pluginOpts = pluginInfo.substr(pluginIndex + 1);
- }
- var userInfoSplitIndex = userInfo.indexOf(":");
- if (userInfoSplitIndex != -1) {
- method = userInfo.substr(0, userInfoSplitIndex);
- password = userInfo.substr(userInfoSplitIndex + 1);
- }
- document.getElementById('ssp_type').value = "ss";
- document.getElementById('ssp_type').dispatchEvent(event);
- document.getElementById('ssp_server').value = server;
- document.getElementById('ssp_prot').value = port;
- document.getElementById('ss_password').value = password || "";
- document.getElementById('ss_method').value = method || "";
- document.getElementById('ss_plugin').value = plugin || "";
- if (plugin != undefined && plugin != "") {
- document.getElementById('ss_plugin_opts').value = pluginOpts || "";
- }
- if (param != undefined) {
- document.getElementById('ssp_name').value = decodeURI(param);
- }
- s.innerHTML = "导入Shadowsocks配置信息成功";
+ var userInfo = b64decsafe(url0.substr(0, sipIndex));
+ var temp = url0.substr(sipIndex + 1).split("/?");
+ var serverInfo = temp[0].split(":");
+ var server = serverInfo[0];
+ var port = serverInfo[1].replace("/","");
+ var method, password, plugin, pluginOpts;
+ if (temp[1]) {
+ var pluginInfo = decodeURIComponent(temp[1]);
+ var pluginIndex = pluginInfo.indexOf(";");
+ var pluginNameInfo = pluginInfo.substr(0, pluginIndex);
+ plugin = pluginNameInfo.substr(pluginNameInfo.indexOf("=") + 1);
+ pluginOpts = pluginInfo.substr(pluginIndex + 1);
+ }
+ var userInfoSplitIndex = userInfo.indexOf(":");
+ if (userInfoSplitIndex != -1) {
+ method = userInfo.substr(0, userInfoSplitIndex);
+ password = userInfo.substr(userInfoSplitIndex + 1);
+ }
+ document.getElementById('ssp_type').value = "ss";
+ document.getElementById('ssp_type').dispatchEvent(event);
+ document.getElementById('ssp_server').value = server;
+ document.getElementById('ssp_prot').value = port;
+ document.getElementById('ss_password').value = password || "";
+ document.getElementById('ss_method').value = method || "";
+ document.getElementById('ss_plugin').value = plugin || "";
+ if (plugin != undefined && plugin != "") {
+ document.getElementById('ss_plugin_opts').value = pluginOpts || "";
}
- else {
- var sstr = b64decsafe(url0);
- document.getElementById('ssp_type').value = "ss";
- document.getElementById('ssp_type').dispatchEvent(event);
- var team = sstr.split('@');
- var part1 = team[0].split(':');
- var part2 = team[1].split(':');
- document.getElementById('ssp_server').value = part2[0];
- document.getElementById('ssp_prot').value = part2[1];
- document.getElementById('ss_password').value = part1[1];
- document.getElementById('ss_method').value = part1[0];
- s.innerHTML = "导入Shadowsocks配置信息成功";
+ if (param != undefined) {
+ document.getElementById('ssp_name').value = decodeURI(param);
+ }
+ s.innerHTML = "导入Shadowsocks配置信息成功"; }
+ else {
+ var sstr = b64decsafe(url0);
+ document.getElementById('ssp_type').value = "ss";
+ document.getElementById('ssp_type').dispatchEvent(event);
+ var team = sstr.split('@');
+ console.log(param);
+ var part1 = team[0].split(':');
+ var part2 = team[1].split(':');
+ document.getElementById('ssp_server').value = part2[0];
+ document.getElementById('ssp_prot').value = part2[1];
+ document.getElementById('ss_password').value = part1[1];
+ document.getElementById('ss_method').value = part1[0];
+ s.innerHTML = "导入Shadowsocks配置信息成功";
}
if (param != undefined) {
document.getElementById('ssp_name').value = decodeURI(param);
@@ -1090,18 +1082,18 @@
document.getElementById('ssp_type').dispatchEvent(event);
var team = sstr.split('@');
var password = team[0]
- var serverPart = team[1].split(':');
+ var serverPart = team[1].split(':');
var others = serverPart[1].split('?');
var port = parseInt(others[0]);
var queryParam = {}
if (others.length > 1) {
- var queryParams = others[1]
- var queryArray = queryParams.split('&');
- for (i = 0; i < queryArray.length; i++) {
- var params = queryArray[i].split('=');
- queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
- }
+ var queryParams = others[1]
+ var queryArray = queryParams.split('&');
+ for (i = 0; i < queryArray.length; i++) {
+ var params = queryArray[i].split('=');
+ queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
}
+ }
document.getElementById('ssp_server').value = serverPart[0];
document.getElementById('ssp_prot').value = port || '443';;
document.getElementById('ss_password').value = password;
@@ -1114,6 +1106,7 @@
return false;
} else if (ssu[0] == "vmess") {
var sstr = b64DecodeUnicode(ssu[1]);
+ console.log(sstr);
var ploc = sstr.indexOf("/?");
document.getElementById('ssp_type').value = "v2ray";
document.getElementById('ssp_type').dispatchEvent(event);
@@ -1122,7 +1115,7 @@
url0 = sstr.substr(0, ploc);
param = sstr.substr(ploc + 2);
}
- var ssm = JSON.parse(removeUselessChars(sstr));
+ var ssm = JSON.parse(sstr);
document.getElementById('ssp_name').value = ssm.ps;
document.getElementById('ssp_server').value = ssm.add;
document.getElementById('ssp_prot').value = ssm.port;
@@ -1132,17 +1125,18 @@
document.getElementById('v2_transport').dispatchEvent(event);
if (ssm.net == "tcp") {
if (ssm.type && ssm.type != "http") {
- ssm.type = "none"
+ ssm.type = "none"
}
document.getElementById('v2_tcp_guise').value = ssm.type;
document.getElementById('v2_http_host').value = ssm.host;
- if (ssm.path != undefined) {
- document.getElementById('v2_http_path').value = ssm.path;
- }
- else {
- document.getElementById('v2_http_path').value = '/';
- }
- }
+ if (ssm.path != undefined){
+ document.getElementById('v2_http_path').value = ssm.path;
+ }
+ else
+ {
+ document.getElementById('v2_http_path').value = '/';
+ }
+ }
if (ssm.net == "ws") {
document.getElementById('v2_ws_host').value = ssm.host;
document.getElementById('v2_ws_path').value = ssm.path;
@@ -1180,23 +1174,23 @@
var port = others[0]
var queryParam = {}
if (others.length > 1) {
- var queryParams = others[1]
- var queryArray = queryParams.split('&');
- for (i = 0; i < queryArray.length; i++) {
- var params = queryArray[i].split('=');
- queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
- }
- }
+ var queryParams = others[1]
+ var queryArray = queryParams.split('&');
+ for (i = 0; i < queryArray.length; i++) {
+ var params = queryArray[i].split('=');
+ queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
+ }
+ }
document.getElementById('ssp_server').value = serverPart[0];
document.getElementById('ssp_prot').value = port;
document.getElementById('v2_vmess_id').value = password;
- document.getElementById('v2_alter_id').value = "0";
+ document.getElementById('v2_alter_id').value = "0";
document.getElementById('ssp_type').value = "xray";
document.getElementById('ssp_type').dispatchEvent(event);
document.getElementById('v2_security').value = queryParam.encryption || "none";
document.getElementById('v2_transport').value = queryParam.type || "tcp";
document.getElementById('v2_transport').dispatchEvent(event);
-
+
if (queryParam.security == "tls") {
document.getElementById('v2_tls').value = '1';
document.getElementById('v2_flow').value = '0';
@@ -1205,32 +1199,34 @@
document.getElementById('ssp_insecure').checked = false;
document.getElementById('ssp_tls_host').value = queryParam.sni || serverPart[0];
}
-
+
if (queryParam.type == "ws") {
document.getElementById('v2_ws_host').value = queryParam.host;
- document.getElementById('v2_ws_path').value = queryParam.path;
+ document.getElementById('v2_ws_path').value = queryParam.path;
}
if (queryParam.type == "h2") {
document.getElementById('v2_h2_host').value = queryParam.host;
document.getElementById('v2_h2_path').value = queryParam.path;
}
-
+
if (queryParam.security == "xtls") {
document.getElementById('v2_tls').value = '2';
if (queryParam.flow != undefined) {
- if (queryParam.flow == 'xtls-rprx-direct') {
- document.getElementById('v2_flow').value = '1';
- }
- else if (queryParam.flow == 'xtls-rprx-splice') {
- document.getElementById('v2_flow').value = '2';
- }
- else {
- document.getElementById('v2_flow').value = '0';
- }
-
+ if(queryParam.flow == 'xtls-rprx-direct'){
+ document.getElementById('v2_flow').value = '1';
+ }
+ else if(queryParam.flow == 'xtls-rprx-splice'){
+ document.getElementById('v2_flow').value = '2';
+ }
+ else
+ {
+ document.getElementById('v2_flow').value = '0';
+ }
+
}
- else {
- document.getElementById('v2_flow').value = '1';
+ else
+ {
+ document.getElementById('v2_flow').value = '1';
}
//document.getElementById('v2_tls').checked = true;
document.getElementById('ssp_insecure').value = 0;
@@ -1291,6 +1287,7 @@
//点击保存节点按钮
function showNodeData(idName, obj) {
var nodeData = document.getElementById(idName);
+ //console.log(nodeData);
for (var key in obj) {
var tr = document.createElement("tr");
var td = document.createElement("td");
@@ -1335,7 +1332,7 @@
}
} else if (type == "v2ray" || type == "xray") {
var http_pathnew = document.getElementById("v2_http_path").value;
- if (http_pathnew == '') { document.getElementById("v2_http_path").value = '/'; }
+ if (http_pathnew == '') { document.getElementById("v2_http_path").value='/';}
var DataObj = {
type: document.getElementById("ssp_type").value,
alias: document.getElementById("ssp_name").value,
@@ -1399,7 +1396,7 @@
}
var post_dbus = JSON.stringify(DataObj)
var ids;
- if (editing_ss_id == 0) {
+ if (editing_ss_id == 0) {
node_global_max += 1;
ids = node_global_max;
} else {
@@ -1408,6 +1405,7 @@
var ns = {};
ns["ssconf_basic_json_" + ids] = post_dbus;
push_data(ns);
+ console.log(DataObj)
}
//post数据到后台处理
function push_data(obj) {
@@ -1419,7 +1417,7 @@
dataType: 'text',
data: $j.param(obj),
success: function (response) {
- //hideLoading();
+ //hideLoading();
$j("#vpnc_settings").fadeOut(200);
dtime();
$j('#table99').bootstrapTable('refresh');
@@ -1428,27 +1426,24 @@
}
function showsdlinkList() {
var value = document.getElementById("nodeList").value;
- if (value > 0) {
- var key = "ssconf_basic_json_" + value;
- var result = JSON.parse(removeUselessChars(db_ss[key]));
- document.getElementById("d_type").value = result.type;
- }
+ if (value >0){
+ var key = "ssconf_basic_json_" + value;
+ var result = JSON.parse(db_ss[key]);
+ document.getElementById("d_type").value = result.type;}
}
function showsudlinkList() {
var value = document.getElementById("u_nodeList").value;
- if (value > 0) {
- var key = "ssconf_basic_json_" + value;
- var result = JSON.parse(removeUselessChars(db_ss[key]));
- document.getElementById("ud_type").value = result.type;
- }
+ if (value >0){
+ var key = "ssconf_basic_json_" + value;
+ var result = JSON.parse(db_ss[key]);
+ document.getElementById("ud_type").value = result.type;}
}
function shows5dlinkList() {
var value = document.getElementById("s5_nodeList").value;
- if (value > 0 ) {
- var key = "ssconf_basic_json_" + value
- var result = JSON.parse(removeUselessChars(db_ss[key]));
- document.getElementById("s5_type").value = result.type;
- }
+ if (value >0){
+ var key = "ssconf_basic_json_" + value
+ var result = JSON.parse(db_ss[key]);
+ document.getElementById("s5_type").value = result.type;}
}