mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 20:25:13 +08:00
⛅ Sync 2026-10-06 21:11:19
This commit is contained in:
1 parent
fa160a7a5e
commit
bcd6b07350
430 files changed
+1035
-48585
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=honk
|
||||
PKG_VERSION:=2026.10.6_pre1
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=10
|
||||
|
||||
# Raw upstream release tag. It keeps the dots in qualifiers (e.g. v0.0.1.beta.49)
|
||||
# because that is what the GitHub release asset name uses.
|
||||
|
||||
+17
-13
@@ -33,22 +33,25 @@ cleanup_netns() {
|
||||
hijack_resolv_conf() {
|
||||
grep -q ' /tmp/resolv\.conf ' /proc/mounts && return 0
|
||||
|
||||
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_HONK" 2>/dev/null
|
||||
|
||||
local dns_list LOGICAL_WAN
|
||||
local dns_list WANS
|
||||
. /lib/functions/network.sh
|
||||
network_find_wan LOGICAL_WAN 2>/dev/null
|
||||
if [ -n "$LOGICAL_WAN" ]; then
|
||||
dns_list=$(ubus call "network.interface.$LOGICAL_WAN" status 2>/dev/null | \
|
||||
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
|
||||
fi
|
||||
unset -v __NETWORK_CACHE
|
||||
__network_ifstatus WANS "" "[@.route[@.target='0.0.0.0' && !@.table]].interface" 2>/dev/null
|
||||
set -- $WANS
|
||||
|
||||
if [ -z "$dns_list" ] && [ -f "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
dns_list=$(awk '/^nameserver/{print $2}' "/tmp/resolv.conf.d/resolv.conf.auto")
|
||||
if [ $# -eq 1 ]; then
|
||||
dns_list=$(ubus call "network.interface.$1" status 2>/dev/null | \
|
||||
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
|
||||
if [ -z "$dns_list" ] && [ -f "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||
dns_list=$(awk '/^nameserver/{print $2}' "/tmp/resolv.conf.d/resolv.conf.auto")
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -z "$dns_list" ] && dns_list="119.29.29.29 223.5.5.5"
|
||||
|
||||
[ -f /tmp/resolv.conf ] || touch /tmp/resolv.conf
|
||||
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_HONK" 2>/dev/null
|
||||
|
||||
for dns in $dns_list; do
|
||||
echo "nameserver $dns" >> "$RESOLV_HONK"
|
||||
done
|
||||
@@ -58,9 +61,10 @@ hijack_resolv_conf() {
|
||||
}
|
||||
|
||||
restore_resolv_conf() {
|
||||
grep -q ' /tmp/resolv\.conf ' /proc/mounts || return 0
|
||||
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
|
||||
umount /tmp/resolv.conf 2>/dev/null
|
||||
while grep -q ' /tmp/resolv\.conf ' /proc/mounts; do
|
||||
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
|
||||
umount /tmp/resolv.conf 2>/dev/null || break
|
||||
done
|
||||
rm -f "$RESOLV_HONK"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Access Control Configuration
|
||||
LUCI_DEPENDS:=
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-accesscontrol
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,17 +0,0 @@
|
||||
module("luci.controller.mia", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/mia") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "mia"}, cbi("mia"), _("Internet Access Schedule Control"), 30).dependent = true
|
||||
entry({"admin", "services", "mia", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("iptables -L INPUT |grep MIA >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@@ -1,68 +0,0 @@
|
||||
a = Map("mia")
|
||||
a.title = translate("Internet Access Schedule Control")
|
||||
a.description = translate("Access Schedule Control Settins")
|
||||
|
||||
a:section(SimpleSection).template = "mia/mia_status"
|
||||
|
||||
t = a:section(TypedSection, "basic")
|
||||
t.anonymous = true
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
|
||||
e = t:option(Flag, "strict", translate("Strict Mode"))
|
||||
e.description = translate("Strict Mode will degrade CPU performance, but it can achieve better results")
|
||||
e.rmempty = false
|
||||
|
||||
t = a:section(TypedSection, "macbind", translate("Client Rules"))
|
||||
t.template = "cbi/tblsection"
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
e.default = "1"
|
||||
|
||||
e = t:option(Value, "macaddr", translate("MAC address (Computer Name)"))
|
||||
e.rmempty = true
|
||||
luci.sys.net.mac_hints(function(t,a)
|
||||
e:value(t,"%s (%s)"%{t,a})
|
||||
end)
|
||||
|
||||
e = t:option(Value, "timeon", translate("Start time"))
|
||||
e.optional = false
|
||||
e.default = "00:00"
|
||||
|
||||
e = t:option(Value, "timeoff", translate("End time"))
|
||||
e.optional = false
|
||||
e.default = "23:59"
|
||||
|
||||
e = t:option(Flag, "z1", translate("Mon"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z2", translate("Tue"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z3", translate("Wed"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z4", translate("Thu"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z5", translate("Fri"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z6", translate("Sat"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z7", translate("Sun"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
return a
|
||||
@@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[mia]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('mia_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green><%:Internet Access Schedule Control%> <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red><%:Internet Access Schedule Control%> <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="mia_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
@@ -1,50 +0,0 @@
|
||||
msgid "Internet Access Schedule Control"
|
||||
msgstr "上网时间控制"
|
||||
|
||||
msgid "Access Schedule Control Settins"
|
||||
msgstr "设置客户端禁止访问互联网的时间"
|
||||
|
||||
msgid "General switch"
|
||||
msgstr "开启/关闭"
|
||||
|
||||
msgid "Strict Mode"
|
||||
msgstr "严格模式"
|
||||
|
||||
msgid "Strict Mode will degrade CPU performance, but it can achieve better results"
|
||||
msgstr "严格模式会损耗部分CPU资源,但可以按照时间规则立即拦截数据包,效果更好"
|
||||
|
||||
msgid "Client Rules"
|
||||
msgstr "客户端规则"
|
||||
|
||||
msgid "Description"
|
||||
msgstr "描述"
|
||||
|
||||
msgid "MAC address (Computer Name)"
|
||||
msgstr "MAC 地址 (主机名)"
|
||||
|
||||
msgid "Start time"
|
||||
msgstr "开始时间"
|
||||
|
||||
msgid "End time"
|
||||
msgstr "结束时间"
|
||||
|
||||
msgid "Mon"
|
||||
msgstr "一"
|
||||
|
||||
msgid "Tue"
|
||||
msgstr "二"
|
||||
|
||||
msgid "Wed"
|
||||
msgstr "三"
|
||||
|
||||
msgid "Thu"
|
||||
msgstr "四"
|
||||
|
||||
msgid "Fri"
|
||||
msgstr "五"
|
||||
|
||||
msgid "Sat"
|
||||
msgstr "六"
|
||||
|
||||
msgid "Sun"
|
||||
msgstr "日"
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
config basic
|
||||
option enable '0'
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
START=30
|
||||
|
||||
CONFIG=mia
|
||||
|
||||
uci_get_by_type() {
|
||||
local index=0
|
||||
if [ -n $4 ]; then
|
||||
index=$4
|
||||
fi
|
||||
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
add_rule(){
|
||||
for i in $(seq 0 100)
|
||||
do
|
||||
local enable=$(uci_get_by_type macbind enable '' $i)
|
||||
local macaddr=$(uci_get_by_type macbind macaddr '' $i)
|
||||
local timeon=$(uci_get_by_type macbind timeon '' $i)
|
||||
local timeoff=$(uci_get_by_type macbind timeoff '' $i)
|
||||
local z1=$(uci_get_by_type macbind z1 '' $i)
|
||||
local z2=$(uci_get_by_type macbind z2 '' $i)
|
||||
local z3=$(uci_get_by_type macbind z3 '' $i)
|
||||
local z4=$(uci_get_by_type macbind z4 '' $i)
|
||||
local z5=$(uci_get_by_type macbind z5 '' $i)
|
||||
local z6=$(uci_get_by_type macbind z6 '' $i)
|
||||
local z7=$(uci_get_by_type macbind z7 '' $i)
|
||||
[ "$z1" == "1" ] && Z1="Mon,"
|
||||
[ "$z2" == "1" ] && Z2="Tue,"
|
||||
[ "$z3" == "1" ] && Z3="Wed,"
|
||||
[ "$z4" == "1" ] && Z4="Thu,"
|
||||
[ "$z5" == "1" ] && Z5="Fri,"
|
||||
[ "$z6" == "1" ] && Z6="Sat,"
|
||||
[ "$z7" == "1" ] && Z7="Sun"
|
||||
if [ -z $enable ] || [ -z $macaddr ] || [ -z $timeoff ] || [ -z $timeon ]; then
|
||||
break
|
||||
fi
|
||||
if [ "$enable" == "1" ]; then
|
||||
iptables -t filter -I MIA -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j DROP
|
||||
fi
|
||||
for n in $(seq 1 7)
|
||||
do
|
||||
unset "Z$n"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
del_rule(){
|
||||
type=$1
|
||||
blackMacAdd=$(iptables -t nat -L $type | grep -w RETURN | grep -w "MAC" | awk '{print $7}')
|
||||
[ -n "$blackMacAdd" ] && {
|
||||
for macaddrb in $blackMacAdd
|
||||
do
|
||||
iptables -t nat -D $type -m mac --mac-source $macaddrb -j RETURN
|
||||
done
|
||||
}
|
||||
}
|
||||
|
||||
start(){
|
||||
stop
|
||||
enable=$(uci get mia.@basic[0].enable)
|
||||
[ $enable -eq 0 ] && exit 0
|
||||
iptables -t filter -N MIA
|
||||
iptables -I INPUT -p udp --dport 53 -m comment --comment "Rule For Control" -j MIA
|
||||
iptables -I INPUT -p tcp --dport 53 -m comment --comment "Rule For Control" -j MIA
|
||||
iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 -m comment --comment "Rule For Control"
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53 -m comment --comment "Rule For Control"
|
||||
strict=$(uci get mia.@basic[0].strict)
|
||||
[ $strict -eq 1 ] && iptables -t filter -I FORWARD -m comment --comment "Rule For Control" -j MIA
|
||||
add_rule
|
||||
}
|
||||
stop(){
|
||||
iptables -t filter -D FORWARD -m comment --comment "Rule For Control" -j MIA 2>/dev/null
|
||||
iptables -D INPUT -p udp --dport 53 -m comment --comment "Rule For Control" -j MIA 2>/dev/null
|
||||
iptables -D INPUT -p tcp --dport 53 -m comment --comment "Rule For Control" -j MIA 2>/dev/null
|
||||
iptables -t nat -D PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 -m comment --comment "Rule For Control" 2>/dev/null
|
||||
iptables -t nat -D PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53 -m comment --comment "Rule For Control" 2>/dev/null
|
||||
iptables -t filter -F MIA 2>/dev/null
|
||||
iptables -t filter -X MIA 2>/dev/null
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/etc/init.d/mia restart
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-mia.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-mia.json << EEOF
|
||||
{
|
||||
"config": "mia",
|
||||
"init": "mia"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@mia[-1]
|
||||
add ucitrack mia
|
||||
set ucitrack.@mia[-1].init=mia
|
||||
commit ucitrack
|
||||
|
||||
delete firewall.mia
|
||||
set firewall.mia=include
|
||||
set firewall.mia.type=script
|
||||
set firewall.mia.path=/etc/mia.include
|
||||
set firewall.mia.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-accesscontrol": {
|
||||
"description": "Grant UCI access for luci-app-accesscontrol",
|
||||
"read": {
|
||||
"uci": [ "mia" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "mia" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "mia",
|
||||
"init": "mia"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# Copyright (C) 2020 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for Adbyby
|
||||
LUCI_DEPENDS:=+adbyby +uclient-fetch +ipset +dnsmasq-full
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-adbyby-plus
|
||||
PKG_VERSION:=2.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,86 +0,0 @@
|
||||
|
||||
module("luci.controller.adbyby", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/adbyby") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "adbyby"}, alias("admin", "services", "adbyby", "base"), _("ADBYBY Plus +"), 9).dependent = true
|
||||
|
||||
entry({"admin", "services", "adbyby", "base"}, cbi("adbyby/base"), _("Base Setting"), 10).leaf = true
|
||||
entry({"admin", "services", "adbyby", "advanced"}, cbi("adbyby/advanced"), _("Advance Setting"), 20).leaf = true
|
||||
entry({"admin", "services", "adbyby", "help"}, form("adbyby/help"), _("Plus+ Domain List"), 30).leaf = true
|
||||
entry({"admin", "services", "adbyby", "esc"}, form("adbyby/esc"), _("Bypass Domain List"), 40).leaf = true
|
||||
entry({"admin", "services", "adbyby", "black"}, form("adbyby/black"), _("Block Domain List"), 50).leaf = true
|
||||
entry({"admin", "services", "adbyby", "block"}, form("adbyby/block"), _("Block IP List"), 60).leaf = true
|
||||
entry({"admin", "services", "adbyby", "user"}, form("adbyby/user"), _("User-defined Rule"), 70).leaf = true
|
||||
|
||||
entry({"admin", "services", "adbyby", "refresh"}, call("refresh_data"))
|
||||
entry({"admin", "services", "adbyby", "run"}, 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
|
||||
|
||||
|
||||
function refresh_data()
|
||||
local set = luci.http.formvalue("set")
|
||||
local icount = 0
|
||||
|
||||
if set == "rule_data" then
|
||||
luci.sys.exec("/usr/share/adbyby/rule-update")
|
||||
icount = luci.sys.exec("/usr/share/adbyby/rule-count '/tmp/rules/'")
|
||||
|
||||
if tonumber(icount)>0 then
|
||||
if nixio.fs.access("/usr/share/adbyby/rules/") then
|
||||
oldcount = luci.sys.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("rm -f /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/* && cp -a /tmp/rules /usr/share/adbyby/")
|
||||
luci.sys.exec("/etc/init.d/adbyby restart &")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
refresh_cmd = "uclient-fetch -q --no-check-certificate -O - 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt' > /tmp/adnew.conf"
|
||||
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
|
||||
if sret== 0 then
|
||||
luci.sys.call("/usr/share/adbyby/ad-update")
|
||||
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
|
||||
if tonumber(icount)>0 then
|
||||
if nixio.fs.access("/usr/share/adbyby/dnsmasq.adblock") then
|
||||
oldcount = luci.sys.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
||||
else
|
||||
oldcount=0
|
||||
end
|
||||
if tonumber(icount) ~= tonumber(oldcount) then
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /usr/share/adbyby/dnsmasq.adblock")
|
||||
luci.sys.exec("cp -f /tmp/ad.conf /tmp/etc/dnsmasq-adbyby.d/adblock")
|
||||
luci.sys.exec("/etc/init.d/adbyby restart &")
|
||||
retstring=tostring(math.ceil(tonumber(icount)))
|
||||
else
|
||||
retstring ="0"
|
||||
end
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
luci.sys.exec("rm -f /tmp/ad.conf")
|
||||
else
|
||||
retstring ="-1"
|
||||
end
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ ret=retstring ,retcount=icount})
|
||||
end
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
local SYS = require "luci.sys"
|
||||
local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
|
||||
|
||||
local ad_count=0
|
||||
if nixio.fs.access("/usr/share/adbyby/dnsmasq.adblock") then
|
||||
ad_count=tonumber(SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l"))
|
||||
end
|
||||
|
||||
local rule_count=0
|
||||
if nixio.fs.access("/usr/share/adbyby/rules/") then
|
||||
rule_count=tonumber(SYS.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'"))
|
||||
end
|
||||
|
||||
m = Map("adbyby")
|
||||
|
||||
s = m:section(TypedSection, "adbyby")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(Flag, "block_ios")
|
||||
o.title = translate("Block Apple iOS OTA update")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "block_cnshort")
|
||||
o.title = translate("Block CNshort APP and Website")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "cron_mode")
|
||||
o.title = translate("Update the rule at 6 a.m. every morning and restart adbyby")
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o=s:option(DummyValue,"ad_data",translate("Adblock Plus Data"))
|
||||
o.rawhtml = true
|
||||
o.template = "adbyby/refresh"
|
||||
o.value =ad_count .. " " .. translate("Records")
|
||||
|
||||
o=s:option(DummyValue,"rule_data",translate("Subscribe 3rd Rules Data"))
|
||||
o.rawhtml = true
|
||||
o.template = "adbyby/refresh"
|
||||
o.value =rule_count .. " " .. translate("Records")
|
||||
o.description = translate("AdGuardHome / Host / DNSMASQ rules auto-convert")
|
||||
|
||||
o = s:option(Button,"delete",translate("Delete All Subscribe Rules"))
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
SYS.exec("rm -f /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/*")
|
||||
SYS.exec("/etc/init.d/adbyby restart 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adbyby", "advanced"))
|
||||
end
|
||||
|
||||
o = s:option(DynamicList, "subscribe_url", translate("Anti-AD Rules Subscribe"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/cjx82630/cjxlist/cjx-annoyance.txt", translate("cjx-annoyance"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easylistchina.txt", translate("easylistchina"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easyprivacy.txt", translate("easyprivacy"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/easylist.txt", translate("easylist"))
|
||||
o:value("https://raw.githubusercontent.com/Spam404/lists/master/adblock-list.txt", translate("adblock-list"))
|
||||
o:value("https://raw.githubusercontent.com/bongochong/CombinedPrivacyBlockLists/master/cpbl-abp-list.txt", translate("cpbl-abp-list"))
|
||||
o:value("https://anti-ad.net/easylist.txt", translate("anti-ad"))
|
||||
o:value("https://anti-ad.net/anti-ad-for-dnsmasq.conf", translate("anti-ad-for-dnsmasq"))
|
||||
o:value("https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt", translate("nocoin"))
|
||||
o:value("https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt", translate("abp-filters-anti-cv"))
|
||||
o.rmempty = true
|
||||
|
||||
return m
|
||||
@@ -1,66 +0,0 @@
|
||||
local NXFS = require "nixio.fs"
|
||||
local SYS = require "luci.sys"
|
||||
local HTTP = require "luci.http"
|
||||
local DISP = require "luci.dispatcher"
|
||||
|
||||
local DL = SYS.exec("head -1 /tmp/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4}'") or ""
|
||||
local DV = SYS.exec("head -1 /tmp/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'") or ""
|
||||
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 = NXFS.readfile("/tmp/adbyby.updated") or "1970-01-01 00:00:00"
|
||||
|
||||
m = Map("adbyby")
|
||||
m.title = translate("Adbyby Plus + Settings")
|
||||
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
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable"))
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, "wan_mode", translate("Running Mode"))
|
||||
o:value("0", translate("Global Mode (The slowest and the best effects)"))
|
||||
o:value("1", translate("Plus + Mode (Filter domain name list and blacklist website.Recommended)"))
|
||||
o:value("2", translate("No filter Mode (Must set in Client Filter Mode Settings manually)"))
|
||||
o.default = 1
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Button, "restart", translate("Adbyby and Rule state"))
|
||||
o.inputtitle = translate("Update Adbyby Rules Manually")
|
||||
o.description = string.format("<strong>"..translate("Last Update Checked")..":</strong> %s<br /><strong>"..translate("Lazy Rule")..":</strong>%s <br /><strong>"..translate("Video Rule")..":</strong>%s", UD, DL, DV)
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
SYS.call("rm -rf /tmp/adbyby.updated /tmp/adbyby/admd5.json && /usr/share/adbyby/adbybyupdate.sh > /tmp/adupdate.log 2>&1 &")
|
||||
SYS.call("sleep 5")
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
|
||||
end
|
||||
|
||||
t = m:section(TypedSection, "acl_rule", translate("<strong>Client Filter Mode Settings</strong>"))
|
||||
t.description = translate("Filter mode settings can be set to specific LAN clients ( <font color=blue> No filter , Global filter </font> ) . Does not need to be set by default.")
|
||||
t.template = "cbi/tblsection"
|
||||
t.sortable = true
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
|
||||
e = t:option(Value, "ipaddr", translate("IP Address"))
|
||||
e.width = "40%"
|
||||
e.datatype = "ip4addr"
|
||||
e.placeholder = "0.0.0.0/0"
|
||||
luci.ip.neighbors({ family = 4 }, function(entry)
|
||||
if entry.reachable then
|
||||
e:value(entry.dest:string())
|
||||
end
|
||||
end)
|
||||
|
||||
e = t:option(ListValue, "filter_mode", translate("Filter Mode"))
|
||||
e.width = "40%"
|
||||
e.default = "disable"
|
||||
e.rmempty = false
|
||||
e:value("disable", translate("No filter"))
|
||||
e:value("global", translate("Global filter"))
|
||||
|
||||
return m
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adblack.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/blockip.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adesc.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/adhost.conf"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,23 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local conffile = "/usr/share/adbyby/rules.txt"
|
||||
|
||||
f = SimpleForm("custom")
|
||||
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 13
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
|
||||
function f.handle(self, state, data)
|
||||
if state == FORM_VALID then
|
||||
if data.conf then
|
||||
fs.writefile(conffile, data.conf:gsub("\r\n", "\n"))
|
||||
luci.sys.call("/etc/init.d/adbyby restart")
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return f
|
||||
@@ -1,22 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[adbyby]], [[run]])%>', 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>
|
||||
@@ -1,35 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function refresh_data(btn,dataname)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Refresh...%> ';
|
||||
murl=dataname;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adbyby","refresh")%>',
|
||||
{ set:murl },
|
||||
function(x,rv)
|
||||
{
|
||||
var s = document.getElementById(dataname+'-status');
|
||||
if (s)
|
||||
{
|
||||
if (rv.ret=="0")
|
||||
s.innerHTML ="<font color='green'>"+"<%:No new data!%> "+"</font>";
|
||||
else if(rv.ret=="-1")
|
||||
{
|
||||
s.innerHTML ="<font color='red'>"+"<%:Refresh Error!%> "+"</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
s.innerHTML ="<font color='green'>"+"<%:Refresh OK!%> "+"<%:Total Records:%>"+rv.ret+"</font>";
|
||||
}
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Refresh Data %>';
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%:Refresh Data%> " onclick="return refresh_data(this,'<%=self.option%>')" />
|
||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,198 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: dingpengyu <dingpengyu06@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: zh_CN\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
|
||||
msgid "ADBYBY Plus +"
|
||||
msgstr "广告屏蔽大师 Plus+"
|
||||
|
||||
msgid "<strong><font color=\"green\">Adbyby Plus + is Running</font></strong>"
|
||||
msgstr "<strong><font color=\"green\">广告屏蔽大师 Plus + 正在运行</font></strong>"
|
||||
|
||||
msgid "<strong><font color=\"red\">Adbyby Plus + is Not Running</font></strong>"
|
||||
msgstr "<strong><font color=\"red\">广告屏蔽大师 Plus + 没有运行</font></strong>"
|
||||
|
||||
msgid "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>"
|
||||
msgstr "广告屏蔽大师 Plus + 可以全面过滤各种横幅、弹窗、视频广告,同时阻止跟踪、隐私窃取及各种恶意网站<br /><font color=\"red\">Plus + 版本可以和 Adblock Plus Host 结合方式运行,过滤广告不损失带宽</font>"
|
||||
|
||||
msgid "Adbyby Plus +"
|
||||
msgstr "广告屏蔽大师 Plus+"
|
||||
|
||||
msgid "Adbyby Plus + Settings"
|
||||
msgstr "广告屏蔽大师 Plus+(支持 AdGuardHome /Host / DNSMASQ 规则)"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Running Mode"
|
||||
msgstr "运行模式"
|
||||
|
||||
msgid "Global Mode (The slowest and the best effects)"
|
||||
msgstr "全局模式(最慢, 效果最好)"
|
||||
|
||||
msgid "Plus + Mode (Filter domain name list and blacklist website.Recommended)"
|
||||
msgstr "Plus + 模式(只过滤列表内域名结合ABP名单。推荐!)"
|
||||
|
||||
msgid "No filter Mode (Must set in Client Filter Mode Settings manually)"
|
||||
msgstr "手动代理模式(必须手动设置浏览器代理,或者客户端过滤模式设置)"
|
||||
|
||||
msgid "Transparent proxy"
|
||||
msgstr "透明代理"
|
||||
|
||||
msgid "Click to disable"
|
||||
msgstr "点击关闭"
|
||||
|
||||
msgid "Click to enable"
|
||||
msgstr "点击开启"
|
||||
|
||||
msgid "Adbyby and Rule state"
|
||||
msgstr "规则状态"
|
||||
|
||||
msgid "Restart Adbyby"
|
||||
msgstr "重启Adbyby"
|
||||
|
||||
msgid "Plus+ Domain List"
|
||||
msgstr "Plus+ 模式过滤的域名"
|
||||
|
||||
msgid "Bypass Domain List"
|
||||
msgstr "域名白名单"
|
||||
|
||||
msgid "Black Domain List"
|
||||
msgstr "域名黑名单"
|
||||
|
||||
msgid "Black IP List"
|
||||
msgstr "IP黑名单"
|
||||
|
||||
msgid "Advance Setting"
|
||||
msgstr "高级设置"
|
||||
|
||||
msgid "Update the rule at 6 a.m. every morning and restart adbyby"
|
||||
msgstr "每天凌晨6点更新规则并重启"
|
||||
|
||||
msgid "ADP Host List"
|
||||
msgstr "Adblock Plus Hosts 记录数"
|
||||
|
||||
msgid "Adblock Plus Data"
|
||||
msgstr "Adblock Plus 规则数据库"
|
||||
|
||||
msgid "Subscribe 3rd Rules Data"
|
||||
msgstr "订阅第三方去广告规则"
|
||||
|
||||
msgid "Records"
|
||||
msgstr "条记录"
|
||||
|
||||
msgid "Refresh Data"
|
||||
msgstr "更新数据库"
|
||||
|
||||
msgid "Refresh..."
|
||||
msgstr "正在更新,请稍候.."
|
||||
|
||||
msgid "Refresh OK!"
|
||||
msgstr "更新成功!"
|
||||
|
||||
msgid "Refresh Error!"
|
||||
msgstr "更新失败!"
|
||||
|
||||
msgid "No new data!"
|
||||
msgstr "你已经是最新数据,无需更新!"
|
||||
|
||||
msgid "Total Records:"
|
||||
msgstr "新的总纪录数:"
|
||||
|
||||
msgid "Delete All Subscribe Rules"
|
||||
msgstr "清空所有订阅的规则库"
|
||||
|
||||
msgid "Anti-AD Rules Subscribe"
|
||||
msgstr "广告过滤规则订阅URL"
|
||||
|
||||
msgid "AdGuardHome / Host / DNSMASQ rules auto-convert"
|
||||
msgstr "AdGuardHome / Host / DNSMASQ 规则自动识别"
|
||||
|
||||
msgid "Manually force update<br />Adblock Plus Host List"
|
||||
msgstr "手动强制更新<br />Adblock Plus Host List"
|
||||
|
||||
msgid "Update Adbyby Rules Manually"
|
||||
msgstr "手动更新规则"
|
||||
|
||||
msgid "Block Apple iOS OTA update"
|
||||
msgstr "拦截 Apple iOS 的OTA更新"
|
||||
|
||||
msgid "Block CNshort APP and Website"
|
||||
msgstr "拦截 短视频 APP 和网站"
|
||||
|
||||
msgid "RAM Running Mode"
|
||||
msgstr "内存运行模式"
|
||||
|
||||
msgid "Running Adbyby in RAM.More speed,less disk consumption"
|
||||
msgstr "在内存中运行Adbyby。更快的速度,更少的存储空间损耗"
|
||||
|
||||
msgid "User-defined Rule"
|
||||
msgstr "用户自定义规则"
|
||||
|
||||
msgid "<strong>Client Filter Mode Settings</strong>"
|
||||
msgstr "<strong>客户端过滤模式设置</strong>"
|
||||
|
||||
msgid "Filter mode settings can be set to specific LAN clients ( <font color=blue> No filter , Global filter </font> ) . Does not need to be set by default."
|
||||
msgstr "可以为局域网客户端分别设置不同的过滤模式 ( <font color=blue> 不过滤 , 全局过滤 </font> ) 。默认无需设置。"
|
||||
|
||||
msgid "IP Address"
|
||||
msgstr "IP地址"
|
||||
|
||||
msgid "Filter Mode"
|
||||
msgstr "过滤模式"
|
||||
|
||||
msgid "(!)Note that you should fill to the domain name ONLY. For example, http://www.baidu.com only needs to write to baidu.com. One line for each"
|
||||
msgstr "这些域名在 Plus 模式中会被过滤。你需要要填写域名即可,例如 http://www.baidu.com,你写 baidu.com 即可。每行一个域名"
|
||||
|
||||
msgid "(!)Will Never filter these Domain"
|
||||
msgstr "永不过滤白名单内的域名(所有模式中生效)"
|
||||
|
||||
msgid "(!)Will Always block these Domain"
|
||||
msgstr "拦截黑名单内的域名(所有模式中生效)"
|
||||
|
||||
msgid "(!)Will Always block these IP"
|
||||
msgstr "拦截黑名单内的IP地址(所有模式中生效)"
|
||||
|
||||
msgid "Each line of the beginning exclamation mark is considered an annotation."
|
||||
msgstr "每行一条规则,感叹号开头的被认为是注释。"
|
||||
|
||||
msgid "<strong><font color=blue>Adblock Plus Host List:</font></strong>"
|
||||
msgstr "<strong><font color=blue>Adblock Plus Host 列表:</font></strong>"
|
||||
|
||||
msgid "Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"
|
||||
msgstr "注意:需要下载并转换规则。后台进程可能需要60-120秒运行。完成后会自动刷新,请不要重复点击!"
|
||||
|
||||
msgid "No filter"
|
||||
msgstr "不过滤"
|
||||
|
||||
msgid "Global filter"
|
||||
msgstr "全局过滤"
|
||||
|
||||
msgid "Update adbyby rules form official website first"
|
||||
msgstr "优先从官方网站更新规则"
|
||||
|
||||
msgid "Last Update Checked"
|
||||
msgstr "上一次检查规则更新"
|
||||
|
||||
msgid "Lazy Rule"
|
||||
msgstr "正式版规则"
|
||||
|
||||
msgid "Video Rule"
|
||||
msgstr "测试版规则"
|
||||
|
||||
msgid "Adblock Plus Host List"
|
||||
msgstr "广告屏蔽大师 Plus 规则列表"
|
||||
|
||||
msgid "Block Domain List"
|
||||
msgstr "域名黑名单"
|
||||
|
||||
msgid "Block IP List"
|
||||
msgstr "IP黑名单"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
config adbyby
|
||||
option daemon '2'
|
||||
option lan_mode '0'
|
||||
option cron_mode '1'
|
||||
option block_ios '0'
|
||||
option enable '0'
|
||||
option wan_mode '1'
|
||||
option mem_mode '1'
|
||||
option update_source '1'
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=96
|
||||
STOP=10
|
||||
|
||||
|
||||
EXTRA_COMMANDS="add_rule del_rule reload_rule"
|
||||
PROG_PATH=/usr/share/adbyby
|
||||
DATA_PATH=$PROG_PATH/data
|
||||
WAN_FILE=/tmp/dnsmasq.d/dnsmasq-adbyby.d/03-adbyby-ipset.conf
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
CONFIG=adbyby
|
||||
ipt_n="iptables -t nat"
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $CONFIG.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_get_by_type() {
|
||||
local index=0
|
||||
if [ -n $4 ]; then
|
||||
|
||||
index=$4
|
||||
fi
|
||||
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
get_config()
|
||||
{
|
||||
config_get_bool enable $1 enable 0
|
||||
config_get_bool cron_mode $1 cron_mode 1
|
||||
config_get wan_mode $1 wan_mode 1
|
||||
config_get_bool block_ios $1 block_ios 0
|
||||
config_get_bool mem_mode $1 mem_mode 1
|
||||
config_get_bool block_cnshort $1 block_cnshort 0
|
||||
}
|
||||
|
||||
add_rules()
|
||||
{
|
||||
rm -f $DATA_PATH/user.bin
|
||||
grep -v ^! $PROG_PATH/rules.txt > $DATA_PATH/user.txt
|
||||
cp $PROG_PATH/rules.txt $DATA_PATH/rules.txt
|
||||
}
|
||||
|
||||
|
||||
add_cron()
|
||||
{
|
||||
if [ $cron_mode -eq 1 ]; then
|
||||
sed -i '/adblock.sh/d' $CRON_FILE
|
||||
echo '0 6 * * * /usr/share/adbyby/adblock.sh > /tmp/adupdate.log 2>&1' >> $CRON_FILE
|
||||
crontab $CRON_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
del_cron()
|
||||
{
|
||||
sed -i '/adblock.sh/d' $CRON_FILE
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
ip_rule()
|
||||
{
|
||||
|
||||
ipset -N adbyby_esc hash:ip
|
||||
$ipt_n -A ADBYBY -m set --match-set adbyby_esc dst -j RETURN
|
||||
|
||||
local icount=$(uci show adbyby | grep 'filter_mode' | wc -l)
|
||||
let icount=icount-1
|
||||
for i in $(seq 0 $icount)
|
||||
do
|
||||
local ip=$(uci_get_by_type acl_rule ipaddr '' $i)
|
||||
local mode=$(uci_get_by_type acl_rule filter_mode '' $i)
|
||||
case "$mode" in
|
||||
disable)
|
||||
$ipt_n -A ADBYBY -s $ip -j RETURN
|
||||
;;
|
||||
global)
|
||||
$ipt_n -A ADBYBY -s $ip -p tcp -j REDIRECT --to-ports 8118
|
||||
$ipt_n -A ADBYBY -s $ip -j RETURN
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
case $wan_mode in
|
||||
0)
|
||||
;;
|
||||
1)
|
||||
ipset -N adbyby_wan hash:ip
|
||||
$ipt_n -A ADBYBY -m set ! --match-set adbyby_wan dst -j RETURN
|
||||
;;
|
||||
2)
|
||||
$ipt_n -A ADBYBY -j RETURN
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "create blockip hash:net family inet hashsize 1024 maxelem 65536" > /tmp/blockip.ipset
|
||||
awk '!/^$/&&!/^#/{printf("add blockip %s'" "'\n",$0)}' /usr/share/adbyby/blockip.conf >> /tmp/blockip.ipset
|
||||
ipset -! restore < /tmp/blockip.ipset 2>/dev/null
|
||||
iptables -I FORWARD -m set --match-set blockip dst -j DROP
|
||||
iptables -I OUTPUT -m set --match-set blockip dst -j DROP
|
||||
}
|
||||
|
||||
add_dns()
|
||||
{
|
||||
mkdir -p /tmp/dnsmasq.d/dnsmasq-adbyby.d
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_esc"'\n",$0)}' $PROG_PATH/adesc.conf > /tmp/dnsmasq.d/dnsmasq-adbyby.d/06-dnsmasq.esc
|
||||
awk '!/^$/&&!/^#/{printf("address=/%s/'"0.0.0.0"'\n",$0)}' $PROG_PATH/adblack.conf > /tmp/dnsmasq.d/dnsmasq-adbyby.d/07-dnsmasq.black
|
||||
|
||||
echo 'conf-dir=/tmp/dnsmasq.d/dnsmasq-adbyby.d' > /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
|
||||
local var=1
|
||||
if [ $wan_mode -eq 1 ]; then
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_wan"'\n",$0)}' $PROG_PATH/adhost.conf > $WAN_FILE
|
||||
if ls /tmp/dnsmasq.d/dnsmasq-adbyby.d/* >/dev/null 2>&1; then
|
||||
mkdir -p /tmp/dnsmasq.d
|
||||
cp /usr/share/adbyby/dnsmasq.adblock /tmp/dnsmasq.d/dnsmasq-adbyby.d/04-dnsmasq.adblock
|
||||
cp /usr/share/adbyby/dnsmasq.ads /tmp/dnsmasq.d/dnsmasq-adbyby.d/05-dnsmasq.ads
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host/*
|
||||
cp -a /usr/share/adbyby/rules/data/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data 2>/dev/null
|
||||
cp -a /usr/share/adbyby/rules/host/* /tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host 2>/dev/null
|
||||
echo 'addn-hosts=/tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/host/' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
echo 'conf-dir=/tmp/dnsmasq.d/dnsmasq-adbyby.d/rules/data' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
|
||||
[ $block_ios -eq 1 ] && echo 'address=/mesu.apple.com/0.0.0.0' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
if [ $block_cnshort -eq 1 ]; then
|
||||
cat <<-EOF >/tmp/etc/dnsmasq-adbyby.d/08-dnsmasq.cnshort
|
||||
address=/api.amemv.com/0.0.0.0
|
||||
address=/.amemv.com/0.0.0.0
|
||||
address=/.tiktokv.com/0.0.0.0
|
||||
address=/.snssdk.com/0.0.0.0
|
||||
address=/.douyin.com/0.0.0.0
|
||||
address=/.ixigua.com/0.0.0.0
|
||||
address=/.pstatp.com/0.0.0.0
|
||||
address=/.ixiguavideo.com/0.0.0.0
|
||||
address=/.v.kandian.qq.com/0.0.0.0
|
||||
address=/.yximgs.com/0.0.0.0
|
||||
address=/.gifshow.com/0.0.0.0
|
||||
address=/.ksapisrv.com/0.0.0.0
|
||||
address=/.kuaishoupay.com/0.0.0.0
|
||||
address=/.ksyun.com/0.0.0.0
|
||||
address=/.live.xycdn.com/0.0.0.0
|
||||
address=/.danuoyi.alicdn.com/0.0.0.0
|
||||
address=/.v.weishi.qq.com/0.0.0.0
|
||||
address=/.pearvideo.com/0.0.0.0
|
||||
address=/.miaopai.com/0.0.0.0
|
||||
address=/.kuaishou.com/0.0.0.0
|
||||
address=/.qupai.me/0.0.0.0
|
||||
address=/.meipai.com/0.0.0.0
|
||||
address=/.huoshan.com/0.0.0.0
|
||||
address=/.ergengtv.com/0.0.0.0
|
||||
address=/.baijiahao.baidu.com/0.0.0.0
|
||||
address=/.xiongzhang.baidu.com/0.0.0.0
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
del_dns()
|
||||
{
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.conf
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-adbyby.d/*
|
||||
rm -f /tmp/adbyby_host.conf
|
||||
}
|
||||
|
||||
|
||||
add_rule()
|
||||
{
|
||||
$ipt_n -N ADBYBY
|
||||
$ipt_n -A ADBYBY -d 0.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 10.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 127.0.0.0/8 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 169.254.0.0/16 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 172.16.0.0/12 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 192.168.0.0/16 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 224.0.0.0/4 -j RETURN
|
||||
$ipt_n -A ADBYBY -d 240.0.0.0/4 -j RETURN
|
||||
ip_rule
|
||||
if [ $(ipset list music -name -quiet | grep music) ]; then
|
||||
$ipt_n -A ADBYBY -m set --match-set music dst -j RETURN 2>/dev/null
|
||||
fi
|
||||
$ipt_n -A ADBYBY -p tcp -j REDIRECT --to-ports 8118 2>/dev/null
|
||||
$ipt_n -I PREROUTING -p tcp --dport 80 -j ADBYBY 2>/dev/null
|
||||
|
||||
mkdir -p /var/etc
|
||||
echo -e "/etc/init.d/adbyby restart" > "/var/etc/adbyby.include"
|
||||
}
|
||||
|
||||
del_rule()
|
||||
{
|
||||
$ipt_n -D PREROUTING -p tcp --dport 80 -j ADBYBY 2>/dev/null
|
||||
$ipt_n -F ADBYBY 2>/dev/null
|
||||
$ipt_n -X ADBYBY 2>/dev/null
|
||||
iptables -D FORWARD -m set --match-set blockip dst -j DROP 2>/dev/null
|
||||
iptables -D OUTPUT -m set --match-set blockip dst -j DROP 2>/dev/null
|
||||
ipset -F adbyby_esc 2>/dev/null
|
||||
ipset -X adbyby_esc 2>/dev/null
|
||||
ipset -F adbyby_wan 2>/dev/null
|
||||
ipset -X adbyby_wan 2>/dev/null
|
||||
ipset -F blockip 2>/dev/null
|
||||
ipset -X blockip 2>/dev/null
|
||||
}
|
||||
|
||||
reload_rule()
|
||||
{
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
del_rule
|
||||
[ $enable -eq 0 ] && exit 0
|
||||
add_rule
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
|
||||
if [ $enable -ne 0 ]; then
|
||||
add_cron
|
||||
[ ! -d "/tmp/adbyby/data" ] && cp -a /usr/share/adbyby /tmp/ && rm -f /tmp/adbyby.updated
|
||||
add_rules
|
||||
|
||||
/tmp/adbyby/adbyby >/dev/null 2>&1 &
|
||||
|
||||
add_dns
|
||||
add_rule
|
||||
/etc/init.d/dnsmasq restart
|
||||
fi
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 $(busybox ps -w | grep "/tmp/adbyby/adbyby" | grep -v grep | grep -v update| grep -v adblock | awk '{print $1}') >/dev/null 2>&1
|
||||
config_load adbyby
|
||||
config_foreach get_config adbyby
|
||||
del_rule
|
||||
del_cron
|
||||
del_dns
|
||||
/etc/init.d/dnsmasq restart
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
mkdir -p /tmp/adbyby && cp -a /usr/share/adbyby /tmp/
|
||||
start
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-adbyby.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-adbyby.json << EEOF
|
||||
{
|
||||
"config": "adbyby",
|
||||
"init": "adbyby"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@adbyby[-1]
|
||||
add ucitrack adbyby
|
||||
set ucitrack.@adbyby[-1].init=adbyby
|
||||
commit ucitrack
|
||||
delete firewall.adbyby
|
||||
set firewall.adbyby=include
|
||||
set firewall.adbyby.type=script
|
||||
set firewall.adbyby.path=/var/etc/adbyby.include
|
||||
set firewall.adbyby.reload=1
|
||||
delete firewall.adblock
|
||||
add firewall rule
|
||||
rename firewall.@rule[-1]="adblock"
|
||||
set firewall.@rule[-1].name="adblock"
|
||||
set firewall.@rule[-1].target="DROP"
|
||||
set firewall.@rule[-1].src="wan"
|
||||
set firewall.@rule[-1].proto="tcp"
|
||||
set firewall.@rule[-1].dest_port="8118"
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/dnsmasq.d
|
||||
|
||||
/etc/init.d/adbyby stop
|
||||
/etc/init.d/adbyby enable
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,6 +0,0 @@
|
||||
/usr/share/adbyby/adhost.conf
|
||||
/usr/share/adbyby/adblack.conf
|
||||
/usr/share/adbyby/blockip.conf
|
||||
/usr/share/adbyby/adesc.conf
|
||||
/usr/share/adbyby/rules.txt
|
||||
/usr/share/adbyby/dnsmasq.adblock
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
if [ -f /tmp/adnew.conf ]; then
|
||||
if (grep -wq "address=" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/ad.conf
|
||||
else
|
||||
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
#rm -f /tmp/adnew.conf
|
||||
@@ -1,14 +0,0 @@
|
||||
gvod.aiseejapp.atianqi.com
|
||||
stat.pandora.xiaomi.com
|
||||
upgrade.mishop.pandora.xiaomi.com
|
||||
logonext.tv.kuyun.com
|
||||
config.kuyun.com
|
||||
mishop.pandora.xiaomi.com
|
||||
dvb.pandora.xiaomi.com
|
||||
api.ad.xiaomi.com
|
||||
de.pandora.xiaomi.com
|
||||
data.mistat.xiaomi.com
|
||||
jellyfish.pandora.xiaomi.com
|
||||
gallery.pandora.xiaomi.com
|
||||
o2o.api.xiaomi.com
|
||||
bss.pandora.xiaomi.com
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uclient-fetch --no-check-certificate -O - 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt' > /tmp/adnew.conf
|
||||
if [ -s "/tmp/adnew.conf" ];then
|
||||
/usr/share/adbyby/ad-update
|
||||
fi
|
||||
|
||||
rm -f /tmp/adbyby.updated
|
||||
sleep 10
|
||||
/etc/init.d/adbyby restart
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROG_PATH=$(pwd)
|
||||
$PROG_PATH/adbybyupdate.sh
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/tmp/adbyby.updated" ];then
|
||||
wget_ok="0"
|
||||
while [ "$wget_ok" = "0" ]
|
||||
do
|
||||
uclient-fetch --spider --quiet --timeout=3 http://www.baidu.com
|
||||
if [ "$?" == "0" ]; then
|
||||
wget_ok="1"
|
||||
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
adm5=$(md5sum /tmp/md5.json | awk -F' ' '{print $1}')
|
||||
touch /tmp/adbyby/admd5.json && bmd5=$(md5sum /tmp/adbyby/admd5.json | awk -F' ' '{print $1}')
|
||||
if [ "$adm5" == "$bmd5" ];then
|
||||
echo "Rules MD5 are the same!"
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
exit 0
|
||||
elif [ -s /tmp/md5.json ];then
|
||||
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "adbyby rules MD5 OK!"
|
||||
mv /tmp/lazy.txt /tmp/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /tmp/adbyby/data/video.txt
|
||||
mv /tmp/md5.json /tmp/adbyby/admd5.json
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
fi
|
||||
else
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f /tmp/adbyby/data/*.bak
|
||||
|
||||
kill -9 $(busybox ps -w | grep "/tmp/adbyby/adbyby" | grep -v grep | grep -v update| grep -v adblock | awk '{print $1}') >/dev/null 2>&1
|
||||
/tmp/adbyby/adbyby >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
weixin.qq.com
|
||||
qpic.cn
|
||||
imtt.qq.com
|
||||
@@ -1,74 +0,0 @@
|
||||
124.232.160.178
|
||||
126.net
|
||||
50bang.org
|
||||
56.com
|
||||
acfun.com
|
||||
acfun.tv
|
||||
admaster.com.cn
|
||||
agn.aty.sohu.com
|
||||
amdc.cp12.ott.cibntv.net
|
||||
analytics-union.xunlei.com
|
||||
api.mydianshijia.com
|
||||
atianqi.com
|
||||
baidustatic.com
|
||||
baofeng.com
|
||||
baofeng.net
|
||||
bdimg.com
|
||||
bdstatic.com
|
||||
cbjs.baidu.com
|
||||
cnbeta.com
|
||||
cnbetacdn.com
|
||||
cntv.cn
|
||||
cpro.baidu.com
|
||||
doubleclick.net
|
||||
fun.tv
|
||||
funshion.com
|
||||
googles.com
|
||||
hitvs.cn
|
||||
hljtv.com
|
||||
hm.baidu.com
|
||||
hoopchina.com.cn
|
||||
hunantv.com
|
||||
ifeng.com
|
||||
img1.kyimg.com
|
||||
iqiyi.com
|
||||
itc.cn
|
||||
jiuzhilan.com
|
||||
kankan.com
|
||||
kankan.xunlei.com
|
||||
ku6.com
|
||||
kuyun.com
|
||||
l.qq.com
|
||||
letv.com
|
||||
letvcloud.com
|
||||
letvimg.com
|
||||
list.video.baidu.com
|
||||
lives.l.aiseet.atianqi.com
|
||||
mediav.com
|
||||
mydrivers.com
|
||||
nsclick.baidu.com
|
||||
play.baidu.com
|
||||
pplive.cn
|
||||
pps.tv
|
||||
ppsimg.com
|
||||
pptv.com
|
||||
ptqy.gitv.tv
|
||||
pv.sohu.com
|
||||
qiyi.com
|
||||
renren.com
|
||||
right.com.cn
|
||||
sclick.baidu.com
|
||||
serving-sys.com
|
||||
share.baidu.com
|
||||
sohu.com
|
||||
sv-video.play.ott.video.qq.com
|
||||
tieba.baidu.com
|
||||
tudou.com
|
||||
v-56.com
|
||||
v.baidu.com
|
||||
v.qq.com
|
||||
video.sina.com.cn
|
||||
wasu.cn
|
||||
www.qq.com
|
||||
you85.cn
|
||||
youku.com
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f "/tmp/adbyby.updated" ];then
|
||||
touch /tmp/adbyby.mem
|
||||
wget_ok="0"
|
||||
while [ "$wget_ok" = "0" ]
|
||||
do
|
||||
uclient-fetch --spider --quiet --tries=1 --timeout=3 www.baidu.com
|
||||
if [ "$?" == "0" ]; then
|
||||
wget_ok="1"
|
||||
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
adm5=$(md5sum /tmp/md5.json | awk -F' ' '{print $1}')
|
||||
touch /tmp/adbyby/admd5.json && bmd5=$(md5sum /tmp/adbyby/admd5.json | awk -F' ' '{print $1}')
|
||||
if [ "$adm5" == "$bmd5" ];then
|
||||
echo "Rules MD5 are the same!"
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
exit 0
|
||||
else
|
||||
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "adbyby rules MD5 OK!"
|
||||
mv /tmp/lazy.txt /tmp/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /tmp/adbyby/data/video.txt
|
||||
mv /tmp/md5.json /tmp/adbyby/admd5.json
|
||||
echo $(date "+%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
fi
|
||||
else
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 10 && /etc/init.d/adbyby restart
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f /usr/share/adbyby/data/*.bak
|
||||
|
||||
touch /tmp/local-md5.json && md5sum /usr/share/adbyby/data/lazy.txt /usr/share/adbyby/data/video.txt > /tmp/local-md5.json
|
||||
touch /tmp/md5.json && uclient-fetch --no-check-certificate -T 10 -O /tmp/md5.json https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/md5.json
|
||||
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
lazy_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '2p')
|
||||
video_online=$(sed 's/":"/\n/g' /tmp/md5.json | sed 's/","/\n/g' | sed -n '4p')
|
||||
|
||||
if [ "$lazy_online"x != "$lazy_local"x -o "$video_online"x != "$video_local"x ]; then
|
||||
echo "MD5 not match! Need update!"
|
||||
touch /tmp/lazy.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/lazy.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/lazy.txt
|
||||
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://cdn.jsdelivr.net/gh/kongfl888/ad-rules/video.txt
|
||||
touch /tmp/local-md5.json && md5sum /tmp/lazy.txt /tmp/video.txt > /tmp/local-md5.json
|
||||
lazy_local=$(grep 'lazy' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
video_local=$(grep 'video' /tmp/local-md5.json | awk -F' ' '{print $1}')
|
||||
if [ "$lazy_online"x == "$lazy_local"x -a "$video_online"x == "$video_local"x ]; then
|
||||
echo "New rules MD5 match!"
|
||||
mv /tmp/lazy.txt /usr/share/adbyby/data/lazy.txt
|
||||
mv /tmp/video.txt /usr/share/adbyby/data/video.txt
|
||||
echo $(date +"%Y-%m-%d %H:%M:%S") > /tmp/adbyby.updated
|
||||
fi
|
||||
else
|
||||
echo "MD5 match! No need to update!"
|
||||
fi
|
||||
|
||||
rm -f /tmp/lazy.txt /tmp/video.txt /tmp/local-md5.json /tmp/md5.json
|
||||
@@ -1 +0,0 @@
|
||||
2.2.2.2
|
||||
Whitespace-only changes.
@@ -1,4 +0,0 @@
|
||||
address=/p.tanx.com/0.0.0.0
|
||||
address=/googlesyndication.com/0.0.0.0
|
||||
address=/linkvans.com/0.0.0.0
|
||||
server=/valf.atm.youku.com/114.114.114.114
|
||||
@@ -1,3 +0,0 @@
|
||||
ipset=/weixin.qq.com/adbyby_wan
|
||||
ipset=/qpic.cn/adbyby_wan
|
||||
ipset=/imtt.qq.com/adbyby_wan
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -f /tmp/blockip.ipset ];then
|
||||
|
||||
adbyby_enable=$(uci get adbyby.@adbyby[0].enable)
|
||||
|
||||
if [ $adbyby_enable -eq 1 ]; then
|
||||
if pidof adbyby>/dev/null; then
|
||||
/etc/init.d/adbyby reload_rule
|
||||
else
|
||||
/etc/init.d/adbyby restart
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
find $1 -type f -exec cat {} \; | wc -l
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
url_md5() {
|
||||
echo -n $1|md5sum|cut -d ' ' -f1
|
||||
}
|
||||
|
||||
convert_rules() {
|
||||
mkdir -p /tmp/rules/data
|
||||
mkdir -p /tmp/rules/host
|
||||
|
||||
uclient-fetch -q --no-check-certificate $1 -O /tmp/adnew.conf
|
||||
|
||||
rulename=$(url_md5 $1)
|
||||
|
||||
if [ -f /tmp/adnew.conf ]; then
|
||||
if (grep -wq "address=" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/rules/data/$rulename.conf
|
||||
elif (grep -wq -e"0.0.0.0" -e"127.0.0.1" /tmp/adnew.conf) ; then
|
||||
cp /tmp/adnew.conf /tmp/rules/host/$rulename.txt
|
||||
else
|
||||
cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/rules/data/$rulename.conf
|
||||
fi
|
||||
fi
|
||||
rm -rf /tmp/adnew.conf
|
||||
}
|
||||
|
||||
ARRAY=$(uci get adbyby.@adbyby[0].subscribe_url 2> /dev/null)
|
||||
|
||||
rm -rf /tmp/rules
|
||||
|
||||
i=1
|
||||
for j in $ARRAY
|
||||
do
|
||||
convert_rules $j
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
@@ -1,15 +0,0 @@
|
||||
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
|
||||
! -------------- 规则基于abp规则,并进行了字符替换部分的扩展-----------------------------
|
||||
! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要
|
||||
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
|
||||
! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。
|
||||
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
|
||||
! "|" 为管线符号,来表示地址的最前端或最末端
|
||||
! "||" 为子域通配符,方便匹配主域名下的所有子域。
|
||||
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
|
||||
! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
|
||||
!! 元素隐藏暂不支持全局规则和排除规则
|
||||
!! 字符替换扩展
|
||||
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
|
||||
! 支持通配符*和?
|
||||
! -------------------------------------------------------------------------------------------
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-adbyby-plus": {
|
||||
"description": "Grant UCI access for luci-app-adbyby-plus",
|
||||
"read": {
|
||||
"uci": [ "adbyby" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "adbyby" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"config": "adbyby",
|
||||
"init": "adbyby"
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-aliyundrive-fuse
|
||||
PKG_VERSION:=0.1.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_MAINTAINER:=messense <messense@icloud.com>
|
||||
|
||||
LUCI_TITLE:=LuCI Support for aliyundrive-fuse
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+aliyundrive-fuse
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,40 +0,0 @@
|
||||
module("luci.controller.aliyundrive-fuse", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/aliyundrive-fuse") then
|
||||
return
|
||||
end
|
||||
|
||||
local page
|
||||
page = entry({"admin", "services", "aliyundrive-fuse"}, alias("admin", "services", "aliyundrive-fuse", "client"), _("AliyunDrive FUSE"), 10) -- 首页
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-aliyundrive-fuse" }
|
||||
|
||||
entry({"admin", "services", "aliyundrive-fuse", "client"}, cbi("aliyundrive-fuse/client"), _("Settings"), 10).leaf = true -- 客户端配置
|
||||
entry({"admin", "services", "aliyundrive-fuse", "log"}, form("aliyundrive-fuse/log"), _("Log"), 30).leaf = true -- 日志页面
|
||||
|
||||
entry({"admin", "services", "aliyundrive-fuse", "status"}, call("action_status")).leaf = true
|
||||
entry({"admin", "services", "aliyundrive-fuse", "logtail"}, call("action_logtail")).leaf = true
|
||||
end
|
||||
|
||||
function action_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pidof aliyundrive-fuse >/dev/null") == 0
|
||||
e.application = luci.sys.exec("aliyundrive-fuse --version")
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function action_logtail()
|
||||
local fs = require "nixio.fs"
|
||||
local log_path = "/var/log/aliyundrive-fuse.log"
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pidof aliyundrive-fuse >/dev/null") == 0
|
||||
if fs.access(log_path) then
|
||||
e.log = luci.sys.exec("tail -n 100 %s | sed 's/\\x1b\\[[0-9;]*m//g'" % log_path)
|
||||
else
|
||||
e.log = ""
|
||||
end
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
m = Map("aliyundrive-fuse")
|
||||
m.title = translate("AliyunDrive FUSE")
|
||||
m.description = translate("<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">Project GitHub URL</a>")
|
||||
|
||||
m:section(SimpleSection).template = "aliyundrive-fuse/aliyundrive-fuse_status"
|
||||
|
||||
e = m:section(TypedSection, "default")
|
||||
e.anonymous = true
|
||||
|
||||
enable = e:option(Flag, "enable", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
refresh_token = e:option(Value, "refresh_token", translate("Refresh Token"))
|
||||
refresh_token.description = translate("<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>")
|
||||
|
||||
mount_point = e:option(Value, "mount_point", translate("Mount Point"))
|
||||
mount_point.default = "/mnt/aliyundrive"
|
||||
|
||||
read_buffer_size = e:option(Value, "read_buffer_size", translate("Read Buffer Size"))
|
||||
read_buffer_size.default = "10485760"
|
||||
read_buffer_size.datatype = "uinteger"
|
||||
|
||||
domain_id = e:option(Value, "domain_id", translate("Domain ID"))
|
||||
domain_id.description = translate("Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>")
|
||||
|
||||
allow_other = e:option(Flag, "allow_other", translate("Allow Other users Access"))
|
||||
allow_other.description = translate("Allow other users to access the drive, enable this if you share with samba")
|
||||
allow_other.rmempty = false
|
||||
|
||||
debug = e:option(Flag, "debug", translate("Debug Mode"))
|
||||
debug.rmempty = false
|
||||
|
||||
return m
|
||||
@@ -1,9 +0,0 @@
|
||||
log = SimpleForm("logview")
|
||||
log.submit = false
|
||||
log.reset = false
|
||||
|
||||
t = log:field(DummyValue, '', '')
|
||||
t.rawhtml = true
|
||||
t.template = 'aliyundrive-fuse/aliyundrive-fuse_log'
|
||||
|
||||
return log
|
||||
@@ -1,15 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<textarea id="logview" class="cbi-input-textarea" style="width: 100%" rows="30" readonly="readonly"></textarea>
|
||||
|
||||
<script type="text/javascript">
|
||||
const LOG_URL = '<%=luci.dispatcher.build_url("admin", "services", "aliyundrive-fuse", "logtail")%>';
|
||||
XHR.poll(1, LOG_URL, null, (x, d) => {
|
||||
let logview = document.getElementById("logview");
|
||||
if (!d.running) {
|
||||
XHR.halt();
|
||||
}
|
||||
logview.value = d.log;
|
||||
logview.scrollTop = logview.scrollHeight;
|
||||
});
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,21 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[aliyundrive-fuse]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('aliyundrive-fuse_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
tb.innerHTML = '<em><b style=color:green>' + data.application + '<%:RUNNING%></b></em>';
|
||||
} else {
|
||||
tb.innerHTML = '<em><b style=color:red>' + data.application + '<%:NOT RUNNING%></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="aliyundrive-fuse_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
@@ -1,56 +0,0 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "AliyunDrive"
|
||||
msgstr "阿里云盘"
|
||||
|
||||
msgid "AliyunDrive FUSE"
|
||||
msgstr "阿里云盘 FUSE"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Refresh Token"
|
||||
msgstr "Refresh Token"
|
||||
|
||||
msgid "Mount Point"
|
||||
msgstr "挂载点"
|
||||
|
||||
msgid "Read Buffer Size"
|
||||
msgstr "下载缓冲大小(bytes)"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "获取数据中..."
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Debug Mode"
|
||||
msgstr "调试模式"
|
||||
|
||||
msgid "<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">Project GitHub URL</a>"
|
||||
msgstr "<a href=\"https://github.com/messense/aliyundrive-fuse\" target=\"_blank\">GitHub 项目地址</a>"
|
||||
|
||||
msgid "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>"
|
||||
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">查看获取 refresh token 的方法</a>"
|
||||
|
||||
msgid "Domain ID"
|
||||
msgstr "阿里云相册与云盘服务 domainId"
|
||||
|
||||
msgid "Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"
|
||||
msgstr "填写此选项将使用<a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">阿里云相册与网盘服务</a>而不是<a href=\"https://www.aliyundrive.com\" target=\"_blank\">阿里云盘</a>"
|
||||
|
||||
msgid "Allow Other users Access"
|
||||
msgstr "允许其他用户访问"
|
||||
|
||||
msgid "Allow other users to access the drive, enable this if you share with samba"
|
||||
msgstr "允许其他用户访问此驱动,如果你想用Samba分享请开启此开关"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-aliyundrive-fuse.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-aliyundrive-fuse.json << EEOF
|
||||
{
|
||||
"config": "aliyundrive-fuse",
|
||||
"init": "aliyundrive-fuse"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@aliyundrive-fuse[-1]
|
||||
add ucitrack aliyundrive-fuse
|
||||
set ucitrack.@aliyundrive-fuse[-1].init=aliyundrive-fuse
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-aliyundrive-fuse": {
|
||||
"description": "Grant UCI access for luci-app-aliyundrive-fuse",
|
||||
"read": {
|
||||
"uci": [ "aliyundrive-fuse" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "aliyundrive-fuse" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-aliyundrive-webdav
|
||||
PKG_VERSION:=2.2.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.5.5
|
||||
PKG_RELEASE:=2
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_MAINTAINER:=messense <messense@icloud.com>
|
||||
|
||||
LUCI_TITLE:=LuCI Support for aliyundrive-webdav
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+aliyundrive-webdav
|
||||
LUCI_DEPENDS:=+aliyundrive-webdav +lua +libuci-lua
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@@ -4,21 +4,12 @@ function index()
|
||||
if not nixio.fs.access("/etc/config/aliyundrive-webdav") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "aliyundrive-webdav"}, alias("admin", "services", "aliyundrive-webdav", "client"),_("AliyunDrive WebDAV"), 10).dependent = true -- 首页
|
||||
entry({"admin", "services", "aliyundrive-webdav", "client"}, cbi("aliyundrive-webdav/client"),_("Settings"), 10).leaf = true -- 客户端配置
|
||||
entry({"admin", "services", "aliyundrive-webdav", "log"}, form("aliyundrive-webdav/log"),_("Log"), 30).leaf = true -- 日志页面
|
||||
|
||||
local page
|
||||
page = entry({ "admin", "services", "aliyundrive-webdav" }, alias("admin", "services", "aliyundrive-webdav", "client"),
|
||||
_("AliyunDrive WebDAV"), 10) -- 首页
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-aliyundrive-webdav" }
|
||||
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "client" }, cbi("aliyundrive-webdav/client"), _("Settings"), 10).leaf = true -- 客户端配置
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "log" }, form("aliyundrive-webdav/log"), _("Log"), 30).leaf = true -- 日志页面
|
||||
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "status" }, call("action_status")).leaf = true -- 运行状态
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "logtail" }, call("action_logtail")).leaf = true -- 日志采集
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "qrcode" }, call("action_generate_qrcode")).leaf = true -- 生成扫码登录二维码地址和参数
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "query" }, call("action_query_qrcode")).leaf = true -- 查询扫码登录结果
|
||||
entry({ "admin", "services", "aliyundrive-webdav", "invalidate-cache" }, call("action_invalidate_cache")).leaf = true -- 清除缓存
|
||||
entry({"admin", "services", "aliyundrive-webdav", "status"}, call("action_status")).leaf = true
|
||||
entry({"admin", "services", "aliyundrive-webdav", "logtail"}, call("action_logtail")).leaf = true
|
||||
end
|
||||
|
||||
function action_status()
|
||||
@@ -42,25 +33,3 @@ function action_logtail()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function action_generate_qrcode()
|
||||
local output = luci.sys.exec("aliyundrive-webdav qr generate")
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write(output)
|
||||
end
|
||||
|
||||
function action_query_qrcode()
|
||||
local data = luci.http.formvalue()
|
||||
local sid = data.sid
|
||||
local output = {}
|
||||
output.refresh_token = luci.sys.exec("aliyundrive-webdav qr query --sid " .. sid)
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(output)
|
||||
end
|
||||
|
||||
function action_invalidate_cache()
|
||||
local e = {}
|
||||
e.ok = luci.sys.call("kill -HUP `pidof aliyundrive-webdav`") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@@ -1,3 +1,6 @@
|
||||
local uci = luci.model.uci.cursor()
|
||||
local m, e
|
||||
|
||||
m = Map("aliyundrive-webdav")
|
||||
m.title = translate("AliyunDrive WebDAV")
|
||||
m.description = translate("<a href=\"https://github.com/messense/aliyundrive-webdav\" target=\"_blank\">Project GitHub URL</a>")
|
||||
@@ -11,11 +14,7 @@ enable = e:option(Flag, "enable", translate("Enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
refresh_token = e:option(Value, "refresh_token", translate("Refresh Token"))
|
||||
refresh_token.description = translate("Double click the input box above to get refresh token by scanning qrcode")
|
||||
|
||||
qrcode = e:option(DummyValue, '', '')
|
||||
qrcode.rawhtml = true
|
||||
qrcode.template = 'aliyundrive-webdav/aliyundrive-webdav_qrcode'
|
||||
refresh_token.description = translate("<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>")
|
||||
|
||||
root = e:option(Value, "root", translate("Root Directory"))
|
||||
root.description = translate("Restrict access to a folder of aliyundrive, defaults to / which means no restrictions")
|
||||
@@ -29,9 +28,6 @@ port = e:option(Value, "port", translate("Port"))
|
||||
port.default = "8080"
|
||||
port.datatype = "port"
|
||||
|
||||
tls_cert = e:option(Value, "tls_cert", translate("TLS certificate file path"))
|
||||
tls_key = e:option(Value, "tls_key", translate("TLS private key file path"))
|
||||
|
||||
auth_user = e:option(Value, "auth_user", translate("Username"))
|
||||
auth_password = e:option(Value, "auth_password", translate("Password"))
|
||||
auth_password.password = true
|
||||
@@ -40,22 +36,6 @@ read_buffer_size = e:option(Value, "read_buffer_size", translate("Read Buffer Si
|
||||
read_buffer_size.default = "10485760"
|
||||
read_buffer_size.datatype = "uinteger"
|
||||
|
||||
prefer_http_download = e:option(Flag, "prefer_http_download", translate("Prefer HTTP Download"))
|
||||
prefer_http_download.description = translate("Prefer downloading files using HTTP instead of HTTPS protocol")
|
||||
prefer_http_download.rmempty = false
|
||||
|
||||
redirect = e:option(Flag, "redirect", translate("Enable 302 Redirect"))
|
||||
redirect.description = translate("Enable 302 redirect when possible")
|
||||
redirect.rmempty = false
|
||||
|
||||
upload_buffer_size = e:option(Value, "upload_buffer_size", translate("Upload Buffer Size"))
|
||||
upload_buffer_size.default = "16777216"
|
||||
upload_buffer_size.datatype = "uinteger"
|
||||
|
||||
skip_upload_same_size = e:option(Flag, "skip_upload_same_size", translate("Skip uploading same size files"))
|
||||
skip_upload_same_size.description = translate("Reduce the upload traffic by skipping uploading files with the same size")
|
||||
skip_upload_same_size.rmempty = false
|
||||
|
||||
cache_size = e:option(Value, "cache_size", translate("Cache Size"))
|
||||
cache_size.default = "1000"
|
||||
cache_size.datatype = "uinteger"
|
||||
@@ -67,9 +47,8 @@ cache_ttl.datatype = "uinteger"
|
||||
no_trash = e:option(Flag, "no_trash", translate("Delete file permanently instead of trashing"))
|
||||
no_trash.rmempty = false
|
||||
|
||||
read_only = e:option(Flag, "read_only", translate("Enable read only mode"))
|
||||
read_only.description = translate("Disallow upload, modify and delete file operations")
|
||||
read_only.rmempty = false
|
||||
domain_id = e:option(Value, "domain_id", translate("Domain ID"))
|
||||
domain_id.description = translate("Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>")
|
||||
|
||||
debug = e:option(Flag, "debug", translate("Debug Mode"))
|
||||
debug.rmempty = false
|
||||
|
||||
-158
@@ -1,158 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
|
||||
<style>
|
||||
#mask-box {
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
background: rgba(255, 255, 255, .8);
|
||||
}
|
||||
#mask-box #code-box {
|
||||
color: #000000;
|
||||
width: 288px;
|
||||
height: 325px;
|
||||
border: 1px solid #585858;
|
||||
padding: 15px;
|
||||
position: absolute;
|
||||
box-shadow: 0px 0px 7px 3px rgb(0 0 0 / 20%);
|
||||
background: #fff url('data:image/gif;base64,R0lGODlhQABAAMQAAJSWlNTS1LSytOzq7MTCxNze3PT29KSipLy6vNza3PTy9MzKzOTm5Pz+/KyqrJyenNTW1LS2tOzu7MTGxOTi5Pz6/KSmpLy+vP///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAwAYACwAAAAAQABAAAAF/iAmjmRpnmiqrmzrvnAsz3Rt33iu7zxqUBRDr2dAPABIhHCIMxyQyKNlyawZoVhEtWbAHo/IynZGiZoBR8rY1CgQLouBiQEF19XrkUHw6PcXDSRddlgAYnkYDXwPB34PASUIXlBaiBgFfY2ZjIciCo1eBwooCgkMgToEjqt4IwpXaAijJwoBEBAMOwiaqw8JtECzKAMJtgU7C71+cjQVtgnMOQOOjY0OqM0DwjrJqwetli4NAZoHDuDhLxUUCRSd6fDx8vP09SYSCQkS9isVEw4OLDiY8I4fiX8CAw5cU6FgCwkKEwrcV4VBgAC5YCQAKFDiMSbOLgag0iJBQo4AwX8xMSByJAyIHSNSZGIRowyEAAFOWGOApDqcFggaTCGhQIGZQ5MqXcq0qVMWDSpgc+pMgAAE6JZOsMr1Y40GCRYE2IZDAlcHViNMlZHgzYQJa21QEICWqwCfMRa8JTCBrA0GdtGqtRGAgGECeL8isOogggMIKhrELaFgb8YdEiIIcAwIRQMIFy5AcEiigYLEOBowOKoCAoLXCCA7bXABNoILkw3Svh0hdG6Drm/HfpoItGjSSyUTX868ufPn0KMnDQEAIfkECQMAGQAsAAAAAEAAQACEnJqc1NLUtLa07OrsrKqs3N7cxMLE9Pb0pKKk3NrcvL689PL0tLK05ObkzMrM/P78nJ6c1NbUvLq87O7srK6s5OLkxMbE/Pr8pKak////AAAAAAAAAAAAAAAAAAAAAAAABf5gJo5kaZ5oqq5s675wLM90bd94ru88eg2DS693sUAAAIhFOMRdKMgogMJs1gxSqcVauxyzSEiVCxuApQ3yaRCwJA4m8xmZVo8uCgREj0mUvHMQcCYLBQMPPAZ8CHoIBSUWc1slDw4ClwoLOgN7jZ0UiHdQWRihJAGXqQpjNQF7nY0IEyUHRmEKpiMPqQwCvQM5DhAYnhh7wCYHEw25JAepAhK9FTkRscOMgjMPCr7eDJo4B9nErwo1FdACDjsJw68IGOE0FQoMEgHNNxUEjAgSs248uKAvx4Nlg+woXMiwocOHdn4EgfjiQQIKBDBQSFCQYokIBDJiJBBBzQVWLcyehAypkQqXAREiIHsxQKTGlTOJxIyJUkXNlRkzBhxyIUIAoz1TPNF4k4JLKzBlyogwMmhJMie3USXgNEJHj38GMANLtqzZs2jTqlVbwYACB/PWZkjgi0GvuNsaBCiQlMaFuhR8sbPRwIIDC/l2TOjFmME5G20ML9lxwG5guwZuFDhs+OsMS3UFULNxoI2DoToOOGAQ2A+KBxUcOKjgeaBn0hM811PAe7TcDA4USBA++Hdw3m9/i6g3XIJvubBl01ZOvbr169iza9/+OwQAIfkECQMAGgAsAAAAAEAAQACElJaUzM7MtLK07OrspKakxMLE3N7c9Pb0nJ6c1NbUvLq89PL0rK6szMrM/P78nJqc1NLUtLa07O7srKqsxMbE5Obk/Pr8pKKk3NrcvL68////AAAAAAAAAAAAAAAAAAAABf6gJo5kaZ5oqq5s675wLM90bd94ru886hwLR6/nCBAeCEJAOMQ5FMgoQmFp3gLS6CNgrTkIiCwiyezGDmLtwXw6GDCVagkdrksXc8oF8IgMdg4QBAQXFwx/JF9pZCQLewCQkAk6gheElxIlEIsQJBYEkZEPAIg2B4OWqQQKJRYRdmFUJBihtRE4BpeqlnIjgRdhBBC9Ihm1oQ84GLu6ayY/QScKx6FlNBXMlhPWLgXUkBdODNkNMxXfAAU5A7qEAsQw08cXeDkSCoQTDc4zT7X0PSwc4EZjQAEFCjDAY8OwocOHECOqsLBQIosBChgwUFDK4ooBGkMeYuOgIouMDMgmpNxoZkCCBB1bWBDJQIBKk05evsR5YqbKnxp52rCQAMLOGChtamTVxSWEmC1ATlBZswJJoSkwLoXqcSLWrmDDih1LtqxZsgsgBFB4toSECHAjFPi6QoKBCgRvFIigQABcDDckNAjQwAAPB3EV8C1nw8DgwXlpPOkbwW8nGxUeT+KBAa5iBZlsOMAQAAI/HaMVF+A6QsLL0Coi5yhZt0AG27DbakhwW0GBzbp3H7x9ObiE2xky5NYtwWi94NCjS59Ovbr169dDAAAh+QQJAwAaACwAAAAAQABAAISUlpTMzsy0srTs6uzc3tzEwsSkpqT09vTU1tS8urycnpz08vTk5uTMysysrqz8/vzU0tS0trTs7uzk4uTExsSsqqz8+vzc2ty8vrykoqT///8AAAAAAAAAAAAAAAAAAAAF/qAmjmRpnmiqrmzrvnAsz3Rt33iu73z6PL3g4yJQKAQEYBD3oBgVGWNBuawRolFj9FK1FZ9gQZf2AJszlvHpIWEs1mYzVWShGACKxIA3ERgqBhhvJQJZUE9iJAsZAI2OXDkTBn+UAgclF2dGkHQVjp8AezcPfoB/GQYBJQ8FhlBTJBegnwk4A5QVqICJJENFGQIXaSQFnwp4jRk4DKaAzhUpFsMmCbOfOAuUp5O1MhSNx6DKOBjbzpwwA9aNDTkLpZMVsDPFs2g6Bw0CFQkXczEW6jmqMEgNjQENEhQQZrChw4cQI0qcuONAgAQRAlyiyOJAAgcCQEbY2OXBNBgBvkBWAOlAVZcBCBCIgvGRpcguFmJCQPCPRYSQQB10W5Lzws6TLVLucwCy3cudM194ZCnAkhqTNPJhbECSo9evYMOKHUu2rFkXFiZcGNCT7IECETBCaBtjwQS2PSAkwIhBz40FAQIz6AF3b1x0MxgEgLC4x8W4cSfcGBAYAmJbfBNgoPviwQTLXXVQLgAhdIkDEwiYLpuvQAEKq8dOcP1a8lkRBF67JnBbxAEKrmH39p069vDjyJMrX868uXOIIQAAIfkECQMAGwAsAAAAAEAAQACElJaUzM7MtLK07OrspKak3N7cxMLE9Pb0nJ6c1NbUvLq89PL0rK6s5ObkzMrM/P78nJqc1NLUtLa07O7srKqs5OLkxMbE/Pr8pKKk3NrcvL68////AAAAAAAAAAAAAAAABf7gJo5kaZ5oqq5s675wLM90bd94ru9877MDDYNhGPx0CYwSgUEkjrdBc6rEGKE0DZWJQBiwNMaSimGAUZfDA0VhNglcc+kSaGM0E95CQ6EwAhcmBm9LBHclBwQAABCMEAU6CwwUBJQUGmskA1xvTFciDwyNjYuMeTh8lJN9kCVJhBhPJBWMi6OMGjgXlpaVXyYNBpManyMWtrWkGDgHfZXPFAozGrfJjDihqqoEDjMO1qUQFDl1vJXFLxOl4AE5F3zPDLIzFhCkthiBOQ8FBhoO6GI8MGCNwoIzNSY4MGCgQiaEECNKnEixokWBBRxYKPDwx4MKDhxwFGhBgEkBFto68njgQICElw5UrigggEFNk618VHD5UoKACjBa2rxp4YiDnjy7vSh502bRHwF4KnCp1AXNoTVz9qjgs6sEoC8elLTJIOURlkhjYtToEMsFkA4q6LtIt67du3jz6t3b48GCBgf4lngQQIFhsDcODJgg80YFwxoUaAhs40CEyw16FDZsOLONARECJMjQI4NkCRrw3JhwOYLWHAdSRw7QGMaDAQnk+jiQIYDuFBcGDJgreAMdCxYiEOc7wIJGCwH1NncOvbgIOhqVW78+oMHy7eDDix9Pvrz58xVDAAAh+QQJAwAaACwAAAAAQABAAISUlpTMzsy0srTs6uzc3tzEwsSkpqT09vTU1tS8urycnpz08vTk5uTMysysrqz8/vycmpzU0tS0trTs7uzk4uTExsSsqqz8+vzc2ty8vrz///8AAAAAAAAAAAAAAAAAAAAF/qAmjmRpnmiqrmzrvnAsz3Rt33iu73zvs4dAIhE4/HQMi2FpsDCOt4OSubQsoLWAQbHtGgJYWoLKVCTCs7GXeS5dEAKDo3LdXSISR4Zy0lIhSxFuDhCFhQpPORdjFo0WgiULFlxUViUShQCGEAp1NxFyjaETJklLEI18JAObEAAKhRU5EqIOopCRDUMNniMNmbCuhQ45tha2oQ0zv6+usK8GORlKjkoYMxGGzZwQAjkEx0q2DkYyB87Amgg6EeLHA1nPwRAODzsTEQ0I5TQP2cASLqCpcQBBhQiJBipcyLChQxkLCBDo9XDFAgEAMgIQQLHFBAwISB1ZoECjxk4w3DAIECBBwLUfGE1q9OZiwsqbAkTyWCBTZkcUKvNIaLmuB4GeJlWxgDN0pYSiPCgg1fiShU2nDiTo3MFzKoCfKBC0bFm1R8yeNF9MQBASygJXMiGArTjiokmOdFsswIBhbt6/gAMLHpz3wgJ7hE8QyJChwNYaFwYc7jEhQwLGBRATZNuWx2LGl/16ZBuBQA8GCQpcziDQxoIIbBPqeKCLsekbDyYQoKDZDgMC8FQ8WDChd2IRDzA0CIDBeOIFy5c/TjwhQHTRf5MvR+A8ce7Jx8OLH0++vPnz6NPTCAEAIfkECQMAGQAsAAAAAEAAQACElJaUzM7M7OrstLK03N7cxMLE9Pb0pKak1NbUvLq8nJ6c9PL05ObkzMrM/P781NLU7O7stLa05OLkxMbE/Pr8rK6s3NrcvL68pKKk////AAAAAAAAAAAAAAAAAAAAAAAABf5gJo5kaZ5oqq5s675wLM90bd94ru9877MOQqNBcPx0i0HlwIwsjjfHgEk9JCjQGmHJ5B4kWVqjeqhgDo3wbLw0u9Mlh+QyiDywO/mkEHiaCFVmTGAkFAkKiIgHEDoOARWQkAwmhl0YZgNLine truncated
|
||||
border-radius: 4px;
|
||||
}
|
||||
#mask-box #code-box img {
|
||||
margin-top: 5px;
|
||||
}
|
||||
#mask-box #close-link {
|
||||
float: right;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin: -32px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHhtbDpzcGFjZT0icHJlc2VydmUiIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiB5PSIwIiB4PSIwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSLlnJblsaRfMSIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iNDdweCIgaGVpZ2h0PSI0N3B4IiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgc3R5bGU9IndpZHRoOjEwMCU7aGVpZ2h0OjEwMCU7YmFja2dyb3VuZC1zaXplOmluaXRpYWw7YmFja2dyb3VuZC1yZXBlYXQteTppbml0aWFsO2JhY2tncm91bmQtcmVwZWF0LXg6aW5pdGlhbDtiYWNrZ3JvdW5kLXBvc2l0aW9uLXk6aW5pdGlhbDtiYWNrZ3JvdW5kLXBvc2l0aW9uLXg6aW5pdGlhbDtiYWNrZ3JvdW5kLW9yaWdpbjppbml0aWFsO2JhY2tncm91bmQtY29sb3I6aW5pdGlhbDtiYWNrZ3JvdW5kLWNsaXA6aW5pdGlhbDtiYWNrZ3JvdW5kLWF0dGFjaG1lbnQ6aW5pdGlhbDthbmltYXRpb24tcGxheS1zdGF0ZTpwYXVzZWQiID48ZyBjbGFzcz0ibGRsLXNjYWxlIiBzdHlsZT0idHJhbnNmb3JtLW9yaWdpbjo1MCUgNTAlO3RyYW5zZm9ybTpyb3RhdGUoMGRlZykgc2NhbGUoMC44LCAwLjgpO2FuaW1hdGlvbi1wbGF5LXN0YXRlOnBhdXNlZCIgPjxjaXJjbGUgZmlsbD0iIzMzMyIgcj0iNDAiIGN5PSI1MCIgY3g9IjUwIiBzdHlsZT0iZmlsbDpyZ2IoODksIDg5LCA4OSk7YW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+PC9jaXJjbGU+CjxnIHN0eWxlPSJhbmltYXRpb24tcGxheS1zdGF0ZTpwYXVzZWQiID48cGF0aCBkPSJNMjUuMyA0NWg0OS41djEwSDI1LjN6IiBmaWxsPSIjZTE1YjY0IiB0cmFuc2Zvcm09InJvdGF0ZSgtNDQuOTk2IDQ5Ljk5NyA0OS45OTcpIiBzdHlsZT0iZmlsbDpyZ2IoMjU1LCAyNTUsIDI1NSk7YW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+PC9wYXRoPjwvZz4KPGcgc3R5bGU9ImFuaW1hdGlvbi1wbGF5LXN0YXRlOnBhdXNlZCIgPjxwYXRoIGQ9Ik00NSAyNS4zaDEwdjQ5LjVINDV6IiBmaWxsPSIjZTE1YjY0IiB0cmFuc2Zvcm09InJvdGF0ZSgtNDUuMDAxIDUwIDUwKSIgc3R5bGU9ImZpbGw6cmdiKDI1NSwgMjU1LCAyNTUpO2FuaW1hdGlvbi1wbGF5LXN0YXRlOnBhdXNlZCIgPjwvcGF0aD48L2c+CjxtZXRhZGF0YSB4bWxuczpkPSJodHRwczovL2xvYWRpbmcuaW8vc3RvY2svIiBzdHlsZT0iYW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+PGQ6bmFtZSBzdHlsZT0iYW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+Y2xvc2U8L2Q6bmFtZT4KPGQ6dGFncyBzdHlsZT0iYW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+Y2xvc2UscmVqZWN0LG9mZixkaXNhYmxlLHJlbW92ZSxkZWxldGUsY2FuY2VsLGRyb3AsY29sbGFwc2U8L2Q6dGFncz4KPGQ6bGljZW5zZSBzdHlsZT0iYW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+Ynk8L2Q6bGljZW5zZT4KPGQ6c2x1ZyBzdHlsZT0iYW5pbWF0aW9uLXBsYXktc3RhdGU6cGF1c2VkIiA+bmVmM2Q0PC9kOnNsdWc+PC9tZXRhZGF0YT48L2c+PCEtLSBnZW5lcmF0ZWQgYnkgaHR0cHM6Ly9sb2FkaW5nLmlvLyAtLT48L3N2Zz4=') no-repeat center center;
|
||||
}
|
||||
#mask-box #load-link {
|
||||
color: #fbfbfb;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 10px;
|
||||
bottom: 115px;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
position: absolute;
|
||||
background: #e4393c;
|
||||
line-height: 48px;
|
||||
text-decoration: none;
|
||||
}
|
||||
div[id$="-html"] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function( window, document, undefined ) {
|
||||
// 选取 DOM 元素
|
||||
var selector, section = document.querySelector("[id$='refresh_token']");
|
||||
|
||||
// 遮罩容器
|
||||
var mask = document.createElement('div');
|
||||
mask.id = 'mask-box';
|
||||
|
||||
// 二维码容器
|
||||
var code = document.createElement('div');
|
||||
code.id = 'code-box';
|
||||
code.innerHTML = "请使用 阿里云盘 App 进行扫码认证";
|
||||
|
||||
// 刷新按钮
|
||||
var load = document.createElement('a');
|
||||
load.id = 'load-link';
|
||||
load.innerHTML = "刷新";
|
||||
|
||||
// 创建二维码
|
||||
var make = new QRCode( code, { correctLevel: QRCode.CorrectLevel.L });
|
||||
make.clear = function() {
|
||||
code.getElementsByTagName("img").item(0).removeAttribute('src');
|
||||
this._oDrawing.clear();
|
||||
}
|
||||
|
||||
// 关闭按钮
|
||||
var link = document.createElement('a');
|
||||
link.id = 'close-link';
|
||||
link.addEventListener('click', ( e ) => {
|
||||
XHR.halt();
|
||||
XHR._q = [];
|
||||
mask.remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
// 二维码层居中
|
||||
var center = function() {
|
||||
// 调整遮罩层覆盖范围
|
||||
mask.style.width = section.clientWidth + "px";
|
||||
mask.style.height = section.clientHeight + "px";
|
||||
// 二维码层居中
|
||||
var top = selector.offsetTop - selector.parentNode.offsetTop;
|
||||
if ( selector.offsetTop <= 380 ) {
|
||||
code.style.top = top + selector.offsetHeight + "px";
|
||||
} else {
|
||||
code.style.top = top - code.offsetHeight + "px";
|
||||
}
|
||||
code.style.left = ( ( section.offsetWidth - code.offsetWidth ) / 2 ) + parseInt( ( selector.currentStyle || window.getComputedStyle( selector ) ).marginLeft ) + "px";
|
||||
};
|
||||
|
||||
// 获取二维码
|
||||
var feedback = function() {
|
||||
// 清除二维码
|
||||
make.clear();
|
||||
// 获取通信数据
|
||||
XHR.get( '<%=luci.dispatcher.build_url("admin", "services", "aliyundrive-webdav","qrcode")%>', null, ( x, d ) => {
|
||||
if ( x.status != 200 ) {
|
||||
alert('获取二维码失败!');
|
||||
return false;
|
||||
}
|
||||
// 移除刷新
|
||||
load.remove();
|
||||
// 创建二维码
|
||||
make.makeCode("https://www.aliyundrive.com/o/oauth/authorize?sid=" + d.sid);
|
||||
// 监听扫码反馈
|
||||
XHR.poll( 3, '<%=luci.dispatcher.build_url("admin", "services", "aliyundrive-webdav", "query")%>', { sid: d.sid }, ( x, d ) => {
|
||||
if ( d.refresh_token.trim() ) {
|
||||
// 清除线程
|
||||
XHR.halt();
|
||||
XHR._q = [];
|
||||
// 回写 Cookie 数据
|
||||
mask.remove();
|
||||
selector.value = d.refresh_token.trim();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 鼠标事件
|
||||
var event = function( e ) {
|
||||
// 区分单击、双击事件
|
||||
if ( e.target.tagName == "INPUT" && e.type == "dblclick" ) {
|
||||
selector = e.target;
|
||||
} else if ( e.target.tagName == "IMG" && e.type == "click" && /add/ig.test( e.target.src ) ) {
|
||||
selector = section.getElementsByTagName("INPUT");
|
||||
selector = selector.item( selector.length - 1 );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// 插入容器
|
||||
if ( !document.contains( mask ) ) {
|
||||
section.prepend( mask );
|
||||
mask.prepend( code );
|
||||
code.prepend( link );
|
||||
center();
|
||||
}
|
||||
// 获取及监听扫码事件
|
||||
feedback();
|
||||
};
|
||||
|
||||
// 绑定事件
|
||||
section.addEventListener( 'click', event );
|
||||
section.addEventListener( 'dblclick', event );
|
||||
})( window, document );
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
||||
+3
-18
@@ -4,33 +4,18 @@ XHR.poll(3, '<%=url([[admin]], [[services]], [[aliyundrive-webdav]], [[status]])
|
||||
var tb = document.getElementById('aliyundrive-webdav_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
tb.innerHTML = '<em><b style=color:green>' + data.application + '<%:RUNNING%></b></em>';
|
||||
tb.innerHTML = '<em><b><font color=green>' + data.application + '<%:RUNNING%></font></b></em>';
|
||||
} else {
|
||||
tb.innerHTML = '<em><b style=color:red>' + data.application + '<%:NOT RUNNING%></b></em>';
|
||||
tb.innerHTML = '<em><b><font color=red>' + data.application + '<%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function invalidateCache(button) {
|
||||
XHR.get('<%=url([[admin]], [[services]], [[aliyundrive-webdav]], [[invalidate-cache]])%>', null,
|
||||
function(x, data) {
|
||||
if (data.ok) {
|
||||
alert("缓存已清除.");
|
||||
} else {
|
||||
alert("清除缓存失败!");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="aliyundrive-webdav_status" style="float: left; width: 60%; margin-top: 12px;">
|
||||
<p id="aliyundrive-webdav_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
<p class="right" style="float: right; width: 40%;">
|
||||
<button class="cbi-button" onclick="event.stopPropagation(); invalidateCache(this);"><%:Invalidate cache%></button>
|
||||
</p>
|
||||
</fieldset>
|
||||
@@ -22,12 +22,6 @@ msgstr "监听主机"
|
||||
msgid "Port"
|
||||
msgstr "监听端口"
|
||||
|
||||
msgid "TLS certificate file path"
|
||||
msgstr "TLS 证书文件路径"
|
||||
|
||||
msgid "TLS private key file path"
|
||||
msgstr "TLS 私钥文件路径"
|
||||
|
||||
msgid "Username"
|
||||
msgstr "用户名"
|
||||
|
||||
@@ -37,9 +31,6 @@ msgstr "密码"
|
||||
msgid "Read Buffer Size"
|
||||
msgstr "下载缓冲大小(bytes)"
|
||||
|
||||
msgid "Upload Buffer Size"
|
||||
msgstr "上传缓冲大小(bytes)"
|
||||
|
||||
msgid "Cache Size"
|
||||
msgstr "目录缓存大小"
|
||||
|
||||
@@ -49,9 +40,6 @@ msgstr "目录缓存过期时间(单位为秒)"
|
||||
msgid "Collecting data..."
|
||||
msgstr "获取数据中..."
|
||||
|
||||
msgid "Invalidate cache"
|
||||
msgstr "清除缓存"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
@@ -68,10 +56,10 @@ msgid "Debug Mode"
|
||||
msgstr "调试模式"
|
||||
|
||||
msgid "<a href=\"https://github.com/messense/aliyundrive-webdav\" target=\"_blank\">Project GitHub URL</a>"
|
||||
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav\" target=\"_blank\">GitHub 项目地址</a> | <a href=\"https://t.zsxq.com/0c9sq6Ca8\" target=\"_blank\">加入知识星球</a>"
|
||||
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav\" target=\"_blank\">GitHub 项目地址</a>"
|
||||
|
||||
msgid "Double click the input box above to get refresh token by scanning qrcode"
|
||||
msgstr "鼠标双击上面的输入框扫码登录自动获取 refresh token"
|
||||
msgid "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">How to get refresh token</a>"
|
||||
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav#%E8%8E%B7%E5%8F%96-refresh_token\" target=\"_blank\">查看获取 refresh token 的方法</a>"
|
||||
|
||||
msgid "Restrict access to a folder of aliyundrive, defaults to / which means no restrictions"
|
||||
msgstr "限制只能访问该云盘目录,默认为 / 表示不限制,注意这个参数不是本地磁盘路径"
|
||||
@@ -79,26 +67,8 @@ msgstr "限制只能访问该云盘目录,默认为 / 表示不限制,注意
|
||||
msgid "Delete file permanently instead of trashing"
|
||||
msgstr "删除文件不放入回收站"
|
||||
|
||||
msgid "Enable read only mode"
|
||||
msgstr "启用只读模式"
|
||||
msgid "Domain ID"
|
||||
msgstr "阿里云相册与云盘服务 domainId"
|
||||
|
||||
msgid "Disallow upload, modify and delete file operations"
|
||||
msgstr "禁止上传、修改和删除文件操作"
|
||||
|
||||
msgid "Skip uploading same size files"
|
||||
msgstr "跳过上传相同大小的文件"
|
||||
|
||||
msgid "Reduce the upload traffic by skipping uploading files with the same size"
|
||||
msgstr "跳过上传相同大小的文件减少上传流量消耗,但可能会导致修改过的同样大小的文件不会被上传"
|
||||
|
||||
msgid "Prefer HTTP Download"
|
||||
msgstr "使用 HTTP 下载"
|
||||
|
||||
msgid "Prefer downloading files using HTTP instead of HTTPS protocol"
|
||||
msgstr "优先使用 HTTP 而不是 HTTPS 协议下载,低端设备上降低 CPU 占用"
|
||||
|
||||
msgid "Enable 302 Redirect"
|
||||
msgstr "启用 302 重定向"
|
||||
|
||||
msgid "Enable 302 redirect when possible"
|
||||
msgstr "在可能的情况下启用 302 重定向"
|
||||
msgid "Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"
|
||||
msgstr "填写此选项将使用<a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">阿里云相册与网盘服务</a>而不是<a href=\"https://www.aliyundrive.com\" target=\"_blank\">阿里云盘</a>"
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-aliyundrive-webdav": {
|
||||
"description": "Grant UCI access for luci-app-aliyundrive-webdav",
|
||||
"read": {
|
||||
"uci": [ "aliyundrive-webdav" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "aliyundrive-webdav" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for CloudDrive2
|
||||
LUCI_DEPENDS:=+clouddrive2
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0.1-r20240822
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_NAME:=luci-app-clouddrive2
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=1
|
||||
LUCI_TITLE:=LuCI support for CloudDrive2
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+mount-utils +lsblk +docker +dockerd +luci-lib-taskd
|
||||
|
||||
define Package/luci-app-clouddrive2/conffiles
|
||||
/etc/config/clouddrive2
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
Regular → Executable
+3
-13
@@ -1,17 +1,7 @@
|
||||
|
||||
module("luci.controller.clouddrive2", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/clouddrive2") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "nas"}, firstchild(), _("NAS"), 45).dependent = false
|
||||
entry({"admin","nas","clouddrive2"},cbi("clouddrive2"),_("CloudDrive2"), 10).acl_depends = { "luci-app-clouddrive2" }
|
||||
entry({"admin", "nas", "clouddrive2", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running=luci.sys.call("pgrep clouddrive >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
entry({"admin", "services", "clouddrive2"}, alias("admin", "services", "clouddrive2", "config"), _("CloudDrive2"), 30).dependent = true
|
||||
entry({"admin", "services", "clouddrive2", "config"}, cbi("clouddrive2"))
|
||||
end
|
||||
@@ -1,21 +1,58 @@
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
]]--
|
||||
|
||||
local taskd = require "luci.model.tasks"
|
||||
local clouddrive2_model = require "luci.model.clouddrive2"
|
||||
local m, s, o
|
||||
|
||||
m = Map("clouddrive2", translate("CloudDrive2"), translate("Configure and manage CloudDrive2"))
|
||||
m = taskd.docker_map("clouddrive2", "clouddrive2", "/usr/libexec/istorec/clouddrive2.sh",
|
||||
translate("CloudDrive2"),
|
||||
translate("CloudDrive is a powerful multi-cloud drive management tool with local mounting of cloud drives.")
|
||||
.. translate("Official website:") .. ' <a href=\"https://www.clouddrive2.com/\" target=\"_blank\">https://www.clouddrive2.com/</a>' .. '<br>'
|
||||
.. translate("Since mounting within the container requires the use of a special shared mount point, to avoid compatibility issues, only mounting to /mnt/CloudNAS is supported (mounting to other paths cannot be seen by the host). The shared mount point is automatically created by this plug-in, uninstalling the plug-in may cause the deployed CloudDrive container to fail to start or mount (iStoreOS is an exception, because /mnt is the shared mount point by default).") .. '<br>'
|
||||
.. translate("Disclaimer: This LuCI plug-in is developed by individuals. It only facilitates users to deploy CloudDrive containers (https://hub.docker.com/u/cloudnas) and has nothing to do with CloudDrive. Since CloudDrive is not open source software, although this plug-in has restricted its permissions to the greatest extent, it does not make any guarantees about the software content and services provided by CloudDrive. Use at your own risk!"))
|
||||
|
||||
m:section(SimpleSection).template="clouddrive2/status"
|
||||
s = m:section(SimpleSection, translate("Service Status"), translate("CloudDrive2 status:"))
|
||||
s:append(Template("clouddrive2/status"))
|
||||
|
||||
s = m:section(TypedSection, "clouddrive2", translate("Settings"))
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
s = m:section(TypedSection, "clouddrive2", translate("Setup"),
|
||||
translate("The following parameters will only take effect during installation or upgrade:"))
|
||||
s.addremove=false
|
||||
s.anonymous=true
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o = s:option(Value, "image", translate("Docker image"))
|
||||
o.rmempty = false
|
||||
o.datatype = "string"
|
||||
o:value("default", translate("Default (cloudnas/clouddrive2)"))
|
||||
o:value("cloudnas/clouddrive2-unstable", "cloudnas/clouddrive2-unstable")
|
||||
o.default = "default"
|
||||
|
||||
o = s:option(Value, "port", translate("Port"))
|
||||
o.datatype = "port"
|
||||
o.default = "19798"
|
||||
--
|
||||
-- o = s:option(Value, "mount_point", translate("Mount Point"))
|
||||
-- o.default = "/mnt/clouddrive"
|
||||
o.datatype = "port"
|
||||
|
||||
local blocks = clouddrive2_model.blocks()
|
||||
local home = clouddrive2_model.home()
|
||||
|
||||
o = s:option(Value, "config_path", translate("Config path").."<b>*</b>")
|
||||
o.rmempty = false
|
||||
o.datatype = "string"
|
||||
|
||||
local paths, default_path = clouddrive2_model.find_paths(blocks, home, "Configs")
|
||||
for _, val in pairs(paths) do
|
||||
o:value(val, val)
|
||||
end
|
||||
o.default = default_path
|
||||
|
||||
o = s:option(Value, "cache_path", translate("Temporary file path"), translate("Default use 'temp' in 'config path' if not set, please make sure there has enough space"))
|
||||
o.datatype = "string"
|
||||
local paths, default_path = clouddrive2_model.find_paths(blocks, home, "Caches")
|
||||
for _, val in pairs(paths) do
|
||||
o:value(val, val)
|
||||
end
|
||||
|
||||
o = s:option(Flag, "share_mnt", translate("Share /mnt"), translate("CloudDrive can read and write other mount points under /mnt for its synchronization or backup functions"))
|
||||
o.default = 0
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,55 @@
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local clouddrive2 = {}
|
||||
|
||||
clouddrive2.blocks = function()
|
||||
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
|
||||
local vals = {}
|
||||
if f then
|
||||
local ret = f:read("*all")
|
||||
f:close()
|
||||
local obj = jsonc.parse(ret)
|
||||
for _, val in pairs(obj["blockdevices"]) do
|
||||
local fsize = val["fssize"]
|
||||
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
|
||||
-- fsize > 1G
|
||||
vals[#vals+1] = val["mountpoint"]
|
||||
end
|
||||
end
|
||||
end
|
||||
return vals
|
||||
end
|
||||
|
||||
clouddrive2.home = function()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local home_dirs = {}
|
||||
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
|
||||
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs")
|
||||
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public")
|
||||
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads")
|
||||
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches")
|
||||
return home_dirs
|
||||
end
|
||||
|
||||
clouddrive2.find_paths = function(blocks, home_dirs, path_name)
|
||||
local default_path = ''
|
||||
local configs = {}
|
||||
|
||||
default_path = home_dirs[path_name] .. "/CloudDrive2"
|
||||
if #blocks == 0 then
|
||||
table.insert(configs, default_path)
|
||||
else
|
||||
for _, val in pairs(blocks) do
|
||||
table.insert(configs, val .. "/" .. path_name .. "/CloudDrive2")
|
||||
end
|
||||
local without_conf_dir = "/root/" .. path_name .. "/CloudDrive2"
|
||||
if default_path == without_conf_dir then
|
||||
default_path = configs[1]
|
||||
end
|
||||
end
|
||||
|
||||
return configs, default_path
|
||||
end
|
||||
|
||||
return clouddrive2
|
||||
@@ -1,27 +1,31 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[nas]], [[clouddrive2]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('clouddrive_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>CloudDrive2 <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openwebui();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>CloudDrive2 <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
<%
|
||||
local util = require "luci.util"
|
||||
local container_status = util.trim(util.exec("/usr/libexec/istorec/clouddrive2.sh status"))
|
||||
local container_install = (string.len(container_status) > 0)
|
||||
local container_running = container_status == "running"
|
||||
-%>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Status%></label>
|
||||
<div class="cbi-value-field">
|
||||
<% if container_running then %>
|
||||
<button class="cbi-button cbi-button-success" disabled="true"><%:CloudDrive2 is running%></button>
|
||||
<% else %>
|
||||
<button class="cbi-button cbi-button-negative" disabled="true"><%:CloudDrive2 is not running%></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
if container_running then
|
||||
local port=util.trim(util.exec("/usr/libexec/istorec/clouddrive2.sh port"))
|
||||
if port == "" then
|
||||
port="19798"
|
||||
end
|
||||
-%>
|
||||
<div class="cbi-value cbi-value-last">
|
||||
<label class="cbi-value-title"> </label>
|
||||
<div class="cbi-value-field">
|
||||
|
||||
function openwebui(){
|
||||
var url = window.location.host+":<%=luci.sys.exec("uci -q get clouddrive2.main.port"):gsub("^%s*(.-)%s*$", "%1")%>";
|
||||
window.open('http://'+url,'target','');
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="clouddrive_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open CloudDrive2%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1 +0,0 @@
|
||||
zh_Hans
|
||||
@@ -0,0 +1,59 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
msgid "Official website:"
|
||||
msgstr "官方网站:"
|
||||
|
||||
msgid "CloudDrive is a powerful multi-cloud drive management tool with local mounting of cloud drives."
|
||||
msgstr "CloudDrive 是一个强大的多云盘管理工具,为用户提供包含云盘本地挂载的一站式的多云盘解决方案。"
|
||||
|
||||
msgid "Since mounting within the container requires the use of a special shared mount point, to avoid compatibility issues, only mounting to /mnt/CloudNAS is supported (mounting to other paths cannot be seen by the host). The shared mount point is automatically created by this plug-in, uninstalling the plug-in may cause the deployed CloudDrive container to fail to start or mount (iStoreOS is an exception, because /mnt is the shared mount point by default)."
|
||||
msgstr "由于容器内挂载需要使用特殊的共享挂载点,为避免兼容性问题,只支持挂载到 /mnt/CloudNAS 之下(挂载到其他路径宿主看不到)。共享挂载点由此插件自动创建,卸载插件可能导致系统重启以后已经部署的 CloudDrive 容器无法启动或无法挂载(iStoreOS 是例外,因为 /mnt 默认就是共享挂载点)。"
|
||||
|
||||
msgid "Disclaimer: This LuCI plug-in is developed by individuals. It only facilitates users to deploy CloudDrive containers (https://hub.docker.com/u/cloudnas) and has nothing to do with CloudDrive. Since CloudDrive is not open source software, although this plug-in has restricted its permissions to the greatest extent, it does not make any guarantees about the software content and services provided by CloudDrive. Use at your own risk!"
|
||||
msgstr "免责声明:此 LuCI 插件为个人开发,仅方便用户部署 CloudDrive 容器( https://hub.docker.com/u/cloudnas ),与 CloudDrive 官方无关。由于 CloudDrive 非开源软件,尽管此插件已最大程度限制其权限,但不对 CloudDrive 提供的软件内容和服务做出任何保证。Use at your own risk!"
|
||||
|
||||
msgid "Config path"
|
||||
msgstr "配置文件路径"
|
||||
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "Docker image"
|
||||
msgstr "Docker 镜像"
|
||||
|
||||
msgid "Temporary file path"
|
||||
msgstr "临时文件路径"
|
||||
|
||||
msgid "Default use 'temp' in 'config path' if not set, please make sure there has enough space"
|
||||
msgstr "留空则使用配置文件路径下的 temp,请确保有足够空间"
|
||||
|
||||
msgid "Share /mnt"
|
||||
msgstr "共享 /mnt"
|
||||
|
||||
msgid "CloudDrive can read and write other mount points under /mnt for its synchronization or backup functions"
|
||||
msgstr "CloudDrive 能够读写 /mnt 下的其他挂载点,用于支持其同步或备份功能"
|
||||
|
||||
msgid "Service Status"
|
||||
msgstr "服务状态"
|
||||
|
||||
msgid "CloudDrive2 status:"
|
||||
msgstr "CloudDrive2 的状态信息如下:"
|
||||
|
||||
msgid "Setup"
|
||||
msgstr "安装配置"
|
||||
|
||||
msgid "The following parameters will only take effect during installation or upgrade:"
|
||||
msgstr "以下参数只在安装或者升级时才会生效:"
|
||||
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
msgid "CloudDrive2 is running"
|
||||
msgstr "CloudDrive2 运行中"
|
||||
|
||||
msgid "CloudDrive2 is not running"
|
||||
msgstr "CloudDrive2 未运行"
|
||||
|
||||
msgid "Open CloudDrive2"
|
||||
msgstr "打开 CloudDrive2"
|
||||
File renamed without changes.
@@ -1,32 +0,0 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "Configure and manage CloudDrive2"
|
||||
msgstr "配置和管理CloudDrive2"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Port"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "Mount Point"
|
||||
msgstr "挂载点"
|
||||
|
||||
msgid "CloudDrive2 Status"
|
||||
msgstr "CloudDrive2状态"
|
||||
|
||||
msgid "Running Status"
|
||||
msgstr "运行状态"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "正在收集数据..."
|
||||
|
||||
msgid "CloudDrive2 is running"
|
||||
msgstr "CloudDrive2 正在运行"
|
||||
|
||||
msgid "CloudDrive2 is not running"
|
||||
msgstr "CloudDrive2 未运行"
|
||||
@@ -0,0 +1,6 @@
|
||||
config clouddrive2
|
||||
option 'port' '19798'
|
||||
option 'image' 'default'
|
||||
# option 'config_path' ''
|
||||
# option 'cache_path' ''
|
||||
option 'share_mnt' '0'
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
|
||||
boot() {
|
||||
# /usr/bin/mountpoint -q /CloudNAS || /usr/bin/mount --make-shared -t tmpfs -o size=4M tmpfs /CloudNAS
|
||||
[ -d /mnt/CloudNAS ] || mkdir -p /mnt/CloudNAS
|
||||
if /usr/bin/mountpoint -q /mnt; then
|
||||
/usr/bin/mount --make-shared /mnt
|
||||
else
|
||||
/usr/bin/mount --make-shared -t tmpfs -o size=4M tmpfs /mnt/CloudNAS
|
||||
fi
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-clouddrive2.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-clouddrive2.json << EEOF
|
||||
{
|
||||
"config": "clouddrive2",
|
||||
"init": "clouddrive2"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@clouddrive2[-1]
|
||||
add ucitrack clouddrive2
|
||||
set ucitrack.@clouddrive2[-1].init=clouddrive2
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
mkdir -p /lib/upgrade/keep.d
|
||||
cat > "/lib/upgrade/keep.d/luci-clouddrive2" <<-EOF
|
||||
/Waytech/CloudDrive2/
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
# Author jjm2473@gmail.com
|
||||
|
||||
ACTION=${1}
|
||||
shift 1
|
||||
|
||||
IMAGE_NAME='default'
|
||||
|
||||
get_image() {
|
||||
IMAGE_NAME=`uci -q get clouddrive2.@clouddrive2[0].image 2>/dev/null`
|
||||
if [ -z "$IMAGE_NAME" -o "$IMAGE_NAME" == "default" ]; then
|
||||
IMAGE_NAME="cloudnas/clouddrive2"
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
get_image
|
||||
echo "docker pull ${IMAGE_NAME}"
|
||||
docker pull ${IMAGE_NAME}
|
||||
docker stop clouddrive2
|
||||
docker rm -f clouddrive2
|
||||
|
||||
do_install_detail
|
||||
}
|
||||
|
||||
do_install_detail() {
|
||||
local config=`uci -q get clouddrive2.@clouddrive2[0].config_path 2>/dev/null`
|
||||
local cache=`uci -q get clouddrive2.@clouddrive2[0].cache_path 2>/dev/null`
|
||||
local port=`uci -q get clouddrive2.@clouddrive2[0].port 2>/dev/null`
|
||||
local share_mnt=`uci -q get clouddrive2.@clouddrive2[0].share_mnt 2>/dev/null`
|
||||
|
||||
if [ -z "$config" ]; then
|
||||
echo "config path is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -z "$port" ] && port=19798
|
||||
|
||||
local cmd="docker run --restart=unless-stopped -d -e CLOUDDRIVE_HOME=/Config -v \"$config:/Config\" "
|
||||
[ -z "$cache" ] || cmd="$cmd -v \"$cache:/Config/temp\" "
|
||||
|
||||
cmd="$cmd\
|
||||
--dns=172.17.0.1 \
|
||||
-p $port:19798"
|
||||
|
||||
local tz="`uci -q get system.@system[0].zonename | sed 's/ /_/g'`"
|
||||
[ -z "$tz" ] || cmd="$cmd -e TZ=$tz"
|
||||
|
||||
# make sure shared mount point existed
|
||||
/etc/init.d/clouddrive2 boot
|
||||
|
||||
if [ "$share_mnt" = 1 ]; then
|
||||
cmd="$cmd -v /mnt:/mnt"
|
||||
mountpoint -q /mnt && cmd="$cmd:rslave"
|
||||
fi
|
||||
cmd="$cmd -v /mnt/CloudNAS:/mnt/CloudNAS:shared"
|
||||
|
||||
# fuse
|
||||
cmd="$cmd\
|
||||
--cap-add SYS_ADMIN \
|
||||
--security-opt apparmor:unconfined \
|
||||
--device /dev/fuse:/dev/fuse"
|
||||
|
||||
cmd="$cmd --name clouddrive2 \"$IMAGE_NAME\""
|
||||
|
||||
echo "$cmd"
|
||||
eval "$cmd"
|
||||
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 sub-command"
|
||||
echo "where sub-command is one of:"
|
||||
echo " install Install the CloudDrive2"
|
||||
echo " upgrade Upgrade the CloudDrive2"
|
||||
echo " rm/start/stop/restart Remove/Start/Stop/Restart the CloudDrive2"
|
||||
echo " status CloudDrive2 status"
|
||||
echo " port CloudDrive2 port"
|
||||
}
|
||||
|
||||
case ${ACTION} in
|
||||
"install")
|
||||
do_install
|
||||
;;
|
||||
"upgrade")
|
||||
do_install
|
||||
;;
|
||||
"rm")
|
||||
docker stop clouddrive2
|
||||
docker rm -f clouddrive2
|
||||
;;
|
||||
"start" | "stop" | "restart")
|
||||
docker ${ACTION} clouddrive2
|
||||
;;
|
||||
"status")
|
||||
docker ps --all -f 'name=^/clouddrive2$' --format '{{.State}}'
|
||||
;;
|
||||
"port")
|
||||
docker ps --all -f 'name=^/clouddrive2$' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->19798/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/'
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -8,4 +8,4 @@
|
||||
"uci": [ "clouddrive2" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "clouddrive2",
|
||||
"init": "clouddrive2"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-design-config
|
||||
PKG_VERSION:=1.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=gngpp <gngppz@gmail.com>
|
||||
|
||||
LUCI_TITLE:=LuCI page for Design Config
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+luci-compat
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/design
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,10 +0,0 @@
|
||||
module("luci.controller.design-config", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access('/www/luci-static/design/css/style.css') then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "system", "design-config"}, form("design-config"), _("Design Config"), 90)
|
||||
page.acl_depends = { "luci-app-design-config" }
|
||||
end
|
||||
@@ -1,58 +0,0 @@
|
||||
local nxfs = require 'nixio.fs'
|
||||
local nutil = require 'nixio.util'
|
||||
local name = 'design'
|
||||
local uci = require 'luci.model.uci'.cursor()
|
||||
|
||||
local mode, navbar, navbar_proxy
|
||||
if nxfs.access('/etc/config/design') then
|
||||
mode = uci:get_first('design', 'global', 'mode')
|
||||
navbar = uci:get_first('design', 'global', 'navbar')
|
||||
navbar_proxy = uci:get_first('design', 'global', 'navbar_proxy')
|
||||
end
|
||||
|
||||
-- [[ 设置 ]]--
|
||||
br = SimpleForm('config', translate('Design Config'), translate('Here you can set the mode of the theme and change the proxy tool icon in the navigation bar. [Recommend Chrome]'))
|
||||
br.reset = false
|
||||
br.submit = false
|
||||
s = br:section(SimpleSection)
|
||||
|
||||
o = s:option(ListValue, 'mode', translate('Theme mode'))
|
||||
o:value('normal', translate('Follow System'))
|
||||
o:value('light', translate('Force Light'))
|
||||
o:value('dark', translate('Force Dark'))
|
||||
o.default = mode
|
||||
o.rmempty = false
|
||||
o.description = translate('You can choose Theme color mode here')
|
||||
|
||||
o = s:option(ListValue, 'navbar', translate('Navigation bar setting'))
|
||||
o:value('display', translate('Display navigation bar'))
|
||||
o:value('close', translate('Close navigation bar'))
|
||||
o.default = navbar
|
||||
o.rmempty = false
|
||||
o.description = translate('The navigation bar is display by default')
|
||||
|
||||
o = s:option(ListValue, 'navbar_proxy', translate('Navigation bar proxy'))
|
||||
o:value('openclash', 'openclash')
|
||||
o:value('shadowsocksr', 'shadowsocksr')
|
||||
o:value('vssr', 'vssr')
|
||||
o:value('passwall', 'passwall')
|
||||
o:value('passwall2', 'passwall2')
|
||||
o.default = navbar_proxy
|
||||
o.rmempty = false
|
||||
o.description = translate('OpenClash by default')
|
||||
|
||||
o = s:option(Button, 'save', translate('Save Changes'))
|
||||
o.inputstyle = 'reload'
|
||||
|
||||
function br.handle(self, state, data)
|
||||
if (state == FORM_VALID and data.mode ~= nil and data.navbar ~= nil and data.navbar_proxy ~= nil) then
|
||||
nxfs.writefile('/tmp/aaa', data)
|
||||
for key, value in pairs(data) do
|
||||
uci:set('design','@global[0]',key,value)
|
||||
end
|
||||
uci:commit('design')
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return br
|
||||
@@ -1,7 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<% if self:cfgvalue(section) ~= false then %>
|
||||
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
|
||||
<% else %>
|
||||
-
|
||||
<% end %>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,8 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span style="color: red">
|
||||
<%
|
||||
local val = self:cfgvalue(section) or self.default or ""
|
||||
write(pcdata(val))
|
||||
%>
|
||||
</span>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,44 +0,0 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "Design Config"
|
||||
msgstr "Design 主题设置"
|
||||
|
||||
msgid "Here you can set the mode of the theme and change the proxy tool icon in the navigation bar. [Recommend Chrome]"
|
||||
msgstr "这里可以设置主题的模式和更换导航栏的代理工具图标。[建议使用 Chrome]"
|
||||
|
||||
msgid "Theme mode"
|
||||
msgstr "主题模式"
|
||||
|
||||
msgid "Follow System"
|
||||
msgstr "跟随系统"
|
||||
|
||||
msgid "Force Light"
|
||||
msgstr "强制亮色"
|
||||
|
||||
msgid "Force Dark"
|
||||
msgstr "强制暗色"
|
||||
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "你可以选择喜欢的主题模式"
|
||||
|
||||
msgid "Navigation bar setting"
|
||||
msgstr "导航栏设置"
|
||||
|
||||
msgid "Display navigation bar"
|
||||
msgstr "显示导航栏"
|
||||
|
||||
msgid "Close navigation bar"
|
||||
msgstr "关闭导航栏"
|
||||
|
||||
msgid "The navigation bar is display by default"
|
||||
msgstr "默认显示导航栏"
|
||||
|
||||
msgid "Navigation bar proxy"
|
||||
msgstr "导航栏代理"
|
||||
|
||||
msgid "OpenClash by default"
|
||||
msgstr "默认 OpenClash"
|
||||
|
||||
msgid "Save Changes"
|
||||
msgstr "保存更改"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,4 +0,0 @@
|
||||
config global
|
||||
option mode 'dark'
|
||||
option navbar 'display'
|
||||
option navbar_proxy 'openclash'
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"luci-app-design-config": {
|
||||
"description": "Grant UCI access for luci-app-design-config",
|
||||
"read": {
|
||||
"uci": [ "design" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "design" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI for Dnsforwarder
|
||||
LUCI_DEPENDS:=+dnsforwarder
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-dnsforwarder
|
||||
PKG_VERSION:=3.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_MAINTAINER:=Dennis <openwrt@tossp.com>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,11 +0,0 @@
|
||||
module("luci.controller.dnsforwarder", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/dnsforwarder") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "dnsforwarder"}, alias("admin", "services", "dnsforwarder", "general"), _("Dnsforwarder")).dependent = true
|
||||
entry({"admin", "services", "dnsforwarder", "general"}, cbi("dnsforwarder/general"), _("General"), 10).leaf = true
|
||||
entry({"admin", "services", "dnsforwarder", "log"}, cbi("dnsforwarder/log"), _("LOG"), 30).leaf = true
|
||||
end
|
||||
@@ -1,187 +0,0 @@
|
||||
--Alex<1886090@gmail.com>
|
||||
--Dennis<code@tossp.com>
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local CONFIG_FILE = "/tmp/dnsforwarder.conf";
|
||||
|
||||
function sync_value_to_file(value, file)
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = nixio.fs.readfile(file)
|
||||
if value ~= old_value then
|
||||
nixio.fs.writefile(file, value)
|
||||
end
|
||||
end
|
||||
|
||||
local state_msg = ""
|
||||
|
||||
local dnsforwarder_on = (luci.sys.call("pidof dnsforwarder > /dev/null") == 0)
|
||||
local resolv_file = luci.sys.exec("uci get dhcp.@dnsmasq[0].resolvfile")
|
||||
local listen_port = luci.sys.exec("uci get dhcp.@dnsmasq[0].server")
|
||||
|
||||
if dnsforwarder_on then
|
||||
state_msg = "<b><font color=\"green\">" .. translate("Running") .. "</font></b>"
|
||||
else
|
||||
state_msg = "<b><font color=\"red\">" .. translate("Not running") .. "</font></b>"
|
||||
end
|
||||
|
||||
if dnsforwarder_on and string.sub(listen_port,1,14) == "127.0.0.1#5053" then
|
||||
state_msg = state_msg .. ",DNSmasq已经将流量定向至本软件"
|
||||
elseif dnsforwarder_on then
|
||||
state_msg = state_msg .. "<b><font color=\"red\"></font></b>"
|
||||
end
|
||||
|
||||
if resolv_file == "" then
|
||||
|
||||
else if dnsforwarder_on then
|
||||
state_msg = state_msg .. "<b><font color=\"red\"></font></b>"
|
||||
end
|
||||
end
|
||||
|
||||
m = Map("dnsforwarder", translate("dnsforwarder"), translate("Dnsforwarder是企业级DNS服务器,可以通过TCP协议进行DNS解析,可以方便的使用iptables进行透明代理,配合ipset、GFWList使用效果更佳。默认上游服务器为114DNS,SSR和Redsocks的GFWList模式要依赖本软件包提供的功能").. "<br><br>状态 - " .. state_msg)
|
||||
|
||||
s = m:section(TypedSection, "arguments", translate("通用配置"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
view_enable = s:option(Flag, "enabled", translate("Enable"))
|
||||
view_dnsmasq = s:option(Flag, "dnsmasq", translate("设置成DNSmasq的上游服务器"), translate("让DNSMasq从本软件获得解析结果,支持GFWList模式"))
|
||||
view_addr = s:option(Value, "addr", translate("转发地址"), translate("请填写dnsforwarder的监听地址,默认127.0.0.1:5053,如果填写<b><font color=\"red\">208.67.222.222:5353</font></b>那么可不通过该软件获得无污染结果"))
|
||||
view_addr.default = "127.0.0.1:5053"
|
||||
|
||||
-- ---------------------------------------------------
|
||||
s1 = m:section(TypedSection, "config", translate("标准配置"))
|
||||
s1.addremove = false
|
||||
s1.anonymous = true
|
||||
log_enable = s1:option(Flag, "log", translate("打开文件日志"))
|
||||
log_enable.rmempty = false
|
||||
log_enable.default = "false"
|
||||
log_enable.disabled = "false"
|
||||
log_enable.enabled = "true"
|
||||
log_size = s1:option(Value,"log_size", translate("单个日志文件大小的临界值(字节)"), translate("当日志文件大小超过这个临界值后,当前的日志文件将会被重命名,然后建立一个新的日志文件,继续记录日志"))
|
||||
log_size.datatype = "uinteger"
|
||||
log_size.default = "102400"
|
||||
log_size:depends ({log = "true"})
|
||||
log_path = s1:option(Value,"log_path", translate("设定日志文件所在的文件夹"), translate("日志文件初始的文件名为 `dnsforwarder.log',当超过临界值之后,将会被重命名为 `dnsforwarder.log.1'、`dnsforwarder.log.2' 等等,然后重新建立一个 dnsforwarder.log' 文件"))
|
||||
log_path.datatype = "directory"
|
||||
log_path.default = "/var/log/"
|
||||
log_path.readonly = true
|
||||
log_path:depends ({log = "true"})
|
||||
gfw_enable = s1:option(Flag,"gfw", translate("使用GFW列表"))
|
||||
gfw_enable.rmempty = false
|
||||
gfw_enable.default = "true"
|
||||
gfw_enable.disabled = "false"
|
||||
gfw_enable.enabled = "true"
|
||||
udp_local = s1:option(DynamicList, "udp_local", translate("本地监听"), translate("设置在本地开启的接口的IP地址和端口,可以是本地回环地址 (127.0.0.1) ,本地局域网,以及互联网<br/>如果是 IPv6 地址,请在IP两端加上方括号(不包含端口部分),例如 [::1]:53 (本地回环)、[fe80::699c:f79a:9bb6:1]:5353<br/>如果不指定端口,则默认为 53"))
|
||||
tcp_group = s1:option(DynamicList, "tcp_group", translate("解析策略(TCP)"), translate([[格式:<IP1[:PORT],IP2[:PORT],...> <DOMAIN1,DOMAIN2,...> <on|PROXY1[:PORT],PROXY2[:PORT],...><br/>
|
||||
设置一个 TCP 上游服务器组,并指定通过这些上游服务器查询的域名<br/>
|
||||
第一部分参数“<IP1[:PORT],IP2[:PORT],...>”,用于指定 TCP 上游服务器,不写端口则默认使用 53 端口<br/>
|
||||
第二部分参数“<DOMAIN1,DOMAIN2,...>”,用于指定通过这些 TCP 上游服务器查询的域名,可以包含通配符<br/>
|
||||
第三部分参数“<no|PROXY1[:PORT],PROXY2[:PORT],...>”,用于指定查询时使用的 Socks5 代理,不写端口则默认使用 1080 端口。`no' 代表不使用代理]]))
|
||||
tcp_group.placeholder = "8.8.8.8 * on"
|
||||
tcp_group.default = tcp_group.placeholder
|
||||
udp_group = s1:option(DynamicList, "udp_group", translate("解析策略(UDP)"), translate([[格式:<IP1[:PORT],IP2[:PORT],...> <DOMAIN1,DOMAIN2,...> <on|off><br/>
|
||||
设置一个 UDP 上游服务器组,并指定通过这些上游服务器查询的域名<br/>
|
||||
第一部分参数“<IP1[:PORT],IP2[:PORT],...>”,用于指定 UDP 上游服务器,不写端口则默认使用 53 端口<br/>
|
||||
第二部分参数“<DOMAIN1,DOMAIN2,...>”,用于指定通过这些 UDP 上游服务器查询的域名,可以包含通配符<br/>
|
||||
第三部分参数“<on|off>”,用于指定是否开启并发查询,`on' 为开启,`off' 为不开启<br/>
|
||||
并发查询指的是,向所有指定的 UDP 服务器发送查询请求,取最先接受到的未屏蔽的回复作为查询结果,并丢弃其余的回复]]))
|
||||
udp_group.placeholder = "9.9.9.9,119.29.29.29,223.5.5.5,114.114.114.114 * on"
|
||||
udp_group.default = udp_group.placeholder
|
||||
group_file = s1:option(DynamicList, "group_file", translate("解析策略(文件)"), translate([[
|
||||
从文件加载服务器组,
|
||||
服务器组文件的写法<a href="https://github.com/holmium/dnsforwarder/wiki/GroupFile-%E7%9A%84%E5%86%99%E6%B3%95-%7C-How-to-write-GroupFiles" target="_blank">点击这里查看</a>。]]))
|
||||
group_file.datatype = "file"
|
||||
s1:option(DummyValue, "nothing", " ", translate([[
|
||||
解析策略优先级:<b>解析策略(TCP)>解析策略(UDP)>解析策略(文件)</b><br/>
|
||||
1.对于没有指定服务器的域名,会随机选择一个服务器组进行查询。<br/>
|
||||
2.如果某域名匹配多个服务器组,则选择的顺序如下:<br/>
|
||||
2.1 优先选择不含通配符的匹配项,如果仍然有多条匹配,则选择匹配度最高的那个,
|
||||
如果匹配度相同的情况下仍然有多条匹配,则选择最后一个。
|
||||
(例如 `ipv6.microsoft.com' 比 `microsoft.com' 对于域名 `teredo.ipv6.microsoft.com' 的匹配度更高)<br/>
|
||||
2.2 然后选择包含通配符的匹配项,如果有多条匹配,则选择第一个.
|
||||
]]))
|
||||
block_ip = s1:option(DynamicList, "block_ip", translate("DNS黑名单"), translate("阻挡含有以上 IP 地址的 DNS 数据包,IPv6 地址不用加方括号"))
|
||||
block_ip.datatype = "ipaddr"
|
||||
block_ip.delimiter = ","
|
||||
ip_substituting = s1:option(DynamicList, "ip_substituting", translate("替换 DNS 数据包"), translate("替换 DNS 数据包中的 IP 地址(只支持 IPv4 地址),例如:<br/><code>127.0.0.1 1.2.0.127</code>的效果是把 DNS 数据包中所有的 127.0.0.1 地址替换为 1.2.0.127,仅替换通过服务器(TCP 和 UDP)查询而来的 DNS 数据包,对于缓存中和 Hosts 中的结果无效"))
|
||||
ip_substituting.placeholder = "127.0.0.1 1.2.0.127"
|
||||
block_negative_resp = s1:option(Flag,"block_negative_resp", translate("过滤失败请求"), translate("是否过滤来自上游服务器的查询未成功的响应。查询未成功指:格式错误、服务器错误、域名不存在和服务器拒绝请求等,参见 RFC 6895,`2.3. RCODE Assignment'"))
|
||||
block_negative_resp.rmempty = false
|
||||
block_negative_resp.default = "false"
|
||||
block_negative_resp.disabled = "false"
|
||||
block_negative_resp.enabled = "true"
|
||||
append_host = s1:option(DynamicList, "append_host", translate("附加hosts"), translate([[
|
||||
写法与HOSTS文件中的一样,同样支持通配符,IPv6 地址不用加方括号<br>
|
||||
也可以定义 CName 的 Hosts 项,例如:<code>www.google.cn *.google.com</code>,这样所有匹配 *.google.com 的域名都将指向 www.google.cn 的 IP 地址<br>
|
||||
如果使某些域名跳过在 hosts 中的查询,可以<code>@@ *.012345.com</code>这样所有匹配 *.012345.com 的域名都不会在 hosts 中查询<br>
|
||||
各种 hosts 的优先级从高到低:1.带 `@@' 的禁止项 2.一般 hosts 项 3.CName hosts 项<br>
|
||||
]]))
|
||||
block_ipv6 = s1:option(Flag,"block_ipv6", translate("拒绝IPv6 地址"), translate("如果一个域名在 Hosts 被指定了一个 IPv4 地址(包括文件 Hosts 和 `AppendHosts' 指定的 Hosts),那么拒绝对这个域名的 IPv6 地址查询"))
|
||||
block_ipv6.rmempty = false
|
||||
block_ipv6.default = "false"
|
||||
block_ipv6.disabled = "false"
|
||||
block_ipv6.enabled = "true"
|
||||
|
||||
cache = s1:option(Flag, "cache", translate("使用缓存"), translate("是否使用缓存"))
|
||||
cache.rmempty = false
|
||||
cache.default = "false"
|
||||
cache.disabled = "false"
|
||||
cache.enabled = "true"
|
||||
cache_size = s1:option(Value, "cache_size", translate("缓存大小 (字节)"), translate("缓存大小不能小于 102400 (100KB)"))
|
||||
cache_size.datatype = "min(102400)"
|
||||
cache_size.default = "1048576"
|
||||
cache_size:depends ({cache = "true"})
|
||||
cache_file = s1:option(Value, "cache_file", translate("缓存文件"))
|
||||
cache_file.default = "/tmp/dnsforwarder.cache"
|
||||
cache_file.readonly = true
|
||||
cache_file:depends ({cache = "true"})
|
||||
cache_ignore = s1:option(Flag,"cache_ignore", translate("忽略TTL"), translate("为 `true' 时将忽略 TTL,此时所有的缓存条目将不会被移除,为 `false' 时不忽略 TTL,缓存条目将会按照 TTL 的时间来移除"))
|
||||
cache_ignore.rmempty = false
|
||||
cache_ignore.default = "false"
|
||||
cache_ignore.disabled = "false"
|
||||
cache_ignore.enabled = "true"
|
||||
cache_ignore:depends ({cache = "true"})
|
||||
cache_control = s1:option(DynamicList, "cache_control", translate("控制域名的缓存行为"), translate([[
|
||||
单条格式:<DOMAIN> [$ [$] ]<TYPE> [ARGUMENT]<br/>
|
||||
<DOMAIN> 是域名;[$ [$] ] 是传染设定;<TYPE> 是类型;[ARGUMENT] 是参数<br/>
|
||||
<DOMAIN> 支持通配符,支持尾部匹配<br/>
|
||||
<TYPE> 有以下可选项(均为小写):<br>
|
||||
orig : 使用原先的 TTL,即不改变指定域名记录的 TTL,此类型无需 [ARGUMENT] 参数<br>
|
||||
nocache : 不缓存指定域名记录,此类型无需 [ARGUMENT] 参数<br>
|
||||
fixed : 将指定域名记录的 TTL 修改为一个预先指定的常数值,这个值通过 [ARGUMENT] 参数指定<br>
|
||||
vari : 将指定域名记录的 TTL 修改为一个预先规定的变量,这个变量通过 [ARGUMENT] 参数指定,此时 [ARGUMENT] 参数的格式为 `ax+b',其中 a、b 为非负整数(需用户手工指定),x 为记录原先的 TTL 值(不需要用户指定)。此选项必须为 `ax+b' 的形式,不能是 `ax-b' 或者其它的变体形<br>
|
||||
<br/>传染机制:<br/>
|
||||
主动传染 (此为默认情况):主动传染 : 所有的域名记录不论是否存在单独指定的控制条目,均使用上级域名控制条目<br>
|
||||
被动传染(<TYPE> 前加一个 `$'): 如果存在单独指定的控制条目,那么使用单独指定的控制条目,否则使用上级域名的控制条目<br>
|
||||
不传染(<TYPE> 前加两个 `$'): 如果存在单独指定的控制条目,那么使用单独指定的控制条目,如果没有则不修改记录的 TTL 值<br>
|
||||
只有被查询的域名控制条目才具有传染性质<br/>
|
||||
<br/>常见例子:<br/>
|
||||
<code>* fixed 300</code>强制使所有缓存的条目的 TTL 为 300<br/>
|
||||
<code>* vari 2x+0</code>将所有缓存条目的 TTL 加倍。即原来为300,现在为600<br/>
|
||||
]]))
|
||||
cache_control:depends ({cache = "true"})
|
||||
|
||||
domain_statistic = s1:option(Flag, "domain_statistic", translate("启用域名统计"), translate("域名信息统计会依照模板文件记录域名的查询情况<b>目前只能生成到<code>/root/.dnsforwarder/statistic.html</code>会影响闪存寿命不建议开启</b>"))
|
||||
domain_statistic.rmempty = false
|
||||
domain_statistic.default = "false"
|
||||
domain_statistic.disabled = "false"
|
||||
domain_statistic.enabled = "true"
|
||||
|
||||
view_cfg = s1:option(TextValue, "1", nil)
|
||||
view_cfg.rmempty = false
|
||||
view_cfg.rows = 24
|
||||
view_cfg.readonly = true
|
||||
|
||||
function view_cfg.cfgvalue()
|
||||
return nixio.fs.readfile(CONFIG_FILE) or ""
|
||||
end
|
||||
function view_cfg.write(self, section, value)
|
||||
end
|
||||
|
||||
-- ---------------------------------------------------
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
os.execute("/etc/init.d/dnsforwarder makeconfig >/dev/null 2>&1 &")
|
||||
os.execute("/etc/init.d/dnsforwarder restart >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -1,28 +0,0 @@
|
||||
local fs = require "nixio.fs"
|
||||
local log = "/var/log/dnsforwarder.log"
|
||||
|
||||
function sync_value_to_file(value, file)
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = nixio.fs.readfile(file)
|
||||
if value ~= old_value then
|
||||
nixio.fs.writefile(file, value)
|
||||
end
|
||||
end
|
||||
|
||||
m = Map("dnsforwarder")
|
||||
m.title = translate("运行日志")
|
||||
m.description = translate("如果想观察日志,需要在配置文件中写明LogOn true 和 LogFileFolder /var/log")
|
||||
|
||||
s = m:section(TypedSection, "arguments")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
gfwlist = s:option(TextValue, "gfwlist", nil, nil)
|
||||
gfwlist.description = translate("日志文件默认位置:" .. log)
|
||||
gfwlist.rows = 26
|
||||
gfwlist.wrap = "off"
|
||||
gfwlist.cfgvalue = function(self, section)
|
||||
return fs.readfile(log) or ""
|
||||
end
|
||||
|
||||
return m
|
||||
@@ -1,14 +0,0 @@
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Running"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "Not running"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "General"
|
||||
msgstr "常规"
|
||||
|
||||
msgid "LOG"
|
||||
msgstr "日志"
|
||||
@@ -1 +0,0 @@
|
||||
zh-cn
|
||||
@@ -1,18 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=E2Guardian LuCI Interface
|
||||
LUCI_DEPENDS:=+luci-mod-admin-full +e2guardian
|
||||
|
||||
PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -1,22 +0,0 @@
|
||||
--[[
|
||||
|
||||
LuCI E2Guardian module
|
||||
|
||||
Copyright (C) 2015, Itus Networks, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Author: Marko Ratkaj <marko.ratkaj@sartura.hr>
|
||||
Luka Perkov <luka.perkov@sartura.hr>
|
||||
|
||||
]]--
|
||||
|
||||
module("luci.controller.e2guardian", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "services", "e2guardian"}, cbi("e2guardian"), _("E2Guardian"))
|
||||
end
|
||||
@@ -1,399 +0,0 @@
|
||||
--[[
|
||||
|
||||
LuCI E2Guardian module
|
||||
|
||||
Copyright (C) 2015, Itus Networks, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Author: Marko Ratkaj <marko.ratkaj@sartura.hr>
|
||||
Luka Perkov <luka.perkov@sartura.hr>
|
||||
|
||||
]]--
|
||||
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
m = Map("e2guardian", translate("E2Guardian"))
|
||||
m.on_after_commit = function() luci.sys.call("/etc/init.d/e2guardian restart") end
|
||||
|
||||
s = m:section(TypedSection, "e2guardian")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
s:tab("tab_general", translate("General Settings"))
|
||||
s:tab("tab_additional", translate("Additional Settings"))
|
||||
s:tab("tab_logs", translate("Logs"))
|
||||
|
||||
|
||||
----------------- General Settings Tab -----------------------
|
||||
|
||||
filterip = s:taboption("tab_general", Value, "filterip", translate("IP that E2Guardian listens"))
|
||||
filterip.datatype = "ip4addr"
|
||||
|
||||
filterports = s:taboption("tab_general", Value, "filterports", translate("Port that E2Guardian listens"))
|
||||
filterports.datatype = "portrange"
|
||||
filterports.placeholder = "0-65535"
|
||||
|
||||
proxyip = s:taboption("tab_general", Value, "proxyip", translate("IP address of the proxy"))
|
||||
proxyip.datatype = "ip4addr"
|
||||
proxyip.default = "127.0.0.1"
|
||||
|
||||
proxyport = s:taboption("tab_general", Value, "proxyport", translate("Port of the proxy"))
|
||||
proxyport.datatype = "portrange"
|
||||
proxyport.placeholder = "0-65535"
|
||||
|
||||
languagedir = s:taboption("tab_general", Value, "languagedir", translate("Language dir"))
|
||||
languagedir.datatype = "string"
|
||||
languagedir.default = "/usr/share/e2guardian/languages"
|
||||
|
||||
language = s:taboption("tab_general", Value, "language", translate("Language to use"))
|
||||
language.datatype = "string"
|
||||
language.default = "ukenglish"
|
||||
|
||||
loglevel = s:taboption("tab_general", ListValue, "loglevel", translate("Logging Settings"))
|
||||
loglevel:value("0", translate("none"))
|
||||
loglevel:value("1", translate("just denied"))
|
||||
loglevel:value("2", translate("all text based"))
|
||||
loglevel:value("3", translate("all requests"))
|
||||
loglevel.default = "2"
|
||||
|
||||
logexceptionhits = s:taboption("tab_general", ListValue, "logexceptionhits", translate("Log Exception Hits"))
|
||||
logexceptionhits:value("0", translate("never"))
|
||||
logexceptionhits:value("1", translate("log, but don't mark as exceptions"))
|
||||
logexceptionhits:value("2", translate("log and mark"))
|
||||
logexceptionhits.default = "2"
|
||||
|
||||
logfileformat = s:taboption("tab_general", ListValue, "logfileformat", translate("Log File Format"))
|
||||
logfileformat:value("1", translate("DansgGuardian format, space delimited"))
|
||||
logfileformat:value("2", translate("CSV-style format"))
|
||||
logfileformat:value("3", translate("Squid Log File Format"))
|
||||
logfileformat:value("4", translate("Tab delimited"))
|
||||
logfileformat:value("5", translate("Protex format"))
|
||||
logfileformat:value("6", translate("Protex format with server field blanked"))
|
||||
logfileformat.default = "1"
|
||||
|
||||
accessdeniedaddress = s:taboption("tab_general", Value, "accessdeniedaddress", translate("Access denied address"),
|
||||
translate("Server to which the cgi e2guardian reporting script was copied. Reporting levels 1 and 2 only"))
|
||||
accessdeniedaddress.datatype = "string"
|
||||
accessdeniedaddress.default = "http://YOURSERVER.YOURDOMAIN/cgi-bin/e2guardian.pl"
|
||||
|
||||
usecustombannedimage = s:taboption("tab_general", ListValue, "usecustombannedimage", translate("Banned image replacement"))
|
||||
usecustombannedimage:value("on", translate("Yes"))
|
||||
usecustombannedimage:value("off", translate("No"))
|
||||
usecustombannedimage.default = "on"
|
||||
|
||||
custombannedimagefile = s:taboption("tab_general", Value, "custombannedimagefile", translate("Custom banned image file"))
|
||||
custombannedimagefile.datatype = "string"
|
||||
custombannedimagefile.default = "/usr/share/e2guardian/transparent1x1.gif"
|
||||
|
||||
usecustombannedflash = s:taboption("tab_general", ListValue, "usecustombannedflash", translate("Banned flash replacement"))
|
||||
usecustombannedflash:value("on", translate("Yes"))
|
||||
usecustombannedflash:value("off", translate("No"))
|
||||
usecustombannedflash.default = "on"
|
||||
|
||||
custombannedflashfile = s:taboption("tab_general", Value, "custombannedflashfile", translate("Custom banned flash file"))
|
||||
custombannedflashfile.datatype = "string"
|
||||
custombannedflashfile.default = "/usr/share/e2guardian/blockedflash.swf"
|
||||
|
||||
filtergroups = s:taboption("tab_general", Value, "filtergroups", translate("Number of filter groups"))
|
||||
filtergroups.datatype = "and(uinteger,min(1))"
|
||||
filtergroups.default = "1"
|
||||
|
||||
filtergroupslist = s:taboption("tab_general", Value, "filtergroupslist", translate("List of filter groups"))
|
||||
filtergroupslist.datatype = "string"
|
||||
filtergroupslist.default = "/etc/e2guardian/lists/filtergroupslist"
|
||||
|
||||
bannediplist = s:taboption("tab_general", Value, "bannediplist", translate("List of banned IPs"))
|
||||
bannediplist.datatype = "string"
|
||||
bannediplist.default = "/etc/e2guardian/lists/bannediplist"
|
||||
|
||||
exceptioniplist = s:taboption("tab_general", Value, "exceptioniplist", translate("List of IP exceptions"))
|
||||
exceptioniplist.datatype = "string"
|
||||
exceptioniplist.default = "/etc/e2guardian/lists/exceptioniplist"
|
||||
|
||||
perroomblockingdirectory = s:taboption("tab_general", Value, "perroomblockingdirectory", translate("Per-Room blocking definition directory"))
|
||||
perroomblockingdirectory.datatype = "string"
|
||||
perroomblockingdirectory.default = "/etc/e2guardian/lists/bannedrooms/"
|
||||
|
||||
showweightedfound = s:taboption("tab_general", ListValue, "showweightedfound", translate("Show weighted phrases found"))
|
||||
showweightedfound:value("on", translate("Yes"))
|
||||
showweightedfound:value("off", translate("No"))
|
||||
showweightedfound.default = "on"
|
||||
|
||||
weightedphrasemode = s:taboption("tab_general", ListValue, "weightedphrasemode", translate("Weighted phrase mode"))
|
||||
weightedphrasemode:value("0", translate("off"))
|
||||
weightedphrasemode:value("1", translate("on, normal operation"))
|
||||
weightedphrasemode:value("2", translate("on, phrase found only counts once on a page"))
|
||||
weightedphrasemode.default = "2"
|
||||
|
||||
urlcachenumber = s:taboption("tab_general", Value, "urlcachenumber", translate("Clean result caching for URLs"))
|
||||
urlcachenumber.datatype = "and(uinteger,min(0))"
|
||||
urlcachenumber.default = "1000"
|
||||
|
||||
urlcacheage = s:taboption("tab_general", Value, "urlcacheage", translate("Age before they should be ignored in seconds"))
|
||||
urlcacheage.datatype = "and(uinteger,min(0))"
|
||||
urlcacheage.default = "900"
|
||||
|
||||
scancleancache = s:taboption("tab_general", ListValue, "scancleancache", translate("Cache for content (AV) scans as 'clean'"))
|
||||
scancleancache:value("on", translate("Yes"))
|
||||
scancleancache:value("off", translate("No"))
|
||||
scancleancache.default = "on"
|
||||
|
||||
phrasefiltermode = s:taboption("tab_general", ListValue, "phrasefiltermode", translate("Filtering options"))
|
||||
phrasefiltermode:value("0", translate("raw"))
|
||||
phrasefiltermode:value("1", translate("smart"))
|
||||
phrasefiltermode:value("2", translate("both raw and smart"))
|
||||
phrasefiltermode:value("3", translate("meta/title"))
|
||||
phrasefiltermode.default = "2"
|
||||
|
||||
preservecase = s:taboption("tab_general", ListValue, "perservecase", translate("Lower caseing options"))
|
||||
preservecase:value("0", translate("force lower case"))
|
||||
preservecase:value("1", translate("don't change"))
|
||||
preservecase:value("2", translate("scan fist in lower, then in original"))
|
||||
preservecase.default = "0"
|
||||
|
||||
hexdecodecontent = s:taboption("tab_general", ListValue, "hexdecodecontent", translate("Hex decoding options"))
|
||||
hexdecodecontent:value("on", translate("Yes"))
|
||||
hexdecodecontent:value("off", translate("No"))
|
||||
hexdecodecontent.default = "off"
|
||||
|
||||
forcequicksearch = s:taboption("tab_general", ListValue, "forcequicksearch", translate("Quick search"))
|
||||
forcequicksearch:value("on", translate("Yes"))
|
||||
forcequicksearch:value("off", translate("No"))
|
||||
forcequicksearch.default = "off"
|
||||
|
||||
reverseaddresslookups= s:taboption("tab_general", ListValue, "reverseaddresslookups", translate("Reverse lookups for banned site and URLs"))
|
||||
reverseaddresslookups:value("on", translate("Yes"))
|
||||
reverseaddresslookups:value("off", translate("No"))
|
||||
reverseaddresslookups.default = "off"
|
||||
|
||||
reverseclientiplookups = s:taboption("tab_general", ListValue, "reverseclientiplookups", translate("Reverse lookups for banned and exception IP lists"))
|
||||
reverseclientiplookups:value("on", translate("Yes"))
|
||||
reverseclientiplookups:value("off", translate("No"))
|
||||
reverseclientiplookups.default = "off"
|
||||
|
||||
logclienthostnames = s:taboption("tab_general", ListValue, "logclienthostnames", translate("Perform reverse lookups on client IPs for successful requests"))
|
||||
logclienthostnames:value("on", translate("Yes"))
|
||||
logclienthostnames:value("off", translate("No"))
|
||||
logclienthostnames.default = "off"
|
||||
|
||||
createlistcachefiles = s:taboption("tab_general", ListValue, "createlistcachefiles", translate("Build bannedsitelist and bannedurllist cache files"))
|
||||
createlistcachefiles:value("on",translate("Yes"))
|
||||
createlistcachefiles:value("off",translate("No"))
|
||||
createlistcachefiles.default = "on"
|
||||
|
||||
prefercachedlists = s:taboption("tab_general", ListValue, "prefercachedlists", translate("Prefer cached list files"))
|
||||
prefercachedlists:value("on", translate("Yes"))
|
||||
prefercachedlists:value("off", translate("No"))
|
||||
prefercachedlists.default = "off"
|
||||
|
||||
maxuploadsize = s:taboption("tab_general", Value, "maxuploadsize", translate("Max upload size (in Kbytes)"))
|
||||
maxuploadsize:value("-1", translate("no blocking"))
|
||||
maxuploadsize:value("0", translate("complete block"))
|
||||
maxuploadsize.default = "-1"
|
||||
|
||||
maxcontentfiltersize = s:taboption("tab_general", Value, "maxcontentfiltersize", translate("Max content filter size"),
|
||||
translate("The value must not be higher than max content ram cache scan size or 0 to match it"))
|
||||
maxcontentfiltersize.datatype = "and(uinteger,min(0))"
|
||||
maxcontentfiltersize.default = "256"
|
||||
|
||||
maxcontentramcachescansize = s:taboption("tab_general", Value, "maxcontentramcachescansize", translate("Max content ram cache scan size"),
|
||||
translate("This is the max size of file that DG will download and cache in RAM"))
|
||||
maxcontentramcachescansize.datatype = "and(uinteger,min(0))"
|
||||
maxcontentramcachescansize.default = "2000"
|
||||
|
||||
maxcontentfilecachescansize = s:taboption("tab_general", Value, "maxcontentfilecachescansize", translate("Max content file cache scan size"))
|
||||
maxcontentfilecachescansize.datatype = "and(uinteger,min(0))"
|
||||
maxcontentfilecachescansize.default = "20000"
|
||||
|
||||
proxytimeout = s:taboption("tab_general", Value, "proxytimeout", translate("Proxy timeout (5-100)"))
|
||||
proxytimeout.datatype = "range(5,100)"
|
||||
proxytimeout.default = "20"
|
||||
|
||||
proxyexchange = s:taboption("tab_general", Value, "proxyexchange", translate("Proxy header excahnge (20-300)"))
|
||||
proxyexchange.datatype = "range(20,300)"
|
||||
proxyexchange.default = "20"
|
||||
|
||||
pcontimeout = s:taboption("tab_general", Value, "pcontimeout", translate("Pconn timeout"),
|
||||
translate("How long a persistent connection will wait for other requests"))
|
||||
pcontimeout.datatype = "range(5,300)"
|
||||
pcontimeout.default = "55"
|
||||
|
||||
filecachedir = s:taboption("tab_general", Value, "filecachedir", translate("File cache directory"))
|
||||
filecachedir.datatype = "string"
|
||||
filecachedir.default = "/tmp"
|
||||
|
||||
deletedownloadedtempfiles = s:taboption("tab_general", ListValue, "deletedownloadedtempfiles", translate("Delete file cache after user completes download"))
|
||||
deletedownloadedtempfiles:value("on", translate("Yes"))
|
||||
deletedownloadedtempfiles:value("off", translate("No"))
|
||||
deletedownloadedtempfiles.default = "on"
|
||||
|
||||
initialtrickledelay = s:taboption("tab_general", Value, "initialtrickledelay", translate("Initial Trickle delay"),
|
||||
translate("Number of seconds a browser connection is left waiting before first being sent *something* to keep it alive"))
|
||||
initialtrickledelay.datatype = "and(uinteger,min(0))"
|
||||
initialtrickledelay.default = "20"
|
||||
|
||||
trickledelay = s:taboption("tab_general", Value, "trickledelay", translate("Trickle delay"),
|
||||
translate("Number of seconds a browser connection is left waiting before being sent more *something* to keep it alive"))
|
||||
trickledelay.datatype = "and(uinteger,min(0))"
|
||||
trickledelay.default = "10"
|
||||
|
||||
downloadmanager = s:taboption("tab_general", Value, "downloadmanager", translate("Download manager"))
|
||||
downloadmanager.datatype = "string"
|
||||
downloadmanager.default = "/etc/e2guardian/downloadmanagers/default.conf"
|
||||
|
||||
contentscannertimeout = s:taboption("tab_general", Value, "contentscannertimeout", translate("Content scanner timeout"))
|
||||
contentscannertimeout.datatype = "and(uinteger,min(0))"
|
||||
contentscannertimeout.default = "60"
|
||||
|
||||
contentscanexceptions = s:taboption("tab_general", ListValue, "contentscanexceptions", translate("Content scan exceptions"))
|
||||
contentscanexceptions:value("on", translate("Yes"))
|
||||
contentscanexceptions:value("off", translate("No"))
|
||||
contentscanexceptions.default = "off"
|
||||
|
||||
recheckreplacedurls = s:taboption("tab_general", ListValue, "recheckreplacedurls", translate("e-check replaced URLs"))
|
||||
recheckreplacedurls:value("on", translate("Yes"))
|
||||
recheckreplacedurls:value("off", translate("No"))
|
||||
recheckreplacedurls.default = "off"
|
||||
|
||||
forwardedfor = s:taboption("tab_general", ListValue, "forwardedfor", translate("Misc setting: forwardedfor"),
|
||||
translate("If on, it may help solve some problem sites that need to know the source ip."))
|
||||
forwardedfor:value("on", translate("Yes"))
|
||||
forwardedfor:value("off", translate("No"))
|
||||
forwardedfor.default = "off"
|
||||
|
||||
usexforwardedfor = s:taboption("tab_general", ListValue, "usexforwardedfor", translate("Misc setting: usexforwardedfor"),
|
||||
translate("This is for when you have squid between the clients and E2Guardian"))
|
||||
usexforwardedfor:value("on", translate("Yes"))
|
||||
usexforwardedfor:value("off", translate("No"))
|
||||
usexforwardedfor.default = "off"
|
||||
|
||||
logconnectionhandlingerrors = s:taboption("tab_general", ListValue, "logconnectionhandlingerrors", translate("Log debug info about log()ing and accept()ing"))
|
||||
logconnectionhandlingerrors:value("on", translate("Yes"))
|
||||
logconnectionhandlingerrors:value("off", translate("No"))
|
||||
logconnectionhandlingerrors.default = "on"
|
||||
|
||||
logchildprocesshandling = s:taboption("tab_general", ListValue, "logchildprocesshandling", translate("Log child process handling"))
|
||||
logchildprocesshandling:value("on", translate("Yes"))
|
||||
logchildprocesshandling:value("off", translate("No"))
|
||||
logchildprocesshandling.default = "off"
|
||||
|
||||
maxchildren = s:taboption("tab_general", Value, "maxchildren", translate("Max number of processes to spawn"))
|
||||
maxchildren.datatype = "and(uinteger,min(0))"
|
||||
maxchildren.default = "180"
|
||||
|
||||
minchildren = s:taboption("tab_general", Value, "minchildren", translate("Min number of processes to spawn"))
|
||||
minchildren.datatype = "and(uinteger,min(0))"
|
||||
minchildren.default = "20"
|
||||
|
||||
minsparechildren = s:taboption("tab_general", Value, "minsparechildren", translate("Min number of processes to keep ready"))
|
||||
minsparechildren.datatype = "and(uinteger,min(0))"
|
||||
minsparechildren.default = "16"
|
||||
|
||||
preforkchildren = s:taboption("tab_general", Value, "preforkchildren", translate("Sets minimum nuber of processes when it runs out"))
|
||||
preforkchildren.datatype = "and(uinteger,min(0))"
|
||||
preforkchildren.default = "10"
|
||||
|
||||
maxsparechildren = s:taboption("tab_general", Value, "maxsparechildren", translate("Sets the maximum number of processes to have doing nothing"))
|
||||
maxsparechildren.datatype = "and(uinteger,min(0))"
|
||||
maxsparechildren.default = "32"
|
||||
|
||||
maxagechildren = s:taboption("tab_general", Value, "maxagechildren", translate("Max age of child process"))
|
||||
maxagechildren.datatype = "and(uinteger,min(0))"
|
||||
maxagechildren.default = "500"
|
||||
|
||||
maxips = s:taboption("tab_general", Value, "maxips", translate("Max number of clinets allowed to connect"))
|
||||
maxips:value("0", translate("no limit"))
|
||||
maxips.default = "0"
|
||||
|
||||
ipipcfilename = s:taboption("tab_general", Value, "ipipcfilename", translate("IP list IPC server directory and filename"))
|
||||
ipipcfilename.datatype = "string"
|
||||
ipipcfilename.default = "/tmp/.dguardianipc"
|
||||
|
||||
urlipcfilename = s:taboption("tab_general", Value, "urlipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process"))
|
||||
urlipcfilename.datatype = "string"
|
||||
urlipcfilename.default = "/tmp/.dguardianurlipc"
|
||||
|
||||
ipcfilename = s:taboption("tab_general", Value, "ipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process"))
|
||||
ipcfilename.datatype = "string"
|
||||
ipcfilename.default = "/tmp/.dguardianipipc"
|
||||
|
||||
nodeamon = s:taboption("tab_general", ListValue, "nodeamon", translate("Disable deamoning"))
|
||||
nodeamon:value("on", translate("Yes"))
|
||||
nodeamon:value("off", translate("No"))
|
||||
nodeamon.default = "off"
|
||||
|
||||
nologger = s:taboption("tab_general", ListValue, "nologger", translate("Disable logger"))
|
||||
nologger:value("on", translate("Yes"))
|
||||
nologger:value("off", translate("No"))
|
||||
nologger.default = "off"
|
||||
|
||||
logadblock = s:taboption("tab_general", ListValue, "logadblock", translate("Enable logging of ADs"))
|
||||
logadblock:value("on", translate("Yes"))
|
||||
logadblock:value("off", translate("No"))
|
||||
logadblock.default = "off"
|
||||
|
||||
loguseragent = s:taboption("tab_general", ListValue, "loguseragent", translate("Enable logging of client user agent"))
|
||||
loguseragent:value("on", translate("Yes"))
|
||||
loguseragent:value("off", translate("No"))
|
||||
loguseragent.default = "off"
|
||||
|
||||
softrestart = s:taboption("tab_general", ListValue, "softrestart", translate("Enable soft restart"))
|
||||
softrestart:value("on", translate("Yes"))
|
||||
softrestart:value("off", translate("No"))
|
||||
softrestart.default = "off"
|
||||
|
||||
|
||||
------------------------ Additional Settings Tab ----------------------------
|
||||
|
||||
e2guardian_config_file = s:taboption("tab_additional", TextValue, "_data", "")
|
||||
e2guardian_config_file.wrap = "off"
|
||||
e2guardian_config_file.rows = 25
|
||||
e2guardian_config_file.rmempty = false
|
||||
|
||||
function e2guardian_config_file.cfgvalue()
|
||||
local uci = require "luci.model.uci".cursor_state()
|
||||
file = "/etc/e2guardian/e2guardianf1.conf"
|
||||
if file then
|
||||
return fs.readfile(file) or ""
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
function e2guardian_config_file.write(self, section, value)
|
||||
if value then
|
||||
local uci = require "luci.model.uci".cursor_state()
|
||||
file = "/etc/e2guardian/e2guardianf1.conf"
|
||||
fs.writefile(file, value:gsub("\r\n", "\n"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---------------------------- Logs Tab -----------------------------
|
||||
|
||||
e2guardian_logfile = s:taboption("tab_logs", TextValue, "lines", "")
|
||||
e2guardian_logfile.wrap = "off"
|
||||
e2guardian_logfile.rows = 25
|
||||
e2guardian_logfile.rmempty = true
|
||||
|
||||
function e2guardian_logfile.cfgvalue()
|
||||
local uci = require "luci.model.uci".cursor_state()
|
||||
file = "/tmp/e2guardian/access.log"
|
||||
if file then
|
||||
return fs.readfile(file) or ""
|
||||
else
|
||||
return "Can't read log file"
|
||||
end
|
||||
end
|
||||
|
||||
function e2guardian_logfile.write()
|
||||
return ""
|
||||
end
|
||||
|
||||
return m
|
||||
Loaded 100 of 430 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user