diff --git a/docker-lan-bridge/Makefile b/docker-lan-bridge/Makefile index f0ef2a5c..9a6f1e13 100644 --- a/docker-lan-bridge/Makefile +++ b/docker-lan-bridge/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=docker-lan-bridge -PKG_VERSION:=1.0.1 -PKG_RELEASE:=1 +PKG_VERSION:=1.0.2 +PKG_RELEASE:=2 PKG_MAINTAINER:=jjm2473 @@ -41,7 +41,7 @@ define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/etc/uci-defaults $(1)/etc/init.d $(1)/etc/hotplug.d/net $(INSTALL_CONF) ./files/docker-lan.uci $(1)/etc/uci-defaults/docker-lan $(INSTALL_BIN) ./files/docker-lan.init $(1)/etc/init.d/docker-lan - $(INSTALL_DATA) ./files/docker-lan.hotplug $(1)/etc/hotplug.d/net/11-docker-lan + $(INSTALL_DATA) ./files/docker-lan.hotplug $(1)/etc/hotplug.d/net/80-docker-lan endef $(eval $(call BuildPackage,docker-lan-bridge)) diff --git a/docker-lan-bridge/files/docker-lan.hotplug b/docker-lan-bridge/files/docker-lan.hotplug index 15d668e2..f288d00c 100644 --- a/docker-lan-bridge/files/docker-lan.hotplug +++ b/docker-lan-bridge/files/docker-lan.hotplug @@ -1,2 +1,5 @@ +#!/bin/sh -[ "$ACTION" = add -a "$DEVICENAME" = br-lan ] && ip link set docker-lan-d master docker-lan +[ "$ACTION" = add -a "$DEVICENAME" = br-lan ] || exit 0 +sleep 1 +ip link set docker-lan-d master docker-lan diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 3f3bf1d3..437d53ea 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=26.3.2 +PKG_VERSION:=26.3.6 PKG_RELEASE:=1 PKG_PO_VERSION:=$(PKG_VERSION) diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm index 9a2add77..537cd9d6 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/node_list.htm @@ -31,8 +31,11 @@ table td, .table .td { background: #5e72e445 !important; } -.ping a:hover{ - text-decoration : underline; +.ping a, +.ping_value a, +.tcping_value a { + text-decoration: none; + cursor: pointer; } @media (prefers-color-scheme: dark) { @@ -553,11 +556,10 @@ table td, .table .td { text = "<%:Timeout%>"; } else { let use_time = parseInt(result.use_time); - if (use_time < 1000) { + if (use_time < 1000) color = "green"; - } else if (use_time < 2000) { + else if (use_time < 2000) color = "#fb9a05"; - } text = use_time + " ms"; } } @@ -569,9 +571,11 @@ table td, .table .td { } function ping_node(cbi_id, dom, type) { - var full = get_address_full(cbi_id); + if (dom.dataset.busy == "1" || !cbi_id) return; + const full = get_address_full(cbi_id); if ((type == "icmp" && full.address != "" ) || (type == "tcping" && full.address != "" && full.port != "")) { - dom.onclick = null + dom.dataset.busy = "1"; + dom.style.color = ""; dom.innerText = "<%:Check...%>"; XHR.get('<%=api.url("ping_node")%>', { address: full.address, @@ -579,19 +583,23 @@ table td, .table .td { type: type }, function(x, result) { + let color = "red"; + let text = "<%:Error%>"; if(x && x.status == 200) { if (result.ping == null || result.ping.trim() == "") { - dom.outerHTML = "<%:Timeout%>"; + text = "<%:Timeout%>"; } else { var ping = parseInt(result.ping); if (ping < 100) - dom.outerHTML = "" + result.ping + " ms" + ""; + color = "green"; else if (ping < 200) - dom.outerHTML = "" + result.ping + " ms" + ""; - else if (ping >= 200) - dom.outerHTML = "" + result.ping + " ms" + ""; + color = "#fb9a05"; + text = result.ping + " ms"; } } + dom.innerText = text; + dom.style.color = color; + dom.dataset.busy = "0"; } ); } @@ -601,15 +609,15 @@ table td, .table .td { function pingAllNodes() { if (auto_detection_time == "icmp" || auto_detection_time == "tcping") { const now = Date.now(); - var nodes = []; + const nodes = []; const ping_value = document.getElementsByClassName(auto_detection_time == "tcping" ? 'tcping_value' : 'ping_value'); - for (var i = 0; i < ping_value.length; i++) { - var cbi_id = ping_value[i].getAttribute("cbiid"); - var full = get_address_full(cbi_id); + for (let i = 0; i < ping_value.length; i++) { + const cbi_id = ping_value[i].getAttribute("cbiid"); + const full = get_address_full(cbi_id); if ((auto_detection_time == "icmp" && full.address != "" ) || (auto_detection_time == "tcping" && full.address != "" && full.port != "")) { - var flag = false; + let flag = false; // Merge duplicates - for (var j = 0; j < nodes.length; j++) { + for (let j = 0; j < nodes.length; j++) { if (nodes[j].address == full.address && nodes[j].port == full.port) { nodes[j].indexs = nodes[j].indexs + "," + i; flag = true; @@ -621,12 +629,17 @@ table td, .table .td { const cacheData = JSON.parse(localStorage.getItem(auto_detection_time + ":" + full.address + ":" + full.port)); if (cacheData && cacheData.savetime && (now - cacheData.timestamp) < cacheData.savetime) { + const a = ping_value[i].firstElementChild; + let color = "red"; if (cacheData.value < 100) - ping_value[i].innerHTML = "" + cacheData.value + " ms" + ""; + color = "green"; else if (cacheData.value < 200) - ping_value[i].innerHTML = "" + cacheData.value + " ms" + ""; - else if (cacheData.value >= 200) - ping_value[i].innerHTML = "" + cacheData.value + " ms" + ""; + color = "#fb9a05"; + a.innerText = cacheData.value + " ms"; + a.style.color = color; + a.onclick = function () { + ping_node(cbi_id, this, auto_detection_time); + }; } else { localStorage.removeItem(auto_detection_time + ":" + full.address + ":" + full.port); nodes.push({ @@ -650,12 +663,14 @@ table td, .table .td { }, function(x, result) { if (x && x.status == 200) { - var strs = dom.indexs.split(","); - for (var i = 0; i < strs.length; i++) { - if (result.ping == null || result.ping.trim() == "") { - ping_value[strs[i]].innerHTML = "<%:Timeout%>"; - } else { - var ping = parseInt(result.ping); + let strs = dom.indexs.split(","); + for (let i = 0; i < strs.length; i++) { + const a = ping_value[strs[i]].firstElementChild; + const cbi_id = ping_value[strs[i]].getAttribute("cbiid"); + let color = "red"; + let text = "<%:Timeout%>"; + if (result.ping !== null && result.ping.trim() !== "") { + let ping = parseInt(result.ping); //save to cache const cache_data = { dom_id: strs[i], @@ -663,23 +678,33 @@ table td, .table .td { savetime: 60 * 1000, value: ping }; + text = result.ping + " ms"; localStorage.setItem(auto_detection_time + ":" + dom.address + ":" + dom.port, JSON.stringify(cache_data)); if (ping < 100) - ping_value[strs[i]].innerHTML = "" + result.ping + " ms" + ""; + color = "green"; else if (ping < 200) - ping_value[strs[i]].innerHTML = "" + result.ping + " ms" + ""; - else if (ping >= 200) - ping_value[strs[i]].innerHTML = "" + result.ping + " ms" + ""; + color = "#fb9a05"; } + a.innerText = text; + a.style.color = color; + a.onclick = function () { + ping_node(cbi_id, this, auto_detection_time); + }; } } res(); }, 5000, function(x) { - var strs = dom.indexs.split(","); - for (var i = 0; i < strs.length; i++) { - ping_value[strs[i]].innerHTML = "<%:Timeout%>"; + let strs = dom.indexs.split(","); + for (let i = 0; i < strs.length; i++) { + const a = ping_value[strs[i]].firstElementChild; + const cbi_id = ping_value[strs[i]].getAttribute("cbiid"); + a.innerText = "<%:Timeout%>"; + a.style.color = "red"; + a.onclick = function () { + ping_node(cbi_id, this, auto_detection_time); + }; } res(); } @@ -926,12 +951,12 @@ table td, .table .td { if (auto_detection_time != "icmp" && o["address"] && o["port"]) { innerHTML = innerHTML.split("{{ping}}").join('<%:Test%>'); } else { - innerHTML = innerHTML.split("{{ping}}").join('---'); + innerHTML = innerHTML.split("{{ping}}").join('---'); } if (auto_detection_time != "tcping" && o["address"] && o["port"]) { innerHTML = innerHTML.split("{{tcping}}").join('<%:Test%>'); } else { - innerHTML = innerHTML.split("{{tcping}}").join('---'); + innerHTML = innerHTML.split("{{tcping}}").join('---'); } innerHTML = innerHTML.split("{{url_test}}").join('<%:Test%>'); innerHTML = innerHTML.split("{{id}}").join(o[".name"]);