mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 16:44:45 +08:00
1 parent
37eb246de8
commit
ec44f6fe2e
16 files changed
+130
-275
No files matched your search
@@ -272,9 +272,17 @@ o = s:option(ListValue, "remote_dns_protocol", translate("Remote DNS Protocol"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("doh", "DoH")
|
||||
o:value("udp", "UDP")
|
||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||
if m.is_js_luci then
|
||||
if current_node.type == "sing-box" then
|
||||
o:value("tls", "TLS(DoT)")
|
||||
o:value("quic", "QUIC(DoQ)")
|
||||
o:value("http3", "HTTP3(DoH3)")
|
||||
end
|
||||
else
|
||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||
end
|
||||
o:depends("_show_dns_option", "1")
|
||||
|
||||
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
||||
@@ -382,9 +390,8 @@ for k, v in pairs(nodes_table) do
|
||||
end
|
||||
end
|
||||
|
||||
--m:appendTemplate("/acl/options", {section = arg[1]})
|
||||
|
||||
-- Shunt Start
|
||||
--[[
|
||||
-- Shunt
|
||||
if current_node.protocol == "_shunt" then
|
||||
local shunt_lua = loadfile("/usr/lib/lua/luci/model/cbi/passwall2/client/include/shunt_options.lua")
|
||||
setfenv(shunt_lua, getfenv(1))(m, s, {
|
||||
@@ -396,5 +403,6 @@ if current_node.protocol == "_shunt" then
|
||||
end
|
||||
|
||||
m:appendTemplate("/acl/shunt", { shunt_list = api.jsonc.stringify(shunt_list), section = s.section })
|
||||
]]--
|
||||
|
||||
return api.return_map(m)
|
||||
@@ -201,9 +201,17 @@ o = s:taboption("DNS", ListValue, "remote_dns_protocol", translate("Remote DNS P
|
||||
o:value("tcp", "TCP")
|
||||
o:value("doh", "DoH")
|
||||
o:value("udp", "UDP")
|
||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||
if m.is_js_luci then
|
||||
if current_node.type == "sing-box" then
|
||||
o:value("tls", "TLS(DoT)")
|
||||
o:value("quic", "QUIC(DoQ)")
|
||||
o:value("http3", "HTTP3(DoH3)")
|
||||
end
|
||||
else
|
||||
o:value("tls", "TLS(DoT)", { _is_singbox = "1" })
|
||||
o:value("quic", "QUIC(DoQ)", { _is_singbox = "1" })
|
||||
o:value("http3", "HTTP3(DoH3)", { _is_singbox = "1" })
|
||||
end
|
||||
|
||||
---- DNS over TCP or UDP or TLS (DoT) or QUIC (DoQ)
|
||||
o = s:taboption("DNS", Value, "remote_dns", translate("Remote DNS"))
|
||||
@@ -259,11 +267,10 @@ o:value("UseIP")
|
||||
o:value("UseIPv4")
|
||||
o:value("UseIPv6")
|
||||
|
||||
if current_node.type == "sing-box" then
|
||||
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
end
|
||||
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
o:depends("_is_singbox", "1")
|
||||
|
||||
o = s:taboption("DNS", TextValue, "dns_hosts", translate("Domain Override"))
|
||||
o.rows = 5
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<%
|
||||
local map = self.map
|
||||
local api = map.api
|
||||
local config = map.config
|
||||
local section = self.section
|
||||
-%>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function setOption(option, val) {
|
||||
const dom = document.getElementById('cbid.<%=config%>.<%=section%>.' + option);
|
||||
if (dom) {
|
||||
dom.value = val;
|
||||
}
|
||||
const combobox_dom = document.getElementById('cbi.combobox.cbid.<%=config%>.<%=section%>.' + option);
|
||||
if (combobox_dom) {
|
||||
combobox_dom.value = val;
|
||||
//combobox_dom.selectedIndex = val;
|
||||
//combobox_dom.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
}
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function dom_event() {
|
||||
waitForElementId('cbi.combobox.cbid.<%=config%>.<%=section%>.tcp_no_redir_ports', function(el) {
|
||||
const o_val = el.value;
|
||||
el.addEventListener("change", () => {
|
||||
const udp_no_redir_ports = getOption("<%=config%>", "<%=section%>", "udp_no_redir_ports");
|
||||
if (el.value == "1:65535" && udp_no_redir_ports && udp_no_redir_ports.value == "1:65535") {
|
||||
setOption("tcp_no_redir_ports", "");
|
||||
setOption("udp_no_redir_ports", "");
|
||||
setOption("mode", 0);
|
||||
cbi_d_update();
|
||||
}
|
||||
});
|
||||
});
|
||||
waitForElementId('cbi.combobox.cbid.<%=config%>.<%=section%>.udp_no_redir_ports', function(el) {
|
||||
const o_val = el.value;
|
||||
el.addEventListener("change", () => {
|
||||
const tcp_no_redir_ports = getOption("<%=config%>", "<%=section%>", "tcp_no_redir_ports");
|
||||
if (el.value == "1:65535" && tcp_no_redir_ports && tcp_no_redir_ports.value == "1:65535") {
|
||||
setOption("tcp_no_redir_ports", "");
|
||||
setOption("udp_no_redir_ports", "");
|
||||
setOption("mode", 0);
|
||||
cbi_d_update();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const ori_cbi_d_update = cbi_d_update;
|
||||
cbi_d_update = function() {
|
||||
ori_cbi_d_update();
|
||||
dom_event();
|
||||
};
|
||||
dom_event();
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
@@ -1507,15 +1507,17 @@ table td, .table .td {
|
||||
|
||||
//Node list option saving logic
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function onChange(option, value) {
|
||||
function onChange(option, value, refresh) {
|
||||
ajax.abortAll();
|
||||
XHR.get('<%=api.url("save_node_list_opt")%>', {
|
||||
option: option,
|
||||
value: value
|
||||
}, function(x) {
|
||||
if (x && x.status == 200) {
|
||||
document.getElementById("node_list").innerHTML = "";
|
||||
loadNodeList();
|
||||
if (refresh) {
|
||||
document.getElementById("node_list").innerHTML = "";
|
||||
loadNodeList();
|
||||
}
|
||||
} else {
|
||||
alert("<%:Error%>");
|
||||
}
|
||||
@@ -1527,7 +1529,7 @@ table td, .table .td {
|
||||
el.addEventListener("change", () => {
|
||||
el.blur();
|
||||
show_node_info = el.checked ? "1" : "0";
|
||||
onChange("show_node_info", show_node_info);
|
||||
onChange("show_node_info", show_node_info, true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1535,32 +1537,47 @@ table td, .table .td {
|
||||
el.addEventListener("change", () => {
|
||||
el.blur();
|
||||
auto_detection_time = el.value;
|
||||
onChange("auto_detection_time", auto_detection_time);
|
||||
onChange("auto_detection_time", auto_detection_time, true);
|
||||
});
|
||||
});
|
||||
|
||||
waitForElement('select[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||
el.addEventListener("change", () => {
|
||||
if (el.value) {
|
||||
onChange("url_test_url", el.value);
|
||||
}
|
||||
<% if api.is_js_luci() then -%>
|
||||
waitForElement('div[id*="cbid.<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||
el.addEventListener("cbi-dropdown-change", () => {
|
||||
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||
onChange("url_test_url", el.value, false);
|
||||
el.new_val = el.value;
|
||||
}
|
||||
});
|
||||
});
|
||||
<% else -%>
|
||||
waitForElement('select[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||
el.addEventListener("change", () => {
|
||||
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||
onChange("url_test_url", el.value, false);
|
||||
el.new_val = el.value;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
waitForElement('input[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||
el.addEventListener("change", () => {
|
||||
if (el.value) {
|
||||
onChange("url_test_url", el.value);
|
||||
}
|
||||
waitForElement('input[id*="<%=appname%>"][id*="url_test_url"]', function(el) {
|
||||
el.addEventListener("change", () => {
|
||||
if (el.value && (!el.new_val || el.new_val != el.value)) {
|
||||
onChange("url_test_url", el.value, false);
|
||||
el.new_val = el.value;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
const ori_cbi_d_update = cbi_d_update;
|
||||
cbi_d_update = function() {
|
||||
ori_cbi_d_update();
|
||||
dom_event();
|
||||
};
|
||||
<% if not api.is_js_luci() then -%>
|
||||
const ori_cbi_d_update = cbi_d_update;
|
||||
cbi_d_update = function() {
|
||||
ori_cbi_d_update();
|
||||
dom_event();
|
||||
};
|
||||
<% end -%>
|
||||
dom_event();
|
||||
|
||||
const links = document.querySelectorAll('a');
|
||||
|
||||
Reference in new issue
Block a user