treewide: add packages from lede (#88)

This commit is contained in:
Beginner 2022-02-15 21:36:48 +08:00 committed by GitHub
parent 5f363d93c5
commit b2efe3b78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
847 changed files with 90718 additions and 0 deletions

View File

@ -0,0 +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 Access Control Configuration
LUCI_DEPENDS:=
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-accesscontrol
PKG_VERSION:=1
PKG_RELEASE:=11
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,17 @@
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

View File

@ -0,0 +1,68 @@
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

View File

@ -0,0 +1,22 @@
<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>

View File

@ -0,0 +1,50 @@
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 "日"

View File

@ -0,0 +1,3 @@
config basic
option enable '0'

View File

@ -0,0 +1,88 @@
#!/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
}

View File

@ -0,0 +1 @@
/etc/init.d/mia restart

View File

@ -0,0 +1,17 @@
#!/bin/sh
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

View File

@ -0,0 +1,18 @@
# 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:=75
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,86 @@
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

View File

@ -0,0 +1,57 @@
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.rmempty = true
return m

View File

@ -0,0 +1,66 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,22 @@
<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>

View File

@ -0,0 +1,35 @@
<%+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%>

View File

@ -0,0 +1,198 @@
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黑名单"

View File

@ -0,0 +1,11 @@
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'

View File

