From 1a20f96cf8ee7972270cf40f32e1d1ea9d570437 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 7 Dec 2019 17:12:35 +0800 Subject: [PATCH] package lienol: update --- package/lienol/luci-app-passwall/Makefile | 24 +- .../luasrc/controller/passwall.lua | 126 +- .../luasrc/model/cbi/passwall/balancing.lua | 8 +- .../luasrc/model/cbi/passwall/global.lua | 4 +- .../luasrc/model/cbi/passwall/node_list.lua | 2 +- .../luasrc/model/cbi/passwall/rule_list.lua | 16 +- .../luasrc/view/passwall/global/status.htm | 27 +- .../luasrc/view/passwall/global/status2.htm | 29 +- .../view/passwall/node_list/auto_ping.htm | 2 +- .../view/passwall/node_list/link_add_node.htm | 6 +- .../view/passwall/node_list/node_list.htm | 20 +- .../luasrc/view/passwall/node_list/ping.htm | 2 +- .../luci-app-passwall/po/zh-cn/passwall.po | 49 +- .../root/etc/config/passwall | 6 +- .../config/passwall_rule}/blacklist_host | 0 .../config/passwall_rule}/blacklist_ip | 0 .../config/passwall_rule}/chnroute | 128 +- .../config/passwall_rule}/gfwlist.conf | 2350 ++++++++--------- .../rule => etc/config/passwall_rule}/router | 0 .../config/passwall_rule}/user.conf | 0 .../config/passwall_rule}/whitelist_host | 0 .../config/passwall_rule}/whitelist_ip | 2 +- .../root/usr/share/passwall/app.sh | 55 +- .../root/usr/share/passwall/iptables.sh | 6 +- .../root/usr/share/passwall/monitor.sh | 10 +- .../root/usr/share/passwall/rule_update.sh | 100 +- .../root/usr/share/passwall/subscription.sh | 55 +- package/lienol/luci-theme-argon-mc/Makefile | 2 +- .../luci-static/argon_mc1/css/style.css | 2 +- .../luci-static/argon_mc1/head-icon.jpg | Bin 15773 -> 0 bytes .../htdocs/luci-static/argon_mc1/img/bg1.jpg | Bin 366856 -> 76341 bytes .../htdocs/luci-static/argon_mc1/img/bg2.jpg | Bin 61029 -> 169771 bytes .../htdocs/luci-static/argon_mc1/img/bg3.jpg | Bin 169771 -> 159265 bytes .../htdocs/luci-static/argon_mc1/img/bg4.jpg | Bin 159265 -> 0 bytes .../etc/uci-defaults/30_luci-theme-argon-mc | 0 .../lienol/luci-theme-bootstrap-mc/Makefile | 15 + .../htdocs/luci-static/bootstrap_blue/bg.jpg | Bin 0 -> 76341 bytes .../luci-static/bootstrap_blue/cascade.css | 1304 +++++++++ .../luci-static/bootstrap_blue/favicon.ico | Bin 0 -> 1150 bytes .../luci-static/bootstrap_blue/html5.js | 3 + .../luci-static/bootstrap_blue/mobile.css | 82 + .../luci-static/bootstrap_blue/wifi.png | Bin 0 -> 21597 bytes .../luci-static/bootstrap_purple/bg.jpg | Bin 0 -> 76341 bytes .../luci-static/bootstrap_purple/cascade.css | 1304 +++++++++ .../luci-static/bootstrap_purple/favicon.ico | Bin 0 -> 1150 bytes .../luci-static/bootstrap_purple/html5.js | 3 + .../luci-static/bootstrap_purple/mobile.css | 82 + .../luci-static/bootstrap_purple/wifi.png | Bin 0 -> 21597 bytes .../view/themes/bootstrap_blue/footer.htm | 56 + .../view/themes/bootstrap_blue/header.htm | 214 ++ .../view/themes/bootstrap_purple/footer.htm | 56 + .../view/themes/bootstrap_purple/header.htm | 214 ++ .../uci-defaults/30_luci-theme-bootstrap-mc | 7 + package/lienol/tcping/Makefile | 42 + 54 files changed, 4970 insertions(+), 1443 deletions(-) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/blacklist_host (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/blacklist_ip (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/chnroute (98%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/dnsmasq.d => etc/config/passwall_rule}/gfwlist.conf (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/router (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/dnsmasq.d => etc/config/passwall_rule}/user.conf (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/whitelist_host (100%) rename package/lienol/luci-app-passwall/root/{usr/share/passwall/rule => etc/config/passwall_rule}/whitelist_ip (94%) delete mode 100644 package/lienol/luci-theme-argon-mc/htdocs/luci-static/argon_mc1/head-icon.jpg delete mode 100644 package/lienol/luci-theme-argon-mc/htdocs/luci-static/argon_mc1/img/bg4.jpg mode change 100755 => 100644 package/lienol/luci-theme-argon-mc/root/etc/uci-defaults/30_luci-theme-argon-mc create mode 100644 package/lienol/luci-theme-bootstrap-mc/Makefile create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/bg.jpg create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/cascade.css create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/favicon.ico create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/html5.js create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/mobile.css create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_blue/wifi.png create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/bg.jpg create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/cascade.css create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/favicon.ico create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/html5.js create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/mobile.css create mode 100644 package/lienol/luci-theme-bootstrap-mc/htdocs/luci-static/bootstrap_purple/wifi.png create mode 100644 package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_blue/footer.htm create mode 100644 package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_blue/header.htm create mode 100644 package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/footer.htm create mode 100644 package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/header.htm create mode 100755 package/lienol/luci-theme-bootstrap-mc/root/etc/uci-defaults/30_luci-theme-bootstrap-mc create mode 100644 package/lienol/tcping/Makefile diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index bd76e387d3..b4a3ed6e95 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:=115-20191201 +PKG_RELEASE:=120-20191207 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PO2LMO:=./po2lmo @@ -77,19 +77,19 @@ 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 \ + +dnsmasq-full +tcping \ +PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2:redsocks2 \ +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 \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_socks:shadowsocksr-libev-ssr-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \ - +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan +redsocks2 \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \ +PACKAGE_$(PKG_NAME)_INCLUDE_Brook:brook \ +PACKAGE_$(PKG_NAME)_INCLUDE_kcptun:kcptun-client \ +PACKAGE_$(PKG_NAME)_INCLUDE_haproxy:haproxy \ @@ -110,17 +110,25 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_DIR) $(1)/usr/share/passwall $(INSTALL_CONF) ./root/etc/config/passwall $(1)/etc/config/passwall $(INSTALL_CONF) ./root/etc/config/passwall_show $(1)/etc/config/passwall_show + + $(INSTALL_DIR) $(1)/etc/config/passwall_rule + cp -pR ./root/etc/config/passwall_rule/* $(1)/etc/config/passwall_rule/ + + $(INSTALL_DIR) $(1)/etc/uci-defaults $(INSTALL_CONF) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults + + $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./root/etc/init.d/passwall $(1)/etc/init.d/passwall + + $(INSTALL_DIR) $(1)/usr/share/passwall + cp -pR ./root/usr/share/passwall/* $(1)/usr/share/passwall + $(INSTALL_DIR) $(1)/usr/lib/lua/luci cp -pR ./luasrc/* $(1)/usr/lib/lua/luci/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n - cp -pR ./root/usr/share/passwall/* $(1)/usr/share/passwall chmod 755 $(PO2LMO) $(PO2LMO) ./po/zh-cn/passwall.po $(1)/usr/lib/lua/luci/i18n/passwall.zh-cn.lmo endef diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index 218a255e88..0b8d2c1a3b 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -179,21 +179,37 @@ function connect_status() end function auto_ping_node() + local index = luci.http.formvalue("index") + local address = luci.http.formvalue("address") + local port = luci.http.formvalue("port") local e = {} - e.index = luci.http.formvalue("index") - e.ping = luci.sys.exec( - "ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'" % - luci.http.formvalue("domain")) + 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}'") + else + e.ping = luci.sys.exec( + "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") luci.http.write_json(e) end function ping_node() local e = {} - local node = luci.http.formvalue("node") - e.ping = luci.sys.exec( - "echo -n `ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*' | awk -F '=' '{print$2}'`" % - node) + 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}'") + 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}'`" % + address) + end luci.http.prepare_content("application/json") luci.http.write_json(e) end @@ -229,20 +245,53 @@ function copy_node() end function check_port() - local retstring = "
" - retstring = retstring .. - "暂时不支持UDP检测
" local s local node_name = "" local uci = luci.model.uci.cursor() - uci:foreach("passwall", "nodes", function(s) - local ret = "" - local tcp_socket - 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 + local retstring = "
" + retstring = retstring .. + "暂时不支持UDP检测
" + + if luci.sys.exec("echo -n `command -v tcping`") ~= "" then + retstring = retstring .. + "使用tcping检测端口延迟
" + uci:foreach("passwall", "nodes", function(s) + local ret = "" + local tcp_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 + 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} + 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}'") + if result and result ~= "" then + retstring = + retstring .. "" .. node_name .. + " " .. result .. "ms.
" + else + retstring = + retstring .. "" .. node_name .. + " Error.
" + end + ret = "" + end + end) + else + retstring = retstring .. + "使用socket检测端口是否打开
" + uci:foreach("passwall", "nodes", function(s) + local ret = "" + local tcp_socket + 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) @@ -251,27 +300,30 @@ function check_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" % - {s.type, s.remarks, s.address, s.port} - end - tcp_socket = nixio.socket("inet", "stream") - tcp_socket:setopt("socket", "rcvtimeo", 3) - tcp_socket:setopt("socket", "sndtimeo", 3) - ret = tcp_socket:connect(s.address, s.port) - if tostring(ret) == "true" then - retstring = retstring .. "" .. node_name .. - " OK.
" else - retstring = retstring .. "" .. node_name .. - " Error.
" + if s.type and s.address and s.port and s.remarks then + node_name = "%s:[%s] %s:%s" % + {s.type, s.remarks, s.address, s.port} + end + tcp_socket = nixio.socket("inet", "stream") + tcp_socket:setopt("socket", "rcvtimeo", 3) + tcp_socket:setopt("socket", "sndtimeo", 3) + ret = tcp_socket:connect(s.address, s.port) + if tostring(ret) == "true" then + retstring = + retstring .. "" .. node_name .. + " OK.
" + else + retstring = + retstring .. "" .. node_name .. + " Error.
" + end + ret = "" end - ret = "" - end - if tcp_socket then tcp_socket:close() end - if udp_socket then udp_socket:close() end - end) + if tcp_socket then tcp_socket:close() end + if udp_socket then udp_socket:close() end + end) + end luci.http.prepare_content("application/json") luci.http.write_json({ret = retstring}) end diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/balancing.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/balancing.lua index f06db3c4f4..b0400551ac 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/balancing.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/balancing.lua @@ -17,10 +17,7 @@ end) m = Map("passwall") -- [[ Haproxy Settings ]]-- -s = m:section(TypedSection, "global_haproxy", translate("Load Balancing"), - "") +s = m:section(TypedSection, "global_haproxy", translate("Load Balancing")) s.anonymous = true ---- Balancing Enable @@ -46,7 +43,8 @@ o.default = "1188" o:depends("balancing_enable", 1) ---- Haproxy Port -o = s:option(Value, "haproxy_port", translate("Haproxy Port")) +o = s:option(Value, "haproxy_port", translate("Haproxy Port"), translate( + "Configure this node with 127.0.0.1: this port")) o.default = "1181" o:depends("balancing_enable", 1) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua index cdf6d7f8bd..731d77e1be 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua @@ -90,7 +90,8 @@ for i = 1, socks5_node_num, 1 do end ---- DNS Forward Mode -o = s:option(ListValue, "dns_mode", translate("DNS Forward Mode")) +o = s:option(ListValue, "dns_mode", translate("DNS Forward Mode"), + translate("if you use no patterns are used, DNS of wan will be used by default as upstream of dnsmasq")) o.rmempty = false o:reset_values() if is_installed("openwrt_chinadns") or is_finded("chinadns") then @@ -106,6 +107,7 @@ if is_installed("pdnsd") or is_installed("pdnsd-alt") or is_finded("pdnsd") then o:value("pdnsd", "pdnsd") end o:value("local_7913", translate("Use local port 7913 as DNS")) +o:value("nonuse", translate("No patterns are used")) ---- upstreamm DNS Server for ChinaDNS o = s:option(ListValue, "up_chinadns_mode", 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 94906c04ac..16531021d9 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 @@ -79,7 +79,7 @@ o.cfgvalue = function(t, n) end--]] ---- Ping -o = s:option(DummyValue, "address", translate("Ping")) +o = s:option(DummyValue, "ping", translate("Ping")) if api.uci_get_type("global_other", "auto_ping", "0") == "0" then o.template = "passwall/node_list/ping" else diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule_list.lua index 4f5c859ff5..96a8c77b5d 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/rule_list.lua @@ -6,7 +6,7 @@ s = m:section(TypedSection, "global", translate("Set Blacklist And Whitelist")) s.anonymous = true ---- Whitelist Hosts -local t = "/usr/share/passwall/rule/whitelist_host" +local t = "/etc/config/passwall_rule/whitelist_host" o = s:option(TextValue, "whitelist_host", translate("Whitelist Hosts")) o.description = translate( "Join the white list of domain names will not go agent.") @@ -16,7 +16,7 @@ o.cfgvalue = function(a, a) return fs.readfile(t) or "" end o.write = function(o, o, a) fs.writefile("/tmp/whitelist_host", a:gsub("\r\n", "\n")) if (luci.sys.call( - "cmp -s /tmp/whitelist_host /usr/share/passwall/rule/whitelist_host") == + "cmp -s /tmp/whitelist_host /etc/config/passwall_rule/whitelist_host") == 1) then fs.writefile(t, a:gsub("\r\n", "\n")) luci.sys.call("rm -f /tmp/dnsmasq.d/whitelist_host.conf >/dev/null") @@ -25,7 +25,7 @@ o.write = function(o, o, a) end ---- Whitelist IP -local t = "/usr/share/passwall/rule/whitelist_ip" +local t = "/etc/config/passwall_rule/whitelist_ip" o = s:option(TextValue, "whitelist_ip", translate("Whitelist IP")) o.description = translate( "These had been joined ip addresses will not use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,112.123.134.145/24 or 112.123.134.145.") @@ -35,7 +35,7 @@ o.cfgvalue = function(a, a) return fs.readfile(t) or "" end o.write = function(o, o, a) fs.writefile(t, a:gsub("\r\n", "\n")) end ---- Blacklist Hosts -local t = "/usr/share/passwall/rule/blacklist_host" +local t = "/etc/config/passwall_rule/blacklist_host" o = s:option(TextValue, "blacklist_host", translate("Blacklist Hosts")) o.description = translate( "These had been joined websites will use proxy.Please input the domain names of websites,every line can input only one website domain.For example,google.com.") @@ -45,7 +45,7 @@ o.cfgvalue = function(a, a) return fs.readfile(t) or "" end o.write = function(o, o, a) fs.writefile("/tmp/blacklist_host", a:gsub("\r\n", "\n")) if (luci.sys.call( - "cmp -s /tmp/blacklist_host /usr/share/passwall/rule/blacklist_host") == + "cmp -s /tmp/blacklist_host /etc/config/passwall_rule/blacklist_host") == 1) then fs.writefile(t, a:gsub("\r\n", "\n")) luci.sys.call("rm -f /tmp/dnsmasq.d/blacklist_host.conf >/dev/null") @@ -54,7 +54,7 @@ o.write = function(o, o, a) end ---- Blacklist IP -local t = "/usr/share/passwall/rule/blacklist_ip" +local t = "/etc/config/passwall_rule/blacklist_ip" o = s:option(TextValue, "blacklist_ip", translate("Blacklist IP")) o.description = translate( "These had been joined ip addresses will use proxy.Please input the ip address or ip address segment,every line can input only one ip address.For example,112.123.134.145/24 or 112.123.134.145.") @@ -64,7 +64,7 @@ o.cfgvalue = function(a, a) return fs.readfile(t) or "" end o.write = function(o, o, a) fs.writefile(t, a:gsub("\r\n", "\n")) end ---- Router Hosts -local t = "/usr/share/passwall/rule/router" +local t = "/etc/config/passwall_rule/router" o = s:option(TextValue, "routerlist", translate("Router Hosts")) o.description = translate( "These had been joined websites will use proxy,but only Router model.Please input the domain names of websites,every line can input only one website domain.For example,google.com.") @@ -73,7 +73,7 @@ o.wrap = "off" o.cfgvalue = function(a, a) return fs.readfile(t) or "" end o.write = function(o, o, a) fs.writefile("/tmp/router", a:gsub("\r\n", "\n")) - if (luci.sys.call("cmp -s /tmp/router /usr/share/passwall/rule/router") == 1) then + if (luci.sys.call("cmp -s /tmp/router /etc/config/passwall_rule/router") == 1) then fs.writefile(t, a:gsub("\r\n", "\n")) luci.sys.call("rm -f /tmp/dnsmasq.d/router.conf >/dev/null") end 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 dc67d69185..5f465ec780 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 @@ -56,6 +56,10 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md font-size:.9rem; color: #fb6340; } + .yellow{ + font-size:.9rem; + color: #b9b90b; + } .sk-text-success{ color: #2dce89; @@ -352,13 +356,32 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md var div = s.parentNode.parentNode.parentNode.parentNode; div.removeAttribute('onclick'); s.innerHTML = '<%:Check...%>'; + var sendDate = (new Date()).getTime(); XHR.get('<%=dsp.build_url("admin/vpn/passwall/connect_status")%>', { type: type }, function(x, rv) { if (rv.status) { - s.className="green"; - s.innerHTML = '<%:Working...%>'; + var receiveDate = (new Date()).getTime(); + var responseTimeMs = receiveDate - sendDate; + var speed = ""; + if (responseTimeMs < 300) { + s.className="green"; + speed = "<%:very good%>"; + } else if (responseTimeMs < 600) { + s.className="green"; + speed = "<%:good%>"; + } else if (responseTimeMs < 2000) { + s.className="yellow"; + speed = "<%:general%>"; + } else if (responseTimeMs < 5000) { + s.className="red"; + speed = "<%:bad%>"; + } else if (responseTimeMs >= 5000) { + s.className="red"; + speed = "<%:very bad%>"; + } + s.innerHTML = speed; } else { s.className="red"; 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 e6c42f6687..356b81e261 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 @@ -208,6 +208,7 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1) function check_connect(btn, type) { btn.disabled = true; btn.value = '<%:Check...%>'; + var sendDate = (new Date()).getTime(); XHR.get('<%=dsp.build_url("admin/vpn/passwall/connect_status")%>', { type: type }, @@ -215,12 +216,32 @@ local socks5_node_num = api.uci_get_type("global_other", "socks5_node_num", 1) var s = document.getElementById('_' + type + '_status'); if(s) { if(rv.status) { - //s.setAttribute("color","green"); - btn.setAttribute("style","background-color: green !important; border-color: green !important;"); - btn.value = '<%:Working...%> ✓'; + var receiveDate = (new Date()).getTime(); + var responseTimeMs = receiveDate - sendDate; + var speed = ""; + var color="red"; + if (responseTimeMs < 300) { + color = "green"; + speed = "<%:very good%>"; + } else if (responseTimeMs < 600) { + color = "green"; + speed = "<%:good%>"; + } else if (responseTimeMs < 2000) { + color = "#b9b90b"; + speed = "<%:general%>"; + } else if (responseTimeMs < 5000) { + color = "red"; + speed = "<%:bad%>"; + } else if (responseTimeMs >= 5000) { + color = "red"; + speed = "<%:very bad%>"; + } + //s.setAttribute("color", color); + btn.setAttribute("style","background-color: " + color + " !important; border-color: " + color + " !important;"); + btn.value = speed; } else { - //s.setAttribute("color","red"); + //s.setAttribute("color", "red"); btn.setAttribute("style","background-color:red !important; border-color: red !important;"); btn.value = '<%:Problem detected!%> X'; } diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/auto_ping.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/auto_ping.htm index 5aee1f8568..d09c8f7f89 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/auto_ping.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/auto_ping.htm @@ -1,3 +1,3 @@ <%+cbi/valueheader%> --- ms +-- ms <%+cbi/valuefooter%> \ No newline at end of file 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 093382c587..b6030b8e83 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 @@ -51,11 +51,11 @@ local dsp = require "luci.dispatcher" function add_node() { var nodes_link = document.getElementById("nodes_link").value; if (nodes_link.trim() != "") { - if (nodes_link.indexOf("ss://") == 0 || nodes_link.indexOf("ssr://") == 0 || nodes_link.indexOf("vmess://") == 0) { + if (nodes_link.indexOf("ss://") == 0 || nodes_link.indexOf("ssr://") == 0 || nodes_link.indexOf("vmess://") == 0 || nodes_link.indexOf("trojan://") == 0) { ajax_add_node(nodes_link); } else { - alert("<%:Please enter the correct link, ss:// ssr:// vmess://%>"); + alert("<%:Please enter the correct link, ss:// ssr:// vmess:// trojan://%>"); } } else { @@ -75,7 +75,7 @@ local dsp = require "luci.dispatcher" + + + + diff --git a/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_blue/header.htm b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_blue/header.htm new file mode 100644 index 0000000000..8bd1cc6391 --- /dev/null +++ b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_blue/header.htm @@ -0,0 +1,214 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Copyright 2012 David Menting + Copyright 2018 Lienol + Licensed to the public under the Apache License 2.0. +-%> + +<% + local sys = require "luci.sys" + local util = require "luci.util" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local boardinfo = util.ubus("system", "board") + + local request = disp.context.path + local request2 = disp.context.request + + local category = request[1] + local cattree = category and disp.node(category) + + local leaf = request2[#request2] + + local tree = disp.node() + local node = disp.context.dispatched + + local categories = disp.node_childs(tree) + + local c = tree + local i, r + + -- tag all nodes leading to this page + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + c._menu_selected = true + end + end + + -- send as HTML5 + http.prepare_content("text/html") + + local function nodeurl(prefix, name, query) + local u = url(prefix, name) + if query then + u = u .. http.build_querystring(query) + end + return pcdata(u) + end + + local function render_tabmenu(prefix, node, level) + if not level then + level = 1 + end + + local childs = disp.node_childs(node) + if #childs > 0 then + if level > 2 then + write('
    ') + end + + local selected_node + local selected_name + local i, v + + for i, v in ipairs(childs) do + local nnode = node.nodes[v] + if nnode._menu_selected then + selected_node = nnode + selected_name = v + end + + if level > 2 then + write('
  • %s
  • ' %{ + v, (nnode._menu_selected or (node.leaf and v == leaf)) and 'active' or '', + nodeurl(prefix, v, nnode.query), + striptags(translate(nnode.title)) + }) + end + end + + if level > 2 then + write('
') + end + + if selected_node then + render_tabmenu(prefix .. "/" .. selected_name, selected_node, level + 1) + end + end + end + + local function render_submenu(prefix, node) + local childs = disp.node_childs(node) + if #childs > 0 then + write('') + end + end + + local function render_topmenu() + local childs = disp.node_childs(cattree) + if #childs > 0 then + write('') + end + end + + local function render_changes() + -- calculate the number of unsaved changes + if tree.nodes[category] and tree.nodes[category].ucidata then + local ucichanges = 0 + + for i, j in pairs(require("luci.model.uci").cursor():changes()) do + for k, l in pairs(j) do + for m, n in pairs(l) do + ucichanges = ucichanges + 1; + end + end + end + + if ucichanges > 0 then + write('%s: %d' %{ + url(category, 'uci/changes'), + http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")), + translate('Unsaved Changes'), + ucichanges + }) + end + end + end +-%> + + + + + <%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI + + + + + + <% if node and node.css then %> + + <% end -%> + <% if css then %> + + <% end -%> + + + + + +
+
+
+ <%=boardinfo.hostname or "?"%> + <% render_topmenu() %> +
+ <% render_changes() %> + +
+
+
+
+ + <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%> +
+
+

<%:No password set!%>

+ <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%>
+ "><%:Go to password configuration...%> +
+
+ <%- end -%> + + + +
+ <% if category then render_tabmenu(category, cattree) end %> diff --git a/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/footer.htm b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/footer.htm new file mode 100644 index 0000000000..a821c31364 --- /dev/null +++ b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/footer.htm @@ -0,0 +1,56 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Copyright 2012 David Menting + Copyright 2018 Lienol + Licensed to the public under the Apache License 2.0. +-%> + +<% + local ver = require "luci.version" + local disp = require "luci.dispatcher" + local request = disp.context.path + local category = request[1] + local tree = disp.node() + local categories = disp.node_childs(tree) +%> + +
+ + + + + diff --git a/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/header.htm b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/header.htm new file mode 100644 index 0000000000..8bd1cc6391 --- /dev/null +++ b/package/lienol/luci-theme-bootstrap-mc/luasrc/view/themes/bootstrap_purple/header.htm @@ -0,0 +1,214 @@ +<%# + Copyright 2008 Steven Barth + Copyright 2008 Jo-Philipp Wich + Copyright 2012 David Menting + Copyright 2018 Lienol + Licensed to the public under the Apache License 2.0. +-%> + +<% + local sys = require "luci.sys" + local util = require "luci.util" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local boardinfo = util.ubus("system", "board") + + local request = disp.context.path + local request2 = disp.context.request + + local category = request[1] + local cattree = category and disp.node(category) + + local leaf = request2[#request2] + + local tree = disp.node() + local node = disp.context.dispatched + + local categories = disp.node_childs(tree) + + local c = tree + local i, r + + -- tag all nodes leading to this page + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + c._menu_selected = true + end + end + + -- send as HTML5 + http.prepare_content("text/html") + + local function nodeurl(prefix, name, query) + local u = url(prefix, name) + if query then + u = u .. http.build_querystring(query) + end + return pcdata(u) + end + + local function render_tabmenu(prefix, node, level) + if not level then + level = 1 + end + + local childs = disp.node_childs(node) + if #childs > 0 then + if level > 2 then + write('
    ') + end + + local selected_node + local selected_name + local i, v + + for i, v in ipairs(childs) do + local nnode = node.nodes[v] + if nnode._menu_selected then + selected_node = nnode + selected_name = v + end + + if level > 2 then + write('
  • %s
  • ' %{ + v, (nnode._menu_selected or (node.leaf and v == leaf)) and 'active' or '', + nodeurl(prefix, v, nnode.query), + striptags(translate(nnode.title)) + }) + end + end + + if level > 2 then + write('
') + end + + if selected_node then + render_tabmenu(prefix .. "/" .. selected_name, selected_node, level + 1) + end + end + end + + local function render_submenu(prefix, node) + local childs = disp.node_childs(node) + if #childs > 0 then + write('') + end + end + + local function render_topmenu() + local childs = disp.node_childs(cattree) + if #childs > 0 then + write('') + end + end + + local function render_changes() + -- calculate the number of unsaved changes + if tree.nodes[category] and tree.nodes[category].ucidata then + local ucichanges = 0 + + for i, j in pairs(require("luci.model.uci").cursor():changes()) do + for k, l in pairs(j) do + for m, n in pairs(l) do + ucichanges = ucichanges + 1; + end + end + end + + if ucichanges > 0 then + write('%s: %d' %{ + url(category, 'uci/changes'), + http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")), + translate('Unsaved Changes'), + ucichanges + }) + end + end + end +-%> + + + + + <%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI + + + + + + <% if node and node.css then %> + + <% end -%> + <% if css then %> + + <% end -%> + + + + + +
+
+
+ <%=boardinfo.hostname or "?"%> + <% render_topmenu() %> +
+ <% render_changes() %> + +
+
+
+
+ + <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%> +
+
+

<%:No password set!%>

+ <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%>
+ "><%:Go to password configuration...%> +
+
+ <%- end -%> + + + +
+ <% if category then render_tabmenu(category, cattree) end %> diff --git a/package/lienol/luci-theme-bootstrap-mc/root/etc/uci-defaults/30_luci-theme-bootstrap-mc b/package/lienol/luci-theme-bootstrap-mc/root/etc/uci-defaults/30_luci-theme-bootstrap-mc new file mode 100755 index 0000000000..c60815910c --- /dev/null +++ b/package/lienol/luci-theme-bootstrap-mc/root/etc/uci-defaults/30_luci-theme-bootstrap-mc @@ -0,0 +1,7 @@ +#!/bin/sh +uci batch <<-EOF + set luci.themes.Bootstrap_Blue=/luci-static/bootstrap_blue + set luci.themes.Bootstrap_Purple=/luci-static/bootstrap_purple + commit luci +EOF +exit 0 diff --git a/package/lienol/tcping/Makefile b/package/lienol/tcping/Makefile new file mode 100644 index 0000000000..6e34f11a68 --- /dev/null +++ b/package/lienol/tcping/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2014 OpenWrt-dist +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + + +PKG_NAME:=tcping +PKG_VERSION:=0.1 +PKG_RELEASE:=2 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/jlyo/tcping.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=79ef6f85d7147d33d0835fac060618ab136503c8 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/tcping + SECTION:=net + CATEGORY:=Network + TITLE:=tcping measures the latency of a tcp-connection + URL:=https://github.com/jlyo/tcping +endef + +define Package/tcping/description +endef + +define Package/tcping/conffiles +endef + +define Package/tcping/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tcping $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,tcping))