mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 03:43:29 +00:00
update adbyby plus+ to fit new luci
This commit is contained in:
parent
06574b6d55
commit
b70eb7f2b0
@ -7,4 +7,12 @@ function index()
|
||||
end
|
||||
|
||||
entry({"admin", "services", "adbyby"}, cbi("adbyby"), _("ADBYBY Plus +"), 10).dependent = true
|
||||
entry({"admin","services","adbyby","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep adbyby >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -4,23 +4,14 @@ local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
|
||||
local m,s,o
|
||||
local Status
|
||||
|
||||
if SYS.call("pidof adbyby >/dev/null") == 0 then
|
||||
Status = translate("<strong><font color=\"green\">Adbyby Plus + is Running</font></strong>")
|
||||
else
|
||||
Status = translate("<strong><font color=\"red\">Adbyby Plus + is Not Running</font></strong>")
|
||||
end
|
||||
|
||||
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 Host,filtering ads without losing bandwidth</font>")
|
||||
|
||||
m:section(SimpleSection).template = "adbyby/adbyby_status"
|
||||
|
||||
s = m:section(TypedSection, "adbyby")
|
||||
s.anonymous = true
|
||||
s.description = translate(string.format("%s<br /><br />", Status))
|
||||
|
||||
|
||||
s:tab("basic", translate("Base Setting"))
|
||||
|
||||
@ -37,24 +28,11 @@ o:value("2", translate("No filter Mode (Must set in Client Filter Mode Settings
|
||||
o.default = 1
|
||||
o.rmempty = false
|
||||
|
||||
o = s:taboption("basic", Button, "proxy")
|
||||
o.title = translate("Transparent proxy")
|
||||
if SYS.call("iptables-save | grep ADBYBY >/dev/null") == 0 then
|
||||
o.inputtitle = translate("Click to disable")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
SYS.call("/etc/init.d/adbyby del_rule")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
|
||||
end
|
||||
else
|
||||
o.inputtitle = translate("Click to enable")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
SYS.call('[ -n "$(pgrep adbyby)" ] && /etc/init.d/adbyby add_rule')
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
|
||||
end
|
||||
end
|
||||
|
||||
mem = s:taboption("basic", Flag, "mem_mode")
|
||||
mem.title = translate("RAM Running Mode")
|
||||
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}'")
|
||||
@ -66,7 +44,6 @@ 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("%s<br /><br />", Status))
|
||||
o.description = translate(string.format("<strong>Lazy Rule:</strong>%s <strong> Video Rule:</strong>%s<br /><strong>Third Party Subscription Rule:</strong>%d lines <strong>User-defined Rule:</strong>%d lines", DL, DV, math.abs(NR-NU), NR))
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
@ -100,13 +77,6 @@ o.title = translate("Block Apple iOS OTA update")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
mem = s:taboption("advanced", Flag, "mem_mode")
|
||||
mem.title = translate("RAM Running Mode")
|
||||
mem.default = 1
|
||||
mem.rmempty = false
|
||||
mem.description = translate("Running Adbyby in RAM.More speed,less disk consumption")
|
||||
|
||||
|
||||
s:tab("help", translate("Plus+ Domain List"))
|
||||
|
||||
local conf = "/usr/share/adbyby/adhost.conf"
|
||||
|
@ -0,0 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[adbyby]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('adbyby_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Adbyby Plus+ <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Adbyby Plus+ <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="adbyby_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
Loading…
Reference in New Issue
Block a user