@ -0,0 +1,254 @@
#!/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=/var/etc/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 /var/etc/dnsmasq-adbyby.d
mkdir -p /tmp/dnsmasq.d
awk '!/^$/&&!/^#/{printf("ipset=/%s/'"adbyby_esc"'\n",$0)}' $PROG_PATH/adesc.conf > /var/etc/dnsmasq-adbyby.d/06-dnsmasq.esc
awk '!/^$/&&!/^#/{printf("address=/%s/'"0.0.0.0"'\n",$0)}' $PROG_PATH/adblack.conf > /var/etc/dnsmasq-adbyby.d/07-dnsmasq.black
echo 'conf-dir=/var/etc/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 /var/etc/dnsmasq-adbyby.d/* >/dev/null 2>&1; then
mkdir -p /tmp/dnsmasq.d
cp /usr/share/adbyby/dnsmasq.adblock /var/etc/dnsmasq-adbyby.d/04-dnsmasq.adblock
cp /usr/share/adbyby/dnsmasq.ads /var/etc/dnsmasq-adbyby.d/05-dnsmasq.ads
fi
fi
mkdir -p /tmp/adbyby/rules/data /tmp/adbyby/rules/host
rm -f /tmp/adbyby/rules/data/* /tmp/adbyby/rules/host/*
cp -a /usr/share/adbyby/rules/data/* /tmp/adbyby/rules/data 2>/dev/null
cp -a /usr/share/adbyby/rules/host/* /tmp/adbyby/rules/host 2>/dev/null
echo 'addn-hosts=/tmp/adbyby/rules/host/' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
echo 'conf-dir=/tmp/adbyby/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 /var/etc/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
}

View File

@ -0,0 +1,30 @@
#!/bin/sh
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

View File

@ -0,0 +1,6 @@
/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

View File

@ -0,0 +1,11 @@
#!/bin/sh -e
if [ -f /tmp/adnew.conf ]; then
if (grep -wq "address=" /tmp/adnew.conf) ; then
cp /tmp/adnew.conf /tmp/ad.conf
elif (grep -wq "0.0.0.0" /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

View File

@ -0,0 +1,14 @@
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

View File

@ -0,0 +1,10 @@
#!/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

View File

@ -0,0 +1,4 @@
#!/bin/sh
PROG_PATH=$(pwd)
$PROG_PATH/adbybyupdate.sh

View File

@ -0,0 +1,49 @@
#!/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/lazy.txt
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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

View File

@ -0,0 +1,3 @@
weixin.qq.com
qpic.cn
imtt.qq.com

View File

@ -0,0 +1,68 @@
cbjs.baidu.com
list.video.baidu.com
nsclick.baidu.com
play.baidu.com
sclick.baidu.com
tieba.baidu.com
baidustatic.com
bdimg.com
bdstatic.com
share.baidu.com
hm.baidu.com
v.baidu.com
cpro.baidu.com
1000fr.net
atianqi.com
56.com
v-56.com
acfun.com
acfun.tv
baofeng.com
baofeng.net
cntv.cn
hoopchina.com.cn
funshion.com
fun.tv
hitvs.cn
hljtv.com
iqiyi.com
qiyi.com
agn.aty.sohu.com
itc.cn
kankan.com
ku6.com
letv.com
letvcloud.com
letvimg.com
pplive.cn
pps.tv
ppsimg.com
pptv.com
www.qq.com
l.qq.com
v.qq.com
video.sina.com.cn
tudou.com
wasu.cn
analytics-union.xunlei.com
kankan.xunlei.com
youku.com
hunantv.com
ifeng.com
renren.com
mediav.com
cnbeta.com
mydrivers.com
168f.info
doubleclick.net
126.net
sohu.com
right.com.cn
50bang.org
you85.cn
jiuzhilan.com
googles.com
cnbetacdn.com
ptqy.gitv.tv
admaster.com.cn
serving-sys.com

View File

@ -0,0 +1,46 @@
#!/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/lazy.txt
touch /tmp/video.txt && uclient-fetch --no-check-certificate -t 1 -T 10 -O /tmp/video.txt https://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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

View File

@ -0,0 +1,30 @@
#!/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/lazy.txt
touch /tmp/video.txt && uclient-fetch --no-check-certificate -T 10 -O /tmp/video.txt https://adbyby.coding.net/p/xwhyc-rules/d/xwhyc-rules/git/raw/master/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

View File

@ -0,0 +1 @@
2.2.2.2

View File

@ -0,0 +1,4 @@
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

View File

@ -0,0 +1,3 @@
ipset=/weixin.qq.com/adbyby_wan
ipset=/qpic.cn/adbyby_wan
ipset=/imtt.qq.com/adbyby_wan

View File

@ -0,0 +1,16 @@
#!/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

View File

@ -0,0 +1,3 @@
#!/bin/sh
find $1 -type f -exec cat {} \; | wc -l

View File

@ -0,0 +1,36 @@
#!/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

View File

@ -0,0 +1,15 @@
! ------------------------------ ADByby 自定义过滤语法简表---------------------------------
! -------------- 规则基于abp规则并进行了字符替换部分的扩展-----------------------------
! ABP规则请参考https://adblockplus.org/zh_CN/filters下面为大致摘要
! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述
! "*" 为字符通配符能够匹配0长度或任意长度的字符串该通配符不能与正则语法混用。
! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。
! "|" 为管线符号,来表示地址的最前端或最末端
! "||" 为子域通配符,方便匹配主域名下的所有子域。
! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。
! "##" 为元素选择器标识符后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class
!! 元素隐藏暂不支持全局规则和排除规则
!! 字符替换扩展
! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@
! 支持通配符*和?
! -------------------------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#
# 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 Apple Airplay2 Receiver
LUCI_DEPENDS:=+alsa-utils +shairport-sync-openssl
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-airplay2
PKG_VERSION:=1
PKG_RELEASE:=10
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,20 @@
-- Copyright 2014 Álvaro Fernández Rojas <noltari@gmail.com>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.shairport-sync", package.seeall)
function index()
if not nixio.fs.access("/etc/config/shairport-sync") then
return
end
entry({"admin", "services", "shairport-sync"}, cbi("shairport-sync"), _("AirPlay 2 Receiver")).dependent = true
entry({"admin", "services", "shairport-sync", "run"}, call("act_status")).leaf = true
end
function act_status()
local e = {}
e.running = luci.sys.call("pgrep shairport-sync >/dev/null") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,69 @@
-- Copyright 2020 Lean <coolsnowwolf@gmail.com>
-- Licensed to the public under the Apache License 2.0.
m = Map("shairport-sync")
m.title = translate("Apple AirPlay 2 Receiver")
m.description = translate("Apple AirPlay 2 Receiver is a simple AirPlay server implementation")
m:section(SimpleSection).template = "shairport-sync/shairport-sync_status"
s = m:section(TypedSection, "shairport-sync")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enabled", translate("Enabled"))
enable.default = "0"
enable.rmempty = false
respawn = s:option(Flag, "respawn", translate("Respawn"))
respawn.default = false
apname = s:option(Value, "name", translate("Airport Name"))
apname.rmempty = false
auth = s:option(Flag, "auth", translate("Password Auth"))
auth.default = false
pw = s:option(Value, "password", translate("Password"))
pw.rmempty = true
pw.password = true
pw.default = ""
pw:depends("auth", "1")
interpolation = s:option(ListValue, "interpolation", translate("Interpolation"))
interpolation:value("basic", translate("Internal Basic Resampler"))
interpolation:value("soxr", translate("High quality SoX Resampler (fast CPU required)"))
port=s:option(Value, "port", translate("Port"))
port.rmempty = false
port.datatype = "port"
alsa_output_device = s:option(ListValue, "alsa_output_device", translate("Alsa Output Device"))
alsa_output_device:value("", translate("default"))
alsa_output_device:value("hw:0", translate("1st Soundcard (hw:0)"))
alsa_output_device:value("hw:1", translate("2nd Soundcard (hw:1)"))
alsa_output_device:value("hw:2", translate("3rd Soundcard (hw:2)"))
alsa_mixer_control_name = s:option(ListValue, "alsa_mixer_control_name", translate("Alsa Mixer Control Name"))
alsa_mixer_control_name:value("", translate("default (software volume)"))
alsa_mixer_control_name:value("PCM", translate("PCM"))
alsa_mixer_control_name:value("Speaker", translate("Speaker"))
alsa_output_rate = s:option(ListValue, "alsa_output_rate", translate("Alsa Output Rate"))
alsa_output_rate:value("auto", translate("auto"))
alsa_output_rate:value("44100", translate("44.1kHz"))
alsa_output_rate:value("88200", translate("88.2kHz"))
alsa_output_rate:value("176400", translate("176.4kHz"))
alsa_output_rate:value("352800", translate("352.8kHz"))
alsa_buffer_length = s:option(Value, "alsa_buffer_length", translate("Alsa Buffer Length"))
alsa_buffer_length.default = "6615"
allow_session_interruption = s:option(ListValue, "sesctl_session_interruption", translate("Allow session interruption"))
allow_session_interruption:value("no", translate("Not allow"))
allow_session_interruption:value("yes", translate("Allow"))
session_timeout = s:option(Value, "sesctl_session_timeout", translate("Session timeout"))
session_timeout.default = "120"
return m

View File

@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[shairport-sync]], [[run]])%>', null,
function(x, data) {
var tb = document.getElementById('shairport-sync_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>Apple AirPlay 2 Receiver <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>Apple AirPlay 2 Receiver <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="shairport-sync_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
"Last-Translator: coolsnowwolf <coolsnowwolf@gmail.com>\n"
"Language-Team: PandoraBox Team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
msgid "AirPlay 2 Receiver"
msgstr "AirPlay 2 音频接收器"
msgid "Respawn"
msgstr "进程守护"
msgid "Apple AirPlay 2 Receiver"
msgstr "Apple AirPlay 2 无损音频接收服务器"
msgid "Apple AirPlay 2 Receiver is a simple AirPlay server implementation"
msgstr "Apple AirPlay 2 是一个强大易用的无损音频服务器( iOS/MacOSX 原生支持)"
msgid "Airport Name"
msgstr "音频接收器名称"
msgid "Password Auth"
msgstr "开启密码认证"
msgid "Interpolation"
msgstr "音频重采样"
msgid "Internal Basic Resampler"
msgstr "内置"
msgid "High quality SoX Resampler (fast CPU required)"
msgstr "高质量 SoX 采样器需要强力的CPU"
msgid "Alsa Output Device"
msgstr "音频输出设备"
msgid "Alsa Mixer Control Name"
msgstr "硬件音量控制器名称"
msgid "default (software volume)"
msgstr "缺省(使用软件音量调整)
msgid "1st Soundcard (hw:0)"
msgstr "第 1 张声卡 (hw:0)"
msgid "2nd Soundcard (hw:1)"
msgstr "第 2 张声卡 (hw:1)"
msgid "3rd Soundcard (hw:2)"
msgstr "第 3 张声卡 (hw:2)"
msgid "Alsa Output Rate"
msgstr "音频输出采样率"
msgid "Alsa Buffer Length"
msgstr "音频缓冲区长度"
msgid "Allow session interruption"
msgstr "允许其他设备打断当前播放会话"
msgid "Not allow"
msgstr "不允许"
msgid "Allow"
msgstr "允许"
msgid "Session timeout"
msgstr "会话超时"

View File

@ -0,0 +1,2 @@
defaults.pcm.dmix.rate 44100 # Force 44.1 KHz
defaults.pcm.dmix.format S16_LE # Force 16 bits

View File

@ -0,0 +1,13 @@
config shairport-sync 'shairport_sync'
option respawn '1'
option name 'AirPlay 2 On OpenWrt'
option auth '0'
option interpolation 'basic'
option port '5050'
option alsa_output_rate 'auto'
option alsa_buffer_length '6615'
option enabled '0'
option sesctl_session_interruption 'no'
option sesctl_session_timeout '120'

View File

@ -0,0 +1,142 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2015-2016 OpenWrt.org
START=99
USE_PROCD=1
append_num() {
local cfg="$1"
local file="$2"
local var="$3"
local opt="$4"
local def="$5"
local val
config_get val "$cfg" "$var"
[ -n "$val" -o -n "$def" ] && echo -e "\t$opt = ${val:-$def};" >> $file
}
append_str() {
local cfg="$1"
local file="$2"
local var="$3"
local opt="$4"
local def="$5"
local val
config_get val "$cfg" "$var"
[ -n "$val" -o -n "$def" ] && echo -e "\t$opt = \"${val:-$def}\";" >> $file
}
start_instance() {
local cfg=$1
local conf_custom conf_file aux
config_get_bool aux "$cfg" 'enabled' '0'
[ "$aux" = 0 ] && return 1
config_get_bool conf_custom "$cfg" 'conf_custom' '0'
config_get conf_file "$cfg" "conf_file"
if [ $conf_custom -ne 1 ] && [ ! -n "$conf_file" ]; then
mkdir -p /var/etc
conf_file="/var/etc/shairport-sync-${cfg}.conf"
echo -e "// Automatically generated from UCI config\n" > $conf_file
# General
echo -e "general =" >> $conf_file
echo -e "{" >> $conf_file
append_str "$cfg" "$conf_file" name "name"
append_str "$cfg" "$conf_file" password "password"
append_str "$cfg" "$conf_file" interpolation "interpolation"
append_str "$cfg" "$conf_file" output_backend "output_backend"
append_str "$cfg" "$conf_file" mdns_backend "mdns_backend"
append_num "$cfg" "$conf_file" port "port" "5050"
append_num "$cfg" "$conf_file" udp_port_base "udp_port_base"
append_num "$cfg" "$conf_file" udp_port_range "udp_port_range"
append_str "$cfg" "$conf_file" statistics "statistics"
append_num "$cfg" "$conf_file" drift "drift"
append_num "$cfg" "$conf_file" resync_threshold "resync_threshold"
append_num "$cfg" "$conf_file" log_verbosity "log_verbosity"
append_str "$cfg" "$conf_file" ignore_volume_control "ignore_volume_control"
append_num "$cfg" "$conf_file" volume_range_db "volume_range_db"
append_str "$cfg" "$conf_file" regtype "regtype"
append_str "$cfg" "$conf_file" playback_mode "playback_mode"
append_num "$cfg" "$conf_file" alsa_buffer_length "audio_backend_buffer_desired_length"
append_num "$cfg" "$conf_file" alsa_latency_offset "audio_backend_latency_offset_in_seconds"
echo -e "};\n" >> $conf_file
# Metadata
echo -e "metadata =" >> $conf_file
echo -e "{" >> $conf_file
append_str "$cfg" "$conf_file" metadata_enabled "enabled"
append_str "$cfg" "$conf_file" metadata_cover_art "include_cover_art"
append_str "$cfg" "$conf_file" metadata_pipe_name "pipe_name"
append_num "$cfg" "$conf_file" metadata_pipe_timeout "pipe_timeout"
append_str "$cfg" "$conf_file" metadata_socket_address "socket_address"
append_num "$cfg" "$conf_file" metadata_socket_port "socket_port"
append_num "$cfg" "$conf_file" metadata_socket_msglength "socket_msglength"
echo -e "};\n" >> $conf_file
# Session control
echo -e "sessioncontrol =" >> $conf_file
echo -e "{" >> $conf_file
append_str "$cfg" "$conf_file" sesctl_run_before_play_begins "run_this_before_play_begins"
append_str "$cfg" "$conf_file" sesctl_run_after_play_ends "run_this_after_play_ends"
append_str "$cfg" "$conf_file" sesctl_wait_for_completion "wait_for_completion"
append_str "$cfg" "$conf_file" sesctl_session_interruption "allow_session_interruption"
append_num "$cfg" "$conf_file" sesctl_session_timeout "session_timeout"
echo -e "};\n" >> $conf_file
# Alsa audio back end
echo -e "alsa =" >> $conf_file
echo -e "{" >> $conf_file
append_str "$cfg" "$conf_file" alsa_output_device "output_device"
append_str "$cfg" "$conf_file" alsa_mixer_control_name "mixer_control_name"
append_str "$cfg" "$conf_file" alsa_mixer_device "mixer_device"
local alsa_output_rate_val
config_get alsa_output_rate_val "$cfg" "alsa_output_rate"
[ $alsa_output_rate_val != "auto" ] && append_num "$cfg" "$conf_file" alsa_output_rate "output_rate" "44100"
append_str "$cfg" "$conf_file" alsa_disable_synchronization "disable_synchronization"
append_num "$cfg" "$conf_file" alsa_period_size "period_size"
append_num "$cfg" "$conf_file" alsa_buffer_size "buffer_size"
echo -e "};\n" >> $conf_file
# Pipe audio back end
echo -e "pipe =" >> $conf_file
echo -e "{" >> $conf_file
append_str "$cfg" "$conf_file" pipe_name "name"
echo -e "};\n" >> $conf_file
fi
procd_open_instance
procd_set_param command /usr/bin/shairport-sync
procd_append_param command -c $conf_file
config_get_bool aux "$cfg" 'respawn' '0'
[ "$aux" = 1 ] && procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "shairport-sync"
}
reload_service() {
stop
start
}
start_service() {
config_load shairport-sync
config_foreach start_instance shairport-sync
}
boot() {
amixer set Master unmute
amixer set Master 100%
amixer set PCM 100%
start
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@shairport-sync[-1]
add ucitrack shairport-sync
set ucitrack.@shairport-sync[-1].init=shairport-sync
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,16 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-aliyundrive-webdav
PKG_VERSION:=1.2.4
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_MAINTAINER:=messense <messense@icloud.com>
LUCI_TITLE:=LuCI Support for aliyundrive-webdav
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+aliyundrive-webdav
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,40 @@
module("luci.controller.aliyundrive-webdav", package.seeall)
function index()
if not nixio.fs.access("/etc/config/aliyundrive-webdav") then
return
end
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 -- 日志采集
end
function action_status()
local e = {}
e.running = luci.sys.call("pidof aliyundrive-webdav >/dev/null") == 0
e.application = luci.sys.exec("aliyundrive-webdav --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-webdav.log"
local e = {}
e.running = luci.sys.call("pidof aliyundrive-webdav >/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

View File

@ -0,0 +1,60 @@
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>")
m:section(SimpleSection).template = "aliyundrive-webdav/aliyundrive-webdav_status"
e = m:section(TypedSection, "server")
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>")
root = e:option(Value, "root", translate("Root Directory"))
root.description = translate("Restrict access to a folder of aliyundrive, defaults to / which means no restrictions")
root.default = "/"
host = e:option(Value, "host", translate("Host"))
host.default = "0.0.0.0"
host.datatype = "ipaddr"
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
read_buffer_size = e:option(Value, "read_buffer_size", translate("Read Buffer Size"))
read_buffer_size.default = "10485760"
read_buffer_size.datatype = "uinteger"
cache_size = e:option(Value, "cache_size", translate("Cache Size"))
cache_size.default = "1000"
cache_size.datatype = "uinteger"
cache_ttl = e:option(Value, "cache_ttl", translate("Cache Expiration Time (seconds)"))
cache_ttl.default = "600"
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
return m

View File

@ -0,0 +1,9 @@
log = SimpleForm("logview")
log.submit = false
log.reset = false
t = log:field(DummyValue, '', '')
t.rawhtml = true
t.template = 'aliyundrive-webdav/aliyundrive-webdav_log'
return log

View File

@ -0,0 +1,15 @@
<%+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-webdav", "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%>

View File

@ -0,0 +1,21 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[aliyundrive-webdav]], [[status]])%>', null,
function(x, data) {
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>';
} 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-webdav_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,86 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
msgid "AliyunDrive"
msgstr "阿里云盘"
msgid "AliyunDrive WebDAV"
msgstr "阿里云盘 WebDAV"
msgid "Enable"
msgstr "启用"
msgid "Refresh Token"
msgstr "Refresh Token"
msgid "Root Directory"
msgstr "云盘根目录"
msgid "Host"
msgstr "监听主机"
msgid "Port"
msgstr "监听端口"
msgid "TLS certificate file path"
msgstr "TLS 证书文件路径"
msgid "TLS private key file path"
msgstr "TLS 私钥文件路径"
msgid "Username"
msgstr "用户名"
msgid "Password"
msgstr "密码"
msgid "Read Buffer Size"
msgstr "下载缓冲大小(bytes)"
msgid "Cache Size"
msgstr "目录缓存大小"
msgid "Cache Expiration Time (seconds)"
msgstr "目录缓存过期时间(单位为秒)"
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-webdav\" target=\"_blank\">Project GitHub URL</a>"
msgstr "<a href=\"https://github.com/messense/aliyundrive-webdav\" 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 "Restrict access to a folder of aliyundrive, defaults to / which means no restrictions"
msgstr "限制只能访问该云盘目录,默认为 / 表示不限制,注意这个参数不是本地磁盘路径"
msgid "Delete file permanently instead of trashing"
msgstr "删除文件不放入回收站"
msgid "Enable read only mode"
msgstr "启用只读模式"
msgid "Disallow upload, modify and delete file operations"
msgstr "禁止上传、修改和删除文件操作"
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>"

View File

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

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@aliyundrive-webdav[-1]
add ucitrack aliyundrive-webdav
set ucitrack.@aliyundrive-webdav[-1].init=aliyundrive-webdav
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-aliyundrive-webdav": {
"description": "Grant UCI access for luci-app-aliyundrive-webdav",
"read": {
"uci": [ "aliyundrive-webdav" ]
},
"write": {
"uci": [ "aliyundrive-webdav" ]
}
}
}

View File

@ -0,0 +1,14 @@
# 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 Amule
LUCI_DEPENDS:=+amule
LUCI_PKGARCH:=all
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,156 @@
--[[
LuCI - Lua Configuration Interface - amule support
Copyright 2016 maz-1 <ohmygod19993@gmail.com>
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
]]--
module("luci.controller.amule", package.seeall)
local uci = luci.model.uci.cursor()
local configdir = uci:get("amule", "main", "config_dir")
function index()
if not nixio.fs.access("/etc/config/amule") then
return
end
entry({"admin", "nas"}, firstchild(), "NAS", 45).dependent = false
entry({"admin", "nas", "amule"}, cbi("amule"), _("aMule Settings")).dependent = true
entry({"admin", "nas", "amule", "logview"}, call("logread")).leaf = true
entry({"admin", "nas", "amule", "status"}, call("get_pid")).leaf = true
entry({"admin", "nas", "amule", "amulecmd"}, call("amulecmd")).leaf = true
entry({"admin", "nas", "amule", "startstop"}, post("startstop")).leaf = true
entry({"admin", "nas", "amule", "down_kad"}, post("down_kad")).leaf = true
entry({"admin", "nas", "amule", "down_ed2k"}, post("down_ed2k")).leaf = true
end
-- called by XHR.get from detail_logview.htm
function logread()
-- read application settings
local uci = luci.model.uci.cursor()
local logdir = uci:get("amule", "main", "config_dir") or "/var/run/amule"
uci:unload("amule")
local ldata=nixio.fs.readfile(logdir .. "/logfile")
if not ldata or #ldata == 0 then
ldata="_nodata_"
end
luci.http.write(ldata)
end
-- called by XHR.get from detail_startstop.htm
function startstop()
local pid = get_pid(true)
if pid > 0 then
luci.sys.call("/etc/init.d/amule stop")
nixio.nanosleep(1) -- sleep a second
if nixio.kill(pid, 0) then -- still running
nixio.kill(pid, 9) -- send SIGKILL
end
pid = 0
else
luci.sys.call("/etc/init.d/amule start")
nixio.nanosleep(1) -- sleep a second
pid = tonumber(luci.sys.exec("pidof amuled")) or 0
if pid > 0 and not nixio.kill(pid, 0) then
pid = 0 -- process did not start
end
end
luci.http.write(tostring(pid)) -- HTTP needs string not number
end
function down_kad()
url = uci:get("amule", "main", "kad_nodes_url")
data_path = configdir .. "/nodes.dat"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_nodes.dat \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_nodes.dat > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
function down_ed2k()
url = uci:get("amule", "main", "ed2k_servers_url")
data_path = configdir .. "/server.met"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_server.met \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_server.met > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
-- called by XHR.poll from detail_startstop.htm
-- and from lua (with parameter "true")
function get_pid(from_lua)
local pid_amuled = tonumber(luci.sys.exec("pidof amuled")) or 0
local amuled_stat =false
if pid_amuled > 0 and not nixio.kill(pid_amuled, 0) then
pid_amuled = 0
end
if pid_amuled > 0 then
amuled_stat =true
else
amuled_stat =false
end
local pid_amuleweb = tonumber(luci.sys.exec("pidof amuleweb")) or 0
local amuleweb_stat = false
if pid_amuleweb > 0 and not nixio.kill(pid_amuleweb, 0) then
pid_amuleweb = 0
end
if pid_amuleweb > 0 then
amuleweb_stat =true
else
amuleweb_stat =false
end
local status = {
amuled = amuled_stat,
amuled_pid = pid_amuled,
amuleweb = amuleweb_stat
}
if from_lua then
return pid_amuled
else
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end
end
function amulecmd()
local re =""
local rv = { }
local cmd = luci.http.formvalue("cmd")
local full_cmd = "HOME=\""..configdir.. "\" /usr/bin/amulecmd".." -c \""..cmd.."\" 2>&1"
local shellpipe = io.popen(full_cmd,"rw")
re = shellpipe:read("*a")
shellpipe:close()
if not re then
re=""
end
re = string.gsub(re, "This is amulecmd %S*\n", "")
re = string.gsub(re, "Creating client%S*\n", "")
re = string.gsub(re, "Succeeded! Connection established to aMule %S*\n", "")
re = string.gsub(re, "\n", "\r\n")
rv[#rv+1]=re
if #rv > 0 then
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
return
end
luci.http.status(404, "No such device")
end

View File

@ -0,0 +1,456 @@
--[[
LuCI - Lua Configuration Interface - Aria2 support
Copyright 2016 maz-1 <ohmygod19993@gmail.com>
]]--
local sys = require "luci.sys"
local util = require "luci.util"
local uci = require "luci.model.uci".cursor()
ptype = {
"socks5",
"socks4",
"http",
"socks4a",
}
whocan = {
"anyone",
"friends",
"nobody",
}
function titlesplit(Value)
return "<p style=\"font-size:20px;font-weight:bold;color: DodgerBlue\">" .. translate(Value) .. "</p>"
end
m = Map("amule", translate("aMule"), translate("aMule is a ED2K/KAD client for all platforms.") .. "<br/><a href=\"https://github.com/maz-1\">luci interface by maz-1</a>")
m:section(SimpleSection).template = "amule/overview_status"
s = m:section(TypedSection, "amule", translate("aMule Settings"))
s.addremove = false
s.anonymous = true
s:tab("general", translate("General"))
s:tab("connection", translate("Connections"))
s:tab("server", translate("Server"))
s:tab("path_and_file", translate("Path And File"))
s:tab("security", translate("Security"))
s:tab("remote", translate("External Control"))
s:tab("template", translate("Edit Template"))
s:tab("logview", translate("Log File Viewer"))
s:tab("amulecmd", translate("aMule command"))
-- GENERAL --
o = s:taboption("general", Flag, "enabled", translate("Enabled"))
o.rmempty = false
user = s:taboption("general", ListValue, "runasuser", translate("Run daemon as user"))
local p_user
for _, p_user in util.vspairs(util.split(sys.exec("cat /etc/passwd | cut -f 1 -d :"))) do
user:value(p_user)
end
o = s:taboption("general", Value, "config_dir", translate("Configuration directory"))
o.rmempty = false
o.placeholder = "/var/run/amule"
o = s:taboption("general", Value, "mem_percentage", translate("Memory Limit"), translate("Percentage"))
o.rmempty = false
o.placeholder = "50"
o.datatype = "range(1, 99)"
o = s:taboption("general", Value, "nick", translate("Nickname"))
o.placeholder = "http://www.aMule.org"
o = s:taboption("general", Value, "max_upload", translate("Max upload speed"), translate("Unlimited when set to 0"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "0"
o = s:taboption("general", Value, "max_download", translate("Max download speed"), translate("Unlimited when set to 0"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "0"
o = s:taboption("general", Value, "slot_allocation", translate("Slot allocation"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "2"
o = s:taboption("general", Value, "max_connections", translate("Max connections"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "500"
o = s:taboption("general", Value, "max_sources_per_file", translate("Max sources per file"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "300"
-- CONNECTIONS --
o = s:taboption("connection", Value, "port", translate("TCP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "4662"
o = s:taboption("connection", Flag, "udp_enable", translate("Enable UDP port"))
o.rmempty = false
o = s:taboption("connection", Value, "udp_port", translate("UDP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "4672"
o = s:taboption("connection", Flag, "upnp_enabled", translate("Enable UPnP"))
o.rmempty = false
o = s:taboption("connection", Value, "upnp_tcp_port", translate("UPnP TCP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "50000"
o = s:taboption("connection", Value, "address", translate("Bind Address"), translate("Leave blank to bind all"))
o.datatype = "ip4addr"
o.rmempty = true
o = s:taboption("connection", Flag, "auto_connect", translate("Automatically connect"))
o.rmempty = false
o = s:taboption("connection", Flag, "reconnect", translate("Automatically reconnect"))
o.rmempty = false
o = s:taboption("connection", Flag, "connect_to_kad", translate("Connect to Kad network"))
o.rmempty = false
o = s:taboption("connection", Flag, "connect_to_ed2k", translate("Connect to ED2K network"))
o.rmempty = false
s:taboption("connection", DummyValue,"titlesplit1" ,titlesplit(translate("Proxy Configuration")))
o = s:taboption("connection", Flag, "proxy_enable_proxy", translate("Enable proxy"))
o.rmempty = false
o = s:taboption("connection", ListValue, "proxy_type", translate("Proxy type"))
for i,v in ipairs(ptype) do
o:value(v)
end
o.rmempty = false
o = s:taboption("connection", Value, "proxy_name", translate("Proxy name"))
o.rmempty = true
o = s:taboption("connection", Value, "proxy_port", translate("Proxy port"))
o.datatype = "port"
o.rmempty = true
o = s:taboption("connection", Flag, "proxy_enable_password", translate("Proxy requires authentication"))
o.rmempty = true
o = s:taboption("connection", Value, "proxy_user", translate("Proxy user"))
--o:depends("proxy_enable_password", "1")
o.rmempty = true
o = s:taboption("connection", Value, "proxy_password", translate("Proxy password"))
o.password = true
o.rmempty = true
-- SERVER --
o = s:taboption("server", Value, "kad_nodes_url", translate("Kad Nodes Url"), "<input type=\"button\" size=\"0\" title=\""
.. translate("Download now") .. "\" onclick=\"onclick_down_kad(this.id)\" "
.. "value=\"&#10597;&#10597;&#10597;\" "
.. "style=\"font-weight:bold;text-decoration:overline;\""
.. "/>")
o.rmempty = false
o.placeholder = "http://upd.emule-security.org/nodes.dat"
o = s:taboption("server", Value, "ed2k_servers_url", translate("Ed2k Servers List Url"), "<input type=\"button\" size=\"0\" title=\""
.. translate("Download now") .. "\" onclick=\"onclick_down_ed2k(this.id)\" "
.. "value=\"&#10597;&#10597;&#10597;\" "
.. "style=\"font-weight:bold;text-decoration:overline;\""
.. "/>")
o.rmempty = false
o.placeholder = "http://upd.emule-security.org/server.met"
o = s:taboption("server", Flag, "remove_dead_server", translate("Remove Dead Server"))
o.rmempty = false
o = s:taboption("server", Value, "dead_server_retry", translate("Dead Server Retry"))
--o:depends("remove_dead_server", "1")
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "3"
o.default = "3"
o = s:taboption("server", Flag, "add_server_list_from_server", translate("Update server list when connecting to a server"))
o.rmempty = false
o = s:taboption("server", Flag, "add_server_list_from_client", translate("Update server list when a client connects"))
o.rmempty = false
o = s:taboption("server", Flag, "scoresystem", translate("Use priority system"))
o.rmempty = false
o = s:taboption("server", Flag, "smart_id_check", translate("Use smart LowID check on connect"))
o.rmempty = false
o = s:taboption("server", Flag, "safe_server_connect", translate("Safe connect"))
o.rmempty = false
o = s:taboption("server", Flag, "auto_connect_static_only", translate("Auto connect to servers in static list only"))
o.rmempty = false
o = s:taboption("server", Flag, "manual_high_prio", translate("Set manually added servers to high priority"))
o.rmempty = false
o = s:taboption("server", Flag, "serverlist", translate("Auto update server list at startup"), translate("addresses.dat file"))
o.rmempty = false
addr = s:taboption("server", Value, "addresses", translate("Server addresses"),
translate("Content of addresses.dat. One address per line"))
addr:depends("serverlist", "1")
addr.template = "cbi/tvalue"
addr.rows = 5
addr.rmempty = true
function addr.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/addresses.dat")
end
function addr.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/addresses.dat", value)
end
-- PATH AND FILE --
o = s:taboption("path_and_file", Value, "temp_dir", translate("Temporary directory"))
o.rmempty = false
o.placeholder = "/var/run/amule/.aMule/Temp"
o = s:taboption("path_and_file", Value, "incoming_dir", translate("Incoming directory"))
o.rmempty = false
o.placeholder = "/var/run/amule/.aMule/Incoming"
shareddir = s:taboption("path_and_file", Value, "shareddir", translate("Shared directory"),
translate("Content of shareddir.dat. One directory per line"))
shareddir.template = "cbi/tvalue"
shareddir.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
shareddir.rows = 5
shareddir.rmempty = true
function shareddir.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/shareddir.dat")
end
function shareddir.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/shareddir.dat", value)
end
o = s:taboption("path_and_file", Flag, "ich", translate("Intelligent corruption handling (I.C.H.)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "a_ich_trust", translate("Advanced I.C.H trusts every hash (not recommended)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "add_new_files_paused", translate("Add files to download in pause mode"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "dap_pref", translate("Add files to download with auto priority"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "start_next_file", translate("Start next paused file when a file completes"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "start_next_file_same_cat", translate("Start next paused file from the same category"))
o:depends("start_next_file", "1")
o.rmempty = true
o = s:taboption("path_and_file", Flag, "start_next_file_alpha", translate("Start next paused file in alphabetic order"))
o:depends("start_next_file", "1")
o.rmempty = true
o = s:taboption("path_and_file", Flag, "allocate_full_file", translate("Preallocate disk space for new files"))
o.rmempty = false
o = s:taboption("path_and_file", Value, "min_free_disk_space", translate("Minimum free disk space. in Mbytes"))
o.datatype = "uinteger"
o.placeholder = "1"
o.rmempty = false
o = s:taboption("path_and_file", Flag, "use_src_seed", translate("Save 10 sources on rare files (< 20 sources)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "uap_pref", translate("Add new shares with auto priority"))
o.rmempty = false
-- SECURITY --
o = s:taboption("security", Flag, "use_sec_ident", translate("Use secure user identification"))
o.rmempty = false
o = s:taboption("security", Flag, "is_crypt_layer_requested", translate("Use obfuscation for outgoing connections"))
o.rmempty = false
o = s:taboption("security", Flag, "is_client_crypt_layer_required", translate("Accept only obfuscation connections"))
o.rmempty = false
o = s:taboption("security", ListValue, "see_share", translate("Who can see my shared files"))
for i,v in ipairs(whocan) do
o:value(v)
end
o.rmempty = false
s:taboption("security", DummyValue,"titlesplit2" ,titlesplit(translate("IP Filter Configuration")))
shareddir = s:taboption("security", Value, "ipfilter_static", translate("Static IP list for filtering"),
translate("Content of ipfilter_static.dat"))
shareddir.template = "cbi/tvalue"
shareddir.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
shareddir.rows = 5
shareddir.rmempty = true
function shareddir.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/ipfilter_static.dat")
end
function shareddir.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/ipfilter_static.dat", value)
end
o = s:taboption("security", Flag, "ip_filter_clients", translate("Filter clients by IP"))
o.rmempty = false
o = s:taboption("security", Flag, "ip_filter_servers", translate("Filter servers by IP"))
o.rmempty = false
o = s:taboption("security", Value, "ip_filter_url", translate("IP filter list URL"))
o.rmempty = true
o = s:taboption("security", Flag, "ip_filter_auto_load", translate("Auto-update ipfilter at startup"))
o.rmempty = false
o = s:taboption("security", Value, "filter_level", translate("Filtering Level"))
o.datatype = "range(1, 255)"
o.rmempty = false
o.placeholder = "127"
o = s:taboption("security", Flag, "filter_lan_ips", translate("Always filter LAN IPs"))
o.rmempty = false
o = s:taboption("security", Flag, "paranoid_filtering", translate("Paranoid handling of non-matching IPs"))
o.rmempty = false
o = s:taboption("security", Flag, "ip_filter_system", translate("Use system-wide ipfilter.dat if available"))
o.rmempty = false
-- REMOTE CONTROL --
o = s:taboption("remote", Value, "ec_address", translate("IP of the listening interface for external connection"))
o.datatype = "ip4addr"
o.placeholder = "127.0.0.1"
o.rmempty = true
o = s:taboption("remote", Value, "ec_port", translate("TCP port for EC"))
o.datatype = "port"
o.placeholder = "4712"
o.rmempty = false
o = s:taboption("remote", Flag, "upnp_ec_enabled", translate("Enable upnp port forwarding on the EC port"))
o.rmempty = false
o = s:taboption("remote", Value, "ec_password", translate("EC password"))
o.password = true
o.rmempty = false
s:taboption("remote", DummyValue,"titlesplit3", titlesplit(translate("aMule Web Configuration")))
o = s:taboption("remote", Flag, "web_enabled", translate("Enable web server on startup"))
o.rmempty = false
o = s:taboption("remote", Value, "template", translate("Web template"))
o.rmempty = false
local tpth_suggestions = luci.sys.exec("ls /usr/share/amule/webserver/|sed ':a;N;$!ba;s/\\n/:/g'")
if tpth_suggestions then
for entry in string.gmatch(tpth_suggestions, "[^:]+") do
o:value(entry)
end
end
o = s:taboption("remote", Value, "web_password", translate("Web full rights password"))
o.password = true
o.rmempty = true
o = s:taboption("remote", Flag, "use_low_rights_user", translate("Use low rights user"))
o.rmempty = false
o = s:taboption("remote", Value, "password_low", translate("Web low rights password"))
o.password = true
o.rmempty = true
o = s:taboption("remote", Value, "web_port", translate("Web TCP port"))
o.datatype = "port"
o.placeholder = "4711"
o.rmempty = false
o = s:taboption("remote", Flag, "upnp_web_server_enabled", translate("Enable UPnP port forwarding of the web server port"))
o.rmempty = false
o = s:taboption("remote", Value, "web_upnp_tcp_port", translate("Web UPnP TCP port"))
o.datatype = "port"
o.placeholder = "50001"
o.rmempty = false
o = s:taboption("remote", Value, "page_refresh_time", translate("Page refresh time(in secs)"))
o.datatype = "range(1, 600)"
o.rmempty = false
o.placeholder = "121"
o = s:taboption("remote", Flag, "use_gzip", translate("Enable Gzip compression"))
o.rmempty = false
-- TEMPLATE --
tmpl = s:taboption("template", Value, "_tmpl",
translate("Edit the template that is used for generating the aMule configuration."),
translate("This is the content of the file '/etc/amule/amule.conf.template' from which your amule configuration will be generated. " ..
"Values enclosed by pipe symbols ('|') should not be changed. They get their values from other tabs."))
tmpl.template = "cbi/tvalue"
tmpl.rows = 20
function tmpl.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/amule.conf.template")
end
function tmpl.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/amule.conf.template", value)
end
-- LOGVIEW --
local lv = s:taboption("logview", DummyValue, "_logview")
lv.template = "amule/detail_logview"
lv.inputtitle = translate("Read / Reread log file")
lv.rows = 50
function lv.cfgvalue(self, section)
return translate("Please press [Read] button")
end
-- AMULECMD --
local cmd = s:taboption("amulecmd", DummyValue, "_amulecmd")
cmd.template = "amule/webshell"
return m

View File

@ -0,0 +1,56 @@
<!-- ++ BEGIN ++ aMule ++ detail_logview.htm ++ -->
<script type="text/javascript">//<![CDATA[
function onclick_logview(section, bottom) {
// get elements
var txt = document.getElementById("cbid.amule.main._logview.txt"); // TextArea
if ( !txt ) { return; } // security check
var lvXHR = new XHR();
lvXHR.get('<%=url('admin/nas/amule/logview')%>', null,
function(x) {
if (x.responseText == "_nodata_")
txt.value = "<%:File not found or empty%>";
else
txt.value = x.responseText;
if (bottom)
txt.scrollTop = txt.scrollHeight;
else
txt.scrollTop = 0; }
);
}
//]]></script>
<%+cbi/valueheader%>
<br />
<%
-- one button on top, one at the buttom
%>
<input class="btn cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, false)"
<%=
attr("name", section) .. attr("id", cbid .. ".btn1") .. attr("value", self.inputtitle)
%> />
<br /><br />
<%
-- set a readable style taken from openwrt theme for textarea#syslog
-- in openwrt theme there are problems with a width of 100 so we check for theme and set to lower value
%>
<textarea style="width: <%if media == "/luci-static/openwrt.org" then%>98.7%<%else%>100%<%end%> ; min-height: 500px; border: 3px solid #cccccc; padding: 5px; font-family: monospace; resize: none;" wrap="off" readonly="readonly"
<%=
attr("name", cbid .. ".txt") .. attr("id", cbid .. ".txt") .. ifattr(self.rows, "rows")
%> >
<%-=pcdata(self:cfgvalue(section))-%>
</textarea>
<br /><br />
<%
-- one button on top, one at the buttom
%>
<input class="btn cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, true)"
<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", self.inputtitle) %> />
<%+cbi/valuefooter%>
<!-- ++ END ++ aMule ++ detail_logview.htm ++ -->

View File

@ -0,0 +1,94 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/nas/amule/status")%>', null,
function(x, data) {
var tb = document.getElementById('amule_status');
var btn = document.getElementById("amule_startstop");
var btn_tmpl = '<input class="btn cbi-button cbi-button-apply" id="btn_startstop" style="font-size: 100%;" value="PID: NUMBER"type="button" onclick="onclick_startstop(this.id)">'
if (data && tb) {
if (data.amuled) {
var links = '<em><%:aMule daemon is running.%></em>';
if (data.amuleweb) {
links += '<input class="cbi-button mar-10" type="button" value="<%:Open aMuleWeb%>" onclick="openWebUI();" />';
}
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><%:aMule daemon is not running.%></em>';
}
if (data.amuled_pid == "0") {
btn.innerHTML = btn_tmpl.replace("PID: NUMBER", "<%:Start aMule%>");
} else {
btn.innerHTML = btn_tmpl.replace("NUMBER", data.amuled_pid);
}
}
}
);
function _data2elements(x, data) {
var btn = document.getElementById("btn_startstop");
if ( ! btn ) { return; } // security check
if (data.amuled_pid == "0") {
btn.value = "<%:Start aMule%>";
btn.className = "cbi-button cbi-button-apply";
btn.disabled = false;
} else {
btn.value = "PID: " + data.amuled_pid;
btn.className = "cbi-button cbi-button-reset";
btn.disabled = false;
}
}
// event handler for start/stop button
function onclick_startstop(id) {
// do start/stop
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/startstop')%>', { token: '<%=token%>' },
function(x, data) { _data2elements(x, data); }
);
}
// event handler for download files
function onclick_down_kad(id) {
if(confirm("<%:Existing file will be overwritten, do you really want to proceed?%>"))
{
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/down_kad')%>', { token: '<%=token%>' },
function(x) {}
);
}
}
function onclick_down_ed2k(id) {
if(confirm("<%:Existing file will be overwritten, do you really want to proceed?%>"))
{
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/down_ed2k')%>', { token: '<%=token%>' },
function(x) {}
);
}
}
function openWebUI() {
var curWwwPath = window.document.location.href;
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos);
var auth_port = document.getElementById("cbid.amule.main.web_port");
if (auth_port.value == "") {
auth_port_value = "44711"
} else {
auth_port_value = auth_port.value
};
var url = localhostPath + ":" + auth_port_value;
window.open(url)
};
//]]>
</script>
<style>.mar-10 {margin-left: 10px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:aMule Status%></legend>
<p id="amule_status">
<em><%:Collecting data...%></em>
</p>
<p id="amule_startstop">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,90 @@
<script type="text/javascript">//<![CDATA[
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
var iwxhr = new XHR();
function update_status(e) {
if(e!=null && e.keyCode!=13) return false;
/*var cmd = document.getElementById("cmd").value;
if(cmd.startsWith("cd"))
{
newpath = cmd.replace("cd","").replace(" ","");
if(newpath.startsWith("/")){
document.getElementById("currentpath").value = newpath;
}else{
document.getElementById("currentpath").value += newpath;
}
cmd="";
}*/
obj = document.getElementById("screen");
cmdstr=(document.getElementById("cmd").value).replace(/\s+/g,"")
if (cmdstr == "cls" || cmdstr == "clear")
{
obj = document.getElementById("screen");
obj.value = "";
document.getElementById("cmd").value = "";
return false;
}
iwxhr.get('<%=luci.dispatcher.build_url("admin", "nas", "amule", "amulecmd")%>', {cmd: document.getElementById("cmd").value },
function(x, ifc)
{
obj = document.getElementById("screen");
obj.value+=ifc[0];
document.getElementById("cmd").focus();
}
)
if ((document.getElementById("cmd").value).replace(/\s+/g,"") != "")
{
obj.value+="\r\n--------------------------------------------\r\n"+document.getElementById("cmd").value+"\r\n--------------------------------------------\r\n";
document.getElementById("cmd").value = "";
return false;
}
};
function clear_textfield() {
obj = document.getElementById("screen");
obj.value=""
}
//]]></script>
<style>
.cmd_line{
background-color:yellow;
}
#list ul li
{
margin-right:5px;
height:16px;
display:block;
float:left;
word-break: keep-all;
}
#list ul li:hover
{
background:blue;
cursor:pointer;
}
</style>
<div class="cbi-map" id="cbi-system">
<h4><a id="content" name="content"><%:You can call amulecmd commands here to control your amule.%></a></h4>
<h4><a id="content" name="content"><%:Execute 'Help' to get more infomation.%></a></h4>
<textarea id="screen" style="width:100%;height:400px;overflow:auto;font-size:12px;" readonly="readonly" ></textarea>
<br/>
<%=translate("Command: ")%>
<input type="text" id="cmd"/>
<input class="btn cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="update_status(null)"
<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", translate("Execute")) %> />
<input class="btn cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="clear_textfield()"
<%= attr("name", section) .. attr("id", cbid .. ".btn3") .. attr("value", translate("Clear")) %> />
<br/>
</div>

