summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2023-12-11 15:46:08 -0700
committerGitHub <noreply@github.com>2023-12-11 15:46:08 -0700
commitf8bd034075f375a134d9b0507da03ddfa2be5e0a (patch)
tree3a53e748ee608df678c596f21ace66d62e6ae13c /applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view
parent6dff72b1cd20bd878e24f9b2fc05b4ecc858d607 (diff)
parent799280877fbe7a43dab9c3af1dd509519e2f542b (diff)
Merge pull request #6761 from stangri/master-luci-app-https-dns-proxy
luci-app-https-dns-proxy: update to 2023-10-25-5
Diffstat (limited to 'applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view')
-rw-r--r--applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js55
1 files changed, 40 insertions, 15 deletions
diff --git a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js
index 280ffc289e..a9bc25b905 100644
--- a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js
+++ b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js
@@ -8,12 +8,10 @@
"use strict";
"require form";
"require rpc";
-"require uci";
"require view";
"require https-dns-proxy.status as hdp";
var pkg = {
-
get Name() {
return "https-dns-proxy";
},
@@ -47,8 +45,8 @@ return view.extend({
return Promise.all([
L.resolveDefault(hdp.getPlatformSupport(pkg.Name), {}),
L.resolveDefault(hdp.getProviders(pkg.Name), {}),
- uci.load(pkg.Name),
- uci.load("dhcp"),
+ L.resolveDefault(L.uci.load(pkg.Name), {}),
+ L.resolveDefault(L.uci.load("dhcp"), {}),
]);
},
@@ -80,7 +78,7 @@ return view.extend({
o = s.option(
form.ListValue,
- "dnsmasq_config_update",
+ "dnsmasq_config_update_option",
_("Update DNSMASQ Config on Start/Stop"),
_(
"If update option is selected, the %s'DNS forwardings' section of DHCP and DNS%s will be automatically updated to use selected DoH providers (%smore information%s)."
@@ -92,22 +90,49 @@ return view.extend({
)
);
o.value("*", _("Update all configs"));
+ o.value("+", _("Update select configs"));
+ o.value("-", _("Do not update configs"));
+ o.default = "*";
+ o.retain = true;
+ o.cfgvalue = function (section_id) {
+ let val = this.map.data.get(
+ this.map.config,
+ section_id,
+ "dnsmasq_config_update"
+ );
+ switch (val) {
+ case "*":
+ case "-":
+ return val;
+ default:
+ return "+";
+ }
+ };
+ o.write = function (section_id, formvalue) {
+ L.uci.set(pkg.Name, section_id, "dnsmasq_config_update", formvalue);
+ };
- var sections = uci.sections("dhcp", "dnsmasq");
- sections.forEach((element) => {
+ o = s.option(
+ form.MultiValue,
+ "dnsmasq_config_update",
+ _("Select the DNSMASQ Configs to update")
+ );
+ Object.values(L.uci.sections("dhcp", "dnsmasq")).forEach(function (
+ element
+ ) {
var description;
var key;
- if (element[".name"] === uci.resolveSID("dhcp", element[".name"])) {
+ if (element[".name"] === L.uci.resolveSID("dhcp", element[".name"])) {
key = element[".index"];
description = "dnsmasq[" + element[".index"] + "]";
} else {
key = element[".name"];
description = element[".name"];
}
- o.value(key, _("Update %s only").format(description));
+ o.value(key, _("%s").format(description));
});
- o.value("-", _("Do not update configs"));
- o.default = "*";
+ o.depends("dnsmasq_config_update_option", "+");
+ o.retain = true;
o = s.option(
form.ListValue,
@@ -191,7 +216,7 @@ return view.extend({
reply.providers.forEach((prov) => {
var option;
let regexp = pkg.templateToRegexp(prov.template);
- let resolver = uci.get(pkg.Name, section_id, "resolver_url");
+ let resolver = L.uci.get(pkg.Name, section_id, "resolver_url");
resolver = resolver === undefined ? null : resolver;
if (!found && resolver && regexp.test(resolver)) {
found = true;
@@ -240,7 +265,7 @@ return view.extend({
return ret || "";
};
_provider.write = function (section_id, formvalue) {
- uci.set(pkg.Name, section_id, "resolver_url", formvalue);
+ L.uci.set(pkg.Name, section_id, "resolver_url", formvalue);
};
reply.providers.forEach((prov, i) => {
@@ -276,7 +301,7 @@ return view.extend({
let resolver = pkg.templateToResolver(template, {
option: formvalue || "",
});
- uci.set(pkg.Name, section_id, "resolver_url", resolver);
+ L.uci.set(pkg.Name, section_id, "resolver_url", resolver);
};
_paramList.remove = _paramList.write;
} else if (
@@ -314,7 +339,7 @@ return view.extend({
let resolver = pkg.templateToResolver(template, {
option: formvalue || "",
});
- uci.set(pkg.Name, section_id, "resolver_url", resolver);
+ L.uci.set(pkg.Name, section_id, "resolver_url", resolver);
};
_paramText.remove = _paramText.write;
}