update-11.05

This commit is contained in:
github-actions[bot] 2021-11-05 09:00:24 +08:00
parent d3a1a0d019
commit d1cb981e28
37 changed files with 644 additions and 659 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dnsfilter
PKG_VERSION:=1.0
PKG_RELEASE:=11
PKG_RELEASE:=12
PKG_LICENSE:=GPLv2
PKG_MAINTAINER:=small_5 kiddin9

View File

@ -1,45 +1,48 @@
module("luci.controller.dnsfilter",package.seeall)
function index()
if not nixio.fs.access("/etc/config/dnsfilter") then
return
end
local page = entry({"admin","services","dnsfilter"},alias("admin","services","dnsfilter","base"),_("DNS Filter"),9)
local page = entry({"admin", "services", "dnsfilter"}, alias("admin", "services", "dnsfilter", "base"), _("DNS Filter"), 9)
page.dependent = true
page.acl_depends = { "luci-app-dnsfilter" }
entry({"admin","services","dnsfilter","base"},cbi("dnsfilter/base"),_("Base Setting"),10).leaf=true
entry({"admin","services","dnsfilter","white"},form("dnsfilter/white"),_("White Domain List"),20).leaf=true
entry({"admin","services","dnsfilter","black"},form("dnsfilter/black"),_("Block Domain List"),30).leaf=true
entry({"admin","services","dnsfilter","ip"},form("dnsfilter/ip"),_("Block IP List"),40).leaf=true
entry({"admin","services","dnsfilter","log"},form("dnsfilter/log"),_("Update Log"),50).leaf=true
entry({"admin","services","dnsfilter","run"},call("act_status")).leaf = true
entry({"admin","services","dnsfilter","refresh"},call("refresh_data"))
entry({"admin", "services", "dnsfilter", "base"}, cbi("dnsfilter/base"), _("Base Setting"), 10).leaf = true
entry({"admin", "services", "dnsfilter", "white"}, form("dnsfilter/white"), _("White Domain List"), 20).leaf = true
entry({"admin", "services", "dnsfilter", "black"}, form("dnsfilter/black"), _("Block Domain List"), 30).leaf = true
entry({"admin", "services", "dnsfilter", "ip"}, form("dnsfilter/ip"), _("Block IP List"), 40).leaf = true
entry({"admin", "services", "dnsfilter", "log"}, form("dnsfilter/log"), _("Update Log"), 50).leaf = true
entry({"admin", "services", "dnsfilter", "run"}, call("act_status")).leaf = true
entry({"admin", "services", "dnsfilter", "refresh"}, call("refresh_data"))
end
function act_status()
local e={}
e.running=luci.sys.call("[ -s /tmp/dnsmasq.dnsfilter/rules.conf ]")==0
local e = {}
e.running = luci.sys.call("[ -s /tmp/dnsmasq.dnsfilter/rules.conf ]") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
function refresh_data()
local set=luci.http.formvalue("set")
local icount=0
local set = luci.http.formvalue("set")
local icount = 0
luci.sys.exec("/usr/share/dnsfilter/dnsfilter down")
icount=luci.sys.exec("find /tmp/ad_tmp -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l")
icount = luci.sys.exec("find /tmp/ad_tmp -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l")
if tonumber(icount)>0 then
oldcount=luci.sys.exec("find /tmp/dnsfilter -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l")
oldcount = luci.sys.exec("find /tmp/dnsfilter -type f -name rules.conf -exec cat {} \\; 2>/dev/null | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("[ -h /tmp/dnsfilter/url ] && (rm -f /etc/dnsfilter/rules/*;cp -a /tmp/ad_tmp/* /etc/dnsfilter/rules) || (rm -f /tmp/dnsfilter/*;cp -a /tmp/ad_tmp/* /tmp/dnsfilter)")
luci.sys.exec("/etc/init.d/dnsfilter restart &")
retstring=tostring(math.ceil(tonumber(icount)))
retstring = tostring(math.ceil(tonumber(icount)))
else
retstring=0
retstring = 0
end
luci.sys.call("echo `date +'%Y-%m-%d %H:%M:%S'` > /tmp/dnsfilter/dnsfilter.updated")
else
retstring="-1"
retstring = "-1"
end
luci.sys.exec("rm -rf /tmp/ad_tmp")

View File

@ -1,60 +1,62 @@
local SYS=require "luci.sys"
local SYS = require "luci.sys"
m=Map("dnsfilter")
m.title=translate("DNS Filter")
m.description=translate("Support AdGuardHome/Host/DNSMASQ/Domain Rules")
m:section(SimpleSection).template="dnsfilter/dnsfilter_status"
m = Map("dnsfilter")
m.title = translate("DNS Filter")
m.description = translate("Support AdGuardHome/Host/DNSMASQ/Domain Rules")
m:section(SimpleSection).template = "dnsfilter/dnsfilter_status"
s=m:section(TypedSection,"dnsfilter")
s.anonymous=true
s = m:section(TypedSection, "dnsfilter")
s.anonymous = true
o=s:option(Flag,"enable")
o.title=translate("Enable")
o.rmempty=false
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false
o=s:option(Flag,"block_ios")
o.title=translate("Block Apple iOS OTA update")
o = s:option(Flag, "block_ios", translate("Block Apple iOS OTA update"))
o.rmempty = false
o.default = 0
o=s:option(Flag,"block_cnshort")
o.title=translate("Block CNshort APP and Website")
o = s:option(Flag, "block_cnshort", translate("Block CNshort APP and Website"))
o.rmempty = false
o.default = 0
o=s:option(Flag,"safe_search")
o.title=translate("Safe Search")
o.description=translate("Enforcing SafeSearch for google, bing, duckduckgo, yandex and youtube.")
o = s:option(Flag, "safe_search", translate("Safe Search"))
o.description = translate("Enforcing SafeSearch for Google Bing Duckduckgo Yandex and Youtube.")
o.rmempty = false
o.default = 0
o=s:option(Flag,"cron_mode")
o.title=translate("Enable automatic update rules")
o = s:option(Flag, "cron_mode", translate("Enable automatic update rules"))
o.rmempty = false
o.default = 1
o=s:option(ListValue,"time_update")
o.title=translate("Update time (every day)")
for s=0,23 do
o = s:option(ListValue, "time_update", translate("Update time (every day)"))
for s = 0,23 do
o:value(s, s .. ':00')
end
o.default=6
o.default = 6
o:depends("cron_mode",1)
tmp_rule=0
tmp_rule = 0
if nixio.fs.access("/tmp/dnsfilter/rules.conf") then
tmp_rule=1
UD=SYS.exec("cat /tmp/dnsfilter/dnsfilter.updated 2>/dev/null")
rule_count=tonumber(SYS.exec("find /tmp/dnsfilter -exec cat {} \\; 2>/dev/null | wc -l"))
o=s:option(DummyValue,"1",translate("Subscribe Rules Data"))
o.rawhtml=true
o.template="dnsfilter/dnsfilter_refresh"
o.value=rule_count.." "..translate("Records")
o.description=string.format(translate("AdGuardHome / Host / DNSMASQ / Domain rules auto-convert").."<br/><strong>"..translate("Last Update Checked")..":</strong> %s<br/>",UD)
tmp_rule = 1
UD = SYS.exec("cat /tmp/dnsfilter/dnsfilter.updated 2>/dev/null")
rule_count = tonumber(SYS.exec("find /tmp/dnsfilter -exec cat {} \\; 2>/dev/null | wc -l"))
o = s:option(DummyValue, "1", translate("Subscribe Rules Data"))
o.rawhtml = true
o.template = "dnsfilter/dnsfilter_refresh"
o.value = rule_count.." "..translate("Records")
o.description = string.format(translate("AdGuardHome / Host / DNSMASQ / Domain rules auto-convert").."<br/><strong>"..translate("Last Update Checked")..":</strong> %s<br/>",UD)
end
o=s:option(Flag,"flash")
o.title=translate("Save rules to flash")
o.description=translate("Should be enabled when rules addresses are slow to download")
o.rmempty=false
o = s:option(Flag, "flash", translate("Save rules to flash"))
o.description = translate("Should be enabled when rules addresses are slow to download")
o.rmempty = false
o.default = 0
if tmp_rule==1 then
o=s:option(Button,"delete",translate("Delete All Subscribe Rules"))
o.inputstyle="reset"
o.description=translate("Delete rules files and delete the subscription link<br/>There is no need to click for modify the subscription link,The script will automatically replace the old rule file")
o.write=function()
o = s:option(Button, "delete", translate("Delete All Subscribe Rules"))
o.inputstyle = "reset"
o.description = translate("Delete rules files and delete the subscription link<br/>There is no need to click for modify the subscription link,The script will automatically replace the old rule file")
o.write = function()
SYS.exec("[ -d /etc/dnsfilter/rules ] && rm -rf /etc/dnsfilter/rules")
SYS.exec("grep -wq 'list url' /etc/config/dnsfilter && sed -i '/list url/d' /etc/config/dnsfilter && /etc/init.d/dnsfilter restart 2>&1 &")
luci.http.redirect(luci.dispatcher.build_url("admin","services","dnsfilter","base"))
@ -63,19 +65,20 @@ end
if luci.sys.call("[ -h /tmp/dnsfilter/url ] || exit 9")==9 then
if nixio.fs.access("/etc/dnsfilter/rules") then
o=s:option(Button,"delete_1",translate("Delete Subscribe Rules On The Flash"))
o.inputstyle="reset"
o.write=function()
o = s:option(Button, "delete_1", translate("Delete Subscribe Rules On The Flash"))
o.inputstyle = "reset"
o.write = function()
SYS.exec("rm -rf /etc/dnsfilter/rules")
luci.http.redirect(luci.dispatcher.build_url("admin","services","dnsfilter","base"))
end
end
end
o=s:option(DynamicList,"url",translate("Anti-AD Rules Subscribe"))
o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf","anti-AD")
o:value("https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt","AdGuard")
o:value("https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt","Easylistchina+Easylist")
o:value("https://block.energized.pro/extensions/porn-lite/formats/domains.txt","Anti-Porn")
o = s:option(DynamicList, "url", translate("Anti-AD Rules Subscribe"))
o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf", translate("anti-AD"))
o:value("https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt", translate("AdGuard"))
o:value("https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt", translate("Easylistchina+Easylist"))
o:value("https://block.energized.pro/extensions/porn-lite/formats/domains.txt", translate("Anti-Porn"))
o.default = "https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf"
return m

View File

@ -1,11 +1,12 @@
local fs=require "nixio.fs"
local conffile="/etc/dnsfilter/black.list"
local fs = require "nixio.fs"
local conffile = "/etc/dnsfilter/black.list"
f=SimpleForm("custom")
t=f:field(TextValue,"conf")
t.rmempty=true
f = SimpleForm("custom")
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows=13
t.description=translate("Will Always block these Domain")
t.description = translate("Will Always block these Domain")
function t.cfgvalue()
return fs.readfile(conffile) or ""
end

View File

@ -1,11 +1,12 @@
local fs=require "nixio.fs"
local conffile="/etc/dnsfilter/ip.list"
local fs = require "nixio.fs"
local conffile = "/etc/dnsfilter/ip.list"
f=SimpleForm("custom")
t=f:field(TextValue,"conf")
t.rmempty=true
f = SimpleForm("custom")
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows=13
t.description=translate("Will Always block these IP")
t.description = translate("Will Always block these IP")
function t.cfgvalue()
return fs.readfile(conffile) or ""
end

View File

@ -1,15 +1,16 @@
local fs=require "nixio.fs"
local conffile="/tmp/adupdate.log"
local fs = require "nixio.fs"
local conffile = "/tmp/adupdate.log"
f = SimpleForm("logview")
f.reset = false
f.submit = false
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 20
f=SimpleForm("logview")
f.reset=false
f.submit=false
t=f:field(TextValue,"conf")
t.rmempty=true
t.rows=20
function t.cfgvalue()
return fs.readfile(conffile) or ""
end
t.readonly="readonly"
t.readonly = "readonly"
return f

View File

@ -1,11 +1,12 @@
local fs=require "nixio.fs"
local conffile="/etc/dnsfilter/white.list"
local fs = require "nixio.fs"
local conffile = "/etc/dnsfilter/white.list"
f = SimpleForm("custom")
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 13
t.description = translate("Will Never filter these Domain")
f=SimpleForm("custom")
t=f:field(TextValue,"conf")
t.rmempty=true
t.rows=13
t.description=translate("Will Never filter these Domain")
function t.cfgvalue()
return fs.readfile(conffile) or ""
end

View File

@ -17,7 +17,7 @@ msgid "Enable"
msgstr "启用"
msgid "Block Apple iOS OTA update"
msgstr "拦截 Apple iOS 的OTA更新"
msgstr "拦截 Apple iOS 的OTA 更新"
msgid "Block CNshort APP and Website"
msgstr "拦截 短视频 APP 和网站"
@ -77,7 +77,7 @@ msgid "Delete Subscribe Rules On The Flash"
msgstr "清空闪存上的订阅规则库"
msgid "Anti-AD Rules Subscribe"
msgstr "广告过滤规则订阅URL"
msgstr "广告过滤规则订阅 URL"
msgid "White Domain List"
msgstr "域名白名单"
@ -92,16 +92,16 @@ msgid "Will Always block these Domain"
msgstr "拦截黑名单内的域名"
msgid "Block IP List"
msgstr "IP黑名单"
msgstr "IP 黑名单"
msgid "Will Always block these IP"
msgstr "拦截黑名单内的IP地址"
msgstr "拦截黑名单内的 IP 地址"
msgid "Safe Search"
msgstr "安全搜索"
msgid "Enforcing SafeSearch for google, bing, duckduckgo, yandex and youtube."
msgstr "强制为google,bing,duckduckgo,yandex,youtube开启安全搜索,过滤不健康内容"
msgid "Enforcing SafeSearch for Google Bing Duckduckgo Yandex and Youtube."
msgstr "强制为 Google Bing Duckduckgo Yandex Youtube 开启安全搜索,过滤不健康内容"
msgid "Update Log"
msgstr "更新日志"

View File

@ -4,5 +4,3 @@ config dnsfilter
option time_update '6'
option flash '0'
option enable '0'
list url 'https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD@master/adblock-for-dnsmasq.conf'

View File

@ -2,53 +2,17 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-godproxy
PKG_VERSION:=3.8.5
PKG_RELEASE:=3-20210917
PKG_RELEASE:=3-20211105
include $(INCLUDE_DIR)/package.mk
PKG_MAINTAINER:=panda-mute <wxuzju@gmail.com>
define Package/luci-app-godproxy
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI support for koolproxy
DEPENDS:=+openssl-util +ipset +dnsmasq-full +@BUSYBOX_CONFIG_DIFF +iptables-mod-nat-extra +wget
MAINTAINER:=panda-mute <wxuzju@gmail.com>
LUCI_TITLE:=LuCI support for koolproxy
LUCI_PKGARCH:=all
LUCI_DEPENDS:=@TARGET_x86_64 +openssl-util +ipset +dnsmasq-full +@BUSYBOX_CONFIG_DIFF +iptables-mod-nat-extra +wget
define Package/$(PKG_NAME)/conffiles
/etc/config/koolproxy
/usr/share/koolproxy/data/rules/
endef
define Build/Compile
endef
define Package/luci-app-godproxy/conffiles
/etc/config/koolproxy
/usr/share/koolproxy/data/rules/
endef
define Package/luci-app-godproxy/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/
cp -pR ./root/* $(1)/
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
po2lmo ./po/zh-cn/koolproxy.po $(1)/usr/lib/lua/luci/i18n/koolproxy.zh-cn.lmo
ifeq ($(ARCH),aarch64)
$(INSTALL_BIN) ./bin/aarch64 $(1)/usr/share/koolproxy/koolproxy
else ifeq ($(ARCH),arm)
$(INSTALL_BIN) ./bin/arm $(1)/usr/share/koolproxy/koolproxy
else ifeq ($(ARCH),i386)
$(INSTALL_BIN) ./bin/i386 $(1)/usr/share/koolproxy/koolproxy
else ifeq ($(ARCH),mips)
$(INSTALL_BIN) ./bin/mips $(1)/usr/share/koolproxy/koolproxy
else ifeq ($(ARCH),mipsel)
$(INSTALL_BIN) ./bin/mipsel $(1)/usr/share/koolproxy/koolproxy
else ($(ARCH),x86_64)
$(INSTALL_BIN) ./bin/x86_64 $(1)/usr/share/koolproxy/koolproxy
endif
endef
$(eval $(call BuildPackage,luci-app-godproxy))
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,3 +1,7 @@
## 更新2021年11月5日
1、感谢 [Beginner-Go](https://github.com/Beginner-Go) 大佬提供最近几次修复。
2、已经修复开启视频规则导致软件无法运行问题。主要原因是猴子大佬的规则内容清空了。直接在后台重新更新规则即可。
## 更新2021年3月23日
感谢 [maple's sky](https://github.com/maplesky) 大佬提供技术支持,修复状态栏不动态问题。

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,15 +4,26 @@ function index()
if not nixio.fs.access("/etc/config/koolproxy") then
return
end
entry({"admin","services","koolproxy"},cbi("koolproxy/global"),_("KoolproxyR Plus+"),1).dependent=true
entry({"admin","services","koolproxy","rss_rule"},cbi("koolproxy/rss_rule"), nil).leaf=true
entry({"admin","services","koolproxy","status"},call("act_status")).leaf=true
entry({"admin", "services", "koolproxy"}, alias("admin", "services", "koolproxy", "basic"),_("GodProxy 滤广告"), 1).dependent = true
entry({"admin", "services", "koolproxy", "basic"}, cbi("koolproxy/basic"), _("基本设置"), 1).leaf = true
entry({"admin", "services", "koolproxy", "control"}, cbi("koolproxy/control"), _("访问控制"), 2).leaf = true
entry({"admin", "services", "koolproxy", "add_rule"}, cbi("koolproxy/add_rule"), _("规则订阅"), 3).leaf = true
entry({"admin", "services", "koolproxy", "cert"}, cbi("koolproxy/cert"), _("证书管理"), 4).leaf = true
entry({"admin", "services", "koolproxy", "white_list"}, cbi("koolproxy/white_list"), _("网站白名单设置"), 5).leaf = true
entry({"admin", "services", "koolproxy", "black_list"}, cbi("koolproxy/black_list"), _("网站黑名单设置"), 6).leaf = true
entry({"admin", "services", "koolproxy", "ip_white_list"}, cbi("koolproxy/ip_white_list"), _("IP白名单设置"), 7).leaf = true
entry({"admin", "services", "koolproxy", "ip_black_list"}, cbi("koolproxy/ip_black_list"), _("IP黑名单设置"), 8).leaf = true
entry({"admin", "services", "koolproxy", "custom_rule"}, cbi("koolproxy/custom_rule"), _("自定义规则"), 9).leaf = true
entry({"admin", "services", "koolproxy", "update_log"}, cbi("koolproxy/update_log"), _("更新日志"), 10).leaf = true
entry({"admin", "services", "koolproxy", "tips"}, cbi("koolproxy/tips"), _("帮助支持"), 11).leaf = true
entry({"admin", "services", "koolproxy", "rss_rule"}, cbi("koolproxy/rss_rule"), nil).leaf = true
entry({"admin", "services", "koolproxy", "status"}, call("act_status")).leaf = true
end
function act_status()
local e={}
e.running=luci.sys.call("pidof koolproxy >/dev/null")==0
local e = {}
e.running = luci.sys.call("pidof koolproxy >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,74 @@
o = Map("koolproxy")
t = o:section(TypedSection,"rss_rule", translate("GodProxy 规则订阅"))
t.description = translate("请确保订阅规则的兼容性")
t.anonymous = true
t.addremove = true
t.sortable = true
t.template = "cbi/tblsection"
t.extedit = luci.dispatcher.build_url("admin/services/koolproxy/rss_rule/%s")
e = t:option(Flag, "load", translate("启用"))
e.rmempty = false
e.default = 0
e = t:option(DummyValue, "name", translate("规则名称"))
function e.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
e = t:option(DummyValue,"url", translate("规则地址"))
function e.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
t.create = function(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(t.extedit % sid)
return
end
end
e = t:option(DummyValue, "time", translate("更新时间"))
function Download()
local t,e
t = nixio.open("/tmp/upload/koolproxyca.tar.gz","r")
luci.http.header('Content-Disposition','attachment; filename="koolproxyCA.tar.gz"')
luci.http.prepare_content("application/octet-stream")
while true do
e = t:read(nixio.const.buffersize)
if(not e)or(#e==0)then
break
else
luci.http.write(e)
end
end
t:close()
luci.http.close()
end
local t,e
t = "/tmp/upload/"
nixio.fs.mkdir(t)
luci.http.setfilehandler(
function(o,a,i)
if not e then
if not o then return end
e = nixio.open(t..o.file,"w")
if not e then
return
end
end
if a and e then
e:write(a)
end
if i and e then
e:close()
e = nil
luci.sys.call("/usr/share/koolproxy/camanagement restore 2>&1 >/dev/null")
end
end)
return o

View File

@ -0,0 +1,121 @@
-- Copyright 2018 Nick Peng (pymumu@gmail.com)
require ("nixio.fs")
require ("luci.http")
require ("luci.dispatcher")
require ("nixio.fs")
local fs = require "nixio.fs"
local sys = require "luci.sys"
local http = require "luci.http"
local o,t,e
local v = luci.sys.exec("/usr/share/koolproxy/koolproxy -v")
local a = luci.sys.exec("head -3 /usr/share/koolproxy/data/rules/koolproxy.txt | grep rules | awk -F' ' '{print $3,$4}'")
local b = luci.sys.exec("head -4 /usr/share/koolproxy/data/rules/koolproxy.txt | grep video | awk -F' ' '{print $3,$4}'")
local c = luci.sys.exec("head -3 /usr/share/koolproxy/data/rules/daily.txt | grep rules | awk -F' ' '{print $3,$4}'")
local s = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/easylistchina.txt | wc -l")
local m = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/mv.txt | wc -l")
local u = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/fanboy.txt | wc -l")
local p = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/yhosts.txt | wc -l")
local h = luci.sys.exec("grep -v '^!' /usr/share/koolproxy/data/rules/user.txt | wc -l")
local l = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/koolproxy.txt | wc -l")
local q = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/daily.txt | wc -l")
local f = luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/anti-ad.txt | wc -l")
local i = luci.sys.exec("cat /usr/share/koolproxy/dnsmasq.adblock | wc -l")
o = Map("koolproxy")
o.title = translate("GodProxy 滤广告")
o.description = translate("GodProxy是基于KoolProxyR Plus重新整理的能识别adblock规则的免费开源软件,追求体验更快、更清洁的网络,屏蔽烦人的广告!")
o:section(SimpleSection).template = "koolproxy/koolproxy_status"
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(Flag, "enabled", translate("启用"))
e.rmempty = false
e.default = 0
e = t:option(Value, "startup_delay", translate("启动延迟"))
e:value(0, translate("不启用"))
for _, v in ipairs({5, 10, 15, 25, 40, 60}) do
e:value(v, translate("%u 秒") %{v})
end
e.datatype = "uinteger"
e.rmempty = false
e.default = 0
e = t:option(ListValue, "koolproxy_mode", translate("过滤模式"))
e.rmempty = false
e:value(1, translate("全局模式"))
e:value(2, translate("IPSET模式"))
e:value(3, translate("视频模式"))
e.default = 1
e = t:option(MultiValue, "koolproxy_rules", translate("内置规则"))
e.optional = false
e.rmempty = false
e:value("koolproxy.txt", translate("静态规则"))
e:value("daily.txt", translate("每日规则"))
e:value("kp.dat", translate("视频规则"))
e:value("user.txt", translate("自定义规则"))
e = t:option(MultiValue, "thirdparty_rules", translate("第三方规则"))
e.optional = true
e.rmempty = false
e:value("easylistchina.txt", translate("ABP规则"))
e:value("fanboy.txt", translate("Fanboy规则"))
e:value("yhosts.txt", translate("Yhosts规则"))
e:value("anti-ad.txt", translate("Anti-AD规则"))
e:value("mv.txt", translate("乘风视频"))
e = t:option(ListValue, "koolproxy_port", translate("端口控制"))
e.rmempty = false
e:value(0, translate("关闭"))
e:value(1, translate("开启"))
e.default = 0
e = t:option(ListValue, "koolproxy_ipv6", translate("IPv6支持"))
e.rmempty = false
e:value(0, translate("关闭"))
e:value(1, translate("开启"))
e.default = 0
e = t:option(Value, "koolproxy_bp_port", translate("例外端口"))
e.description = translate("单端口:80&nbsp;&nbsp;多端口:80,443")
e.rmempty = false
e:depends("koolproxy_port", "1")
e = t:option(Flag, "koolproxy_host", translate("开启Adblock Plus Hosts"))
e:depends("koolproxy_mode","2")
e.default = 0
e = t:option(ListValue, "koolproxy_acl_default", translate("默认访问控制"))
e.description = translate("访问控制设置中其他主机的默认规则")
e.rmempty = false
e:value(0, translate("不过滤"))
e:value(1, translate("过滤HTTP协议"))
e:value(2, translate("过滤HTTP(S)协议"))
e:value(3, translate("全部过滤"))
e.default = 1
e = t:option(ListValue, "time_update", translate("定时更新"))
e.description = translate("定时更新规则。请把时间修改掉,默认时间使用人数多会更新失败")
e.rmempty = false
for t = 0,23 do
e:value(t,translate("每天"..t..""))
end
e:value(nil, translate("关闭"))
e.default = nil
e = t:option(Button, "restart", translate("规则状态"))
e.inputtitle = translate("更新规则")
e.inputstyle = "reload"
e.write = function()
luci.sys.call("/usr/share/koolproxy/kpupdate 2>&1 >/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin","services","koolproxy"))
end
e.description = translate(string.format("<font color=\"red\"><strong>更新订阅规则与Adblock Plus Hosts</strong></font><br /><font color=\"green\">ABP规则: %s条<br />Fanboy规则: %s条<br />Yhosts规则: %s条<br />Anti-AD规则: %s条<br />静态规则: %s条<br />视频规则: %s<br />乘风视频: %s条<br />每日规则: %s条<br />自定义规则: %s条<br />Host: %s条</font><br />", s, u, p, f, l, b, m, q, h, i))
return o

View File

@ -0,0 +1,32 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(TextValue, "adblock_domain")
e.description = translate("加入的网址将走广告过滤端口。只针对黑名单模式。只能输入WEB地址google.com每个地址一行。")
e.rmempty = false
e.rows = 28
e.wrap = "off"
local fs = require "nixio.fs"
local i = "/etc/adblocklist/adblock"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adblock", value)
if (luci.sys.call("cmp -s /tmp/adblock /etc/adblocklist/adblock") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adblock")
end
return o

View File

@ -0,0 +1,31 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.title = translate("证书恢复")
t.description = translate("上传恢复已备份的证书文件名必须为koolproxyCA.tar.gz")
t.anonymous = true
e = t:option(DummyValue,"c1status")
e = t:option(FileUpload,"")
e.template = "koolproxy/caupload"
t = o:section(TypedSection, "global")
t.title = translate("证书备份")
t.description = translate("下载备份的证书")
t.anonymous = true
e = t:option(DummyValue,"",nil)
e.template = "koolproxy/cadvalue"
if nixio.fs.access("/usr/share/koolproxy/data/certs/ca.crt") then
e = t:option(DummyValue,"c2status")
e = t:option(Button,"certificate")
e.inputtitle = translate("下载证书备份")
e.inputstyle = "reload"
e.write=function()
luci.sys.call("/usr/share/koolproxy/camanagement backup 2>&1 >/dev/null")
Download()
luci.http.redirect(luci.dispatcher.build_url("admin","services","koolproxy"))
end
end
return o

View File

@ -0,0 +1,33 @@
o = Map("koolproxy")
t = o:section(TypedSection, "acl_rule", translate("GodProxy 访问控制"))
t.anonymous = true
t.description = translate("访问控制列表是用于指定特殊IP过滤模式的工具如为已安装证书的客户端开启https广告过滤等MAC或者IP必须填写其中一项。")
t.template = "cbi/tblsection"
t.sortable = true
t.addremove = true
e = t:option(Value, "remarks", translate("客户端备注"))
e.rmempty = true
e.width = "30%"
e = t:option(Value, "ipaddr", translate("内部IP地址"))
e.width = "20%"
e.datatype = "ip4addr"
luci.ip.neighbors({family = 4}, function(neighbor)
if neighbor.reachable then
e:value(neighbor.dest:string(), "%s (%s)" %{neighbor.dest:string(), neighbor.mac})
end
end)
e = t:option(ListValue, "proxy_mode", translate("访问控制"))
e.rmempty = false
e.width = "20%"
e:value(0,translate("不过滤"))
e:value(1,translate("过滤 HTTP"))
e:value(2,translate("过滤HTTP + HTTPS"))
e:value(3,translate("过滤全端口"))
e.default = 1
return o

View File

@ -0,0 +1,32 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(TextValue, "user_rule")
e.description = translate("输入你的自定义规则,每条规则一行。")
e.rmempty = false
e.rows = 28
e.wrap = "off"
local fs = require "nixio.fs"
local i = "/usr/share/koolproxy/data/user.txt"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/user.txt", value)
if (luci.sys.call("cmp -s /tmp/user.txt /usr/share/koolproxy/data/user.txt") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/user.txt")
end
return o

View File

@ -1,396 +0,0 @@
-- Copyright 2018 Nick Peng (pymumu@gmail.com)
require ("nixio.fs")
require ("luci.http")
require ("luci.dispatcher")
require ("nixio.fs")
local fs = require "nixio.fs"
local sys = require "luci.sys"
local http = require "luci.http"
local o,t,e
local v=luci.sys.exec("/usr/share/koolproxy/koolproxy -v")
local a=luci.sys.exec("head -3 /usr/share/koolproxy/data/rules/koolproxy.txt | grep rules | awk -F' ' '{print $3,$4}'")
local b=luci.sys.exec("head -4 /usr/share/koolproxy/data/rules/koolproxy.txt | grep video | awk -F' ' '{print $3,$4}'")
local c=luci.sys.exec("head -3 /usr/share/koolproxy/data/rules/daily.txt | grep rules | awk -F' ' '{print $3,$4}'")
local s=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/easylistchina.txt | wc -l")
local m=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/mv.txt | wc -l")
local u=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/fanboy.txt | wc -l")
local p=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/yhosts.txt | wc -l")
local h=luci.sys.exec("grep -v '^!' /usr/share/koolproxy/data/rules/user.txt | wc -l")
local l=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/koolproxy.txt | wc -l")
local q=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/daily.txt | wc -l")
local f=luci.sys.exec("grep -v !x /usr/share/koolproxy/data/rules/anti-ad.txt | wc -l")
local i=luci.sys.exec("cat /usr/share/koolproxy/dnsmasq.adblock | wc -l")
o = Map("koolproxy", translate("GodProxy 滤广告 "), translate("GodProxy是基于KoolProxyR Plus重新整理的能识别adblock规则的免费开源软件,追求体验更快、更清洁的网络,屏蔽烦人的广告!"))
o:section(SimpleSection).template = "koolproxy/koolproxy_status"
t = o:section(TypedSection, "global")
t.anonymous = true
t:tab("base",translate("Basic Settings"))
e = t:taboption("base", Flag, "enabled", translate("Enable"))
e.default = 0
e.rmempty = false
e = t:taboption("base", Value, "startup_delay", translate("启动延迟"))
e:value(0, translate("不启用"))
for _, v in ipairs({5, 10, 15, 25, 40, 60}) do
e:value(v, translate("%u 秒") %{v})
end
e.datatype = "uinteger"
e.default = 0
e.rmempty = false
e = t:taboption("base", ListValue, "koolproxy_mode", translate("Filter Mode"))
e.default = 1
e.rmempty = false
e:value(1, translate("全局模式"))
e:value(2, translate("IPSET模式"))
e:value(3, translate("视频模式"))
e = t:taboption("base", MultiValue, "koolproxy_rules", translate("内置规则"))
e.optional = false
e.rmempty = false
e:value("koolproxy.txt", translate("静态规则"))
e:value("daily.txt", translate("每日规则"))
e:value("kp.dat", translate("视频规则"))
e:value("user.txt", translate("自定义规则"))
e = t:taboption("base", MultiValue, "thirdparty_rules", translate("第三方规则"))
e.optional = true
e.rmempty = false
e:value("easylistchina.txt", translate("ABP规则"))
e:value("fanboy.txt", translate("Fanboy规则"))
e:value("yhosts.txt", translate("Yhosts规则"))
e:value("anti-ad.txt", translate("Anti-AD规则"))
e:value("mv.txt", translate("乘风视频"))
e = t:taboption("base", ListValue, "koolproxy_port", translate("端口控制"))
e.default = 0
e.rmempty = false
e:value(0, translate("关闭"))
e:value(1, translate("开启"))
e = t:taboption("base", ListValue, "koolproxy_ipv6", translate("IPv6支持"))
e.default = 0
e.rmempty = false
e:value(0, translate("关闭"))
e:value(1, translate("开启"))
e = t:taboption("base", Value, "koolproxy_bp_port", translate("例外端口"))
e:depends("koolproxy_port", "1")
e.rmempty = false
e.description = translate(string.format("<font color=\"red\"><strong>单端口:80&nbsp;&nbsp;多端口:80,443</strong></font>"))
e=t:taboption("base",Flag,"koolproxy_host",translate("开启Adblock Plus Hosts"))
e.default=0
e:depends("koolproxy_mode","2")
e = t:taboption("base", ListValue, "koolproxy_acl_default", translate("默认访问控制"))
e.default = 1
e.rmempty = false
e:value(0, translate("不过滤"))
e:value(1, translate("过滤HTTP协议"))
e:value(2, translate("过滤HTTP(S)协议"))
e:value(3, translate("全部过滤"))
e.description = translate(string.format("<font color=\"blue\"><strong>访问控制设置中其他主机的默认规则</strong></font>"))
e = t:taboption("base", ListValue, "time_update", translate("定时更新"))
for t = 0,23 do
e:value(t,translate("每天"..t..""))
end
e:value(nil, translate("关闭"))
e.default = nil
e.rmempty = false
e.description = translate(string.format("<font color=\"red\"><strong>定时更新规则。请把时间修改掉,默认时间使用人数多会更新失败</strong></font>"))
e = t:taboption("base", Button, "restart", translate("规则状态"))
e.inputtitle = translate("更新规则")
e.inputstyle = "reload"
e.write = function()
luci.sys.call("/usr/share/koolproxy/kpupdate 2>&1 >/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin","services","koolproxy"))
end
e.description = translate(string.format("<font color=\"red\"><strong>更新订阅规则与Adblock Plus Hosts</strong></font><br /><font color=\"green\">ABP规则: %s条<br />Fanboy规则: %s条<br />Yhosts规则: %s条<br />Anti-AD规则: %s条<br />静态规则: %s条<br />视频规则: %s<br />乘风视频: %s条<br />每日规则: %s条<br />自定义规则: %s条<br />Host: %s条</font><br />", s, u, p, f, l, b, m, q, h, i))
t:tab("cert",translate("Certificate Management"))
e=t:taboption("cert",DummyValue,"c1status",translate("<div align=\"left\"><strong>证书恢复</strong></div>"))
e=t:taboption("cert",FileUpload,"")
e.template="koolproxy/caupload"
e=t:taboption("cert",DummyValue,"",nil)
e.template="koolproxy/cadvalue"
if nixio.fs.access("/usr/share/koolproxy/data/certs/ca.crt")then
e=t:taboption("cert",DummyValue,"c2status",translate("<div align=\"left\"><strong>证书备份</strong></div>"))
e=t:taboption("cert",Button,"certificate")
e.inputtitle=translate("Backup Download")
e.inputstyle="reload"
e.write=function()
luci.sys.call("/usr/share/koolproxy/camanagement backup 2>&1 >/dev/null")
Download()
luci.http.redirect(luci.dispatcher.build_url("admin","services","koolproxy"))
end
end
t:tab("white_weblist",translate("网站白名单设置"))
local i = "/etc/adblocklist/adbypass"
e = t:taboption("white_weblist", TextValue, "adbypass_domain")
e.description = translate("这些已经加入的网站将不会使用过滤器。请输入网站的域名每行只能输入一个网站域名。例如google.com。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adbypass", value)
if (luci.sys.call("cmp -s /tmp/adbypass /etc/adblocklist/adbypass") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adbypass")
end
t:tab("weblist",translate("Set Backlist Of Websites"))
local i = "/etc/adblocklist/adblock"
e = t:taboption("weblist", TextValue, "adblock_domain")
e.description = translate("加入的网址将走广告过滤端口。只针对黑名单模式。只能输入WEB地址google.com每个地址一行。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adblock", value)
if (luci.sys.call("cmp -s /tmp/adblock /etc/adblocklist/adblock") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adblock")
end
t:tab("white_iplist",translate("IP白名单设置"))
local i = "/etc/adblocklist/adbypassip"
e = t:taboption("white_iplist", TextValue, "adbypass_ip")
e.description = translate("这些已加入的ip地址将使用代理但只有GFW型号。请输入ip地址或ip地址段每行只能输入一个ip地址。例如112.123.134.145 / 24或112.123.134.145。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adbypassip", value)
if (luci.sys.call("cmp -s /tmp/adbypassip /etc/adblocklist/adbypassip") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adbypassip")
end
t:tab("iplist",translate("IP黑名单设置"))
local i = "/etc/adblocklist/adblockip"
e = t:taboption("iplist", TextValue, "adblock_ip")
e.description = translate("这些已经加入的ip地址不会使用过滤器.请输入ip地址或ip地址段每行只能输入一个ip地址。例如112.123.134.145 / 24或112.123.134.145。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adblockip", value)
if (luci.sys.call("cmp -s /tmp/adblockip /etc/adblocklist/adblockip") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adblockip")
end
t:tab("customlist", translate("Set Backlist Of custom"))
local i = "/usr/share/koolproxy/data/user.txt"
e = t:taboption("customlist", TextValue, "user_rule")
e.description = translate("Enter your custom rules, each row.")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/user.txt", value)
if (luci.sys.call("cmp -s /tmp/user.txt /usr/share/koolproxy/data/user.txt") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/user.txt")
end
t:tab("logs",translate("View the logs"))
local i = "/var/log/koolproxy.log"
e = t:taboption("logs", TextValue, "kpupdate_log")
e.description = translate("Koolproxy Logs")
e.rows = 28
e.wrap = "off"
e.rmempty = false
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
end
t=o:section(TypedSection,"acl_rule",translate("GodProxy 访问控制"),
translate("ACLs is a tools which used to designate specific IP filter mode,The MAC addresses added to the list will be filtered using https"))
t.template="cbi/tblsection"
t.sortable=true
t.anonymous=true
t.addremove=true
e=t:option(Value,"remarks",translate("Client Remarks"))
e.width="30%"
e.rmempty=true
e=t:option(Value,"ipaddr",translate("IP Address"))
e.width="20%"
e.datatype="ip4addr"
luci.ip.neighbors({family = 4}, function(neighbor)
if neighbor.reachable then
e:value(neighbor.dest:string(), "%s (%s)" %{neighbor.dest:string(), neighbor.mac})
end
end)
e=t:option(Value,"mac",translate("MAC Address"))
e.width="20%"
e.rmempty=true
e.datatype="macaddr"
luci.ip.neighbors({family = 4}, function(neighbor)
if neighbor.reachable then
e:value(neighbor.mac, "%s (%s)" %{neighbor.mac, neighbor.dest:string()})
end
end)
e=t:option(ListValue,"proxy_mode",translate("访问控制"))
e.width="20%"
e.default=1
e.rmempty=false
e:value(0,translate("不过滤"))
e:value(1,translate("过滤 HTTP"))
e:value(2,translate("过滤HTTP + HTTPS"))
e:value(3,translate("过滤全端口"))
t=o:section(TypedSection,"rss_rule",translate("GodProxy 规则订阅"), translate("请确保订阅规则的兼容性"))
t.anonymous=true
t.addremove=true
t.sortable=true
t.template="cbi/tblsection"
t.extedit=luci.dispatcher.build_url("admin/services/koolproxy/rss_rule/%s")
t.create=function(...)
local sid=TypedSection.create(...)
if sid then
luci.http.redirect(t.extedit % sid)
return
end
end
e=t:option(Flag,"load",translate("启用"))
e.default=0
e.rmempty=false
e=t:option(DummyValue,"name",translate("规则名称"))
function e.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
e=t:option(DummyValue,"url",translate("规则地址"))
function e.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
e=t:option(DummyValue,"time",translate("更新时间"))
function Download()
local t,e
t=nixio.open("/tmp/upload/koolproxyca.tar.gz","r")
luci.http.header('Content-Disposition','attachment; filename="koolproxyCA.tar.gz"')
luci.http.prepare_content("application/octet-stream")
while true do
e=t:read(nixio.const.buffersize)
if(not e)or(#e==0)then
break
else
luci.http.write(e)
end
end
t:close()
luci.http.close()
end
local t,e
t="/tmp/upload/"
nixio.fs.mkdir(t)
luci.http.setfilehandler(
function(o,a,i)
if not e then
if not o then return end
e=nixio.open(t..o.file,"w")
if not e then
return
end
end
if a and e then
e:write(a)
end
if i and e then
e:close()
e=nil
luci.sys.call("/usr/share/koolproxy/camanagement restore 2>&1 >/dev/null")
end
end
)
t=o:section(TypedSection,"usetips",translate("GodProxy 帮助支持"))
t.anonymous = true
t:append(Template("koolproxy/feedback"))
return o

View File

@ -0,0 +1,32 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(TextValue, "adblock_ip")
e.description = translate("这些已经加入的ip地址不会使用过滤器.请输入ip地址或ip地址段每行只能输入一个ip地址。例如112.123.134.145 / 24或112.123.134.145。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
local fs = require "nixio.fs"
local i = "/etc/adblocklist/adblockip"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adblockip", value)
if (luci.sys.call("cmp -s /tmp/adblockip /etc/adblocklist/adblockip") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adblockip")
end
return o

View File

@ -0,0 +1,32 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(TextValue, "adbypass_ip")
e.description = translate("这些已加入的ip地址将使用代理但只有GFW型号。请输入ip地址或ip地址段每行只能输入一个ip地址。例如112.123.134.145 / 24或112.123.134.145。")
e.rows = 28
e.wrap = "off"
e.rmempty = false
local fs = require "nixio.fs"
local i = "/etc/adblocklist/adbypassip"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adbypassip", value)
if (luci.sys.call("cmp -s /tmp/adbypassip /etc/adblocklist/adbypassip") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adbypassip")
end
return o

View File

@ -2,7 +2,8 @@ local m, s, o
local koolproxy = "koolproxy"
local sid = arg[1]
m = Map(koolproxy, "%s - %s" %{translate("GodProxy滤广告"), translate("编辑规则")})
m = Map(koolproxy)
m.title = translate("GodProxy滤广告 - 编辑规则")
m.redirect = luci.dispatcher.build_url("admin/services/koolproxy")
if not arg[1] or m.uci:get(koolproxy, sid) ~= "rss_rule" then
@ -15,15 +16,15 @@ s = m:section(NamedSection, sid, "rss_rule")
s.anonymous = true
s.addremove = true
o=s:option(Flag,"load",translate("启用"))
o.default=0
o.rmempty=false
o = s:option(Flag, "load", translate("启用"))
o.rmempty = false
o.default = 0
o=s:option(Value,"name",translate("规则描述"))
o.rmempty=true
o = s:option(Value, "name", translate("规则描述"))
o.rmempty = true
o=s:option(Value,"url",translate("规则地址"))
o.rmempty=false
o = s:option(Value, "url", translate("规则地址"))
o.rmempty = false
o.placeholder="[https|http|ftp]://[Hostname]/[File]"
function o.validate(self, value)
if not value then

View File

@ -0,0 +1,8 @@
o = Map("koolproxy")
t = o:section(TypedSection, "usetips")
t.title = translate("GodProxy 帮助支持")
t.anonymous = true
t:append(Template("koolproxy/tips"))
return o

View File

@ -0,0 +1,22 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
local fs = require "nixio.fs"
local i = "/var/log/koolproxy.log"
e = t:option(TextValue, "kpupdate_log")
e.description = translate("查看最近的更新日志")
e.rmempty = false
e.rows = 28
e.wrap = "off"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
end
return o

View File

@ -0,0 +1,32 @@
o = Map("koolproxy")
t = o:section(TypedSection, "global")
t.anonymous = true
e = t:option(TextValue, "adbypass_domain")
e.description = translate("这些已经加入的网站将不会使用过滤器。请输入网站的域名每行只能输入一个网站域名。例如google.com。")
e.rmempty = false
e.rows = 28
e.wrap = "off"
local fs = require "nixio.fs"
local i = "/etc/adblocklist/adbypass"
function e.cfgvalue()
return fs.readfile(i) or ""
end
function e.write(self, section, value)
if value then
value = value:gsub("\r\n", "\n")
else
value = ""
end
fs.writefile("/tmp/adbypass", value)
if (luci.sys.call("cmp -s /tmp/adbypass /etc/adblocklist/adbypass") == 1) then
fs.writefile(i, value)
end
fs.remove("/tmp/adbypass")
end
return o

View File

@ -1,5 +1,5 @@
<%+cbi/valueheader%>
<label class="cbi-value" style="display:inline-block; width: 400px" for="ulfile"><font color="red"><%:Upload backup file,The file name must be koolproxyCA.tar.gz%></font></label><br />
<label class="cbi-value" style="display:inline-block; width: 400px" for="ulfile"></label><br />
<input class="cbi-input-file" style="width: 400px" type="file" id="ulfile" name="ulfile" />
<input type="submit" class="cbi-button cbi-input-apply" name="upload" value="<%:Upload Restore%>" />
<input type="submit" class="cbi-button cbi-input-apply" name="upload" value="<%:上传恢复证书%>" />
<%+cbi/valuefooter%>

View File

@ -4,9 +4,9 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[koolproxy]], [[status]])%>', null
var tb = document.getElementById('koolproxy_status');
if (data && tb) {
if (data.running) {
tb.innerHTML = '<em><b><font color=green><%:KoolproxyR Plus+%> <%:RUNNING%></font></b></em>';
tb.innerHTML = '<em><b><font color=green><%:GodProxy 滤广告%> <%:运行中%></font></b></em>';
} else {
tb.innerHTML = '<em><b><font color=red><%:KoolproxyR Plus+%> <%:NOT RUNNING%></font></b></em>';
tb.innerHTML = '<em><b><font color=red><%:GodProxy 滤广告%> <%:未运行%></font></b></em>';
}
}
}
@ -16,6 +16,6 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[koolproxy]], [[status]])%>', null
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="koolproxy_status">
<em><%:Collecting data...%></em>
<em><%:收集数据...%></em>
</p>
</fieldset>

View File

@ -1,53 +0,0 @@
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Filter Mode"
msgstr "过滤模式"
msgid "Collecting data..."
msgstr "收集数据..."
msgid "Basic Settings"
msgstr "基础设置"
msgid "View the logs"
msgstr "更新日志"
msgid "Certificate Management"
msgstr "证书管理"
msgid "Set Backlist Of custom"
msgstr "自定义规则"
msgid "IP Address"
msgstr "内部IP地址"
msgid "Client Remarks"
msgstr "客户端备注"
msgid "Upload Restore"
msgstr "上传恢复证书"
msgid "Backup Download"
msgstr "下载证书备份"
msgid "Set Backlist Of Websites"
msgstr "网站黑名单设置"
msgid "KoolproxyR Plus+"
msgstr "GodProxy 滤广告"
msgid "Koolproxy Logs"
msgstr "查看最近的更新日志"
msgid "Enter your custom rules, each row."
msgstr "输入你的自定义规则,每条规则一行。"
msgid "Upload backup file,The file name must be koolproxyCA.tar.gz"
msgstr "上传恢复已备份的证书文件名必须为koolproxyCA.tar.gz"
msgid "ACLs is a tools which used to designate specific IP filter mode,The MAC addresses added to the list will be filtered using https"
msgstr "访问控制列表是用于指定特殊IP过滤模式的工具如为已安装证书的客户端开启https广告过滤等MAC或者IP必须填写其中一项。"

View File

@ -1 +0,0 @@
zh-cn

View File

@ -1,42 +1,40 @@
2021-10-01 00:35:57: ------------------- 规则更新 -----------------------
2021-10-01 00:35:57: ====================================================
2021-10-01 00:35:57: 开始更新koolproxy的规则请等待...
2021-10-01 00:35:57: ---------------------------------------------------------------------------------------
2021-10-01 00:35:58: ABP规则的本地版本号 202109250013
2021-10-01 00:35:58: ABP规则的在线版本号 202110010026
2021-10-01 00:35:58: 检测到 ABP规则 已更新,现在开始更新...
2021-10-01 00:35:58: 将临时的ABP规则文件移动到指定位置
2021-10-01 00:35:59: kpr_our_rule2规则文件下载失败
2021-10-01 00:35:59: yhosts规则本地版本号 !version: 202106172037
2021-10-01 00:35:59: yhosts规则在线版本号 #version: 202106172037
2021-10-01 00:35:59: 检测到 yhosts规则 已更新,现在开始更新...
2021-10-01 00:35:59: 将临时文件覆盖到原始yhosts文件
2021-10-01 00:35:59: 远程视频规则md5e068116c27640e3b2f3d0731751f467e
2021-10-01 00:35:59: 您本地视频规则md5e068116c27640e3b2f3d0731751f467e
2021-10-01 00:35:59: 检测到 视频规则 本地版本号和在线版本号相同,那还更新个毛啊!
2021-10-01 00:35:59: fanboy规则本地版本号 202103250121
2021-10-01 00:35:59: fanboy规则在线版本号
2021-10-01 00:35:59: fanboy规则 文件下载失败!
2021-10-01 00:35:59: antiad规则本地版本号 20210923024101
2021-10-01 00:35:59: antiad规则在线版本号 20210929154523
2021-10-01 00:35:59: 检测到新版本 antiad规则 列表,开始更新...
2021-10-01 00:35:59: 将临时文件覆盖到原始 antiad规则 文件
2021-10-01 00:36:00: StevenBlack规则本地版本号 24 September
2021-10-01 00:36:00: StevenBlack规则在线版本号 24 September
2021-10-01 00:36:00: 检测到 StevenBlack规则 本地版本号和在线版本号相同,那还更新个毛啊!
2021-10-01 00:36:00: 跳过优化 fanboy规则。。。。。
2021-10-01 00:36:00: 正在优化 ABP规则。。。。。
2021-10-01 00:36:02: 正在优化 补充规则yhosts。。。。。
2021-10-01 00:36:03: 正在优化 补充规则antiad。。。。。
2021-10-01 00:36:03: 跳过优化 补充规则adwars。。。。。
2021-10-01 00:36:03: 跳过优化 补充规则ADgkStevenBlack。。。。。
2021-10-01 00:36:03: 所有规则更新并优化完毕!
2021-10-01 00:36:03: ====================================================
2021-10-01 00:36:09: -------------------Yhosts规则 version !version: 202106172037
2021-10-01 00:36:09: -------------------ABP规则 version 202110010026
2021-10-01 00:36:09: -------------------Fanboy规则 version 202103250121
2021-10-01 00:36:09: -------------------Antiad规则 version 20210929154523
2021-10-01 00:36:09: -------------------静态规则 version 2020-02-27 23:00
2021-10-01 00:36:09: -------------------乘风视频 version 202105021
2021-10-01 00:36:09: ------------------- 内置规则更新成功! -------------------
2021-10-01 00:36:09: ------------------- 规则更新成功! -------------------
2021-11-05 00:30:37: ------------------- 规则更新 -----------------------
2021-11-05 00:30:37: ====================================================
2021-11-05 00:30:37: 开始更新koolproxy的规则请等待...
2021-11-05 00:30:37: ---------------------------------------------------------------------------------------
2021-11-05 00:30:38: ABP规则的本地版本号 202111050016
2021-11-05 00:30:38: ABP规则的在线版本号 202111050016
2021-11-05 00:30:38: 检测到 ABP规则本地版本号和在线版本号相同那还更新个毛啊!
2021-11-05 00:30:39: kpr_our_rule2规则文件下载失败
2021-11-05 00:30:39: yhosts规则本地版本号 !version: 202110242326
2021-11-05 00:30:39: yhosts规则在线版本号 #version: 202110242326
2021-11-05 00:30:39: 检测到 yhosts规则 已更新,现在开始更新...
2021-11-05 00:30:39: 将临时文件覆盖到原始yhosts文件
2021-11-05 00:30:39: 远程视频规则md5
2021-11-05 00:30:39: 您本地视频规则md5
2021-11-05 00:30:39: 检测到 视频规则 本地版本号和在线版本号相同,那还更新个毛啊!
2021-11-05 00:30:39: fanboy规则本地版本号 202103250121
2021-11-05 00:30:39: fanboy规则在线版本号
2021-11-05 00:30:39: fanboy规则 文件下载失败!
2021-11-05 00:30:39: antiad规则本地版本号 20211105024137
2021-11-05 00:30:39: antiad规则在线版本号 20211105024137
2021-11-05 00:30:39: 检测到 antiad规则 本地版本号和在线版本号相同,那还更新个毛啊!
2021-11-05 00:30:39: StevenBlack规则本地版本号 04 November
2021-11-05 00:30:39: StevenBlack规则在线版本号 04 November
2021-11-05 00:30:39: 检测到 StevenBlack规则 本地版本号和在线版本号相同,那还更新个毛啊!
2021-11-05 00:30:39: 跳过优化 fanboy规则。。。。。
2021-11-05 00:30:39: 跳过优化 ABP规则。。。。。
2021-11-05 00:30:39: 正在优化 补充规则yhosts。。。。。
2021-11-05 00:30:40: 跳过优化 补充规则antiad。。。。。
2021-11-05 00:30:40: 跳过优化 补充规则adwars。。。。。
2021-11-05 00:30:40: 跳过优化 补充规则ADgkStevenBlack。。。。。
2021-11-05 00:30:40: 所有规则更新并优化完毕!
2021-11-05 00:30:40: ====================================================
2021-11-05 00:30:42: -------------------Yhosts规则 version !version: 202110242326
2021-11-05 00:30:42: -------------------ABP规则 version 202111050016
2021-11-05 00:30:42: -------------------Fanboy规则 version 202103250121
2021-11-05 00:30:42: -------------------Antiad规则 version 20211105024137
2021-11-05 00:30:42: -------------------静态规则 version 2020-02-27 23:00
2021-11-05 00:30:42: -------------------乘风视频 version 202105021
2021-11-05 00:30:42: ------------------- 内置规则更新成功! -------------------
2021-11-05 00:30:42: ------------------- 规则更新成功! -------------------