View File

@ -0,0 +1,359 @@
msgid "aMule is a ED2K/KAD client for all platforms."
msgstr "aMule是一个跨平台的ED2K/KAD客户端"
msgid "NAS"
msgstr "网络存储"
msgid "General"
msgstr "常规"
msgid "Connections"
msgstr "连接"
msgid "Server"
msgstr "服务器"
msgid "Path And File"
msgstr "路径和文件"
msgid "Security"
msgstr "安全"
msgid "External Control"
msgstr "远程控制"
msgid "Edit Template"
msgstr "编辑配置模版"
msgid "Log File Viewer"
msgstr "日志查看"
msgid "aMule Settings"
msgstr "aMule设置"
msgid "Run daemon as user"
msgstr "运行守护进程的用户"
msgid "Configuration directory"
msgstr "配置目录"
msgid "Nickname"
msgstr "昵称"
msgid "Max upload speed"
msgstr "最大上传速度"
msgid "Max download speed"
msgstr "最大下载速度"
msgid "Unlimited when set to 0"
msgstr "设为0时不限制"
msgid "Slot allocation"
msgstr "槽速度"
msgid "Max connections"
msgstr "最大连接数"
msgid "Max sources per file"
msgstr "单文件最大连接数"
msgid "TCP port"
msgstr "TCP端口"
msgid "UDP port"
msgstr "UDP端口"
msgid "Enable UDP port"
msgstr "启用UDP端口"
msgid "Enable UPnP"
msgstr "启用UPnP"
msgid "UPnP TCP port"
msgstr "UPnP TCP端口"
msgid "Bind Address"
msgstr "地址绑定"
msgid "Leave blank to bind all"
msgstr "留空则全部绑定"
msgid "Default to bind all"
msgstr "默认全部绑定"
msgid "Automatically connect"
msgstr "自动连接"
msgid "Automatically reconnect"
msgstr "自动重连"
msgid "Connect to Kad network"
msgstr "连接到Kad网络"
msgid "Connect to ED2K network"
msgstr "连接到ED2K网络"
msgid "Proxy Configuration"
msgstr "代理设置"
msgid "Enable proxy"
msgstr "启用代理"
msgid "Proxy type"
msgstr "代理类型"
msgid "Proxy name"
msgstr "代理名称"
msgid "Proxy port"
msgstr "代理端口"
msgid "Proxy requires authentication"
msgstr "代理需要认证"
msgid "Proxy user"
msgstr "代理用户"
msgid "Proxy password"
msgstr "代理密码"
msgid "Kad Nodes Url"
msgstr "Kad节点URL"
msgid "Ed2k Servers List Url"
msgstr "Ed2k服务器列表URL"
msgid "Remove Dead Server"
msgstr "删除无效服务器"
msgid "Dead Server Retry"
msgstr "删除前重连次数"
msgid "Update server list when connecting to a server"
msgstr "与服务器连接时更新服务器列表"
msgid "Update server list when a client connects"
msgstr "与其他用户连接时更新服务器列表"
msgid "Use priority system"
msgstr "启用优先级系统"
msgid "Use smart LowID check on connect"
msgstr "智能LOWID检测"
msgid "Safe connect"
msgstr "安全连接"
msgid "Auto connect to servers in static list only"
msgstr "只自动连接到静态列表中的服务器"
msgid "Set manually added servers to high priority"
msgstr "将手动输入的服务器设为高优先级"
msgid "Auto update server list at startup"
msgstr "启动时自动更新服务器列表"
msgid "addresses.dat file"
msgstr "addresses.dat文件"
msgid "Server addresses"
msgstr "服务器地址"
msgid "Content of addresses.dat. One address per line"
msgstr "addresses.dat的内容. 每行一个地址."
msgid "Temporary directory"
msgstr "临时文件夹"
msgid "Incoming directory"
msgstr "下载文件夹"
msgid "Shared directory"
msgstr "共享文件夹"
msgid "Content of shareddir.dat. One directory per line"
msgstr "shareddir.dat的内容. 每行一个目录."
msgid "Intelligent corruption handling (I.C.H.)"
msgstr "智能损坏数据处理(I.C.H.)"
msgid "Advanced I.C.H trusts every hash (not recommended)"
msgstr "高级I.C.H信任全部校验值不推荐"
msgid "Add files to download in pause mode"
msgstr "添加新下载文件时设为暂停"
msgid "Add files to download with auto priority"
msgstr "添加新下载文件时设定优先级为自动"
msgid "Start next paused file when a file completes"
msgstr "一个文件完成时开始下一个暂停的文件"
msgid "Start next paused file from the same category"
msgstr "从同一分类开始下一个暂停的文件"
msgid "Start next paused file in alphabetic order"
msgstr "根据字母顺序开始下一个暂停的文件"
msgid "Preallocate disk space for new files"
msgstr "为新文件预分配磁盘空间"
msgid "Minimum free disk space. in Mbytes"
msgstr "最低剩余空间单位MB"
msgid "Save 10 sources on rare files (< 20 sources)"
msgstr "保存稀有文件少于20个源的十个源"
msgid "Add new shares with auto priority"
msgstr "添加新共享文件时设优先级为自动"
msgid "Use secure user identification"
msgstr "使用安全用户认证"
msgid "Use obfuscation for outgoing connections"
msgstr "为传出连接使用迷惑协议"
msgid "Accept only obfuscation connections"
msgstr "只接受迷惑协议连接"
msgid "Who can see my shared files"
msgstr "谁可查看我的共享文件"
msgid "IP Filter Configuration"
msgstr "IP过滤设置"
msgid "Static IP list for filtering"
msgstr "静态IP过滤列表"
msgid "Content of ipfilter_static.dat"
msgstr "ipfilter_static.dat的内容"
msgid "Filter clients by IP"
msgstr "过滤用户"
msgid "Filter servers by IP"
msgstr "过滤服务器"
msgid "IP filter list URL"
msgstr "过滤列表URL"
msgid "Auto-update ipfilter at startup"
msgstr "自动更新过滤列表"
msgid "Filtering Level"
msgstr "过滤级别"
msgid "Always filter LAN IPs"
msgstr "总是过滤局域网ip地址"
msgid "Paranoid handling of non-matching IPs"
msgstr "处理不匹配的IP"
msgid "Use system-wide ipfilter.dat if available"
msgstr "可用情况下使用系统级的ipfilter.dat"
msgid "IP of the listening interface for external connection"
msgstr "远程连接监听IP"
msgid "TCP port for EC"
msgstr "远程连接TCP端口"
msgid "Enable upnp port forwarding on the EC port"
msgstr "为远程连接端口启用upnp"
msgid "aMule Web Configuration"
msgstr "aMule Web设置"
msgid "EC password"
msgstr "远程连接密码"
msgid "Enable web server on startup"
msgstr "启动时运行Web服务"
msgid "Web template"
msgstr "Web模版"
msgid "Web full rights password"
msgstr "Web最高权限密码"
msgid "Use low rights user"
msgstr "启用低权限用户"
msgid "Web low rights password"
msgstr "Web低权限密码"
msgid "Web TCP port"
msgstr "Web TCP端口"
msgid "Enable UPnP port forwarding of the web server port"
msgstr "为Web服务端口启用UPnP端口转发"
msgid "Web UPnP TCP port"
msgstr "Web服务UPnP的TCP端口"
msgid "Page refresh time(in secs)"
msgstr "页面刷新周期(秒)"
msgid "Enable Gzip compression"
msgstr "启用Gzip压缩"
msgid "Edit the template that is used for generating the aMule configuration."
msgstr "编辑用来生成aMule设置的模板"
msgid "This is the content of the file '/etc/amule/amule.conf.template' from which your amule configuration will be generated. Values enclosed by pipe symbols ('|') should not be changed. They get their values from other tabs."
msgstr "创建aMule设置的 '/etc/amule/amule.conf.template' 文件的内容。被通道符|包围的值不应该在这里改动,请在其他标签修改这些设置。"
msgid "Read / Reread log file"
msgstr "读取/重载日志文件"
msgid "Please press [Read] button"
msgstr "请点击[读取]按钮"
msgid "File not found or empty"
msgstr "文件不存在或为空"
msgid "aMule Status"
msgstr "aMule状态"
msgid "Open aMuleWeb"
msgstr "打开aMuleWeb"
msgid "aMule daemon is running."
msgstr "aMule守护进程正在运行"
msgid "aMule daemon is not running."
msgstr "aMule守护进程未运行"
msgid "Start aMule"
msgstr "启动aMule"
msgid "aMule command"
msgstr "aMule命令"
msgid "aMule Command"
msgstr "aMule命令"
msgid "You can call amulecmd commands here to control your amule."
msgstr "你可以在这里运行amulecmd命令以控制你的aMule"
msgid "Execute 'Help' to get more infomation."
msgstr "执行'Help'命令以获取更多信息"
msgid "Execute"
msgstr "执行"
msgid "Clear"
msgstr "清空"
msgid "Command: "
msgstr "命令: "
msgid "Download now"
msgstr "立即下载"
msgid "Existing file will be overwritten, do you really want to proceed?"
msgstr "已有文件将被覆盖,是否继续?"
msgid "Percentage"
msgstr "百分比"

