parent
9111e3e4f9
commit
b04fbad043
@ -14,7 +14,6 @@ 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"
|
||||
@ -24,24 +23,6 @@ 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.node_type == "normal" 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([[
|
||||
<script>
|
||||
window.auto_detection_time = "%s";
|
||||
</script>
|
||||
]], auto_detection_time)
|
||||
|
||||
-- [[ Node List ]]--
|
||||
s = m:section(TypedSection, "nodes")
|
||||
@ -168,17 +149,13 @@ o = s:option(DummyValue, "ping", "Ping")
|
||||
o.width = "8%"
|
||||
o.rawhtml = true
|
||||
o.cfgvalue = function(t, n)
|
||||
local type = m:get(n, "type") or ""
|
||||
local protocol = m:get(n, "protocol") or ""
|
||||
if (type == "sing-box" or type == "Xray") and
|
||||
(protocol == "_shunt" or protocol == "_balancing" or protocol == "_urltest" or protocol == "_iface") then
|
||||
return string.format('<span class="ping_value" cbiid="%s">---</span>', n)
|
||||
end
|
||||
local result = "---"
|
||||
if auto_detection_time ~= "icmp" then
|
||||
return string.format('<span class="ping"><a href="javascript:void(0)" onclick="javascript:ping_node(\'%s\', this, \'icmp\')">%s</a></span>', n, translate("Test"))
|
||||
result = string.format('<span class="ping"><a href="javascript:void(0)" onclick="javascript:ping_node(\'%s\', this, \'icmp\')">%s</a></span>', n, translate("Test"))
|
||||
else
|
||||
return string.format('<span class="ping_value" cbiid="%s">---</span>', n)
|
||||
result = string.format('<span class="ping_value" cbiid="%s">---</span>', n)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
---- TCP Ping
|
||||
@ -186,17 +163,13 @@ o = s:option(DummyValue, "tcping", "TCPing")
|
||||
o.width = "8%"
|
||||
o.rawhtml = true
|
||||
o.cfgvalue = function(t, n)
|
||||
local type = m:get(n, "type") or ""
|
||||
local protocol = m:get(n, "protocol") or ""
|
||||
if (type == "sing-box" or type == "Xray") and
|
||||
(protocol == "_shunt" or protocol == "_balancing" or protocol == "_urltest" or protocol == "_iface") then
|
||||
return string.format('<span class="tcping_value" cbiid="%s">---</span>', n)
|
||||
end
|
||||
local result = "---"
|
||||
if auto_detection_time ~= "tcping" then
|
||||
return string.format('<span class="ping"><a href="javascript:void(0)" onclick="javascript:ping_node(\'%s\', this, \'tcping\')">%s</a></span>', n, translate("Test"))
|
||||
result = string.format('<span class="ping"><a href="javascript:void(0)" onclick="javascript:ping_node(\'%s\', this, \'tcping\')">%s</a></span>', n, translate("Test"))
|
||||
else
|
||||
return string.format('<span class="tcping_value" cbiid="%s">---</span>', n)
|
||||
result = string.format('<span class="tcping_value" cbiid="%s">---</span>', n)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "_url_test", translate("URL Test"))
|
||||
|
@ -46,6 +46,7 @@ table td, .table .td {
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
let auto_detection_time = "<%=api.uci_get_type("@global_other[0]", "auto_detection_time", "0")%>"
|
||||
|
||||
var node_list = {};
|
||||
var node_count = 0;
|
||||
@ -313,7 +314,7 @@ table td, .table .td {
|
||||
|
||||
/* 自动Ping */
|
||||
function pingAllNodes() {
|
||||
if (window.auto_detection_time == "icmp" || window.auto_detection_time == "tcping") {
|
||||
if (auto_detection_time == "icmp" || auto_detection_time == "tcping") {
|
||||
var nodes = [];
|
||||
const ping_value = document.getElementsByClassName(auto_detection_time == "tcping" ? 'tcping_value' : 'ping_value');
|
||||
for (var i = 0; i < ping_value.length; i++) {
|
||||
|
@ -634,9 +634,6 @@ msgstr "延迟"
|
||||
msgid "Automatic detection delay"
|
||||
msgstr "自动检测延迟"
|
||||
|
||||
msgid "To optimize performance, auto-detection is disabled when there are more than 30 nodes."
|
||||
msgstr "为优化性能,超过 30 个节点不自动检测。"
|
||||
|
||||
msgid "Show server address and port"
|
||||
msgstr "显示服务器地址和端口"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user