Skip to content

Commit

Permalink
Merge pull request openwrt#6767 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.1-1
  • Loading branch information
stangri committed Dec 15, 2023
2 parents d06b0c9 + 8d8ca1c commit dfa2946
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 255 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.1.0-7
PKG_VERSION:=1.1.1-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 @@ -18,6 +18,9 @@ var pkg = {
humanFileSize: function (bytes, si = false, dp = 2) {
return `%${si ? 1000 : 1024}.${dp ?? 0}mB`.format(bytes);
},
isObjEmpty: function (obj) {
return Object.keys(obj).length === 0;
},
};

return view.extend({
Expand Down Expand Up @@ -46,6 +49,9 @@ return view.extend({
unbound_installed: false,
leds: [],
},
pkg: (!pkg.isObjEmpty(data[2]) && data[2]) || null,
dhcp: (!pkg.isObjEmpty(data[3]) && data[3]) || null,
smartdns: (!pkg.isObjEmpty(data[4]) && data[4]) || null,
};
var status, m, s1, s2, s3, o;

Expand Down Expand Up @@ -176,127 +182,132 @@ return view.extend({
);
o.depends("dns", "dnsmasq.conf");

o = s1.taboption(
"tab_basic",
form.ListValue,
"dnsmasq_instance_option",
_("Use AdBlocking on the dnsmasq instance(s)"),
_(
"You can limit the AdBlocking to the specific dnsmasq instance(s) (%smore information%s)."
).format(
'<a href="' + pkg.URL + "#dnsmasq_instance" + '" target="_blank">',
"</a>"
)
);
o.value("*", _("AdBlock on all instances"));
o.value("+", _("AdBlock on select instances"));
o.value("-", _("No AdBlock on dnsmasq"));
o.default = "*";
o.depends("dns", "dnsmasq.addnhosts");
o.depends("dns", "dnsmasq.servers");
o.retain = true;
o.cfgvalue = function (section_id) {
let val = this.map.data.get(
this.map.config,
section_id,
"dnsmasq_instance"
if (reply.platform.dnsmasq_installed && reply.dhcp) {
o = s1.taboption(
"tab_basic",
form.ListValue,
"dnsmasq_instance_option",
_("Use AdBlocking on the dnsmasq instance(s)"),
_(
"You can limit the AdBlocking to the specific dnsmasq instance(s) (%smore information%s)."
).format(
'<a href="' + pkg.URL + "#dnsmasq_instance" + '" target="_blank">',
"</a>"
)
);
switch (val) {
case "*":
case "-":
return val;
default:
return "+";
}
};
o.write = function (section_id, formvalue) {
L.uci.set(pkg.Name, section_id, "dnsmasq_instance", formvalue);
};

o = s1.taboption(
"tab_basic",
form.MultiValue,
"dnsmasq_instance",
_("Pick the dnsmasq instance(s) for AdBlocking")
);
Object.values(L.uci.sections("dhcp", "dnsmasq")).forEach(function (
element
) {
var description;
var key;
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, _("%s").format(description));
});
o.depends("dnsmasq_instance_option", "+");
o.retain = true;
o.value("*", _("AdBlock on all instances"));
o.value("+", _("AdBlock on select instances"));
o.value("-", _("No AdBlock on dnsmasq"));
o.default = "*";
o.depends("dns", "dnsmasq.addnhosts");
o.depends("dns", "dnsmasq.servers");
o.retain = true;
o.cfgvalue = function (section_id) {
let val = this.map.data.get(
this.map.config,
section_id,
"dnsmasq_instance"
);
switch (val) {
case "*":
case "-":
return val;
default:
return "+";
}
};
o.write = function (section_id, formvalue) {
L.uci.set(pkg.Name, section_id, "dnsmasq_instance", formvalue);
};

o = s1.taboption(
"tab_basic",
form.ListValue,
"smartdns_instance_option",
_("Use AdBlocking on the SmartDNS instance(s)"),
_(
"You can limit the AdBlocking to the specific SmartDNS instance(s) (%smore information%s)."
).format(
'<a href="' + pkg.URL + "#smartdns_instance" + '" target="_blank">',
"</a>"
)
);
o.value("*", _("AdBlock on all instances"));
o.value("+", _("AdBlock on select instances"));
o.value("-", _("No AdBlock on SmartDNS"));
o.default = "*";
o.depends("dns", "smartdns.domainset");
o.depends("dns", "smartdns.ipset");
o.depends("dns", "smartdns.nftset");
o.retain = true;
o.cfgvalue = function (section_id) {
let val = this.map.data.get(
this.map.config,
section_id,
"smartdns_instance"
o = s1.taboption(
"tab_basic",
form.MultiValue,
"dnsmasq_instance",
_("Pick the dnsmasq instance(s) for AdBlocking")
);
switch (val) {
case "*":
case "-":
return val;
default:
return "+";
}
};
o.write = function (section_id, formvalue) {
L.uci.set(pkg.Name, section_id, "smartdns_instance", formvalue);
};
Object.values(L.uci.sections("dhcp", "dnsmasq")).forEach(function (
element
) {
var description;
var key;
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, _("%s").format(description));
});
o.depends("dnsmasq_instance_option", "+");
o.retain = true;
}

o = s1.taboption(
"tab_basic",
form.MultiValue,
"smartdns_instance",
_("Pick the SmartDNS instance(s) for AdBlocking")
);
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, _("%s").format(description));
});
o.depends("smartdns_instance_option", "+");
o.retain = true;
if (reply.platform.smartdns_installed && reply.smartdns) {
o = s1.taboption(
"tab_basic",
form.ListValue,
"smartdns_instance_option",
_("Use AdBlocking on the SmartDNS instance(s)"),
_(
"You can limit the AdBlocking to the specific SmartDNS instance(s) (%smore information%s)."
).format(
'<a href="' + pkg.URL + "#smartdns_instance" + '" target="_blank">',
"</a>"
)
);
o.value("*", _("AdBlock on all instances"));
o.value("+", _("AdBlock on select instances"));
o.value("-", _("No AdBlock on SmartDNS"));
o.default = "*";
o.depends("dns", "smartdns.domainset");
o.depends("dns", "smartdns.ipset");
o.depends("dns", "smartdns.nftset");
o.retain = true;
o.cfgvalue = function (section_id) {
let val = this.map.data.get(
this.map.config,
section_id,
"smartdns_instance"
);
switch (val) {
case "*":
case "-":
return val;
default:
return "+";
}
};
o.write = function (section_id, formvalue) {
L.uci.set(pkg.Name, section_id, "smartdns_instance", formvalue);
};

o = s1.taboption(
"tab_basic",
form.MultiValue,
"smartdns_instance",
_("Pick the SmartDNS instance(s) for AdBlocking")
);
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, _("%s").format(description));
});
o.depends("smartdns_instance_option", "+");
o.retain = true;
}
o = s1.taboption(
"tab_basic",
form.ListValue,
Expand Down
Loading

0 comments on commit dfa2946

Please sign in to comment.