View File

@ -0,0 +1,206 @@
[eMule]
Nick=|NICK|
MaxUpload=|MAXUPLOAD|
MaxDownload=|MAXDOWNLOAD|
SlotAllocation=|SLOTALLOCATION|
MaxConnections=|MAXCONNECTIONS|
MaxSourcesPerFile=|MAXSOURCESPERFILE|
Port=|PORT|
UDPPort=|UDPPORT|
UDPEnable=|UDPENABLE|
UPnPEnabled=|UPNPENABLED|
UPnPTCPPort=|UPNPTCPPORT|
Address=|ADDRESS|
Autoconnect=|AUTOCONNECT|
Reconnect=|RECONNECT|
ConnectToKad=|CONNECTTOKAD|
ConnectToED2K=|CONNECTTOED2K|
KadNodesUrl=|KADNODESURL|
Ed2kServersUrl=|ED2KSERVERSURL|
RemoveDeadServer=|REMOVEDEADSERVER|
DeadServerRetry=|DEADSERVERRETRY|
AddServerListFromServer=|ADDSERVERLISTFROMSERVER|
AddServerListFromClient=|ADDSERVERLISTFROMCLIENT|
Scoresystem=|SCORESYSTEM|
SmartIdCheck=|SMARTIDCHECK|
SafeServerConnect=|SAFESERVERCONNECT|
AutoConnectStaticOnly=|AUTOCONNECTSTATICONLY|
ManualHighPrio=|MANUALHIGHPRIO|
Serverlist=|SERVERLIST|
TempDir=|TEMPDIR|
IncomingDir=|INCOMINGDIR|
ICH=|ICH|
AICHTrust=|AICHTRUST|
AddNewFilesPaused=|ADDNEWFILESPAUSED|
DAPPref=|DAPPREF|
StartNextFile=|STARTNEXTFILE|
StartNextFileSameCat=|STARTNEXTFILESAMECAT|
StartNextFileAlpha=|STARTNEXTFILEALPHA|
AllocateFullFile=|ALLOCATEFULLFILE|
MinFreeDiskSpace=|MINFREEDISKSPACE|
UAPPref=|UAPPREF|
SeeShare=|SEESHARE|
IPFilterURL=|IPFILTERURL|
IPFilterAutoLoad=|IPFILTERAUTOLOAD|
FilterLevel=|FILTERLANIPS|
FilterLanIPs=|FILTERLANIPS|
ParanoidFiltering=|PARANOIDFILTERING|
IPFilterSystem=|IPFILTERSYSTEM|
FilterMessages=1
FilterAllMessages=0
MessagesFromFriendsOnly=0
MessageFromValidSourcesOnly=1
FilterWordMessages=0
MessageFilter=
ShowMessagesInLog=1
FilterComments=0
CommentFilter=
AppVersion=SVN
QueueSizePref=50
MaxConnectionsPerFiveSeconds=20
ServerKeepAliveTimeout=0
CheckDiskspace=1
PreviewPrio=0
FileBufferSizePref=16
OSDirectory=/var/run/amule
OnlineSignature=0
OnlineSignatureUpdate=5
EnableTrayIcon=0
MinToTray=0
ConfirmExit=1
StartupMinimized=0
3DDepth=10
ToolTipDelay=1
ShowOverhead=0
ShowInfoOnCatTabs=1
VerticalToolbar=0
GeoIPEnabled=1
VideoPlayer=
StatGraphsInterval=3
statsInterval=30
DownloadCapacity=300
UploadCapacity=100
StatsAverageMinutes=5
VariousStatisticsMaxValue=100
ShareHiddenFiles=0
AutoSortDownloads=0
NewVersionCheck=1
AdvancedSpamFilter=1
MessageUseCaptchas=1
Language=
SplitterbarPosition=75
YourHostname=
DateTimeFormat=%A, %x, %X
AllcatType=0
ShowAllNotCats=0
SmartIdState=0
DropSlowSources=0
ShowRatesOnTitle=0
GeoLiteCountryUpdateUrl=http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
StatsServerName=Shorty's ED2K stats
StatsServerURL=http://ed2k.shortypower.dyndns.org/?hash=
CreateSparseFiles=1
[Browser]
OpenPageInTab=1
CustomBrowserString=
[Proxy]
ProxyEnableProxy=|PROXYENABLEPROXY|
ProxyType=|PROXYTYPE|
ProxyName=|PROXYNAME|
ProxyPort=|PROXYPORT|
ProxyEnablePassword=|PROXYENABLEPASSWORD|
ProxyUser=|PROXYUSER|
ProxyPassword=|PROXYPASSWORD|
[DLP]
CheckModString=1
CheckUsername=1
CheckUserHash=1
CheckHelloTag=1
CheckInfoTag=1
CheckVeryCDMod=0
CheckGhostMod=1
[ExternalConnect]
ECAddress=|ECADDRESS|
ECPort=|ECPORT|
UPnPECEnabled=|UPNPECENABLED|
ECPassword=|ECPASSWORD|
UseSrcSeeds=|USESRCSEED|
UseSecIdent=|USESECIDENT|
IpFilterClients=|IPFILTERCLIENTS|
IpFilterServers=|IPFILTERSERVERS|
AcceptExternalConnections=1
ShowProgressBar=1
ShowPercent=1
TransmitOnlyUploadingClients=0
[WebServer]
Enabled=|WEBENABLED|
Template=|TEMPLATE|
Password=|WEBPASSWORD|
UseLowRightsUser=|USELOWRIGHTSUSER|
PasswordLow=|PASSWORDLOW|
Port=|WEBPORT|
UPnPWebServerEnabled=|UPNPWEBSERVERENABLED|
WebUPnPTCPPort=|WEBUPNPTCPPORT|
PageRefreshTime=|PAGEREFRESHTIME|
UseGzip=|USEGZIP|
Path=amuleweb
[GUI]
HideOnClose=0
[Razor_Preferences]
FastED2KLinksHandler=1
[SkinGUIOptions]
Skin=
[Statistics]
MaxClientVersions=0
[Obfuscation]
IsCryptLayerRequested=|ISCRYPTLAYERREQUESTED|
IsClientCryptLayerRequired=|ISCLIENTCRYPTLAYERREQUIRED|
IsClientCryptLayerSupported=1
CryptoPaddingLenght=254
CryptoKadUDPKey=281625462
[PowerManagement]
PreventSleepWhileDownloading=0
[UserEvents]
[UserEvents/DownloadCompleted]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/NewChatSession]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/OutOfDiskSpace]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/ErrorOnCompletion]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[HTTPDownload]
URL_1=

