add adbyby updated time display and wrtwmon translate

This commit is contained in:
coolsnowwolf 2018-11-05 19:30:01 +08:00
parent 69a76b3999
commit 972cd4f0a4
8 changed files with 67 additions and 40 deletions

View File

@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +coreutils +coreutils-nohup +dnsmasq-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-adbyby-plus
PKG_VERSION:=2.0
PKG_RELEASE:=38
PKG_RELEASE:=39
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -4,6 +4,13 @@ local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local DL = SYS.exec("head -1 /usr/share/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4}'")
local DV = SYS.exec("head -1 /usr/share/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'")
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
local UD = SYS.exec("cat /tmp/adbyby.updated 2>/dev/null")
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
m = Map("adbyby")
m.title = translate("Adbyby Plus +")
m.description = translate("Adbyby Plus + can filter all kinds of banners, popups, video ads, and prevent tracking, privacy theft and a variety of malicious websites<br /><font color=\"red\">Plus + version combination mode can operation with Adblock Plus Hostfiltering ads without losing bandwidth</font>")
@ -34,17 +41,11 @@ mem.default = 1
mem.rmempty = false
mem.description = translate("Running Adbyby in RAM.More speed,less disk consumption")
local DL = SYS.exec("head -1 /usr/share/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4}'")
local DV = SYS.exec("head -1 /usr/share/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'")
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
--local NW = SYS.exec("uci get adbyby.@adbyby[-1].domain 2>/dev/null | wc -l")
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
o = s:taboption("basic", Button, "restart")
o.title = translate("Adbyby and Rule state")
o.inputtitle = translate("Restart Adbyby")
o.description = translate(string.format("<strong>Lazy Rule</strong>%s <strong>&nbsp;&nbsp;Video Rule</strong>%s<br /><strong>Third Party Subscription Rule</strong>%d lines&nbsp;&nbsp;<strong>User-defined Rule</strong>%d lines", DL, DV, math.abs(NR-NU), NR))
o.description = string.format("<strong>Last Update Checked</strong> %s<br /><strong>Lazy Rule</strong>%s <br /><strong>Video Rule</strong>%s", UD, DL, DV)
o.inputstyle = "reload"
o.write = function()
SYS.call("nohup sh /usr/share/adbyby/adupdate.sh > /tmp/adupdate.log 2>&1 &")

View File

@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for Wrtbwmon
LUCI_DEPENDS:=+luci-app-nlbwmon
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=6
PKG_RELEASE:=7
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -1,9 +1,9 @@
local m = Map("wrtbwmon", "详细设置")
local m = Map("wrtbwmon", translate("Details"))
local s = m:section(NamedSection, "general", "wrtbwmon", "通用设置")
local s = m:section(NamedSection, "general", "wrtbwmon", translate("General settings"))
local o = s:option(Flag, "persist", "写入数据库到 ROM",
"把统计数据写入 /etc/config 中避免重启或者升级后丢失 (需要占用 ROM 空间并降低闪存寿命)")
local o = s:option(Flag, "persist", translate("Persist database"),
translate("Check this to persist the database file"))
o.rmempty = false
function o.write(self, section, value)

View File

@ -3,8 +3,8 @@ local USER_FILE_PATH = "/etc/config/wrtbwmon.user"
local fs = require "nixio.fs"
local f = SimpleForm("wrtbwmon",
"自定义MAC地址对应的主机名",
"每一行的格式为 00:aa:bb:cc:ee:ff,username (不支持中文主机名)")
translate("Usage - Custom User File"),
translate("This file is used to match users with MAC addresses and it must have the following format: 00:aa:bb:cc:ee:ff,username"))
local o = f:field(Value, "_custom")

View File

