diff options
Diffstat (limited to 'applications/luci-app-adblock-fast/htdocs/luci-static')
-rw-r--r-- | applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js | 75 |
1 files changed, 52 insertions, 23 deletions
diff --git a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js index ab36223983..ae8a4f2a08 100644 --- a/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js +++ b/applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js @@ -5,7 +5,6 @@ "use strict"; "require form"; -"require uci"; "require view"; "require adblock-fast.status as adb"; @@ -26,8 +25,9 @@ return view.extend({ return Promise.all([ L.resolveDefault(adb.getFileUrlFilesizes(pkg.Name), {}), L.resolveDefault(adb.getPlatformSupport(pkg.Name), {}), - uci.load(pkg.Name), - uci.load("dhcp"), + L.uci.load(pkg.Name), + L.uci.load("dhcp"), + L.uci.load("smartdns"), ]); }, @@ -95,6 +95,14 @@ return view.extend({ ); } } + if (!reply.platform.smartdns_installed) { + text = + text + + "<br />" + + _("Please note that %s is not supported on this system.").format( + "<i>smartdns.domainset</i>" + ); + } if (!reply.platform.unbound_installed) { text = text + @@ -122,6 +130,9 @@ return view.extend({ } o.value("dnsmasq.servers", _("dnsmasq servers file")); } + if (reply.platform.smartdns_installed) { + o.value("smartdns.domainset", _("smartdns domain set")); + } if (reply.platform.unbound_installed) { o.value("unbound.adb_list", _("unbound adblock list")); } @@ -155,27 +166,12 @@ return view.extend({ ); o.value("*", _("AdBlock on all instances")); - // Object.values(L.uci.sections("dhcp", "dnsmasq")).forEach(function ( - // val, - // index - // ) { - // const nameValueMap = new Map(Object.entries(val)); - // so.value( - // nameValueMap.get(".name"), - // "%s (Name: %s, Domain: %s, Local: %s)".format( - // nameValueMap.get(".index"), - // nameValueMap.get(".name") || "noname", - // val.domain || "unset", - // val.local || "unset" - // ) - // ); - // }); - - var sections = uci.sections("dhcp", "dnsmasq"); - sections.forEach((element) => { + 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 { @@ -193,6 +189,39 @@ return view.extend({ o = s1.taboption( "tab_basic", form.ListValue, + "smartdns_instance", + _("Use AdBlocking on the SmartDNS instance(s)"), + _( + "You can limit the AdBlocking to a specific SmartDNS instance(s) (%smore information%s)." + ).format( + '<a href="' + pkg.URL + "#smartdns_instance" + '" target="_blank">', + "</a>" + ) + ); + o.value("*", _("AdBlock on all instances")); + + Object.values(L.uci.sections("smartdns", "smartdns")).forEach(function ( + element + ) { + var description; + var key; + if (element[".name"] === L.uci.resolveSID("smartdns", element[".name"])) { + key = element[".index"]; + description = "smartdns[" + element[".index"] + "]"; + } else { + key = element[".name"]; + description = element[".name"]; + } + o.value(key, _("AdBlock on %s only").format(description)); + }); + o.value("-", _("No AdBlock on SmartDNS")); + o.default = "*"; + o.depends("dns", "smartdns.domainset"); + o.retain = true; + + o = s1.taboption( + "tab_basic", + form.ListValue, "force_dns", _("Force Router DNS"), _("Forces Router DNS use on local devices, also known as DNS Hijacking.") @@ -381,7 +410,7 @@ return view.extend({ o = s3.option(form.DummyValue, "_size", _("Size")); o.modalonly = false; o.cfgvalue = function (section_id) { - let url = uci.get(pkg.Name, section_id, "url"); + let url = L.uci.get(pkg.Name, section_id, "url"); let ret = _("Unknown"); reply.sizes.forEach((element) => { if (element.url === url) { |