Skip to content

Commit

Permalink
Merge pull request openwrt#6742 from stangri/master-luci-app-adblock-…
Browse files Browse the repository at this point in the history
…fast

luci-app-adblock-fast: update to 1.1.0-1
  • Loading branch information
stangri committed Dec 6, 2023
2 parents c0c3790 + 8db9af1 commit 576fd04
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 107 deletions.
2 changes: 1 addition & 1 deletion applications/luci-app-adblock-fast/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk

PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
PKG_VERSION:=1.0.1-2
PKG_VERSION:=1.1.0-1

LUCI_TITLE:=AdBlock-Fast Web UI
LUCI_DESCRIPTION:=Provides Web UI for adblock-fast service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

"use strict";
"require form";
"require uci";
"require view";
"require adblock-fast.status as adb";

Expand All @@ -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"),
]);
},

Expand Down Expand Up @@ -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 +
Expand Down Expand Up @@ -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"));
}
Expand Down Expand Up @@ -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 {
Expand All @@ -190,6 +186,39 @@ return view.extend({
o.depends("dns", "dnsmasq.servers");
o.retain = true;

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,
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 576fd04

Please sign in to comment.