From 7fc0d56e8ad8f5eb652b615573b83b2c171b90ca Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 14 Dec 2019 18:01:26 +0800 Subject: [PATCH] package lienol: merge upsteam update --- package/lienol/luci-app-passwall/Makefile | 14 +- .../luasrc/controller/passwall.lua | 50 +- .../luasrc/model/cbi/passwall/node_list.lua | 5 + .../luasrc/view/passwall/global/status.htm | 2 +- .../luasrc/view/passwall/global/status2.htm | 10 +- .../view/passwall/node_list/link_add_node.htm | 3 +- .../view/passwall/node_list/node_list.htm | 9 +- .../view/passwall/rule/brook_version.htm | 1 - .../view/passwall/rule/kcptun_version.htm | 1 - .../view/passwall/rule/rule_version.htm | 2 - .../view/passwall/rule/v2ray_version.htm | 1 - .../luci-app-passwall/po/zh-cn/passwall.po | 16 +- .../root/etc/config/passwall | 3 +- .../etc/config/passwall_rule/gfwlist.conf | 2342 ++++++++--------- .../root/etc/config/passwall_rule/router | 1 + .../root/usr/share/passwall/app.sh | 92 +- .../root/usr/share/passwall/iptables.sh | 4 +- .../root/usr/share/passwall/rule_update.sh | 44 +- .../root/usr/share/passwall/subscription.sh | 147 +- .../root/usr/share/passwall/test.sh | 46 +- .../lienol/luci-theme-bootstrap-mc/Makefile | 2 +- .../luci-static/bootstrap_blue/cascade.css | 1257 +++++---- .../luci-static/bootstrap_purple/cascade.css | 1261 +++++---- 23 files changed, 2942 insertions(+), 2371 deletions(-) diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index 75f3c3f92f..e009d9306c 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.0 -PKG_RELEASE:=120-20191207 +PKG_RELEASE:=127-20191214 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PO2LMO:=./po2lmo @@ -17,8 +17,8 @@ include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME)/config menu "Configuration" -config PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2 - bool "Include RedSocks2" +config PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks + bool "Include ipt2socks" default n config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks @@ -77,13 +77,13 @@ endmenu endef define Package/$(PKG_NAME) - CATEGORY:=LuCI + CATEGORY:=LuCI for Lienol SUBMENU:=3. Applications TITLE:=LuCI support for PassWall By Lienol PKGARCH:=all - DEPENDS:=+curl +libcurl +libmbedtls +ca-bundle +ca-certificates +resolveip +iptables-mod-tproxy +kmod-ipt-tproxy +iptables-mod-ipopt +kmod-ipt-ipopt +ip +ipset +coreutils +coreutils-base64 +coreutils-nohup +luci-lib-jsonc +unzip \ - +dnsmasq-full +tcping \ - +PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2:redsocks2 \ + DEPENDS:=+curl +wget +libcurl +libmbedtls +ca-bundle +ca-certificates +resolveip +iptables-mod-tproxy +kmod-ipt-tproxy +iptables-mod-ipopt +kmod-ipt-ipopt +ip +ipset +coreutils +coreutils-base64 +coreutils-nohup +luci-lib-jsonc +unzip \ + +dnsmasq-full +tcping +bash \ + +PACKAGE_$(PKG_NAME)_INCLUDE_ipt2socks:ipt2socks \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-alt \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_socks:shadowsocks-libev-ss-local \ diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index 0b8d2c1a3b..d434c08c04 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -167,11 +167,11 @@ function connect_status() local e = {} if luci.http.formvalue("type") == "google" then e.status = luci.sys.call( - "echo `curl -I -o /dev/null -s -m 10 --connect-timeout 5 -w %{http_code} 'https://www.google.com'` | grep 200 >/dev/null") == + "echo `/usr/share/passwall/test.sh test_url 'https://www.google.com'` | grep 200 >/dev/null") == 0 else e.status = luci.sys.call( - "echo `curl -I -o /dev/null -s -m 10 --connect-timeout 2 -w %{http_code} 'http://www.baidu.com'` | grep 200 >/dev/null") == + "echo `/usr/share/passwall/test.sh test_url 'https://www.baidu.com'` | grep 200 >/dev/null") == 0 end luci.http.prepare_content("application/json") @@ -184,13 +184,16 @@ function auto_ping_node() local port = luci.http.formvalue("port") local e = {} e.index = index - if luci.sys.exec("echo -n `command -v tcping`") ~= "" then - e.ping = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. port .. " " .. - address .. - " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'") + if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" % + appname) == "1" and + luci.sys.exec("echo -n `command -v tcping`") ~= "" then + e.ping = luci.sys.exec( + "echo -n `tcping -q -c 1 -i 3 -p " .. port .. " " .. + address .. + " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`") else e.ping = luci.sys.exec( - "ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'" % + "echo -n `ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`" % address) end luci.http.prepare_content("application/json") @@ -201,10 +204,13 @@ function ping_node() local e = {} local address = luci.http.formvalue("address") local port = luci.http.formvalue("port") - if luci.sys.exec("echo -n `command -v tcping`") ~= "" then - e.ping = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. port .. " " .. - address .. - " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'") + if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" % + appname) == "1" and + luci.sys.exec("echo -n `command -v tcping`") ~= "" then + e.ping = luci.sys.exec( + "echo -n `tcping -q -c 1 -i 3 -p " .. port .. " " .. + address .. + " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`") else e.ping = luci.sys.exec( "echo -n `ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`" % @@ -253,7 +259,9 @@ function check_port() retstring = retstring .. "暂时不支持UDP检测
" - if luci.sys.exec("echo -n `command -v tcping`") ~= "" then + if luci.sys.exec("echo -n `uci -q get %s.@global_other[0].use_tcping`" % + appname) == "1" and + luci.sys.exec("echo -n `command -v tcping`") ~= "" then retstring = retstring .. "使用tcping检测端口延迟
" uci:foreach("passwall", "nodes", function(s) @@ -263,13 +271,12 @@ function check_port() (s.v2ray_transport and s.v2ray_transport == "mkcp" and s.port) then else if s.type and s.address and s.port and s.remarks then - node_name = "[%s] [%s:%s]" % - {s.remarks, s.address, s.port} + node_name = "[%s] [%s:%s]" % {s.remarks, s.address, s.port} end - result = luci.sys.exec("tcping -q -c 1 -i 3 -p " .. s.port .. - " " .. s.address .. - " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'") + result = luci.sys.exec("echo -n `tcping -q -c 1 -i 3 -p " .. + s.port .. " " .. s.address .. + " 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`") if result and result ~= "" then retstring = retstring .. "" .. node_name .. @@ -291,15 +298,6 @@ function check_port() local udp_socket if (s.use_kcp and s.use_kcp == "1" and s.kcp_port) or (s.v2ray_transport and s.v2ray_transport == "mkcp" and s.port) then - --[[local port = (s.use_kcp == "1" and s.kcp_port) and s.kcp_port or (s.v2ray_transport == "mkcp" and s.port) and s.port or nil - if port then - udp_socket = nixio.socket("inet", "dgram") - udp_socket:setopt("socket", "rcvtimeo", 3) - udp_socket:setopt("socket", "sndtimeo", 3) - udp_socket:sendto("test", s.address, port) - r,c,d=udp_socket:recvfrom(10) - ret="" - end--]] else if s.type and s.address and s.port and s.remarks then node_name = "%s:[%s] %s:%s" % 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 16531021d9..f0bbb155ec 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 @@ -11,6 +11,11 @@ m = Map(appname) s = m:section(TypedSection, "global_other") s.anonymous = true +---- Use TCPing +o = s:option(Flag, "use_tcping", translate("Use TCPing"), + translate("This will use tcping replace ping detection of node")) +o.default = 1 + ---- Auto Ping o = s:option(Flag, "auto_ping", translate("Auto Ping"), translate("This will automatically ping the node for latency")) diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm index bf3124c61d..83924ea1d4 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm @@ -221,7 +221,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
-

<%:Server Check%>
<%:Touch Check%>

+

<%:Node Check%>
<%:Touch Check%>

diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status2.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status2.htm index 5221fed698..f55ce1b0c8 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status2.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status2.htm @@ -49,7 +49,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1) padding-top: unset; } - #_server_status > font { + #_node_status > font { display: block; } } @@ -148,11 +148,11 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1)
- +
@@ -258,7 +258,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1) btn.value = '<%:Check...%>'; XHR.get('<%=dsp.build_url("admin/vpn/passwall/check_port")%>', null, function(x, rv) { - var s = document.getElementById('_server_status'); + var s = document.getElementById('_node_status'); if(s) { s.innerHTML = rv.ret; var clear_btn = document.getElementById('clear_check_port_btn'); @@ -273,7 +273,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1) function clear_check_port(btn) { btn.style.display = 'none'; - var s = document.getElementById('_server_status'); + var s = document.getElementById('_node_status'); s.innerHTML = ""; return false; } diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm index d6d76cc458..a6077f58e5 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm @@ -59,7 +59,6 @@ local dsp = require "luci.dispatcher" } } else { - alert("<%:Please Enter The Link%>"); document.getElementById("nodes_link").focus(); } } @@ -75,7 +74,7 @@ local dsp = require "luci.dispatcher"