🦄 Sync 2026-07-04 08:36:24

This commit is contained in:
github-actions[bot] committed 2026-07-04 08:36:24 +08:00
1 parent a524ec1eaf
commit 37d8256bc3
18 files changed
+690 -546

No files matched your search

@@ -46,12 +46,6 @@ function getServiceStatus() {
});
}
function smartdnsServiceStatus() {
return Promise.all([
getServiceStatus()
]);
}
function smartdnsRenderStatus(isRunning) {
let renderHTML = "";
@@ -70,7 +64,7 @@ function smartdnsRenderStatus(isRunning) {
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const uiLink = protocol + "//" + hostname + ":" + uiPort;
renderHTML += "&#160; <a class=\"btn cbi-button\" style=\"margin-left: 10px; background-color: black; color: white; border-color: #333;\" href=\"" + uiLink + "\" target=\"_blank\">" + _("Open the WebUI") + "</a>";
renderHTML += '&#160; <a class="btn cbi-button" ' + 'href="' + uiLink + '" target="_blank">' + _("Open the WebUI") + '</a>';
}
} else {
renderHTML += "<span style=\"color:red;font-weight:bold\">SmartDNS - " + _("NOT RUNNING") + "</span>";
@@ -125,7 +119,7 @@ return view.extend({
s.anonymous = true;
s.render = function (section_id) {
const renderStatus = function () {
return L.resolveDefault(smartdnsServiceStatus()).then(function (res) {
return L.resolveDefault(getServiceStatus()).then(function (res) {
const view = document.getElementById("service_status");
if (view == null) {
return;
@@ -223,6 +217,8 @@ return view.extend({
o.value("ping,tcp:443,tcp:80");
o.value("tcp:80,tcp:443,ping");
o.value("tcp:443,tcp:80,ping");
o.value("tcp-syn:80,tcp-syn:443,ping");
o.value("tcp-syn:443,tcp-syn:80,ping");
o.value("none", _("None"));
o.validate = function (section_id, value) {
if (value == "") {
@@ -248,6 +244,15 @@ return view.extend({
continue;
}
if (cm.indexOf("tcp-syn:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP SYN port is empty");
}
continue;
}
return _("Speed check mode is invalid.");
}
@@ -386,8 +391,8 @@ return view.extend({
return true;
}
var ipset = value.split(",")
for (var i = 0; i < ipset.length; i++) {
let ipset = value.split(",")
for (let i = 0; i < ipset.length; i++) {
if (!ipset[i].match(/^(#[4|6]:)?[a-zA-Z0-9\-_]+$/)) {
return _("ipset name format error, format: [#[4|6]:]ipsetname");
}
@@ -427,9 +432,9 @@ return view.extend({
return true;
}
var nftset = value.split(",")
for (var i = 0; i < nftset.length; i++) {
if (!nftset[i].match(/^#[4|6]:[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+$/)) {
const nftset = value.split(",")
for (let nfts of nftset) {
if (!nfts.match(/^#[4|6]:[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+$/)) {
return _("NFTset name format error, format: [#[4|6]:[family#table#set]]");
}
}
@@ -496,7 +501,7 @@ return view.extend({
}
if (df.type != 'config') {
continue
continue;
}
o.value(df.name);
@@ -504,16 +509,16 @@ return view.extend({
o = s.taboption("advanced", form.DynamicList, "hosts_files", _("Hosts File"), _("Include hosts file."));
o.rmempty = true;
for (var i = 0; i < download_files.length; i++) {
if (download_files[i].type == undefined) {
for (let df of download_files) {
if (df.type == undefined) {
continue;
}
if (download_files[i].type != 'other') {
continue
if (df.type != 'other') {
continue;
}
o.value(download_files[i].name);
o.value(df.name);
}
///////////////////////////////////////
@@ -671,7 +676,7 @@ return view.extend({
o.depends('enable_auto_update', '1');
o = s.taboption('files', form.ListValue, 'auto_update_day_time', _("Update time (every day)"));
for (var i = 0; i < 24; i++)
for (let i = 0; i < 24; i++)
o.value(i, i + ':00');
o.default = '5';
o.depends('enable_auto_update', '1');
@@ -831,7 +836,7 @@ return view.extend({
})
}, [_("View Log")]);
}
var log_levels = ["debug", "info", "notice", "warn", "error", "fatal"];
const log_levels = ["debug", "info", "notice", "warn", "error", "fatal"];
log_levels.forEach(function(level) {
o.depends({ log_output_mode: "file", log_level: level });
});
@@ -1112,9 +1117,9 @@ return view.extend({
return true;
}
var val = uci.sections('smartdns', 'server');
for (var i = 0; i < val.length; i++) {
if (value == val[i].server_group) {
const val = uci.sections('smartdns', 'server');
for (let i of val) {
if (value == i.server_group) {
return true;
}
}
@@ -1132,6 +1137,8 @@ return view.extend({
o.value("ping,tcp:443,tcp:80");
o.value("tcp:80,tcp:443,ping");
o.value("tcp:443,tcp:80,ping");
o.value("tcp-syn:80,tcp-syn:443,ping");
o.value("tcp-syn:443,tcp-syn:80,ping");
o.value("none", _("None"));
o.validate = function (section_id, value) {
if (value == "") {
@@ -1142,14 +1149,14 @@ return view.extend({
return true;
}
var check_mode = value.split(",")
for (var i = 0; i < check_mode.length; i++) {
if (check_mode[i] == "ping") {
const check_mode = value.split(",")
for (let cm of check_mode) {
if (cm == "ping") {
continue;
}
if (check_mode[i].indexOf("tcp:") == 0) {
var port = check_mode[i].split(":")[1];
if (cm.indexOf("tcp:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP port is empty");
}
@@ -1157,6 +1164,15 @@ return view.extend({
continue;
}
if (cm.indexOf("tcp-syn:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP SYN port is empty");
}
continue;
}
return _("Speed check mode is invalid.");
}
@@ -1189,9 +1205,9 @@ return view.extend({
return true;
}
var ipset = value.split(",")
for (var i = 0; i < ipset.length; i++) {
if (!ipset[i].match(/^(#[4|6]:)?[a-zA-Z0-9\-_]+$/)) {
const ipset = value.split(",")
for (let ips of ipset) {
if (!ips.match(/^(#[4|6]:)?[a-zA-Z0-9\-_]+$/)) {
return _("ipset name format error, format: [#[4|6]:]ipsetname");
}
}
@@ -1209,9 +1225,9 @@ return view.extend({
return true;
}
var nftset = value.split(",")
for (var i = 0; i < nftset.length; i++) {
if (!nftset[i].match(/^#[4|6]:[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+$/)) {
const nftset = value.split(",")
for (let nfts of nftset) {
if (!nfts.match(/^#[4|6]:[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+#[a-zA-Z0-9\-_]+$/)) {
return _("NFTset name format error, format: [#[4|6]:[family#table#set]]");
}
}
@@ -1223,16 +1239,16 @@ return view.extend({
download_files = uci.sections('smartdns', 'download-file');
o = s.taboption("advanced", form.DynamicList, "conf_files", _("Include Config Files<br>/etc/smartdns/conf.d"),
_("Include other config files from /etc/smartdns/conf.d or custom path, can be downloaded from the download page."));
for (var i = 0; i < download_files.length; i++) {
if (download_files[i].type == undefined) {
for (let df of download_files) {
if (df.type == undefined) {
continue;
}
if (download_files[i].type != 'config') {
continue
if (df.type != 'config') {
continue;
}
o.value(download_files[i].name);
o.value(df.name);
}
o = s.taboption("block", form.FileUpload, "block_domain_set_file", _("Domain List File"), _("Upload domain list file."));
@@ -1291,6 +1307,8 @@ return view.extend({
o.value("ping,tcp:443,tcp:80");
o.value("tcp:80,tcp:443,ping");
o.value("tcp:443,tcp:80,ping");
o.value("tcp-syn:80,tcp-syn:443,ping");
o.value("tcp-syn:443,tcp-syn:80,ping");
o.value("none", _("None"));
o.validate = function (section_id, value) {
if (value == "") {
@@ -1301,14 +1319,14 @@ return view.extend({
return true;
}
var check_mode = value.split(",")
for (var i = 0; i < check_mode.length; i++) {
if (check_mode[i] == "ping") {
const check_mode = value.split(",")
for (let cm of check_mode) {
if (cm == "ping") {
continue;
}
if (check_mode[i].indexOf("tcp:") == 0) {
var port = check_mode[i].split(":")[1];
if (cm.indexOf("tcp:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP port is empty");
}
@@ -1316,6 +1334,15 @@ return view.extend({
continue;
}
if (cm.indexOf("tcp-syn:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP SYN port is empty");
}
continue;
}
return _("Speed check mode is invalid.");
}
@@ -1515,6 +1542,8 @@ return view.extend({
so.value("ping,tcp:443,tcp:80");
so.value("tcp:80,tcp:443,ping");
so.value("tcp:443,tcp:80,ping");
so.value("tcp-syn:80,tcp-syn:443,ping");
so.value("tcp-syn:443,tcp-syn:80,ping");
so.value("none", _("None"));
so.validate = function (section_id, value) {
if (value == "") {
@@ -1540,6 +1569,15 @@ return view.extend({
continue;
}
if (cm.indexOf("tcp-syn:") == 0) {
const port = cm.split(":")[1];
if (port == "") {
return _("TCP SYN port is empty");
}
continue;
}
return _("Speed check mode is invalid.");
}