View File

@ -0,0 +1,71 @@
config amule 'main'
option enabled '0'
option runasuser 'amule'
option config_dir '/var/run/amule'
option mem_percentage '50'
option nice '10'
option ionice_flags '-c 3'
option nick 'http://www.aMule.org'
option max_upload '0'
option max_download '0'
option slot_allocation '2'
option max_connections '500'
option max_sources_per_file '300'
option port '4662'
option udp_enable '1'
option udp_port '4672'
option upnp_tcp_port '50000'
option auto_connect '1'
option reconnect '1'
option connect_to_kad '1'
option connect_to_ed2k '1'
option kad_nodes_url 'http://upd.emule-security.org/nodes.dat'
option ed2k_servers_url 'http://upd.emule-security.org/server.met'
option remove_dead_server '1'
option dead_server_retry '3'
option scoresystem '1'
option smart_id_check '1'
option use_sec_ident '1'
option is_crypt_layer_requested '1'
option ip_filter_clients '1'
option ip_filter_servers '1'
option ip_filter_auto_load '1'
option filter_level '127'
option filter_lan_ips '1'
option paranoid_filtering '1'
option ec_port '4712'
option ec_password '12345678'
option ich '1'
option dap_pref '1'
option start_next_file '1'
option min_free_disk_space '1'
option use_src_seed '1'
option temp_dir '/var/run/amule/Temp'
option incoming_dir '/var/run/amule/Incoming'
option proxy_enable_proxy '0'
option add_server_list_from_server '0'
option add_server_list_from_client '0'
option safe_server_connect '0'
option auto_connect_static_only '0'
option manual_high_prio '0'
option serverlist '0'
option a_ich_trust '0'
option add_new_files_paused '0'
option allocate_full_file '0'
option uap_pref '0'
option is_client_crypt_layer_required '0'
option see_share 'nobody'
option ip_filter_system '0'
option upnp_ec_enabled '0'
option web_enabled '0'
option upnp_enabled '0'
option proxy_type 'socks5'
option template 'default'
option use_low_rights_user '0'
option web_port '44711'
option upnp_web_server_enabled '0'
option web_upnp_tcp_port '50001'
option page_refresh_time '121'
option use_gzip '0'

