Skip to content

Commit

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

luci-app-adblock-fast: sync with 1.1.2-3 principal package
  • Loading branch information
stangri authored Aug 10, 2024
2 parents 257cfac + bd7bee7 commit 76f6c1d
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 228 deletions.
3 changes: 2 additions & 1 deletion applications/luci-app-adblock-fast/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ PKG_NAME:=luci-app-adblock-fast
PKG_LICENSE:=AGPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <[email protected]>
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
PKG_RELEASE:=3

LUCI_TITLE:=AdBlock-Fast Web UI
LUCI_URL:=https://github.com/stangri/luci-app-adblock-fast/
LUCI_DESCRIPTION:=Provides Web UI for adblock-fast service.
LUCI_DEPENDS:=+luci-base +adblock-fast +jsonfilter

Expand Down
4 changes: 4 additions & 0 deletions applications/luci-app-adblock-fast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# README

Documentation for this project is available at [https://docs.openwrt.melmac.net/luci-app-adblock-fast/](https://docs.openwrt.melmac.net/luci-app-adblock-fast/).

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ var pkg = {
get Name() {
return "adblock-fast";
},
get ReadmeCompat() {
return "";
},
get URL() {
return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
return (
"https://docs.openwrt.melmac.net/" + pkg.Name + "/" + pkg.ReadmeCompat
);
},
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;
},
};

Expand Down Expand Up @@ -515,6 +526,8 @@ RPC.on("setInitAction", function (reply) {

return L.Class.extend({
status: status,
pkg: pkg,
getInitStatus: getInitStatus,
getFileUrlFilesizes: getFileUrlFilesizes,
getPlatformSupport: getPlatformSupport,
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@
"require view";
"require adblock-fast.status as adb";

var pkg = {
get Name() {
return "adblock-fast";
},
get URL() {
return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
},
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;
},
};
var pkg = adb.pkg;

return view.extend({
load: function () {
Expand Down Expand Up @@ -525,7 +512,21 @@ return view.extend({
return val == "allow" ? _("Allow") : _("Block");
};

o = s3.option(form.DummyValue, "_name", _("Name/URL"));
o.modalonly = false;
o.cfgvalue = function (section_id) {
let name = L.uci.get(pkg.Name, section_id, "name");
let url = L.uci.get(pkg.Name, section_id, "url");
let ret = _("Unknown");
return name ? name : url;
};

o = s3.option(form.Value, "name", _("Name"));
o.modalonly = true;
o.optional = true;

o = s3.option(form.Value, "url", _("URL"));
o.modalonly = true;
o.optional = false;

return Promise.all([status.render(), m.render()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,15 @@
"require rpc";
"require form";
"require baseclass";
"require adblock-fast.status as adb";

var pkg = {
get Name() {
return "adblock-fast";
},
get URL() {
return "https://docs.openwrt.melmac.net/" + pkg.Name + "/";
},
};

var getInitStatus = rpc.declare({
object: "luci." + pkg.Name,
method: "getInitStatus",
params: ["name"],
});
var pkg = adb.pkg;

return baseclass.extend({
title: _("AdBlock-Fast"),

load: function () {
return Promise.all([getInitStatus(pkg.Name)]);
return Promise.all([adb.getInitStatus(pkg.Name)]);
},

render: function (data) {
Expand Down
Loading

0 comments on commit 76f6c1d

Please sign in to comment.