]> git.99rst.org Git - openwrt-luci.git/blob
19db4c4711071a95981ca51bd9c70ce65ca3e01c
[openwrt-luci.git] /
1 "require ui";
2 "require rpc";
3 "require form";
4 "require baseclass";
5 "require adblock-fast.status as adb";
6
7 const { pkg } = adb;
8
9 return baseclass.extend({
10 title: _("AdBlock-Fast"),
11
12 load: function () {
13 return Promise.all([adb.getInitStatus(pkg.Name)]);
14 },
15
16 render: function (data) {
17 var reply = {
18 status: (data[0] && data[0][pkg.Name]) || {
19 enabled: false,
20 status: null,
21 running: null,
22 version: null,
23 errors: [],
24 warnings: [],
25 force_dns_active: null,
26 force_dns_ports: [],
27 entries: null,
28 dns: null,
29 outputFile: null,
30 outputCache: null,
31 outputGzip: null,
32 outputFileExists: null,
33 outputCacheExists: null,
34 outputGzipExists: null,
35 leds: [],
36 },
37 };
38
39 var cacheText;
40 if (reply.status.outputCacheExists) {
41 cacheText = _("Cache file");
42 } else if (reply.status.outputGzipExists) {
43 cacheText = _("Compressed cache");
44 }
45 var forceDnsText = "";
46 if (reply.status.force_dns_active) {
47 reply.status.force_dns_ports.forEach((element) => {
48 forceDnsText += element + " ";
49 });
50 } else {
51 forceDnsText = "-";
52 }
53
54 var table = E(
55 "table",
56 { class: "table", id: "adblock-fast_status_table" },
57 [
58 E("tr", { class: "tr table-titles" }, [
59 E("th", { class: "th" }, _("Status")),
60 E("th", { class: "th" }, _("Version")),
61 E("th", { class: "th" }, _("DNS Service")),
62 E("th", { class: "th" }, _("Blocked Domains")),
63 E("th", { class: "th" }, _("Cache")),
64 E("th", { class: "th" }, _("Force DNS Ports")),
65 ]),
66 E("tr", { class: "tr" }, [
67 E(
68 "td",
69 { class: "td" },
70 pkg.statusTable[reply.status.status] || _("Unknown")
71 ),
72 E("td", { class: "td" }, reply.status.version || _("-")),
73 E("td", { class: "td" }, reply.status.dns || _("-")),
74 E("td", { class: "td" }, reply.status.entries || _("-")),
75 E("td", { class: "td" }, cacheText || _("-")),
76 E("td", { class: "td" }, forceDnsText || _("-")),
77 ]),
78 ]
79 );
80
81 return table;
82 },
83 });
git clone https://git.99rst.org/PROJECT