View File

@ -0,0 +1,14 @@
#!/bin/sh
# Copyright (C) 2007 OpenWrt.org
/etc/init.d/amule enabled && {
[ "$ACTION" = "ifup" ] && {
/etc/init.d/amule start
}
[ "$ACTION" = "ifdown" ] && {
/etc/init.d/amule stop
}
}

View File

@ -0,0 +1,175 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org
START=99
USE_PROCD=1
LIST_SEP="
"
unregex() {
echo "$1" | sed -e 's/[]\/()$*.^|[]/\\&/g'
}
option_word_to_digit() {
word=$(grep -ioE "\b$2=\S+" "$1"|awk -F= '{print $2}')
digit=$(echo "$3" |grep -oE "$word/\S+"|awk -F'/' '{print $2}')
sed -i "s/\b$2=$word\b/$2=$digit/g" "$1"
}
encrypt_password() {
pass_notencryted=$(grep -ioE "\b$2=[^\n]+" "$1"|sed "s/.*$2=//g")
pass_encryted=$(echo -n $pass_notencryted|md5sum|grep -oE "[a-z0-9]{32}")
[[ -z $pass_notencryted ]] || sed -i "s/\b$2=$(unregex $pass_notencryted)/$2=$pass_encryted/g" "$1"
}
write_dat_file() {
if [[ -s "$1" ]] ; then
cat "$1" > "$2"
else
[[ -s "$2" ]] && cat "$2" > "$1"
fi
}
set_params() {
cat /etc/amule/amule.conf.template > "$config_file"
local p; local v; local s="$1"; shift
for p in $*; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
[ -n "$v" ] && (
sed -i "s;|$(echo $p|tr '[a-z]' '[A-Z]'|sed -e 's|_||g')|;$(unregex $v);g" "$config_file"
)
done
unset IFS
done
#delete unreplaced placeholders
sed -i "s;=|[A-Z0-9]*|;=;g" "$config_file"
#convert some options to digit
option_word_to_digit "$config_file" "ProxyType" "socks5/0 socks4/1 http/2 socks4a/3"
option_word_to_digit "$config_file" "SeeShare" "anyone/0 friends/1 nobody/2"
#encrypt password
encrypt_password "$config_file" "ECPassword"
encrypt_password "$config_file" "Password"
encrypt_password "$config_file" "PasswordLow"
}
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
set_owner() {
case $(echo "$1"|grep -oE "^/[^/]+") in
"/var"|"/tmp"|"/mnt"|"root")
cur_user=$(ls -w50 -ld "$1"|awk '{print $3}')
cur_group=$(ls -w50 -ld "$1"|awk '{print $4}')
[[ $cur_user == $2 ]] || ( chown -R $2 "$1" )
[[ $cur_group == $3 ]] || ( chgrp -R $3 "$1" )
;;
*)
false
;;
esac
}
amule() {
local cfg="$1"
local USE
local runasuser
local incoming_dir config_dir temp_dir
local mem_percentage
local config_overwrite nice ionice_flags
local cmdline
section_enabled "$section" || return 1
config_get config_dir "$cfg" 'config_dir' '/var/run/amule'
config_get runasuser "$cfg" 'runasuser' 'daemon'
config_get incoming_dir "$cfg" 'incoming_dir' "$config_dir/Incoming"
config_get temp_dir "$cfg" 'temp_dir' "$config_dir/Temp"
config_get mem_percentage "$cfg" 'mem_percentage' '50'
config_get config_overwrite "$cfg" config_overwrite 1
config_get nice "$cfg" nice "-19"
config_get ionice_flags "$cfg" ionice_flags ''
group=$(id -Gn $runasuser)
case $(echo "$config_dir"|grep -oE "^/[^/]+") in
"/var"|"/tmp"|"/mnt"|"/root"|"/home")
true
;;
*)
echo "You should set config_dir to subfolders under /var, /tmp ,/mnt or /root"
return 1
;;
esac
which ionice > /dev/null || ionice_flags=''
local MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
if test "$MEM" -gt 1;then
USE=$(expr $MEM \* $mem_percentage \* 10)
fi
config_file="$config_dir/amule.conf"
#[ -d "$config_dir" ] || {
mkdir -m 0755 -p "$config_dir"
chmod g+s "$config_dir"
chown $group:$runasuser "$config_dir"
touch "$config_file" "$config_dir/addresses.dat" "$config_dir/shareddir.dat" \
"$config_dir/ipfilter_static.dat"
[ -d "$config_dir/.aMule" ] || ln -s ./ $config_dir/.aMule
#[ -z "$runasuser" ] || set_owner "$config_dir" $runasuser $group
#}
touch "$config_file"
write_dat_file /etc/amule/addresses.dat "$config_dir/addresses.dat"
write_dat_file /etc/amule/shareddir.dat "$config_dir/shareddir.dat"
write_dat_file /etc/amule/ipfilter_static.dat "$config_dir/ipfilter_static.dat"
#[ "$config_overwrite" == 0 ] || {
set_params "$cfg" $(uci show amule|awk -F'[.=]' '{print $3}'|tr '\n' ' ')
#}
HOME="$config_dir" /usr/bin/amulecmd --create-config-from="$config_file"
cmdline="/usr/bin/amuled -c $config_dir"
[ "$ionice_flags" ] && cmdline="ionice $ionice_flags $cmdline"
procd_open_instance
procd_set_param command $cmdline
procd_set_param respawn retry=60
procd_set_param user "$runasuser"
procd_set_param nice "$nice"
if test -z "$USE";then
procd_set_param limits core="0 0"
else
procd_set_param limits core="0 0" as="$USE $USE"
logger -t amule "Starting with $USE virt mem"
fi
procd_add_jail amule log
procd_add_jail_mount_rw $config_file
procd_add_jail_mount_rw $incoming_dir
procd_add_jail_mount_rw $temp_dir
procd_close_instance
}
start_service() {
killall -9 amuleweb >/dev/null 2>&1
config_load 'amule'
config_foreach amule 'amule'
}
restart() {
stop
sleep 2
start
}

