diff options
Diffstat (limited to 'applications/luci-app-adblock')
6 files changed, 125 insertions, 152 deletions
diff --git a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua index f71fb7ba4d..68f9c8897e 100644 --- a/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua +++ b/applications/luci-app-adblock/luasrc/model/cbi/adblock/overview_tab.lua @@ -6,9 +6,25 @@ local uci = require("uci") local sys = require("luci.sys") local json = require("luci.jsonc") local adbinput = uci.get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json" +local dnspath = uci.get("adblock", "global", "adb_dnsdir") or "" local parse = json.parse(fs.readfile(adbinput) or "") -local dnsFile1 = sys.exec("find '/tmp/dnsmasq.d/.adb_hidden' -maxdepth 1 -type f -name 'adb_list*' -print 2>/dev/null") -local dnsFile2 = sys.exec("find '/var/lib/unbound/.adb_hidden' -maxdepth 1 -type f -name 'adb_list*' -print 2>/dev/null") +if parse ~= nil then + version = parse.data.adblock_version + domains = parse.data.blocked_domains + fetch = parse.data.fetch_info + backend = parse.data.dns_backend + rundate = parse.data.last_rundate + if dnspath == "" then + if backend == "dnsmasq" then + dnspath = "/tmp/dnsmasq.d" + elseif backend == "unbound" then + dnspath = "/var/lib/unbound" + elseif backend == "named" then + dnspath = "/var/lib/bind" + end + end +end +local dnsfile = dnspath .. "/.adb_hidden/adb_list.overall" m = Map("adblock", translate("Adblock"), translate("Configuration of the adblock package to block ad/abuse domains by using DNS. ") @@ -17,7 +33,13 @@ m = Map("adblock", translate("Adblock"), .. "see online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md")) function m.on_after_commit(self) - luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1") + function e3.validate(self, value) + if value == "0" then + luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1") + else + luci.sys.call("/etc/init.d/adblock start >/dev/null 2>&1") + end + end luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock")) end @@ -30,7 +52,7 @@ o1.default = o1.enabled o1.rmempty = false btn = s:option(Button, "", translate("Suspend / Resume adblock")) -if dnsFile1 ~= "" or dnsFile2 ~= "" then +if parse ~= nil and nixio.fs.access(dnsfile) then btn.inputtitle = translate("Resume adblock") btn.inputstyle = "apply" btn.disabled = false @@ -72,52 +94,53 @@ dv1 = s:option(DummyValue, "status", translate("Status")) dv1.template = "adblock/runtime" if parse == nil then dv1.value = translate("n/a") -elseif parse.data.blocked_domains == "0" then +elseif domains == "0" then dv1.value = translate("no domains blocked") -elseif dnsFile1 ~= "" or dnsFile2 ~= "" then +elseif nixio.fs.access(dnsfile) then dv1.value = translate("suspended") else dv1.value = translate("active") end + dv2 = s:option(DummyValue, "adblock_version", translate("Adblock version")) dv2.template = "adblock/runtime" -if parse ~= nil then - dv2.value = parse.data.adblock_version or translate("n/a") -else +if parse == nil then dv2.value = translate("n/a") +else + dv2.value = version end dv3 = s:option(DummyValue, "fetch_info", translate("Download Utility (SSL Library)"), translate("For SSL protected blocklist sources you need a suitable SSL library, e.g. 'libustream-ssl' or the wget 'built-in'.")) dv3.template = "adblock/runtime" -if parse ~= nil then - dv3.value = parse.data.fetch_info or translate("n/a") -else +if parse == nil then dv3.value = translate("n/a") +else + dv3.value = fetch end dv4 = s:option(DummyValue, "dns_backend", translate("DNS backend")) dv4.template = "adblock/runtime" -if parse ~= nil then - dv4.value = parse.data.dns_backend or translate("n/a") -else +if parse == nil then dv4.value = translate("n/a") +else + dv4.value = backend end dv5 = s:option(DummyValue, "blocked_domains", translate("Blocked domains (overall)")) dv5.template = "adblock/runtime" -if parse ~= nil then - dv5.value = parse.data.blocked_domains or translate("n/a") -else +if parse == nil then dv5.value = translate("n/a") +else + dv5.value = domains end dv6 = s:option(DummyValue, "last_rundate", translate("Last rundate")) dv6.template = "adblock/runtime" -if parse ~= nil then - dv6.value = parse.data.last_rundate or translate("n/a") -else +if parse == nil then dv6.value = translate("n/a") +else + dv6.value = rundate end -- Blocklist table @@ -157,12 +180,18 @@ e2 = e:option(Flag, "adb_forcesrt", translate("Force Overall Sort"), e2.default = e2.disabled e2.rmempty = false -e3 = e:option(Flag, "adb_backup", translate("Enable blocklist backup")) +e3 = e:option(Flag, "adb_manmode", translate("Manual mode"), + translate("Do not automatically update blocklists during startup, use blocklist backups instead.")) e3.default = e3.disabled e3.rmempty = false -e4 = e:option(Value, "adb_backupdir", translate("Backup directory")) -e4.datatype = "directory" +e4 = e:option(Flag, "adb_backup", translate("Enable blocklist backup"), + translate("Create compressed blocklist backups, they will be used in case of download errors or during startup in manual mode.")) +e4.default = e4.disabled e4.rmempty = false +e5 = e:option(Value, "adb_backupdir", translate("Backup directory")) +e5.datatype = "directory" +e5.rmempty = false + return m diff --git a/applications/luci-app-adblock/po/ja/adblock.po b/applications/luci-app-adblock/po/ja/adblock.po index ac470fedd6..07fd783ed2 100644 --- a/applications/luci-app-adblock/po/ja/adblock.po +++ b/applications/luci-app-adblock/po/ja/adblock.po @@ -8,7 +8,7 @@ msgstr "" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.1\n" +"X-Generator: Poedit 2.0.2\n" "Language: ja\n" msgid "Adblock" @@ -50,12 +50,27 @@ msgstr "" "DNS の利用によって広告/不正ドメインをブロックする、Adblock パッケージの設定で" "す。" +msgid "" +"Create compressed blocklist backups, they will be used in case of download " +"errors or during startup in manual mode." +msgstr "" +"圧縮されたブロックリストのバックアップを作成します。これは、リストのダウン" +"ロードがエラーの場合、またはマニュアル モードでサービスを起動時に使用されま" +"す。" + msgid "DNS backend" msgstr "DNS バックエンド" msgid "Description" msgstr "説明" +msgid "" +"Do not automatically update blocklists during startup, use blocklist backups " +"instead." +msgstr "" +"サービス起動時にブロックリストを自動的に更新せず、代わりにバックアップされた" +"ブロックリストを使用します。" + msgid "Download Utility (SSL Library)" msgstr "ダウンロード ユーティリティ(SSL ライブラリ)" @@ -95,7 +110,7 @@ msgid "" "'libustream-ssl' or the wget 'built-in'." msgstr "" "SSLで保護されているブロックリストの取得には、適切なSSL ライブラリが必要です。" -"例: 'libustream-ssl' または wget 'ビルトイン'" +"例: 'libustream-ssl' または wget 'built-in'" msgid "" "For further information <a href=\"%s\" target=\"_blank\">see online " @@ -122,6 +137,9 @@ msgstr "最終実行日時" msgid "Loading" msgstr "読込中" +msgid "Manual mode" +msgstr "マニュアル モード" + msgid "No" msgstr "いいえ" @@ -251,129 +269,3 @@ msgstr "ブロックされたドメインはありません" msgid "suspended" msgstr "一時停止中" - -#~ msgid "." -#~ msgstr "。" - -#~ msgid "For further information" -#~ msgstr "詳細な情報は" - -#~ msgid "see online documentation" -#~ msgstr "オンライン ドキュメントを確認してください" - -#~ msgid "Backup options" -#~ msgstr "バックアップ オプション" - -#~ msgid "Restrict interface reload trigger to certain interface(s)" -#~ msgstr "リロード トリガを特定のインターフェースに限定する" - -#~ msgid "" -#~ "Space separated list of interfaces that trigger a reload action. To " -#~ "disable reload trigger at all remove all entries." -#~ msgstr "" -#~ "リロードのトリガとなる、スペースで区切られたインターフェースのリストです。" -#~ "リロード トリガを無効にするには、全てのエントリーを削除して空欄にします。" - -#~ msgid "" -#~ "Space separated list of interfaces that trigger a reload action. To " -#~ "disable reload trigger at all set it to 'false'." -#~ msgstr "" -#~ "リロードのトリガとなる、スペースで区切られたインターフェースのリストで" -#~ "す。'false' に設定した場合、全てのリロード トリガは無効になります。" - -#~ msgid "" -#~ "Please add only one domain per line. Comments introduced with '#' are " -#~ "allowed - ip addresses, wildcards & regex are not." -#~ msgstr "" -#~ "一行に一つのドメインを追加してください。'#' から始まるコメントを記述できま" -#~ "すが、IPアドレスやワイルドカード、正規表現を設定値として使用することはでき" -#~ "ません。" - -#~ msgid "" -#~ "). Note that list URLs and Shallalist category selections are not " -#~ "configurable via Luci." -#~ msgstr "" -#~ ")。これらのリストのURLおよびshallaリストの選択済みカテゴリーは、Luciを通" -#~ "して設定することができません。" - -#~ msgid "Available blocklist sources (" -#~ msgstr "利用可能なブロックリスト提供元です(" - -#~ msgid "" -#~ "File with whitelisted hosts/domains that are allowed despite being on a " -#~ "blocklist." -#~ msgstr "" -#~ "ホワイトリスト ファイル内のホスト/ドメインは、ブロックリストの登録に関わら" -#~ "ず許可されます。" - -#~ msgid "Global options" -#~ msgstr "一般設定" - -#~ msgid "Restrict reload trigger to certain interface(s)" -#~ msgstr "リロードトリガを特定のインターフェースに限定する" - -#~ msgid "" -#~ "Space separated list of wan interfaces that trigger reload action. To " -#~ "disable reload trigger set it to 'false'. Default: empty" -#~ msgstr "" -#~ "リロード実行のトリガとなる、スペースで区切られたWANインターフェースのリス" -#~ "トです。リロードトリガを無効にするには、 false を設定します。デフォルト:" -#~ "(空)" - -#~ msgid "Whitelist file" -#~ msgstr "ホワイトリスト ファイル" - -#~ msgid "see list details" -#~ msgstr "リストの詳細を見る" - -#~ msgid "Count" -#~ msgstr "カウント" - -#~ msgid "Do not write status info to flash" -#~ msgstr "ステータス情報をフラッシュに書き込まない" - -#~ msgid "Last update of the blocklists" -#~ msgstr "ブロックリストの最終更新日時" - -#~ msgid "List date/state" -#~ msgstr "リスト日時/状態" - -#~ msgid "Name of the logical lan interface" -#~ msgstr "論理LANインターフェース名" - -#~ msgid "Percentage of blocked packets (before last update, IPv4/IPv6)" -#~ msgstr "ブロック済みパケットの割合(最終更新以前、IPv4/IPv6)" - -#~ msgid "Port of the adblock uhttpd instance" -#~ msgstr "adblock uhttpdインスタンスのポート" - -#~ msgid "Port of the adblock uhttpd instance for https links" -#~ msgstr "httpsリンク用adblock uhttpdインスタンスのポート" - -#~ msgid "Redirect all DNS queries to the local resolver" -#~ msgstr "全てのDNSクエリをローカルリゾルバにリダイレクト" - -#~ msgid "" -#~ "Skip writing update status information to the config file. Status fields " -#~ "on this page will not be updated." -#~ msgstr "" -#~ "更新ステータス情報をコンフィグファイルに書き込まず、スキップします。この" -#~ "ページのステータス画面は更新されなくなります。" - -#~ msgid "Statistics" -#~ msgstr "ステータス" - -#~ msgid "Timeout for blocklist fetch (seconds)" -#~ msgstr "ブロックリスト取得の制限時間(秒)" - -#~ msgid "Total count of blocked domains" -#~ msgstr "ブロック済みドメインの合計" - -#~ msgid "" -#~ "When adblock is active, all DNS queries are redirected to the local " -#~ "resolver in this server by default. You can disable that to allow queries " -#~ "to external DNS servers." -#~ msgstr "" -#~ "adblockがアクティブである時、全てのDNSクエリは既定でこのサーバー上のリゾル" -#~ "バにリダイレクトされます。外部DNSサーバーへのクエリを許可する場合、この設" -#~ "定を無効にすることもできます。" diff --git a/applications/luci-app-adblock/po/pt-br/adblock.po b/applications/luci-app-adblock/po/pt-br/adblock.po index 72f6910429..044352da63 100644 --- a/applications/luci-app-adblock/po/pt-br/adblock.po +++ b/applications/luci-app-adblock/po/pt-br/adblock.po @@ -51,12 +51,22 @@ msgstr "" "Configuração do pacote adblock para bloquear, usando o DNS, domínios que " "distribuem propagandas abusivas." +msgid "" +"Create compressed blocklist backups, they will be used in case of download " +"errors or during startup in manual mode." +msgstr "" + msgid "DNS backend" msgstr "" msgid "Description" msgstr "Descrição" +msgid "" +"Do not automatically update blocklists during startup, use blocklist backups " +"instead." +msgstr "" + msgid "Download Utility (SSL Library)" msgstr "" @@ -117,6 +127,9 @@ msgstr "" msgid "Loading" msgstr "" +msgid "Manual mode" +msgstr "" + msgid "No" msgstr "" diff --git a/applications/luci-app-adblock/po/sv/adblock.po b/applications/luci-app-adblock/po/sv/adblock.po index 7f271221ae..cf92dbddc0 100644 --- a/applications/luci-app-adblock/po/sv/adblock.po +++ b/applications/luci-app-adblock/po/sv/adblock.po @@ -40,12 +40,22 @@ msgstr "" "Konfiguration av paketet adblock för att blockera annons/otillåtna domäner " "genom att använda DNS." +msgid "" +"Create compressed blocklist backups, they will be used in case of download " +"errors or during startup in manual mode." +msgstr "" + msgid "DNS backend" msgstr "Bakände för DNS" msgid "Description" msgstr "Beskrivning" +msgid "" +"Do not automatically update blocklists during startup, use blocklist backups " +"instead." +msgstr "" + msgid "Download Utility (SSL Library)" msgstr "Nerladdningsprogram (SSL-bibliotek)" @@ -107,6 +117,9 @@ msgstr "" msgid "Loading" msgstr "Laddar" +msgid "Manual mode" +msgstr "" + msgid "No" msgstr "Nej" diff --git a/applications/luci-app-adblock/po/templates/adblock.pot b/applications/luci-app-adblock/po/templates/adblock.pot index c5771ef22e..5b5a96866a 100644 --- a/applications/luci-app-adblock/po/templates/adblock.pot +++ b/applications/luci-app-adblock/po/templates/adblock.pot @@ -38,12 +38,22 @@ msgid "" "Configuration of the adblock package to block ad/abuse domains by using DNS." msgstr "" +msgid "" +"Create compressed blocklist backups, they will be used in case of download " +"errors or during startup in manual mode." +msgstr "" + msgid "DNS backend" msgstr "" msgid "Description" msgstr "" +msgid "" +"Do not automatically update blocklists during startup, use blocklist backups " +"instead." +msgstr "" + msgid "Download Utility (SSL Library)" msgstr "" @@ -104,6 +114,9 @@ msgstr "" msgid "Loading" msgstr "" +msgid "Manual mode" +msgstr "" + msgid "No" msgstr "" diff --git a/applications/luci-app-adblock/po/zh-cn/adblock.po b/applications/luci-app-adblock/po/zh-cn/adblock.po index dfa03f32b1..46dc99e66e 100644 --- a/applications/luci-app-adblock/po/zh-cn/adblock.po +++ b/applications/luci-app-adblock/po/zh-cn/adblock.po @@ -50,12 +50,22 @@ msgid "" "Configuration of the adblock package to block ad/abuse domains by using DNS." msgstr "Adblock 配置工具,通过 DNS 来拦截广告和阻止域名。" +msgid "" +"Create compressed blocklist backups, they will be used in case of download " +"errors or during startup in manual mode." +msgstr "" + msgid "DNS backend" msgstr "DNS 后端" msgid "Description" msgstr "描述" +msgid "" +"Do not automatically update blocklists during startup, use blocklist backups " +"instead." +msgstr "" + msgid "Download Utility (SSL Library)" msgstr "" @@ -116,6 +126,9 @@ msgstr "" msgid "Loading" msgstr "加载中" +msgid "Manual mode" +msgstr "" + msgid "No" msgstr "否" |