@ -1,35 +1,35 @@
<%+header%>
<h2>客户端实时流量监测</h2>
<h2><%=translate("Usage")%></h2>
<p style="position:relative;">
<button id="resetDatabase" class="cbi-button" style="position:absolute;right:0;bottom:0;">重置统计数据库</button>
<button id="resetDatabase" class="cbi-button" style="position:absolute;right:0;bottom:0;"><%=translate("Reset Database")%></button>
</p>
<p>
<small><span id="updated"></span> <span id="updating"></span></small>
<span style="float:right;text-align:right;">
<label>
<small>数据自动刷新间隔</small>
<small><%=translate("Auto Refresh Interval")%></small>
<select id="intervalSelect" style="width:90px;height:20px;font-size:11px;">
<option value="-1">禁用</option>
<option value="1">1 </option>
<option value="2">2 </option>
<option value="3">3 </option>
<option value="4">4 </option>
<option value="5" selected="selected">5 </option>
<option value="10">10 </option>
<option value="20">20 </option>
<option value="30">30 </option>
<option value="40">40 </option>
<option value="50">50 </option>
<option value="60">60 </option>
<option value="120">2 分钟</option>
<option value="180">3 分钟</option>
<option value="240">4 分钟</option>
<option value="360">5 分钟</option>
<option value="-1"><%=translate("Disabled")%></option>
<option value="1">1 <%=translate("Second")%></option>
<option value="2">2 <%=translate("Seconds")%></option>
<option value="3">3 <%=translate("Seconds")%></option>
<option value="4">4 <%=translate("Seconds")%></option>
<option value="5" selected="selected">5 <%=translate("Seconds")%></option>
<option value="10">10 <%=translate("Seconds")%></option>
<option value="20">20 <%=translate("Seconds")%></option>
<option value="30">30 <%=translate("Seconds")%></option>
<option value="40">40 <%=translate("Seconds")%></option>
<option value="50">50 <%=translate("Seconds")%></option>
<option value="60">60 <%=translate("Seconds")%></option>
<option value="120">2 <%=translate("Minutes")%></option>
<option value="180">3 <%=translate("Minutes")%></option>
<option value="240">4 <%=translate("Minutes")%></option>
<option value="360">5 <%=translate("Minutes")%></option>
</select>
</label>
<br/>
<label>
<small>合并计算客户端流量</small>
<small><%=translate("Per-host Totals")%></small>
<input id="perHostTotals" type="checkbox" style="vertical-align:middle;"/>
</label>
<!-- label>
@ -39,7 +39,7 @@
</span>
</p>
<table class="table">
<tbody id="tableBody"><tr><td>Loading...</td></tr></tbody>
<tbody id="tableBody"><tr><td><%=translate("Loading...")%></td></tr></tbody>
</table>
<!--suppress HtmlUnknownTarget -->
<script src="/luci-static/wrtbwmon.js"></script>

View File

@ -1,3 +1,6 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Usage"
msgstr "实时流量监测"
@ -19,12 +22,35 @@ msgstr "通用设置"
msgid "Persist database"
msgstr "写入数据库到硬盘"
msgid "Check this to persist the database file under /etc/config. "
msgstr "把统计数据写入 /etc/config 中避免重启或者升级后丢失 需要占用空间并降低ROM寿命"
msgid "Check this to persist the database file"
msgstr "把统计数据写入 /etc/config 中避免重启或者升级后丢失"
msgid "Usage - Custom User File"
msgstr "自定义MAC地址对应的主机名"
msgid "This file is used to match users with MAC addresses and it must have the following format: 00:aa:bb:cc:ee:ff,username"
msgstr "每一行的格式为 00:aa:bb:cc:ee:ff,username (不支持中文主机名)"
msgstr "每一行的格式为 00:aa:bb:cc:ee:ff,username"
msgid "Reset Database"
msgstr "重置数据库"
msgid "Auto Refresh Interval"
msgstr "自动刷新间隔"
msgid "Disabled"
msgstr "禁用"
msgid "Second"
msgstr "秒"
msgid "Seconds"
msgstr "秒"
msgid "Minutes"
msgstr "分钟"
msgid "Per-host Totals"
msgstr "合并每一客户端数据"
msgid "Loading..."
msgstr "加载中..."

View File

@ -1 +1 @@
/etc/init.d/wrtbwmon restart
/etc/init.d/wrtbwmon restart >/dev/null 2>&1