View File

@ -0,0 +1,25 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@amule[-1]
add ucitrack amule
set ucitrack.@amule[-1].init=amule
commit ucitrack
EOF
while [ ! $(grep -e "amule" ${IPKG_INSTROOT}/etc/passwd) ]
do
gid=$(awk -v min=1000 -v max=1500 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
echo amule:x:0:0:99999:7::: >> ${IPKG_INSTROOT}/etc/shadow
grep -e ":$gid:" ${IPKG_INSTROOT}/etc/passwd || ( \
echo "amule:x:$gid:amule" >> ${IPKG_INSTROOT}/etc/group ; \
echo "amule:x:$gid:$gid:amule:/var/run/amule:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd )
done
mkdir -p ${IPKG_INSTROOT}/etc/amule/
touch ${IPKG_INSTROOT}/etc/amule/addresses.dat
touch ${IPKG_INSTROOT}/etc/amule/ipfilter_static.dat
touch ${IPKG_INSTROOT}/etc/amule/shareddir.dat
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,19 @@
#
# 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:=ARP Binding
LUCI_DEPENDS:=+ip
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-arpbind
PKG_VERSION:=1
PKG_RELEASE:=3
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,14 @@
--[[
ARP绑定 Luci页面 Controller
Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
]]--
module("luci.controller.arpbind", package.seeall)
function index()
if not nixio.fs.access("/etc/config/arpbind") then
return
end
entry({"admin", "network", "arpbind"}, cbi("arpbind"), _("IP/MAC Binding"), 45).dependent = true
end

View File

@ -0,0 +1,40 @@
local sys = require "luci.sys"
local ifaces = sys.net:devices()
m = Map("arpbind")
m.title = translate("IP/MAC Binding")
m.description = translatef("ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules.")
s = m:section(TypedSection, "arpbind", translate("Rules"))
s.template = "cbi/tblsection"
s.anonymous = true
s.addremove = true
a = s:option(Value, "ipaddr", translate("IP Address"))
a.optional = false
a.datatype = "ipaddr"
luci.ip.neighbors({ family = 4 }, function(entry)
if entry.reachable then
a:value(entry.dest:string())
end
end)
a = s:option(Value, "macaddr", translate("MAC Address"))
a.datatype = "macaddr"
a.optional = false
luci.ip.neighbors({family = 4}, function(neighbor)
if neighbor.reachable then
a:value(neighbor.mac, "%s (%s)" %{neighbor.mac, neighbor.dest:string()})
end
end)
a = s:option(ListValue, "ifname", translate("Interface"))
for _, iface in ipairs(ifaces) do
if iface ~= "lo" then
a:value(iface)
end
end
a.default = "br-lan"
a.rmempty = false
return m

View File

@ -0,0 +1,30 @@
msgid ""
msgstr ""
"Project-Id-Version: Luci ARP Bind\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-23 20:16+0800\n"
"PO-Revision-Date: 2015-06-23 20:17+0800\n"
"Last-Translator: 981213 <gch981213@gmail.com>\n"
"Language-Team: PandoraBox Team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-SourceCharset: UTF-8\n"
msgid "IP/MAC Binding"
msgstr "IP/MAC绑定"
msgid "IP Address"
msgstr "IP 地址"
msgid "MAC Address"
msgstr "MAC 地址"
msgid "ARP is used to convert a network address (e.g. an IPv4 address) to a physical address such as a MAC address.Here you can add some static ARP binding rules."
msgstr "ARP协议是用于实现网络地址到物理地址转换的协议。在这里你可以设置静态ARP绑定规则。"
msgid "Rules"
msgstr "规则"

View File

@ -0,0 +1,2 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] && /etc/init.d/arpbind start

View File

@ -0,0 +1,55 @@
#!/bin/sh /etc/rc.common
# OpenWrt 静态ARP绑定 启动脚本
# Copyright (C) 2015 GuoGuo <gch981213@gmail.com>
START=80
STOP=20
#清除单接口ARP
#参数:$1:接口名称
if_clean_arp()
{
[ -z "$1" ] && return
ip link set arp off dev $1
ip link set arp on dev $1
}
#清除系统所有ARP
#参数:无
clean_arp()
{
for i in $(ls /sys/class/net)
do
if_clean_arp $i
done
}
#添加静态ARP绑定
#参数:$1:IP地址 $2:MAC地址 $3:接口名称
add_arp()
{
[ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] && return
echo "Adding ARP:IP Addr:$1 MAC Addr:$2 Interface:$3"
ip neigh add $1 lladdr $2 nud permanent dev $3 || \
ip neigh change $1 lladdr $2 nud permanent dev $3
}
arpconf_foreach()
{
config_get ipaddr "$1" 'ipaddr'
config_get macaddr "$1" 'macaddr'
config_get ifname "$1" 'ifname'
[ -z "$ifname" ] && return
add_arp $ipaddr $macaddr $ifname
}
start()
{
config_load 'arpbind'
config_foreach arpconf_foreach 'arpbind'
}
stop()
{
clean_arp
}

View File

@ -0,0 +1,12 @@
#!/bin/sh
touch /etc/config/arpbind
uci -q batch <<-EOF >/dev/null
delete ucitrack.@arpbind[-1]
add ucitrack arpbind
set ucitrack.@arpbind[-1].init=arpbind
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-arpbind": {
"description": "Grant UCI access for luci-app-arpbind",
"read": {
"uci": [ "arpbind" ]
},
"write": {
"uci": [ "arpbind" ]
}
}
}

View File

@ -0,0 +1,18 @@
# 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 Scheduled Reboot
LUCI_DEPENDS:=+luci
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-autoreboot
PKG_VERSION:=1.0
PKG_RELEASE:=8
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,9 @@
module("luci.controller.autoreboot",package.seeall)
function index()
if not nixio.fs.access("/etc/config/autoreboot") then
return
end
entry({"admin", "system", "autoreboot"}, cbi("autoreboot"), _("Scheduled Reboot"),88)
end

View File

@ -0,0 +1,40 @@
require("luci.sys")
m = Map("autoreboot")
m.title = translate("Scheduled Reboot")
m.description = translate("Scheduled reboot Setting")
s = m:section(TypedSection, "login")
s.addremove = false
s.anonymous = true
enable = s:option(Flag,"enable" ,translate("Enable"))
enable.rmempty = false
enable.default = 0
week = s:option(ListValue, "week", translate("Week Day"))
week:value(7, translate("Everyday"))
week:value(1, translate("Monday"))
week:value(2, translate("Tuesday"))
week:value(3, translate("Wednesday"))
week:value(4, translate("Thursday"))
week:value(5, translate("Friday"))
week:value(6, translate("Saturday"))
week:value(0, translate("Sunday"))
week.default = 0
hour = s:option(Value, "hour", translate("Hour"))
hour.datatype = "range(0,23)"
hour.rmempty = false
pass = s:option(Value, "minute", translate("Minute"))
pass.datatype = "range(0,59)"
pass.rmempty = false
local e = luci.http.formvalue("cbi.apply")
if e then
io.popen("/etc/init.d/autoreboot restart")
end
return m

