diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua index 33587b183..61dd830f9 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua @@ -14,6 +14,7 @@ o = s:option(ListValue, "auto_detection_time", translate("Automatic detection de o:value("0", translate("Close")) o:value("icmp", "Ping") o:value("tcping", "TCP Ping") +o.description = translate("To optimize performance, auto-detection is disabled when there are more than 30 nodes.") o = s:option(Flag, "show_node_info", translate("Show server address and port")) o.default = "0" @@ -23,6 +24,24 @@ s:append(Template(appname .. "/node_list/link_add_node")) local auto_detection_time = m:get("@global_other[0]", "auto_detection_time") or "0" local show_node_info = m:get("@global_other[0]", "show_node_info") or "0" +if auto_detection_time ~= "0" then + local node_count = 0 + for k, e in ipairs(api.get_valid_nodes()) do + if e.protocol ~= "_shunt" and e.protocol ~= "_balancing" and e.protocol ~= "_urltest" and e.protocol ~= "_iface" then + node_count = node_count + 1 + end + end + if node_count > 30 then auto_detection_time = "0" end +end + +-- Pass the auto_detection_time global variable to the webpage +local o = s:option(DummyValue, "_auto_detection_time") +o.rawhtml = true +o.default = string.format([[ + +]], auto_detection_time) -- [[ Node List ]]-- s = m:section(TypedSection, "nodes") @@ -149,13 +168,15 @@ o = s:option(DummyValue, "ping", "Ping") o.width = "8%" o.rawhtml = true o.cfgvalue = function(t, n) - local result = "---" - if auto_detection_time ~= "icmp" then - result = string.format('%s', n, translate("Test")) - else - result = string.format('---', n) + local protocol = m:get(n, "protocol") + if protocol == "_shunt" or protocol == "_balancing" or protocol == "_urltest" or protocol == "_iface" then + return string.format('---', n) + end + if auto_detection_time ~= "icmp" then + return string.format('%s', n, translate("Test")) + else + return string.format('---', n) end - return result end ---- TCP Ping @@ -163,13 +184,15 @@ o = s:option(DummyValue, "tcping", "TCPing") o.width = "8%" o.rawhtml = true o.cfgvalue = function(t, n) - local result = "---" - if auto_detection_time ~= "tcping" then - result = string.format('%s', n, translate("Test")) - else - result = string.format('---', n) + local protocol = m:get(n, "protocol") + if protocol == "_shunt" or protocol == "_balancing" or protocol == "_urltest" or protocol == "_iface" then + return string.format('---', n) + end + if auto_detection_time ~= "tcping" then + return string.format('%s', n, translate("Test")) + else + return string.format('---', n) end - return result end o = s:option(DummyValue, "_url_test", translate("URL Test")) 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 ef64abace..d94416802 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 @@ -46,8 +46,7 @@ table td, .table .td {