From 3fd41be750a9f8a7f2b60a7abab27f003cb52e31 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Wed, 22 Jan 2020 20:52:23 +0800 Subject: [PATCH] luci-app-passwall: sync with upstream source --- package/lienol/luci-app-passwall/Makefile | 2 +- .../api/gen_trojan_client_config_file.lua | 0 .../api/gen_v2ray_client_config_file.lua | 0 .../luasrc/model/cbi/passwall/node_list.lua | 4 +- .../view/passwall/node_list/node_list.htm | 5 ++- .../root/usr/share/passwall/app.sh | 44 +++++++++++++++++++ 6 files changed, 52 insertions(+), 3 deletions(-) mode change 100644 => 100755 package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua mode change 100644 => 100755 package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray_client_config_file.lua diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index a5d269e3e6..98b66bf641 100644 --- a/package/lienol/luci-app-passwall/Makefile +++ b/package/lienol/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=3.3 -PKG_RELEASE:=32-20200121 +PKG_RELEASE:=33-20200122 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua old mode 100644 new mode 100755 diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray_client_config_file.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_v2ray_client_config_file.lua old mode 100644 new mode 100755 diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua index eaeab767bb..38091539e7 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/node_list.lua @@ -105,7 +105,9 @@ else o = s:option(DummyValue, "type", translate("Type")) o.cfgvalue = function(t, n) local v = Value.cfgvalue(t, n) - return translate(v) + if v then + return translate(v) + end end ---- Address diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm index 3151bd692a..7ab2e7e2e4 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm @@ -161,7 +161,7 @@ table td, .table .td { var address = document.getElementById("cbid.passwall." + cbi_id + ".address").value; var port = document.getElementById("cbid.passwall." + cbi_id + ".port").value; <% end %> - if ((address != null && address != "") && (port != null && port != "")) { + if ((address != null && address != "") && (port != null && port != "")) { ajax.post('<%=dsp.build_url("admin/vpn/passwall/ping_node")%>', { index: index, address: address, @@ -211,6 +211,9 @@ table td, .table .td { auto_ping(); }, ); + } else { + index++; + auto_ping(); } } else { diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh b/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh index 88fff3a7af..7d7f747a33 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh @@ -302,6 +302,28 @@ gen_start_config() { else echolog "找不到V2ray客户端主程序,无法启用!" fi + elif [ "$type" == "v2ray_balancing" ]; then + local balancing_node=$(config_n_get $node v2ray_balancing_node) + balancing_node_address="" + for node_id in $balancing_node + do + local address=$(config_n_get $node_id address) + local port=$(config_n_get $node_id port) + local temp="" + if [ -z "$balancing_node_address" ]; then + temp="${address}:${port}" + else + temp="${balancing_node_address}\n${address}:${port}" + fi + balancing_node_address="$temp" + done + lua $API_GEN_V2RAY $node nil nil $local_port >$config_file + v2ray_path=$(config_t_get global_app v2ray_file $(find_bin v2ray)) + if [ -f "${v2ray_path}/v2ray" ]; then + ${v2ray_path}/v2ray -config=$config_file >/dev/null & + else + echolog "找不到V2ray客户端主程序,无法启用!" + fi elif [ "$type" == "trojan" ]; then lua $API_GEN_TROJAN $node client "0.0.0.0" $local_port >$config_file trojan_bin=$(find_bin trojan) @@ -366,6 +388,28 @@ gen_start_config() { else echolog "找不到V2ray客户端主程序,无法启用!" fi + elif [ "$type" == "v2ray_balancing" ]; then + local balancing_node=$(config_n_get $node v2ray_balancing_node) + balancing_node_address="" + for node_id in $balancing_node + do + local address=$(config_n_get $node_id address) + local port=$(config_n_get $node_id port) + local temp="" + if [ -z "$balancing_node_address" ]; then + temp="${address}:${port}" + else + temp="${balancing_node_address}\n${address}:${port}" + fi + balancing_node_address="$temp" + done + lua $API_GEN_V2RAY $node udp $local_port nil >$config_file + v2ray_path=$(config_t_get global_app v2ray_file $(find_bin v2ray)) + if [ -f "${v2ray_path}/v2ray" ]; then + ${v2ray_path}/v2ray -config=$config_file >/dev/null & + else + echolog "找不到V2ray客户端主程序,无法启用!" + fi elif [ "$type" == "trojan" ]; then SOCKS5_PROXY_PORT4=$(expr $SOCKS5_PROXY_PORT3 + 1) local_port=$(get_not_exists_port_after $SOCKS5_PROXY_PORT4 tcp)