View File

@ -0,0 +1,25 @@
msgid "Scheduled Reboot"
msgstr "定时重启"
msgid "Scheduled reboot Setting"
msgstr "定时重启设置"
msgid "Week Day"
msgstr "星期"
msgid "Everyday"
msgstr "每天"
msgid "Day"
msgstr "天"
msgid "Hour"
msgstr "小时"
msgid "Minute"
msgstr "分钟"

View File

@ -0,0 +1,6 @@
config login
option minute '0'
option hour '5'
option week '3'
option enable '0'

View File

@ -0,0 +1,41 @@
#!/bin/sh /etc/rc.common
START=50
run_reboot()
{
local enable
config_get_bool enable $1 enable
if [ $enable = 1 ]; then
local minute
local hour
config_get week $1 week
config_get minute $1 minute
config_get hour $1 hour
if [ $minute = 0 ] ; then
minute="00"
fi
if [ $week = 7 ] ; then
week="*"
fi
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
/etc/init.d/cron restart
echo "$minute $hour * * $week sleep 5 && touch /etc/banner && reboot" >> /etc/crontabs/root
echo "Auto REBOOT has started."
else
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
/etc/init.d/cron restart
echo "Auto REBOOT has started."
fi
}
start()
{
config_load autoreboot
config_foreach run_reboot login
}
stop()
{
echo "Auto REBOOT has stoped."
}

View File

@ -0,0 +1,24 @@
#
# <https://github.com/KFERMercer/luci-app-baidupcs-web>
#
# Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com>
# Copyright (C) 2020 [CTCGFW] Project OpenWRT
#
# THIS IS FREE SOFTWARE, LICENSED UNDER GPLv3.
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for BaiduPCS-Go
LUCI_DEPENDS:=+baidupcs-web +wget +openssl-util
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-baidupcs-web
PKG_VERSION:=1.0
PKG_RELEASE:=5
PKG_MAINTAINER:=<https://github.com/KFERMercer/luci-app-baidupcs-web>
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,18 @@
module("luci.controller.baidupcs-web", package.seeall)
function index()
if not nixio.fs.access("/etc/config/baidupcs-web") then
return
end
entry({"admin", "nas", "baidupcs-web"}, cbi("baidupcs-web"), _("BaiduPCS Web"), 300).dependent = true
entry({"admin", "nas", "baidupcs-web", "status"}, call("act_status")).leaf = true
end
function act_status()
local e = {}
e.running=luci.sys.call("pgrep baidupcs-web >/dev/null") == 0
-- e.port = luci.sys.exec("uci get baidupcs-web.config.port")
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,48 @@
--[[
Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com>
Copyright (C) 2020 [CTCGFW] Project OpenWRT
THIS IS FREE SOFTWARE, LICENSED UNDER GPLv3
]]--
m = Map("baidupcs-web")
m.title = translate("BaiduPCS-Web")
m.description = translate("基于BaiduPCS-Go, 可以让你高效的使用百度云")
m:section(SimpleSection).template = "baidupcs-web/baidupcs-web_status"
s = m:section(TypedSection, "baidupcs-web")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enabled", translate("启用"))
enable.rmempty = false
o = s:option(Value, "port", translate("网页端口"))
o.datatype = "port"
o.placeholder = "5299"
o.default = "5299"
o.rmempty = false
o = s:option(Value, "download_dir", translate("下载目录"))
o.placeholder = "/opt/baidupcsweb-download"
o.default = "/opt/baidupcsweb-download"
o.rmempty = false
o = s:option(Value, "max_download_rate", translate("最大下载速度"))
o.placeholder = "0"
o = s:option(Value, "max_upload_rate", translate("最大上传速度"))
o.placeholder = "0"
o.description = translate("0代表不限制, 单位为每秒的传输速率, 后缀'/s' 可省略, 如 2MB/s, 2MB, 2m, 2mb 均为一个意思")
o = s:option(Value, "max_download_load", translate("同时进行下载文件的最大数量"))
o.placeholder = "1"
o.description = translate("不要太贪心, 当心被封号")
o = s:option(Value, "max_parallel", translate("最大并发连接数"))
o.placeholder = "8"
return m

View File

@ -0,0 +1,38 @@
<!--
Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com>
THIS IS FREE SOFTWARE, LICENSED UNDER GPLv3.
-->
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[nas]], [[baidupcs-web]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('baidupcs-web_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>BaiduPCS-Web <%:RUNNING%></font></b></em><input class="cbi-button mar-10" type="button" value="<%:打开管理页面%>" onclick="openClient();" />';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>BaiduPCS-Web <%:NOT RUNNING%></font></b></em>';
}
}
}
);
function openClient() {
var curWwwPath = window.document.location.href;
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos);
var clientPort = window.document.getElementById("cbid.baidupcs-web.config.port").value
var url = localhostPath + ":" + clientPort;
window.open(url)
};
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="baidupcs-web_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,2 @@
config baidupcs-web 'config'

View File

@ -0,0 +1,32 @@
#!/bin/sh /etc/rc.common
START=90
STOP=10
enabled="$(uci -q get baidupcs-web.config.enabled)"
port="$(uci -q get baidupcs-web.config.port)"
download_dir="$(uci -q get baidupcs-web.config.download_dir)"
max_download_rate="$(uci -q get baidupcs-web.config.max_download_rate || echo '0')"
max_upload_rate="$(uci -q get baidupcs-web.config.max_upload_rate || echo '0')"
max_download_load="$(uci -q get baidupcs-web.config.max_download_load || echo '1')"
max_parallel="$(uci -q get baidupcs-web.config.max_parallel || echo '8')"
start() {
stop
[ "$enabled" == "1" ] || exit 0
mkdir -p "${download_dir}"
baidupcs-web config set \
--savedir "${download_dir}" \
--max_download_rate "${max_download_rate}" \
--max_upload_rate "${max_upload_rate}" \
--max_download_load "${max_download_load}" \
--max_parallel "${max_parallel}" \
--max_upload_parallel "${max_parallel}" \
>/dev/null 2>&1
baidupcs-web web --port "${port}" --access >/dev/null 2>&1 &
}
stop() {
killall baidupcs-web >/dev/null 2>&1
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@baidupcs-web[-1]
add ucitrack baidupcs-web
set ucitrack.@baidupcs-web[-1].init=baidupcs-web
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +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 for SMB/CIFS Mount
LUCI_DEPENDS:=+kmod-fs-cifs +kmod-nls-utf8
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-cifs-mount
PKG_VERSION:=1
PKG_RELEASE:=7
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,10 @@
module("luci.controller.cifs", package.seeall)
function index()
if not nixio.fs.access("/etc/config/cifs") then
return
end
entry({"admin", "nas", "cifs"}, cbi("cifs"), _("Mount SMB NetShare")).dependent = true
end

View File

@ -0,0 +1,64 @@
local fs = require "nixio.fs"
m = Map("cifs")
m.title = translate("Mount SMB/CIFS Netshare")
m.description = translate("Mount SMB/CIFS Netshare for OpenWrt")
s = m:section(TypedSection, "cifs")
s.anonymous = true
switch = s:option(Flag, "enabled", translate("Enable"))
switch.rmempty = false
workgroup = s:option(Value, "workgroup", translate("Workgroup"))
workgroup.default = "WORKGROUP"
s = m:section(TypedSection, "natshare", translate("CIFS/SMB Netshare"))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
server = s:option(Value, "server", translate("Server IP"))
server.size = 12
server.rmempty = false
name = s:option(Value, "name", translate("Share Folder"))
name.rmempty = false
name.size = 8
pth = s:option(Value, "natpath", translate("Mount Path"))
if nixio.fs.access("/etc/config/fstab") then
pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
end
pth.rmempty = false
pth.size = 10
smbver = s:option(Value, "smbver", translate("SMB Version"))
smbver.rmempty = false
smbver:value("1.0","SMB v1")
smbver:value("2.0","SMB v2")
smbver:value("3.0","SMB v3")
smbver.default = "2.0"
smbver.size = 3
agm = s:option(Value, "agm", translate("Arguments"))
agm:value("ro", translate("Read Only"))
agm:value("rw", translate("Read/Write"))
agm.rmempty = true
agm.default = "ro"
iocharset = s:option(Value, "iocharset", translate("Charset"))
iocharset:value("utf8", "UTF8")
iocharset.default = "utf8"
iocharset.size = 2
users = s:option(Value, "users", translate("User"))
users:value("guest", "Guest")
users.rmempty = true
users.default = "guest"
pwd = s:option(Value, "pwd", translate("Password"))
pwd.rmempty = true
pwd.size = 8
return m

View File

@ -0,0 +1,42 @@
msgid "Mount SMB NetShare"
msgstr "挂载 SMB 网络共享"
msgid "Mount SMB/CIFS Netshare"
msgstr "挂载 SMB/CIFS 网络共享文件夹"
msgid "Mount SMB/CIFS Netshare for OpenWrt"
msgstr "可以将 SMB/CIFS 的共享文件夹挂载到本地(修改挂载后,需要重启使用这些文件夹的客户端)"
msgid "CIFS/SMB Netshare"
msgstr "CIFS/SMB 文件夹共享挂载设置"
msgid "Server IP"
msgstr "服务器IP"
msgid "Share Folder"
msgstr "共享文件夹"
msgid "Mount Path"
msgstr "挂载路径"
msgid "SMB Version"
msgstr "SMB 版本"
msgid "Arguments"
msgstr "挂载参数"
msgid "Charset"
msgstr "字符集"
msgid "User"
msgstr "用户名"
msgid "Password"
msgstr "密码"
msgid "Read Only"
msgstr "只读"
msgid "Read/Write"
msgstr "可读/写"

View File

@ -0,0 +1,8 @@
config cifs
option enabled '0'
option workgroup 'WORKGROUP'
option iocharset 'utf8'
option delay '5'
option mountarea '/mnt'

View File

@ -0,0 +1,67 @@
#!/bin/sh /etc/rc.common
START=97
ENABLED=0
WORKGROUPD=0
IOCHARSET=0
GUEST=""
USERS=""
AGM=""
cifs_header() {
local enabled
local workgroup
config_get enabled $1 enabled
config_get workgroup $1 workgroup
ENABLED=$enabled
WORKGROUPD=$workgroup
}
mount_natshare() {
local server
local name
local natpath
local guest
local users
local pwd
local agm
local iocharset
local smbver
config_get server $1 server
config_get name $1 name
config_get natpath $1 natpath
config_get guest $1 guest
config_get users $1 users
config_get pwd $1 pwd
config_get agm $1 agm
config_get iocharset $1 iocharset
config_get smbver $1 smbver
mkdir -p $natpath && chmod 777 $natpath
#echo "mount -t cifs -o vers=$smbver,user=$users,password=$pwd,iocharset=$iocharset,$agm //$server/$name $natpath"
mount -t cifs -o vers=$smbver,user=$users,password=$pwd,iocharset=$iocharset,$agm //$server/$name $natpath
}
start() {
config_load cifs
config_foreach cifs_header cifs
if [ $ENABLED == 1 ]
then {
config_foreach mount_natshare natshare
#echo "Cifs Mount succeed."
}
fi
}
stop() {
mount | grep '//' | awk -F ' ' '{print$3}' | while read line; do
#echo "umount -d -l $line"
umount -d -l $line 2>/dev/null
done
}

Some files were not shown because too many files have changed in this diff Show More