update-09.13

This commit is contained in:
github-actions[bot] 2021-09-13 08:31:34 +08:00
parent 57f64da6f9
commit 810909d9c8
99 changed files with 3093 additions and 306 deletions

View File

@ -0,0 +1,57 @@
# Copyright (C) 2018-2019 Lienol
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-adguardhome
PKG_MAINTAINER:=<https://github.com/rufengsuixing/luci-app-adguardhome>
LUCI_TITLE:=LuCI app for AdGuardHome
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+ca-certs +curl +wget-ssl +PACKAGE_$(PKG_NAME)_INCLUDE_binary:adguardhome
LUCI_DESCRIPTION:=LuCI support for AdGuardHome
define Package/$(PKG_NAME)/config
config PACKAGE_$(PKG_NAME)_INCLUDE_binary
bool "Include Binary File"
default y
endef
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_binary
define Package/luci-app-adguardhome/conffiles
/usr/share/AdGuardHome/links.txt
/etc/config/AdGuardHome
/etc/AdGuardHome.yaml
endef
define Package/luci-app-adguardhome/postinst
#!/bin/sh
/etc/init.d/AdGuardHome enable >/dev/null 2>&1
enable=$(uci get AdGuardHome.AdGuardHome.enabled 2>/dev/null)
if [ "$enable" == "1" ]; then
/etc/init.d/AdGuardHome reload
fi
rm -f /tmp/luci-indexcache
rm -f /tmp/luci-modulecache/*
exit 0
endef
define Package/luci-app-adguardhome/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/AdGuardHome disable
/etc/init.d/AdGuardHome stop
uci -q batch <<-EOF >/dev/null 2>&1
delete ucitrack.@AdGuardHome[-1]
commit ucitrack
EOF
fi
exit 0
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,130 @@
module("luci.controller.AdGuardHome",package.seeall)
local fs=require"nixio.fs"
local http=require"luci.http"
local uci=require"luci.model.uci".cursor()
function index()
local page = entry({"admin", "services", "AdGuardHome"},alias("admin", "services", "AdGuardHome", "base"),_("AdGuard Home"))
page.order = 10
page.dependent = true
page.acl_depends = { "luci-app-adguardhome" }
entry({"admin","services","AdGuardHome","base"},cbi("AdGuardHome/base"),_("Base Setting"),1).leaf = true
entry({"admin","services","AdGuardHome","log"},form("AdGuardHome/log"),_("Log"),2).leaf = true
entry({"admin","services","AdGuardHome","manual"},cbi("AdGuardHome/manual"),_("Manual Config"),3).leaf = true
entry({"admin","services","AdGuardHome","status"},call("act_status")).leaf=true
entry({"admin", "services", "AdGuardHome", "check"}, call("check_update"))
entry({"admin", "services", "AdGuardHome", "doupdate"}, call("do_update"))
entry({"admin", "services", "AdGuardHome", "getlog"}, call("get_log"))
entry({"admin", "services", "AdGuardHome", "dodellog"}, call("do_dellog"))
entry({"admin", "services", "AdGuardHome", "reloadconfig"}, call("reload_config"))
entry({"admin", "services", "AdGuardHome", "gettemplateconfig"}, call("get_template_config"))
end
function get_template_config()
local b
local d=""
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
if (b~=nil) then
d=d.." - "..b.."\n"
end
end
local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+")
local tbl = {}
local a=""
while (1) do
a=f:read("*l")
if (a=="#bootstrap_dns") then
a=d
elseif (a=="#upstream_dns") then
a=d
elseif (a==nil) then
break
end
table.insert(tbl, a)
end
f:close()
http.prepare_content("text/plain; charset=utf-8")
http.write(table.concat(tbl, "\n"))
end
function reload_config()
fs.remove("/tmp/AdGuardHometmpconfig.yaml")
http.prepare_content("application/json")
http.write('')
end
function act_status()
local e={}
local binpath=uci:get("AdGuardHome","AdGuardHome","binpath")
e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0
e.redirect=(fs.readfile("/var/run/AdGredir")=="1")
http.prepare_content("application/json")
http.write_json(e)
end
function do_update()
fs.writefile("/var/run/lucilogpos","0")
http.prepare_content("application/json")
http.write('')
local arg
if luci.http.formvalue("force") == "1" then
arg="force"
else
arg=""
end
if fs.access("/var/run/update_core") then
if arg=="force" then
luci.sys.exec("kill $(pgrep /usr/share/AdGuardHome/update_core.sh) ; sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &")
end
else
luci.sys.exec("sh /usr/share/AdGuardHome/update_core.sh "..arg.." >/tmp/AdGuardHome_update.log 2>&1 &")
end
end
function get_log()
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
if (logfile==nil) then
http.write("no log available\n")
return
elseif (logfile=="syslog") then
if not fs.access("/var/run/AdGuardHomesyslog") then
luci.sys.exec("(/usr/share/AdGuardHome/getsyslog.sh &); sleep 1;")
end
logfile="/tmp/AdGuardHometmp.log"
fs.writefile("/var/run/AdGuardHomesyslog","1")
elseif not fs.access(logfile) then
http.write("")
return
end
http.prepare_content("text/plain; charset=utf-8")
local fdp
if fs.access("/var/run/lucilogreload") then
fdp=0
fs.remove("/var/run/lucilogreload")
else
fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0
end
local f=io.open(logfile, "r+")
f:seek("set",fdp)
local a=f:read(2048000) or ""
fdp=f:seek()
fs.writefile("/var/run/lucilogpos",tostring(fdp))
f:close()
http.write(a)
end
function do_dellog()
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile")
fs.writefile(logfile,"")
http.prepare_content("application/json")
http.write('')
end
function check_update()
http.prepare_content("text/plain; charset=utf-8")
local fdp=tonumber(fs.readfile("/var/run/lucilogpos")) or 0
local f=io.open("/tmp/AdGuardHome_update.log", "r+")
f:seek("set",fdp)
local a=f:read(2048000) or ""
fdp=f:seek()
fs.writefile("/var/run/lucilogpos",tostring(fdp))
f:close()
if fs.access("/var/run/update_core") then
http.write(a)
else
http.write(a.."\0")
end
end

View File

@ -0,0 +1,304 @@
require("luci.sys")
require("luci.util")
require("io")
local m,s,o,o1
local fs=require"nixio.fs"
local uci=require"luci.model.uci".cursor()
local configpath=uci:get("AdGuardHome","AdGuardHome","configpath") or "/etc/AdGuardHome.yaml"
local binpath=uci:get("AdGuardHome","AdGuardHome","binpath") or "/usr/bin/AdGuardHome"
httpport=uci:get("AdGuardHome","AdGuardHome","httpport") or "3000"
m = Map("AdGuardHome", "AdGuard Home")
m.description = translate("Free and open source, powerful network-wide ads & trackers blocking DNS server.")
m:section(SimpleSection).template = "AdGuardHome/AdGuardHome_status"
s = m:section(TypedSection, "AdGuardHome")
s.anonymous=true
s.addremove=false
---- enable
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 0
o.optional = false
---- httpport
o =s:option(Value,"httpport",translate("Browser management port"))
o.placeholder=3000
o.default=3000
o.datatype="port"
o.optional = false
o.description = translate("<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"..httpport.."\" onclick=\"window.open('http://'+window.location.hostname+':"..httpport.."/')\"/>")
---- update warning not safe
local binmtime=uci:get("AdGuardHome","AdGuardHome","binmtime") or "0"
local e=""
if not fs.access(configpath) then
e=e.." "..translate("no config")
end
if not fs.access(binpath) then
e=e.." "..translate("no core")
else
local version=uci:get("AdGuardHome","AdGuardHome","version")
local testtime=fs.stat(binpath,"mtime")
if testtime~=tonumber(binmtime) or version==nil then
local tmp=luci.sys.exec(binpath.." --version | grep -m 1 -E 'v[0-9.]+' -o ")
version=string.sub(tmp, 1)
if version=="" then version="core error" end
uci:set("AdGuardHome","AdGuardHome","version",version)
uci:set("AdGuardHome","AdGuardHome","binmtime",testtime)
uci:save("AdGuardHome")
end
e=version..e
end
o=s:option(Button,"restart",translate("Update"))
o.inputtitle=translate("Update core version")
o.template = "AdGuardHome/AdGuardHome_check"
o.showfastconfig=(not fs.access(configpath))
o.description=string.format(translate("core version:").."<strong><font id=\"updateversion\" color=\"green\">%s </font></strong>",e)
---- port warning not safe
local port=luci.sys.exec("awk '/ port:/{printf($2);exit;}' "..configpath.." 2>nul")
if (port=="") then port="?" end
---- Redirect
o = s:option(ListValue, "redirect", port..translate("Redirect"), translate("AdGuardHome redirect mode"))
o.placeholder = "none"
o:value("none", translate("none"))
o:value("dnsmasq-upstream", translate("Run as dnsmasq upstream server"))
o:value("redirect", translate("Redirect 53 port to AdGuardHome"))
o:value("exchange", translate("Use port 53 replace dnsmasq"))
o.default = "none"
o.optional = true
---- bin path
o = s:option(Value, "binpath", translate("Bin Path"), translate("AdGuardHome Bin path if no bin will auto download"))
o.default = "/usr/bin/AdGuardHome"
o.datatype = "string"
o.optional = false
o.rmempty=false
o.validate=function(self, value)
if value=="" then return nil end
if fs.stat(value,"type")=="dir" then
fs.rmdir(value)
end
if fs.stat(value,"type")=="dir" then
if (m.message) then
m.message =m.message.."\nerror!bin path is a dir"
else
m.message ="error!bin path is a dir"
end
return nil
end
return value
end
--- upx
o = s:option(ListValue, "upxflag", translate("use upx to compress bin after download"))
o:value("", translate("none"))
o:value("-1", translate("compress faster"))
o:value("-9", translate("compress better"))
o:value("--best", translate("compress best(can be slow for big files)"))
o:value("--brute", translate("try all available compression methods & filters [slow]"))
o:value("--ultra-brute", translate("try even more compression variants [very slow]"))
o.default = ""
o.description=translate("bin use less space,but may have compatibility issues")
o.rmempty = true
---- config path
o = s:option(Value, "configpath", translate("Config Path"), translate("AdGuardHome config path"))
o.default = "/etc/AdGuardHome.yaml"
o.datatype = "string"
o.optional = false
o.rmempty=false
o.validate=function(self, value)
if value==nil then return nil end
if fs.stat(value,"type")=="dir" then
fs.rmdir(value)
end
if fs.stat(value,"type")=="dir" then
if m.message then
m.message =m.message.."\nerror!config path is a dir"
else
m.message ="error!config path is a dir"
end
return nil
end
return value
end
---- work dir
o = s:option(Value, "workdir", translate("Work dir"), translate("AdGuardHome work dir include rules,audit log and database"))
o.default = "/etc/AdGuardHome"
o.datatype = "string"
o.optional = false
o.rmempty=false
o.validate=function(self, value)
if value=="" then return nil end
if fs.stat(value,"type")=="reg" then
if m.message then
m.message =m.message.."\nerror!work dir is a file"
else
m.message ="error!work dir is a file"
end
return nil
end
if string.sub(value, -1)=="/" then
return string.sub(value, 1, -2)
else
return value
end
end
---- log file
o = s:option(Value, "logfile", translate("Runtime log file"), translate("AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log"))
o.datatype = "string"
o.rmempty = true
o.validate=function(self, value)
if fs.stat(value,"type")=="dir" then
fs.rmdir(value)
end
if fs.stat(value,"type")=="dir" then
if m.message then
m.message =m.message.."\nerror!log file is a dir"
else
m.message ="error!log file is a dir"
end
return nil
end
return value
end
---- debug
o = s:option(Flag, "verbose", translate("Verbose log"))
o.default = 0
o.optional = true
---- gfwlist
local a=luci.sys.call("grep -m 1 -q programadd "..configpath)
if (a==0) then
a="Added"
else
a="Not added"
end
o=s:option(Button,"gfwdel",translate("Del gfwlist"),translate(a))
o.optional = true
o.inputtitle=translate("Del")
o.write=function()
luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh del 2>&1")
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome"))
end
o=s:option(Button,"gfwadd",translate("Add gfwlist"),translate(a))
o.optional = true
o.inputtitle=translate("Add")
o.write=function()
luci.sys.exec("sh /usr/share/AdGuardHome/gfw2adg.sh 2>&1")
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome"))
end
o = s:option(Value, "gfwupstream", translate("Gfwlist upstream dns server"), translate("Gfwlist domain upstream dns service")..translate(a))
o.default = "tcp://208.67.220.220:5353"
o.datatype = "string"
o.optional = true
---- chpass
o = s:option(Value, "hashpass", translate("Change browser management password"), translate("Press load culculate model and culculate finally save/apply"))
o.default = ""
o.datatype = "string"
o.template = "AdGuardHome/AdGuardHome_chpass"
o.optional = true
---- upgrade protect
o = s:option(MultiValue, "upprotect", translate("Keep files when system upgrade"))
o:value("$binpath",translate("core bin"))
o:value("$configpath",translate("config file"))
o:value("$logfile",translate("log file"))
o:value("$workdir/data/sessions.db",translate("sessions.db"))
o:value("$workdir/data/stats.db",translate("stats.db"))
o:value("$workdir/data/querylog.json",translate("querylog.json"))
o:value("$workdir/data/filters",translate("filters"))
o.widget = "checkbox"
o.default = nil
o.optional=true
---- wait net on boot
o = s:option(Flag, "waitonboot", translate("On boot when network ok restart"))
o.default = 1
o.optional = true
---- backup workdir on shutdown
local workdir=uci:get("AdGuardHome","AdGuardHome","workdir") or "/etc/AdGuardHome"
o = s:option(MultiValue, "backupfile", translate("Backup workdir files when shutdown"))
o1 = s:option(Value, "backupwdpath", translate("Backup workdir path"))
local name
o:value("filters","filters")
o:value("stats.db","stats.db")
o:value("querylog.json","querylog.json")
o:value("sessions.db","sessions.db")
o1:depends ("backupfile", "filters")
o1:depends ("backupfile", "stats.db")
o1:depends ("backupfile", "querylog.json")
o1:depends ("backupfile", "sessions.db")
for name in fs.glob(workdir.."/data/*")
do
name=fs.basename (name)
if name~="filters" and name~="stats.db" and name~="querylog.json" and name~="sessions.db" then
o:value(name,name)
o1:depends ("backupfile", name)
end
end
o.widget = "checkbox"
o.default = nil
o.optional=false
o.description=translate("Will be restore when workdir/data is empty")
----backup workdir path
o1.default = "/etc/AdGuardHome"
o1.datatype = "string"
o1.optional = false
o1.validate=function(self, value)
if fs.stat(value,"type")=="reg" then
if m.message then
m.message =m.message.."\nerror!backup dir is a file"
else
m.message ="error!backup dir is a file"
end
return nil
end
if string.sub(value,-1)=="/" then
return string.sub(value, 1, -2)
else
return value
end
end
----Crontab
o = s:option(MultiValue, "crontab", translate("Crontab task"),translate("Please change time and args in crontab"))
o:value("autoupdate",translate("Auto update core"))
o:value("cutquerylog",translate("Auto tail querylog"))
o:value("cutruntimelog",translate("Auto tail runtime log"))
o:value("autohost",translate("Auto update ipv6 hosts and restart adh"))
o:value("autogfw",translate("Auto update gfwlist and restart adh"))
o.widget = "checkbox"
o.default = nil
o.optional=true
----downloadpath
o = s:option(TextValue, "downloadlinks",translate("Download links for update"))
o.optional = false
o.rows = 4
o.wrap = "soft"
o.cfgvalue = function(self, section)
return fs.readfile("/usr/share/AdGuardHome/links.txt")
end
o.write = function(self, section, value)
fs.writefile("/usr/share/AdGuardHome/links.txt", value:gsub("\r\n", "\n"))
end
fs.writefile("/var/run/lucilogpos","0")
function m.on_commit(map)
if (fs.access("/var/run/AdGserverdis")) then
io.popen("/etc/init.d/AdGuardHome reload &")
return
end
local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest")
if ucitracktest=="1" then
return
elseif ucitracktest=="0" then
io.popen("/etc/init.d/AdGuardHome reload &")
else
if (fs.access("/var/run/AdGlucitest")) then
uci:set("AdGuardHome","AdGuardHome","ucitracktest","0")
io.popen("/etc/init.d/AdGuardHome reload &")
else
fs.writefile("/var/run/AdGlucitest","")
if (ucitracktest=="2") then
uci:set("AdGuardHome","AdGuardHome","ucitracktest","1")
else
uci:set("AdGuardHome","AdGuardHome","ucitracktest","2")
end
end
uci:save("AdGuardHome")
end
end
return m

View File

@ -0,0 +1,16 @@
local fs=require"nixio.fs"
local uci=require"luci.model.uci".cursor()
local f,t
f=SimpleForm("logview")
f.reset = false
f.submit = false
t=f:field(TextValue,"conf")
t.rmempty=true
t.rows=20
t.template="AdGuardHome/log"
t.readonly="readonly"
local logfile=uci:get("AdGuardHome","AdGuardHome","logfile") or ""
t.timereplace=(logfile~="syslog" and logfile~="" )
t.pollcheck=logfile~=""
fs.writefile("/var/run/lucilogreload","")
return f

View File

@ -0,0 +1,97 @@
local m, s, o
local fs = require "nixio.fs"
local uci=require"luci.model.uci".cursor()
local sys=require"luci.sys"
require("string")
require("io")
require("table")
function gen_template_config()
local b
local d=""
for cnt in io.lines("/tmp/resolv.conf.d/resolv.conf.auto") do
b=string.match (cnt,"^[^#]*nameserver%s+([^%s]+)$")
if (b~=nil) then
d=d.." - "..b.."\n"
end
end
local f=io.open("/usr/share/AdGuardHome/AdGuardHome_template.yaml", "r+")
local tbl = {}
local a=""
while (1) do
a=f:read("*l")
if (a=="#bootstrap_dns") then
a=d
elseif (a=="#upstream_dns") then
a=d
elseif (a==nil) then
break
end
table.insert(tbl, a)
end
f:close()
return table.concat(tbl, "\n")
end
m = Map("AdGuardHome")
local configpath = uci:get("AdGuardHome","AdGuardHome","configpath")
local binpath = uci:get("AdGuardHome","AdGuardHome","binpath")
s = m:section(TypedSection, "AdGuardHome")
s.anonymous=true
s.addremove=false
--- config
o = s:option(TextValue, "escconf")
o.rows = 66
o.wrap = "off"
o.rmempty = true
o.cfgvalue = function(self, section)
return fs.readfile("/tmp/AdGuardHometmpconfig.yaml") or fs.readfile(configpath) or gen_template_config() or ""
end
o.validate=function(self, value)
fs.writefile("/tmp/AdGuardHometmpconfig.yaml", value:gsub("\r\n", "\n"))
if fs.access(binpath) then
if (sys.call(binpath.." -c /tmp/AdGuardHometmpconfig.yaml --check-config 2> /tmp/AdGuardHometest.log")==0) then
return value
end
else
return value
end
luci.http.redirect(luci.dispatcher.build_url("admin","services","AdGuardHome","manual"))
return nil
end
o.write = function(self, section, value)
fs.move("/tmp/AdGuardHometmpconfig.yaml",configpath)
end
o.remove = function(self, section, value)
fs.writefile(configpath, "")
end
--- js and reload button
o = s:option(DummyValue, "")
o.anonymous=true
o.template = "AdGuardHome/yamleditor"
if not fs.access(binpath) then
o.description=translate("WARNING!!! no bin found apply config will not be test")
end
--- log
if (fs.access("/tmp/AdGuardHometmpconfig.yaml")) then
local c=fs.readfile("/tmp/AdGuardHometest.log")
if (c~="") then
o = s:option(TextValue, "")
o.readonly=true
o.rows = 5
o.rmempty = true
o.name=""
o.cfgvalue = function(self, section)
return fs.readfile("/tmp/AdGuardHometest.log")
end
end
end
function m.on_commit(map)
local ucitracktest=uci:get("AdGuardHome","AdGuardHome","ucitracktest")
if ucitracktest=="1" then
return
elseif ucitracktest=="0" then
io.popen("/etc/init.d/AdGuardHome reload &")
else
fs.writefile("/var/run/AdGlucitest","")
end
end
return m

View File

@ -0,0 +1,78 @@
<%+cbi/valueheader%>
<%local fs=require"nixio.fs"%>
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:Update core version%>" onclick=" return apply_update() "/>
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_forceupdate_button" value="<%:Force update%>" onclick=" return apply_forceupdate()" style="display:none"/>
<% if self.showfastconfig then %>
<input type="button" class="btn cbi-button cbi-button-apply" id="to_configpage" value="<%:Fast config%>" onclick="location.href='<%=url([[admin]], [[services]], [[AdGuardHome]], [[manual]])%>'"/>
<%end%>
<div id="logview" style="display:none">
<input type="checkbox" id="reversetag" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;"><%:reverse%></input>
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:block;" data-update="change" rows="5" cols="60" readonly="readonly" > </textarea>
</div>
<script type="text/javascript">//<![CDATA[
var updatebtn = document.getElementById('apply_update_button');
var forceupdatebtn = document.getElementById('apply_forceupdate_button');
var islogreverse = false;
function apply_forceupdate(){
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',{ force: 1 },function(x, data){}
);
updatebtn.disabled = true;
poll_check();
return
}
function reverselog(){
var lv = document.getElementById('cbid.logview.1.conf');
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
if (islogreverse){
islogreverse=false;
}else{
islogreverse=true;
}
return
}
function apply_update(){
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[doupdate]])%>',null,function(x, data){}
);
updatebtn.disabled = true;
updatebtn.value = '<%:Check...%>';
forceupdatebtn.style.display="inline"
poll_check();
return
}
function poll_check(){
var tag = document.getElementById('logview');
tag.style.display="block"
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>', null,
function(x, data) {
var lv = document.getElementById('cbid.logview.1.conf');
if (x.responseText && lv) {
if (x.responseText=="\u0000"){
for(j = 0,len=this.XHR._q.length; j < len; j++) {
if (this.XHR._q[j].url == '<%=url([[admin]], [[services]], [[AdGuardHome]], [[check]])%>'){
this.XHR._q.splice(j,1);
updatebtn.disabled = false;
updatebtn.value = '<%:Updated%>';
break;
}
}
return
}
if (islogreverse){
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
}else{
lv.innerHTML += x.responseText;
}
}
}
);}
<% if fs.access("/var/run/update_core") then %>
updatebtn.disabled = true;
updatebtn.value = '<%:Check...%>';
forceupdatebtn.style.display="inline"
poll_check();
<%elseif fs.access("/var/run/update_core_error") then %>
poll_check();
<%end%>
//]]>
</script>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,49 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
function chpass(btn)
{
btn.disabled = true;
btn.value = '<%:loading...%>';
if (typeof bcryptloaded == 'undefined' ){
var theHead = document.getElementsByTagName('head').item(0);
//创建脚本的dom对象实例
var myScript = document.createElement('script');
myScript.src = '<%=resource%>/twin-bcrypt.min.js'; //指定脚本路径
myScript.type = 'text/javascript'; //指定脚本类型
myScript.defer = true; //程序下载完后再解析和执行
theHead.appendChild(myScript);
bcryptloaded=1;
btn.value = '<%:Culculate%>';
btn.disabled = false;
return
}
var lv = document.getElementById('cbid.AdGuardHome.AdGuardHome.hashpass');
if (lv.value != ""){
var hash = TwinBcrypt.hashSync(lv.value);
lv.value=hash;
btn.value = '<%:Please save/apply%>';
}else{
btn.value = '<%:is empty%>';
btn.disabled = false;
}
}
//]]>
</script>
<input data-update="change"<%=
attr("id", cbid) ..
attr("name", cbid) ..
attr("type", self.password and "password" or "text") ..
attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
attr("value", self:cfgvalue(section) or self.default) ..
ifattr(self.size, "size") ..
ifattr(self.placeholder, "placeholder") ..
ifattr(self.readonly, "readonly") ..
ifattr(self.maxlength, "maxlength") ..
ifattr(self.datatype, "data-type", self.datatype) ..
ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
%> />
<% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
<input type="button" class="btn cbi-button cbi-button-apply" id="cbid.AdGuardHome.AdGuardHome.applychpass" value="<%:Load culculate model%>" onclick="return chpass(this)"/>
<%+cbi/valuefooter%>

View File

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

View File

@ -0,0 +1,110 @@
<%+cbi/valueheader%>
<input type="checkbox" name="NAME" value="reverse" onclick=" return reverselog()" style="vertical-align:middle;height: auto;" checked><%:reverse%></input>
<%if self.timereplace then%>
<input type="checkbox" name="NAME" value="localtime" onclick=" return chlogtime()" style="vertical-align:middle;height: auto;" checked><%:localtime%></input><br>
<%end%>
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:dellog%>" onclick=" return apply_del_log() "/>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:download log%>" style=" display:inline;" onclick=" return download_log()" />
<script type="text/javascript">//<![CDATA[
var islogreverse = true;
var isutc2local = <%=tostring(self.timereplace)%>;
function createAndDownloadFile(fileName, content) {
var aTag = document.createElement('a');
var blob = new Blob([content]);
aTag.download = fileName;
aTag.href = URL.createObjectURL(blob);
aTag.click();
URL.revokeObjectURL(blob);
}
function download_log(){
var lv = document.getElementById('cbid.logview.1.conf');
var dt = new Date();
var timestamp = (dt.getMonth()+1)+"-"+dt.getDate()+"-"+dt.getHours()+"_"+dt.getMinutes();
createAndDownloadFile("AdGuardHome"+timestamp+".log",lv.innerHTML)
return
}
function apply_del_log(){
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[dodellog]])%>',null,function(x, data){
var lv = document.getElementById('cbid.logview.1.conf');
lv.innerHTML="";
}
);
return
}
function chlogtime(){
var lv = document.getElementById('cbid.logview.1.conf');
if (isutc2local){
lv.innerHTML=line_toUTC(lv.innerHTML).join('\n');
isutc2local=false;
}else{
lv.innerHTML=line_tolocal(lv.innerHTML).join('\n');
isutc2local=true;
}
return
}
function reverselog(){
var lv = document.getElementById('cbid.logview.1.conf');
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
if (islogreverse){
islogreverse=false;
}else{
islogreverse=true;
}
return
}
function p(s) {
return s < 10 ? '0' + s: s;
}
function line_tolocal(str){
var strt=new Array();
str.trim().split('\n').forEach(function(v, i) {
var dt = new Date(v.substring(0,19)+" UTC");
if (dt != "Invalid Date"){
strt[i]=dt.getFullYear()+"/"+p(dt.getMonth()+1)+"/"+p(dt.getDate())+" "+p(dt.getHours())+":"+p(dt.getMinutes())+":"+p(dt.getSeconds())+v.substring(19);
}else{
strt[i]=v;}})
return strt
}
function line_toUTC(str){
var strt=new Array();
str.trim().split('\n').forEach(function(v, i) {
var dt = new Date(v.substring(0,19))
if (dt != "Invalid Date"){
strt[i]=dt.getUTCFullYear()+"/"+p(dt.getUTCMonth()+1)+"/"+p(dt.getUTCDate())+" "+p(dt.getUTCHours())+":"+p(dt.getUTCMinutes())+":"+p(dt.getUTCSeconds())+v.substring(19);
}else{
strt[i]=v;}})
return strt
}
function poll_check(){
XHR.poll(3, '<%=url([[admin]], [[services]], [[AdGuardHome]], [[getlog]])%>', null,
function(x, data) {
var lv = document.getElementById('cbid.logview.1.conf');
if (x.responseText && lv) {
if (isutc2local)
{
var lines=line_tolocal(x.responseText);
if (islogreverse){
lv.innerHTML = lines.reverse().join('\n')+lv.innerHTML;
}else{
lv.innerHTML += lines.join('\n');
}
}else{
if (islogreverse){
lv.innerHTML = x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
}else{
lv.innerHTML += x.responseText;
}
}
}
}
);}
<%if self.pollcheck then%>
poll_check();
<%else%>
var lv = document.getElementById('cbid.logview.1.conf');
lv.innerHTML="<%:Please add log path in config to enable log%>"
<%end%>
//]]>
</script>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,39 @@
<%+cbi/valueheader%>
<script src="/luci-static/resources/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="/luci-static/resources/codemirror/lib/codemirror.css"/>
<script src="/luci-static/resources/codemirror/mode/yaml/yaml.js"></script>
<link rel="stylesheet" href="/luci-static/resources/codemirror/theme/dracula.css"/>
<link rel="stylesheet" href="/luci-static/resources/codemirror/addon/fold/foldgutter.css"/>
<script src="/luci-static/resources/codemirror/addon/fold/foldcode.js"></script>
<script src="/luci-static/resources/codemirror/addon/fold/foldgutter.js"></script>
<script src="/luci-static/resources/codemirror/addon/fold/indent-fold.js"></script>
<script type="text/javascript">//<![CDATA[
var editor = CodeMirror.fromTextArea(document.getElementById("cbid.AdGuardHome.AdGuardHome.escconf"), {
mode: "text/yaml", //实现groovy代码高亮
styleActiveLine: true,
lineNumbers: true, //显示行号
theme: "dracula", //设置主题
lineWrapping: true, //代码折叠
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
matchBrackets: true //括号匹配
}
);
function reload_config(){
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[reloadconfig]])%>', null,
function(x, data) {
location.reload();
});}
function use_template(){
XHR.get('<%=url([[admin]], [[services]], [[AdGuardHome]], [[gettemplateconfig]])%>', null,
function(x, data) {
editor.setValue(x.responseText)
});}
//]]>
</script>
<%fs=require"nixio.fs"%>
<%if fs.access("/tmp/AdGuardHometmpconfig.yaml") then%>
<input type="button" id="apply_update_button" value="<%:Reload Config%>" onclick=" return reload_config() "/>
<%end%>
<input type="button" id="template_button" value="<%:Use template%>" onclick=" return use_template() "/>
<%+cbi/valuefooter%>

View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,408 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:27
msgid ""
"<input type=\"button\" style=\"width:210px;border-color:Teal; text-align:"
"center;font-weight:bold;color:Green;\" value=\"AdGuardHome Web:"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:6
msgid "AdGuard Home"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
msgid "AdGuardHome Bin path if no bin will auto download"
msgstr "AdGuardHome 执行文件路径 如果没有执行文件将自动下载"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
msgid "AdGuardHome config path"
msgstr "AdGuardHome 配置文件路径"
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
msgid "AdGuardHome redirect mode"
msgstr "AdGuardHome重定向模式"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
msgid ""
"AdGuardHome runtime Log file if 'syslog': write to system log;if empty no log"
msgstr "AdGuardHome 运行日志 如果填syslog将写入系统日志如果空则不记录日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
msgid "AdGuardHome work dir include rules,audit log and database"
msgstr "AdGuardHome 工作目录包含规则,审计日志和数据库"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:179
msgid "Add"
msgstr "添加"
# hide div
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:177
msgid "Add gfwlist"
msgstr "加入gfw列表"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:259
msgid "Auto tail querylog"
msgstr "自动截短查询日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:260
msgid "Auto tail runtime log"
msgstr "自动截短运行日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:258
msgid "Auto update core"
msgstr "自动升级核心"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:262
msgid "Auto update gfwlist and restart adh"
msgstr "自动更新gfw列表并重启adh"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:261
msgid "Auto update ipv6 hosts and restart adh"
msgstr "自动更新ipv6主机并重启adh"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:212
msgid "Backup workdir files when shutdown"
msgstr "在关机时备份工作目录文件"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:213
msgid "Backup workdir path"
msgstr "工作目录备份路径"
# /cgi-bin/luci/admin/services/AdGuardHome
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:7
msgid "Base Setting"
msgstr "基础设置"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:67
msgid "Bin Path"
msgstr "执行文件路径"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:22
msgid "Browser management port"
msgstr "网页管理端口"
# hide div
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
msgid "Change browser management password"
msgstr "改变网页登录密码"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:37
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:70
msgid "Check..."
msgstr "检查中..."
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:25
msgid "Collecting data..."
msgstr "获取数据中..."
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:99
msgid "Config Path"
msgstr "配置文件路径"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
msgid "Crontab task"
msgstr "计划任务"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:16
msgid "Culculate"
msgstr "计算"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:172
msgid "Del"
msgstr "删除"
# hide div
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:170
msgid "Del gfwlist"
msgstr "删除gfw列表"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:268
msgid "Download links for update"
msgstr "升级用的下载链接"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:18
msgid "Enable"
msgstr "启用"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:6
msgid "Fast config"
msgstr "快速配置"
# button hide
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:4
msgid "Force update"
msgstr "强制更新"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:11
msgid ""
"Free and open source, powerful network-wide ads & trackers blocking DNS "
"server."
msgstr "免费开源功能强大的全网络广告和跟踪程序拦截DNS服务器"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
msgid "Gfwlist domain upstream dns service"
msgstr "gfw列表域名上游服务器"
# hide div
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:184
msgid "Gfwlist upstream dns server"
msgstr "gfw列表上游服务器"
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:195
msgid "Keep files when system upgrade"
msgstr "系统升级时保留文件"
# #button change
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:48
msgid "Load culculate model"
msgstr "载入计算模块"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:8
msgid "Log"
msgstr "日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/controller/AdGuardHome.lua:9
msgid "Manual Config"
msgstr "手动设置"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:9
msgid "NOT RUNNING"
msgstr "未运行"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:15
msgid "Not redirect"
msgstr "未重定向"
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:207
msgid "On boot when network ok restart"
msgstr "开机后网络准备好时重启"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:106
msgid "Please add log path in config to enable log"
msgstr "请在设置里填写日志路径以启用日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:257
msgid "Please change time and args in crontab"
msgstr "请在计划任务中修改时间和参数"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:24
msgid "Please save/apply"
msgstr "请提交"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:189
msgid "Press load culculate model and culculate finally save/apply"
msgstr "按载入计算模块 然后计算 最后保存/提交"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:7
msgid "RUNNING"
msgstr "运行中"
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:58
msgid "Redirect"
msgstr "重定向"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:62
msgid "Redirect 53 port to AdGuardHome"
msgstr "重定向53端口到AdGuardHome"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_status.htm:13
msgid "Redirected"
msgstr "已重定向"
# hide button
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:36
msgid "Reload Config"
msgstr "重新载入配置"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:47
msgid "Reveal/hide password"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:61
msgid "Run as dnsmasq upstream server"
msgstr "作为dnsmasq的上游服务器"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:142
msgid "Runtime log file"
msgstr "运行日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:49
msgid "Update"
msgstr "更新"
# button change
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:50
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:3
msgid "Update core version"
msgstr "更新核心版本"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:54
msgid "Updated"
msgstr "已更新"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:63
msgid "Use port 53 replace dnsmasq"
msgstr "使用53端口替换dnsmasq"
# /cgi-bin/luci//admin/services/AdGuardHome/manual/
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/yamleditor.htm:38
msgid "Use template"
msgstr "使用模板"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:160
msgid "Verbose log"
msgstr "详细日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/manual.lua:71
msgid "WARNING!!! no bin found apply config will not be test"
msgstr "警告!!!未找到执行文件,提交配置将不会进行校验"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:234
msgid "Will be restore when workdir/data is empty"
msgstr "在工作目录/data为空的时候恢复"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:120
msgid "Work dir"
msgstr "工作目录"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:96
msgid "bin use less space,but may have compatibility issues"
msgstr "减小执行文件空间占用,但是可能压缩后有兼容性问题"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:92
msgid "compress best(can be slow for big files)"
msgstr "最好的压缩(大文件可能慢)"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:91
msgid "compress better"
msgstr "更好的压缩"
# inlist
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:90
msgid "compress faster"
msgstr "快速压缩"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:197
msgid "config file"
msgstr "配置文件"
# checkbox
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:196
msgid "core bin"
msgstr "核心执行文件"
#
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:53
msgid "core version:"
msgstr "核心版本:"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:7
msgid "dellog"
msgstr "删除日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:8
msgid "download log"
msgstr "下载日志"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:202
msgid "filters"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:26
msgid "is empty"
msgstr "为空"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_chpass.htm:6
msgid "loading..."
msgstr "载入中"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:4
msgid "localtime"
msgstr "本地时间"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:198
msgid "log file"
msgstr "日志文件"
# description change
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:32
msgid "no config"
msgstr "没有配置文件"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:35
msgid "no core"
msgstr "没有核心"
# inlist
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:60
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:89
msgid "none"
msgstr "无"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:201
msgid "querylog.json"
msgstr "审计日志.json"
# /cgi-bin/luci/admin/services/AdGuardHome/log/
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/AdGuardHome_check.htm:9
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/view/AdGuardHome/log.htm:2
msgid "reverse"
msgstr "逆序"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:199
msgid "sessions.db"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:200
msgid "stats.db"
msgstr ""
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:93
msgid "try all available compression methods & filters [slow]"
msgstr "尝试所有可能的压缩方法和过滤器[慢]"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:94
msgid "try even more compression variants [very slow]"
msgstr "尝试更多变体压缩手段[很慢]"
#: /mnt/A/openwrt-latest/package/ctcgfw/luci-app-adguardhome/luasrc/model/cbi/AdGuardHome/base.lua:88
msgid "use upx to compress bin after download"
msgstr "下载后使用upx压缩执行文件"
#~ msgid "Added"
#~ msgstr "已添加"
#~ msgid "Not added"
#~ msgstr "未添加"
# unused
#~ msgid "Change browser management username"
#~ msgstr "改变网页登录用户名"
#~ msgid "Username"
#~ msgstr "用户名"
#~ msgid "Check Config"
#~ msgstr "检查配置"
#~ msgid "unknown"
#~ msgstr "未知"
#~ msgid "Keep database when system upgrade"
#~ msgstr "系统升级时保留数据"
#~ msgid "Boot delay until network ok"
#~ msgstr "开机时直到网络准备好再启动"

View File

@ -0,0 +1,11 @@
config AdGuardHome 'AdGuardHome'
option enabled '0'
option httpport '3000'
option redirect 'none'
option configpath '/etc/AdGuardHome.yaml'
option workdir '/etc/AdGuardHome'
option logfile '/tmp/AdGuardHome.log'
option verbose '0'
option binpath '/usr/bin/AdGuardHome'
option upxflag ''

View File

@ -0,0 +1,642 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=95
STOP=01
CONFIGURATION=AdGuardHome
CRON_FILE=/etc/crontabs/root
extra_command "do_redirect" "0 or 1"
extra_command "testbackup" "backup or restore"
extra_command "test_crontab"
extra_command "force_reload"
extra_command "isrunning"
set_forward_dnsmasq()
{
local PORT="$1"
addr="127.0.0.1#$PORT"
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
if [ $? -eq 0 ]; then
return
fi
uci delete dhcp.@dnsmasq[0].server 2>/dev/null
uci add_list dhcp.@dnsmasq[0].server=$addr
for server in $OLD_SERVER; do
if [ "$server" = "$addr" ]; then
continue
fi
# uci add_list dhcp.@dnsmasq[0].server=$server
done
uci delete dhcp.@dnsmasq[0].resolvfile 2>/dev/null
uci set dhcp.@dnsmasq[0].noresolv=1
uci commit dhcp
/etc/init.d/dnsmasq restart
}
stop_forward_dnsmasq()
{
local OLD_PORT="$1"
addr="127.0.0.1#$OLD_PORT"
OLD_SERVER="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
echo $OLD_SERVER | grep "^$addr" >/dev/null 2>&1
if [ $? -ne 0 ]; then
return
fi
uci del_list dhcp.@dnsmasq[0].server=$addr 2>/dev/null
addrlist="`uci get dhcp.@dnsmasq[0].server 2>/dev/null`"
if [ -z "$addrlist" ] ; then
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.d/resolv.conf.auto 2>/dev/null
uci delete dhcp.@dnsmasq[0].noresolv 2>/dev/null
fi
uci commit dhcp
/etc/init.d/dnsmasq restart
}
set_iptable()
{
local ipv6_server=$1
local tcp_server=$2
uci -q batch <<-EOF >/dev/null 2>&1
delete firewall.AdGuardHome
set firewall.AdGuardHome=include
set firewall.AdGuardHome.type=script
set firewall.AdGuardHome.path=/usr/share/AdGuardHome/firewall.start
set firewall.AdGuardHome.reload=1
commit firewall
EOF
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
for IP in $IPS
do
if [ "$tcp_server" == "1" ]; then
iptables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
fi
iptables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
done
if [ "$ipv6_server" == 0 ]; then
return
fi
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
for IP in $IPS
do
if [ "$tcp_server" == "1" ]; then
ip6tables -t nat -A PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
fi
ip6tables -t nat -A PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $AdGuardHome_PORT >/dev/null 2>&1
done
}
clear_iptable()
{
uci -q batch <<-EOF >/dev/null 2>&1
delete firewall.AdGuardHome
commit firewall
EOF
local OLD_PORT="$1"
local ipv6_server=$2
IPS="`ifconfig | grep "inet addr" | grep -v ":127" | grep "Bcast" | awk '{print $2}' | awk -F : '{print $2}'`"
for IP in $IPS
do
iptables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
iptables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
done
if [ "$ipv6_server" == 0 ]; then
return
fi
echo "warn ip6tables nat mod is needed"
IPS="`ifconfig | grep "inet6 addr" | grep -v " fe80::" | grep -v " ::1" | grep "Global" | awk '{print $3}'`"
for IP in $IPS
do
ip6tables -t nat -D PREROUTING -p udp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
ip6tables -t nat -D PREROUTING -p tcp -d $IP --dport 53 -j REDIRECT --to-ports $OLD_PORT >/dev/null 2>&1
done
}
service_triggers() {
procd_add_reload_trigger "$CONFIGURATION"
[ "$(uci get AdGuardHome.AdGuardHome.redirect)" == "redirect" ] && procd_add_reload_trigger firewall
}
isrunning(){
config_load "${CONFIGURATION}"
_isrunning
local r=$?
([ "$r" == "0" ] && echo "running") || ([ "$r" == "1" ] && echo "not run" ) || echo "no bin"
return $r
}
_isrunning(){
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
[ ! -f "$binpath" ] && return 2
pgrep $binpath 2>&1 >/dev/null && return 0
return 1
}
force_reload(){
config_load "${CONFIGURATION}"
_isrunning && procd_send_signal "$CONFIGURATION" || start
}
get_tz()
{
SET_TZ=""
if [ -e "/etc/localtime" ]; then
return
fi
for tzfile in /etc/TZ /var/etc/TZ
do
if [ ! -e "$tzfile" ]; then
continue
fi
tz="`cat $tzfile 2>/dev/null`"
done
if [ -z "$tz" ]; then
return
fi
SET_TZ=$tz
}
rm_port53()
{
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
if [ -z "$dnsmasq_port" ]; then
dnsmasq_port="53"
fi
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
if [ "$dnsmasq_port" == "53" ]; then
dnsmasq_port="1745"
fi
elif [ "$dnsmasq_port" == "53" ]; then
return
fi
config_editor "dns.port" "$dnsmasq_port" "$configpath"
uci set dhcp.@dnsmasq[0].port="53"
uci commit dhcp
/etc/init.d/dnsmasq reload
}
use_port53()
{
local AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
dnsmasq_port=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
if [ -z "$dnsmasq_port" ]; then
dnsmasq_port="53"
fi
if [ "$dnsmasq_port" == "$AdGuardHome_PORT" ]; then
if [ "$dnsmasq_port" == "53" ]; then
AdGuardHome_PORT="1745"
fi
elif [ "$AdGuardHome_PORT" == "53" ]; then
return
fi
config_editor "dns.port" "53" "$configpath"
uci set dhcp.@dnsmasq[0].port="$AdGuardHome_PORT"
uci commit dhcp
/etc/init.d/dnsmasq reload
}
do_redirect()
{
config_load "${CONFIGURATION}"
_do_redirect $1
}
_do_redirect()
{
local section="$CONFIGURATION"
args=""
ipv6_server=1
tcp_server=0
enabled=$1
if [ "$enabled" == "1" ]; then
echo -n "1">/var/run/AdGredir
else
echo -n "0">/var/run/AdGredir
fi
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
AdGuardHome_PORT=$(config_editor "dns.port" "" "$configpath" "1")
if [ -z "$AdGuardHome_PORT" ]; then
AdGuardHome_PORT="0"
fi
config_get "redirect" "$section" "redirect" "none"
config_get "old_redirect" "$section" "old_redirect" "none"
config_get "old_port" "$section" "old_port" "0"
config_get "old_enabled" "$section" "old_enabled" "0"
uci get dhcp.@dnsmasq[0].port >/dev/null 2>&1 || uci set dhcp.@dnsmasq[0].port="53" >/dev/null 2>&1
if [ "$old_enabled" = "1" -a "$old_redirect" == "exchange" ]; then
AdGuardHome_PORT=$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)
fi
if [ "$old_redirect" != "$redirect" ] || [ "$old_port" != "$AdGuardHome_PORT" ] || [ "$old_enabled" = "1" -a "$enabled" = "0" ]; then
if [ "$old_redirect" != "none" ]; then
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
clear_iptable "$old_port" "$ipv6_server"
elif [ "$old_redirect" == "dnsmasq-upstream" ]; then
stop_forward_dnsmasq "$old_port"
elif [ "$old_redirect" == "exchange" ]; then
rm_port53
fi
fi
elif [ "$old_enabled" = "1" -a "$enabled" = "1" ]; then
if [ "$old_redirect" == "redirect" -a "$old_port" != "0" ]; then
clear_iptable "$old_port" "$ipv6_server"
fi
fi
uci delete AdGuardHome.@AdGuardHome[0].old_redirect 2>/dev/null
uci delete AdGuardHome.@AdGuardHome[0].old_port 2>/dev/null
uci delete AdGuardHome.@AdGuardHome[0].old_enabled 2>/dev/null
uci add_list AdGuardHome.@AdGuardHome[0].old_redirect="$redirect" 2>/dev/null
uci add_list AdGuardHome.@AdGuardHome[0].old_port="$AdGuardHome_PORT" 2>/dev/null
uci add_list AdGuardHome.@AdGuardHome[0].old_enabled="$enabled" 2>/dev/null
uci commit AdGuardHome
[ "$enabled" == "0" ] && return 1
if [ "$AdGuardHome_PORT" == "0" ]; then
return 1
fi
if [ "$redirect" = "redirect" ]; then
set_iptable $ipv6_server $tcp_server
elif [ "$redirect" = "dnsmasq-upstream" ]; then
set_forward_dnsmasq "$AdGuardHome_PORT"
elif [ "$redirect" == "exchange" -a "$(uci get dhcp.@dnsmasq[0].port 2>/dev/null)" == "53" ]; then
use_port53
fi
}
get_filesystem()
{
# print out path filesystem
echo $1 | awk '
BEGIN{
while (("mount"| getline ret) > 0)
{
split(ret,d);
fs[d[3]]=d[5];
m=index(d[1],":")
if (m==0)
{
pt[d[3]]=d[1]
}else{
pt[d[3]]=substr(d[1],m+1)
}}}{
split($0,d,"/");
if ("/" in fs)
{
result1=fs["/"];
}
if ("/" in pt)
{
result2=pt["/"];
}
for (i=2;i<=length(d);i++)
{
p[i]=p[i-1]"/"d[i];
if (p[i] in fs)
{
result1=fs[p[i]];
result2=pt[p[i]];
}
}
if (result2 in fs){
result=fs[result2]}
else{
result=result1}
print(result);}'
}
config_editor()
{
awk -v yaml="$1" -v value="$2" -v file="$3" -v ro="$4" '
BEGIN{split(yaml,part,"\.");s="";i=1;l=length(part);}
{
if (match($0,s""part[i]":"))
{
if (i==l)
{
split($0,t,": ");
if (ro==""){
system("sed -i '\''"FNR"c \\"t[1]": "value"'\'' "file);
}else{
print(t[2]);
}
exit;
}
s=s"[- ]{2}";
i++;
}
}' $3
}
boot_service() {
rm /var/run/AdGserverdis >/dev/null 2>&1
config_load "${CONFIGURATION}"
config_get waitonboot $CONFIGURATION waitonboot "0"
config_get_bool enabled $CONFIGURATION enabled 0
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
[ -f "$binpath" ] && start_service
if [ "$enabled" == "1" ] && [ "$waitonboot" == "1" ]; then
procd_open_instance "waitnet"
procd_set_param command "/usr/share/AdGuardHome/waitnet.sh"
procd_close_instance
echo "no net start pinging"
fi
}
testbackup(){
config_load "${CONFIGURATION}"
if [ "$1" == "backup" ]; then
backup
elif [ "$1" == "restore" ]; then
restore
fi
}
restore()
{
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
cp -u -r -f $backupwdpath/data $workdir
}
backup() {
config_get backupwdpath $CONFIGURATION backupwdpath "/etc/AdGuardHome"
mkdir -p $backupwdpath/data
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
config_get backupfile $CONFIGURATION backupfile ""
for one in $backupfile;
do
while :
do
if [ -d "$backupwdpath/data/$one" ]; then
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data 2>&1)
else
cpret=$(cp -u -r -f $workdir/data/$one $backupwdpath/data/$one 2>&1)
fi
echo "$cpret"
echo "$cpret" | grep "no space left on device"
if [ "$?" == "0" ]; then
echo "磁盘已满,删除log重试中"
del_querylog && continue
rm -f -r $backupwdpath/data/filters
rm -f -r $workdir/data/filters && continue
echo "backup failed"
fi
break
done
done
}
start_service() {
# Reading config
rm /var/run/AdGserverdis >/dev/null 2>&1
config_load "${CONFIGURATION}"
# update password
config_get hashpass $CONFIGURATION hashpass ""
config_get configpath $CONFIGURATION configpath "/etc/AdGuardHome.yaml"
if [ -n "$hashpass" ]; then
config_editor "users.password" "$hashpass" "$configpath"
uci set $CONFIGURATION.$CONFIGURATION.hashpass=""
fi
local enabled
config_get_bool enabled $CONFIGURATION enabled 0
# update crontab
do_crontab
if [ "$enabled" == "0" ]; then
_do_redirect 0
return
fi
#what need to do before reload
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
config_get backupfile $CONFIGURATION backupfile ""
mkdir -p $workdir/data
if [ -n "$backupfile" ] && [ ! -d "$workdir/data" ]; then
restore
fi
# for overlay data-stk-oo not suppport
local cwdfs=$(get_filesystem $workdir)
echo "workdir is a $cwdfs filesystem"
if [ "$cwdfs" == "jffs2" ]; then
echo "fs error ln db to tmp $workdir $cwdfs"
logger "AdGuardHome" "warning db redirect to tmp"
touch $workdir/data/stats.db
if [ ! -L $workdir/data/stats.db ]; then
mv -f $workdir/data/stats.db /tmp/stats.db 2>/dev/null
ln -s /tmp/stats.db $workdir/data/stats.db 2>/dev/null
fi
touch $workdir/data/sessions.db
if [ ! -L $workdir/data/sessions.db ]; then
mv -f $workdir/data/sessions.db /tmp/sessions.db 2>/dev/null
ln -s /tmp/sessions.db $workdir/data/sessions.db 2>/dev/null
fi
fi
local ADDITIONAL_ARGS=""
config_get binpath $CONFIGURATION binpath "/usr/bin/AdGuardHome"
mkdir -p ${binpath%/*}
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -c $configpath"
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -w $workdir"
config_get httpport $CONFIGURATION httpport 3000
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -p $httpport"
# hack to save config file when upgrade system
config_get upprotect $CONFIGURATION upprotect ""
eval upprotect=${upprotect// /\\\\n}
echo -e "$upprotect">/lib/upgrade/keep.d/luci-app-adguardhome
config_get logfile $CONFIGURATION logfile ""
if [ -n "$logfile" ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -l $logfile"
fi
if [ ! -f "$binpath" ]; then
_do_redirect 0
/usr/share/AdGuardHome/update_core.sh 2>&1 >/tmp/AdGuardHome_update.log &
exit 0
fi
config_get_bool verbose $CONFIGURATION verbose 0
if [ "$verbose" -eq 1 ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -v"
fi
procd_open_instance
get_tz
if [ -n "$SET_TZ" ]; then
procd_set_param env TZ="$SET_TZ"
fi
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param limits core="unlimited" nofile="65535 65535"
procd_set_param stderr 1
procd_set_param command $binpath $ADDITIONAL_ARGS
procd_set_param file "$configpath" "/etc/hosts" "/etc/config/AdGuardHome"
procd_close_instance
if [ -f "$configpath" ]; then
_do_redirect 1
else
_do_redirect 0
config_get "redirect" "AdGuardHome" "redirect" "none"
if [ "$redirect" != "none" ]; then
procd_open_instance "waitconfig"
procd_set_param command "/usr/share/AdGuardHome/watchconfig.sh"
procd_close_instance
echo "no config start watching"
fi
fi
echo "AdGuardHome service enabled"
echo "luci enable switch=$enabled"
(sleep 10 && [ -z "$(pgrep $binpath)" ] && logger "AdGuardHome" "no process in 10s cancel redirect" && _do_redirect 0 )&
if [[ "`uci get bypass.@global[0].global_server 2>/dev/null`" && "`uci get bypass.@global[0].adguardhome 2>/dev/null`" == 1 && "$(uci get dhcp.@dnsmasq[0].port)" == "53" ]]; then
c1=0
while ! netstat -tunlp | grep 53 | grep -i AdGuardHome 2>&1; do
/etc/init.d/bypass restart 2>/dev/null
sleep 1
[ $c1 == 5 ] && break || let c1++
done
fi
}
reload_service()
{
rm /var/run/AdGlucitest >/dev/null 2>&1
echo "AdGuardHome reloading"
start
}
del_querylog(){
local btarget=$(ls $backupwdpath/data | grep -F "querylog.json" | sort -r | head -n 1)
local wtarget=$(ls $workdir/data | grep -F "querylog.json" | sort -r | head -n 1)
if [ "$btarget"x == "$wtarget"x ]; then
[ -z "$btarget" ] && return 1
rm -f $workdir/data/$wtarget
rm -f $backupwdpath/data/$btarget
return 0
fi
if [ "$btarget" \> "$wtarget" ]; then
rm -f $backupwdpath/data/$btarget
return 0
else
rm -f $workdir/data/$wtarget
return 0
fi
}
stop_service()
{
config_load "${CONFIGURATION}"
_do_redirect 0
do_crontab
if [ "$1" != "nobackup" ]; then
config_get backupfile $CONFIGURATION backupfile "0"
if [ -n "$backupfile" ]; then
backup
fi
fi
echo "AdGuardHome service disabled"
touch /var/run/AdGserverdis
killall -9 AdGuardHome 2>/dev/null
/etc/init.d/dnsmasq restart
}
boot() {
rc_procd boot_service "$@"
if eval "type service_started" 2>/dev/null; then
service_started
fi
}
test_crontab(){
config_load "${CONFIGURATION}"
do_crontab
}
do_crontab(){
config_get_bool enabled $CONFIGURATION enabled 0
config_get crontab $CONFIGURATION crontab ""
local findstr default cronenable replace commit
local cronreload=0
local commit=0
findstr="/usr/share/AdGuardHome/update_core.sh"
default="30 3 * * * /usr/share/AdGuardHome/update_core.sh 2>&1"
[ "$enabled" == "0" ] || [ "${crontab//autoupdate/}" == "$crontab" ] && cronenable=0 || cronenable=1
crontab_editor
config_get workdir $CONFIGURATION workdir "/etc/AdGuardHome"
config_get lastworkdir $CONFIGURATION lastworkdir "/etc/AdGuardHome"
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
#[ -n "$lastworkdir" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastworkdir/data/querylog.json" && [ "$lastworkdir" != "$workdir" ] && replace="${lastworkdir//\//\\/}/${workdir//\//\\/}"
default="0 * * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.workdir)/data/querylog.json"
[ "$enabled" == "0" ] || [ "${crontab//cutquerylog/}" == "$crontab" ] && cronenable=0 || cronenable=1
crontab_editor
#[ "$lastworkdir" != "$workdir" ] && uci set AdGuardHome.AdGuardHome.lastworkdir="$workdir" && commit=1
config_get logfile $CONFIGURATION logfile ""
config_get lastlogfile $CONFIGURATION lastlogfile ""
findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* \$(uci get AdGuardHome.AdGuardHome.logfile)"
default="30 3 * * * /usr/share/AdGuardHome/tailto.sh 2000 \$(uci get AdGuardHome.AdGuardHome.logfile)"
#[ -n "$lastlogfile" ] && findstr="/usr/share/AdGuardHome/tailto.sh [0-9]* $lastlogfile" && [ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && replace="${lastlogfile//\//\\/}/${logfile//\//\\/}"
[ "$logfile" == "syslog" ] || [ "$logfile" == "" ] || [ "$enabled" == "0" ] || [ "${crontab//cutruntimelog/}" == "$crontab" ] && cronenable=0 || cronenable=1
crontab_editor
#[ -n "$logfile" ] && [ "$lastlogfile" != "$logfile" ] && uci set AdGuardHome.AdGuardHome.lastlogfile="$logfile" && commit=1
findstr="/usr/share/AdGuardHome/addhost.sh"
default="0 * * * * /usr/share/AdGuardHome/addhost.sh"
[ "$enabled" == "0" ] || [ "${crontab//autohost/}" == "$crontab" ] && cronenable=0 || cronenable=1
crontab_editor
[ "$cronenable" == "0" ] && /usr/share/AdGuardHome/addhost.sh "del" "noreload" || /usr/share/AdGuardHome/addhost.sh "" "noreload"
findstr="/usr/share/AdGuardHome/gfw2adg.sh"
default="30 3 * * * /usr/share/AdGuardHome/gfw2adg.sh"
[ "$enabled" == "0" ] || [ "${crontab//autogfw/}" == "$crontab" ] && cronenable=0 || cronenable=1
crontab_editor
[ "$cronreload" -gt 0 ] && /etc/init.d/cron restart
#[ "$commit" -gt 0 ] && uci commit AdGuardHome
}
crontab_editor(){
#usage input:
#findstr=
#default=
#cronenable=
#replace="${last//\//\\/}/${now//\//\\/}"
#output:cronreload:if >1 please /etc/init.d/cron restart manual
local testline reload
local line="$(grep "$findstr" $CRON_FILE)"
[ -n "$replace" ] && [ -n "$line" ] && eval testline="\${line//$replace}" && [ "$testline" != "$line" ] && line="$testline" && reload="1" && replace=""
if [ "${line:0:1}" != "#" ]; then
if [ $cronenable -eq 1 ]; then
[ -z "$line" ] && line="$default" && reload="1"
if [ -n "$reload" ]; then
sed -i "\,$findstr,d" $CRON_FILE
echo "$line" >> $CRON_FILE
cronreload=$((cronreload+1))
fi
elif [ -n "$line" ]; then
sed -i "\,$findstr,d" $CRON_FILE
echo "#$line" >> $CRON_FILE
cronreload=$((cronreload+1))
fi
else
if [ $cronenable -eq 1 ]; then
sed -i "\,$findstr,d" $CRON_FILE
echo "${line:1}" >> $CRON_FILE
cronreload=$((cronreload+1))
elif [ -z "$reload" ]; then
sed -i "\,$findstr,d" $CRON_FILE
echo "$line" >> $CRON_FILE
fi
fi
}

View File

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

View File

@ -0,0 +1,109 @@
#提交就可以直接用的配置模板文件
#a template config can be use with a apply
bind_host: 0.0.0.0
bind_port: 3000
users:
- name: root
password: $2y$10$FfeQavihMUiXCuJhHuQwy.6EOXDvkXb/S50qI5fXizqarNT/ShhQm
language: ""
rlimit_nofile: 0
dns:
bind_host: 0.0.0.0
port: 5553
statistics_interval: 1
protection_enabled: true
filtering_enabled: true
filters_update_interval: 24
blocking_mode: nxdomain
blocked_response_ttl: 10
querylog_enabled: false
querylog_interval: 1
ratelimit: 0
ratelimit_whitelist: []
refuse_any: false
bootstrap_dns:
#bootstrap_dns
all_servers: false
allowed_clients: []
disallowed_clients: []
blocked_hosts: []
parental_block_host: ""
safebrowsing_block_host: ""
blocked_services: []
cache_size: 4194304
parental_sensitivity: 13
parental_enabled: false
safesearch_enabled: false
safebrowsing_enabled: false
safebrowsing_cache_size: 1048576
safesearch_cache_size: 1048576
parental_cache_size: 1048576
cache_time: 30
rewrites: []
upstream_dns:
#upstream_dns
tls:
enabled: false
server_name: ""
force_https: false
port_https: 443
port_dns_over_tls: 853
certificate_chain: ""
private_key: ""
certificate_path: ""
private_key_path: ""
filters:
- enabled: true
url: https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt
name: AdGuard Simplified Domain Names filter
id: 1
- enabled: true
url: https://adaway.org/hosts.txt
name: AdAway
id: 2
- enabled: false
url: https://hosts-file.net/ad_servers.txt
name: hpHosts - Ad and Tracking servers only
id: 3
- enabled: true
url: https://www.malwaredomainlist.com/hostslist/hosts.txt
name: MalwareDomainList.com Hosts List
id: 4
- enabled: false
url: https://raw.githubusercontent.com/vokins/yhosts/master/data/tvbox.txt
name: tvbox
id: 1575018007
- enabled: true
url: https://hosts.nfz.moe/full/hosts
name: neoHosts full
id: 1575618240
- enabled: false
url: https://hosts.nfz.moe/basic/hosts
name: neoHosts basic
id: 1575618241
- enabled: false
url: http://sbc.io/hosts/hosts
name: StevenBlack host basic
id: 1575618242
- enabled: false
url: http://sbc.io/hosts/alternates/fakenews-gambling-porn-social/hosts
name: StevenBlack host+fakenews + gambling + porn + social
id: 1575618243
- enabled: false
url: https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-easylist.txt
name: anti-AD(Adblock+neohosts+yhosts+cjxlist+adhlist)
id: 1577113202
user_rules: []
dhcp:
enabled: false
interface_name: ""
gateway_ip: ""
subnet_mask: ""
range_start: ""
range_end: ""
lease_duration: 86400
icmp_timeout_msec: 1000
clients: []
log_file: ""
verbose: false
schema_version: 5

View File

@ -0,0 +1,35 @@
#!/bin/sh
checkmd5(){
local nowmd5=$(md5sum /etc/hosts)
nowmd5=${nowmd5%% *}
local lastmd5=$(uci get AdGuardHome.AdGuardHome.hostsmd5 2>/dev/null)
if [ "$nowmd5" != "$lastmd5" ]; then
uci set AdGuardHome.AdGuardHome.hostsmd5="$nowmd5"
uci commit AdGuardHome
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
fi
}
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' /etc/hosts && checkmd5 "$2" && exit 0
/usr/bin/awk 'BEGIN{
while ((getline < "/tmp/dhcp.leases") > 0)
{
a[$2]=$4;
}
while (("ip -6 neighbor show | grep -v fe80" | getline) > 0)
{
if (a[$5]) {print $1" "a[$5] >"/tmp/tmphost"; }
}
print "#programaddend" >"/tmp/tmphost";
}'
grep programaddstart /etc/hosts >/dev/null 2>&1
if [ "$?" == "0" ]; then
sed -i '/programaddstart/,/programaddend/c\#programaddstart' /etc/hosts
sed -i '/programaddstart/'r/tmp/tmphost /etc/hosts
else
echo "#programaddstart" >>/etc/hosts
cat /tmp/tmphost >> /etc/hosts
fi
rm /tmp/tmphost
checkmd5 "$2"

View File

@ -0,0 +1,8 @@
#!/bin/sh
AdGuardHome_enable=$(uci get AdGuardHome.AdGuardHome.enabled)
redirect=$(uci get AdGuardHome.AdGuardHome.redirect)
if [ $AdGuardHome_enable -eq 1 -a "$redirect" == "redirect" ]; then
/etc/init.d/AdGuardHome do_redirect 1
fi

View File

@ -0,0 +1,20 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
logread -e AdGuardHome > /tmp/AdGuardHometmp.log
logread -e AdGuardHome -f >> /tmp/AdGuardHometmp.log &
pid=$!
echo "1">/var/run/AdGuardHomesyslog
while true
do
sleep 12
watchdog=$(cat /var/run/AdGuardHomesyslog)
if [ "$watchdog"x == "0"x ]; then
kill $pid
rm /tmp/AdGuardHometmp.log
rm /var/run/AdGuardHomesyslog
exit 0
else
echo "0">/var/run/AdGuardHomesyslog
fi
done

View File

@ -0,0 +1,89 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
checkmd5(){
local nowmd5=$(md5sum /tmp/adguard.list 2>/dev/null)
nowmd5=${nowmd5%% *}
local lastmd5=$(uci get AdGuardHome.AdGuardHome.gfwlistmd5 2>/dev/null)
if [ "$nowmd5" != "$lastmd5" ]; then
uci set AdGuardHome.AdGuardHome.gfwlistmd5="$nowmd5"
uci commit AdGuardHome
[ "$1" == "noreload" ] || /etc/init.d/AdGuardHome reload
fi
}
configpath=$(uci get AdGuardHome.AdGuardHome.configpath 2>/dev/null)
[ "$1" == "del" ] && sed -i '/programaddstart/,/programaddend/d' $configpath && checkmd5 "$2" && exit 0
gfwupstream=$(uci get AdGuardHome.AdGuardHome.gfwupstream 2>/dev/null)
if [ -z $gfwupstream ]; then
gfwupstream="tcp://208.67.220.220:5353"
fi
if [ ! -f "$configpath" ]; then
echo "please make a config first"
exit 1
fi
wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O- | base64 -d > /tmp/gfwlist.txt
cat /tmp/gfwlist.txt | awk -v upst="$gfwupstream" 'BEGIN{getline;}{
s1=substr($0,1,1);
if (s1=="!")
{next;}
if (s1=="@"){
$0=substr($0,3);
s1=substr($0,1,1);
white=1;}
else{
white=0;
}
if (s1=="|")
{s2=substr($0,2,1);
if (s2=="|")
{
$0=substr($0,3);
split($0,d,"/");
$0=d[1];
}else{
split($0,d,"/");
$0=d[3];
}}
else{
split($0,d,"/");
$0=d[1];
}
star=index($0,"*");
if (star!=0)
{
$0=substr($0,star+1);
dot=index($0,".");
if (dot!=0)
$0=substr($0,dot+1);
else
next;
s1=substr($0,1,1);
}
if (s1==".")
{fin=substr($0,2);}
else{fin=$0;}
if (index(fin,".")==0) next;
if (index(fin,"%")!=0) next;
if (index(fin,":")!=0) next;
match(fin,"^[0-9\.]+")
if (RSTART==1 && RLENGTH==length(fin)) {print "ipset add gfwlist "fin>"/tmp/doipset.sh";next;}
if (fin=="" || finl==fin) next;
finl=fin;
if (white==0)
{print(" - '\''[/"fin"/]"upst"'\''");}
else{
print(" - '\''[/"fin"/]#'\''");}
}END{print(" - '\''[/programaddend/]#'\''")}' > /tmp/adguard.list
grep programaddstart $configpath
if [ "$?" == "0" ]; then
sed -i '/programaddstart/,/programaddend/c\ - '\''\[\/programaddstart\/\]#'\''' $configpath
sed -i '/programaddstart/'r/tmp/adguard.list $configpath
else
sed -i '1i\ - '\''[/programaddstart/]#'\''' /tmp/adguard.list
sed -i '/upstream_dns:/'r/tmp/adguard.list $configpath
fi
checkmd5 "$2"
rm -f /tmp/gfwlist.txt /tmp/adguard.list

View File

@ -0,0 +1,3 @@
https://github.com/AdguardTeam/AdGuardHome/releases/download/${latest_ver}/AdGuardHome_linux_${Arch}.tar.gz
https://static.adguard.com/adguardhome/release/AdGuardHome_linux_${Arch}.tar.gz
#https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_${Arch}.tar.gz

View File

@ -0,0 +1,5 @@
#!/bin/sh
tail -n $1 "$2" > /var/run/tailtmp
cat /var/run/tailtmp > "$2"
rm /var/run/tailtmp

View File

@ -0,0 +1,236 @@
#!/bin/bash
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
if [ -z "$binpath" ]; then
uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
binpath="/tmp/AdGuardHome/AdGuardHome"
fi
mkdir -p ${binpath%/*}
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
check_if_already_running(){
running_tasks="$(ps |grep "AdGuardHome" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
[ "${running_tasks}" -gt "2" ] && echo -e "\nA task is already running." && EXIT 2
}
check_wgetcurl(){
which curl && downloader="curl -L -k --retry 2 --connect-timeout 20 -o" && return
which wget-ssl && downloader="wget-ssl --no-check-certificate -t 2 -T 20 -O" && return
[ -z "$1" ] && opkg update || (echo error opkg && EXIT 1)
[ -z "$1" ] && (opkg remove wget wget-nossl --force-depends ; opkg install wget ; check_wgetcurl 1 ;return)
[ "$1" == "1" ] && (opkg install curl ; check_wgetcurl 2 ; return)
echo error curl and wget && EXIT 1
}
check_latest_version(){
check_wgetcurl
latest_ver="$($downloader - https://api.github.com/repos/AdguardTeam/AdGuardHome/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E 'v[0-9.]+' -o 2>/dev/null)"
if [ -z "${latest_ver}" ]; then
echo -e "\nFailed to check latest version, please try again later." && EXIT 1
fi
now_ver="$($binpath -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o)"
if [ "${latest_ver}"x != "${now_ver}"x ] || [ "$1" == "force" ]; then
echo -e "Local version: ${now_ver}., cloud version: ${latest_ver}."
doupdate_core
else
echo -e "\nLocal version: ${now_ver}, cloud version: ${latest_ver}."
echo -e "You're already using the latest version."
if [ ! -z "$upxflag" ]; then
filesize=$(ls -l $binpath | awk '{ print $5 }')
if [ $filesize -gt 8000000 ]; then
echo -e "start upx may take a long time"
doupx
mkdir -p "/tmp/AdGuardHomeupdate/AdGuardHome" >/dev/null 2>&1
rm -fr /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $binpath -o /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/}
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
/etc/init.d/AdGuardHome stop nobackup
rm $binpath
mv -f /tmp/AdGuardHomeupdate/AdGuardHome/${binpath##*/} $binpath
/etc/init.d/AdGuardHome start
echo -e "finished"
fi
fi
EXIT 0
fi
}
doupx(){
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
case $Archt in
"i386")
Arch="i386"
;;
"i686")
Arch="i386"
echo -e "i686 use $Arch may have bug"
;;
"x86")
Arch="amd64"
;;
"mipsel")
Arch="mipsel"
;;
"mips64el")
Arch="mips64el"
Arch="mipsel"
echo -e "mips64el use $Arch may have bug"
;;
"mips")
Arch="mips"
;;
"mips64")
Arch="mips64"
Arch="mips"
echo -e "mips64 use $Arch may have bug"
;;
"arm")
Arch="arm"
;;
"armeb")
Arch="armeb"
;;
"aarch64")
Arch="arm64"
;;
"powerpc")
Arch="powerpc"
;;
"powerpc64")
Arch="powerpc64"
;;
*)
echo -e "error not support $Archt if you can use offical release please issue a bug"
EXIT 1
;;
esac
upx_latest_ver="$($downloader - https://api.github.com/repos/upx/upx/releases/latest 2>/dev/null|grep -E 'tag_name' |grep -E '[0-9.]+' -o 2>/dev/null)"
$downloader /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz "https://github.com/upx/upx/releases/download/v${upx_latest_ver}/upx-${upx_latest_ver}-${Arch}_linux.tar.xz" 2>&1
#tar xvJf
which xz || (opkg list | grep ^xz || opkg update && opkg install xz) || (echo "xz download fail" && EXIT 1)
mkdir -p /tmp/upx-${upx_latest_ver}-${Arch}_linux
xz -d -c /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz| tar -x -C "/tmp" >/dev/null 2>&1
if [ ! -e "/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx" ]; then
echo -e "Failed to download upx."
EXIT 1
fi
rm /tmp/upx-${upx_latest_ver}-${Arch}_linux.tar.xz
}
doupdate_core(){
echo -e "Updating core..."
mkdir -p "/tmp/AdGuardHomeupdate"
rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
case $Archt in
"i386")
Arch="386"
;;
"i686")
Arch="386"
;;
"x86")
Arch="amd64"
;;
"mipsel")
Arch="mipsle"
;;
"mips64el")
Arch="mips64le"
Arch="mipsle"
echo -e "mips64el use $Arch may have bug"
;;
"mips")
Arch="mips"
;;
"mips64")
Arch="mips64"
Arch="mips"
echo -e "mips64 use $Arch may have bug"
;;
"arm")
Arch="arm"
;;
"aarch64")
Arch="arm64"
;;
"powerpc")
Arch="ppc"
echo -e "error not support $Archt"
EXIT 1
;;
"powerpc64")
Arch="ppc64"
echo -e "error not support $Archt"
EXIT 1
;;
*)
echo -e "error not support $Archt if you can use offical release please issue a bug"
EXIT 1
;;
esac
echo -e "start download"
grep -v "^#" /usr/share/AdGuardHome/links.txt >/tmp/run/AdHlinks.txt
while read link
do
eval link="$link"
$downloader /tmp/AdGuardHomeupdate/${link##*/} "$link" 2>&1
if [ "$?" != "0" ]; then
echo "download failed try another download"
rm -f /tmp/AdGuardHomeupdate/${link##*/}
else
local success="1"
break
fi
done < "/tmp/run/AdHlinks.txt"
rm /tmp/run/AdHlinks.txt
[ -z "$success" ] && echo "no download success" && EXIT 1
if [ "${link##*.}" == "gz" ]; then
tar -zxf "/tmp/AdGuardHomeupdate/${link##*/}" -C "/tmp/AdGuardHomeupdate/"
if [ ! -e "/tmp/AdGuardHomeupdate/AdGuardHome" ]; then
echo -e "Failed to download core."
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
EXIT 1
fi
downloadbin="/tmp/AdGuardHomeupdate/AdGuardHome/AdGuardHome"
else
downloadbin="/tmp/AdGuardHomeupdate/${link##*/}"
fi
chmod 755 $downloadbin
echo -e "download success start copy"
if [ -n "$upxflag" ]; then
echo -e "start upx may take a long time"
doupx
/tmp/upx-${upx_latest_ver}-${Arch}_linux/upx $upxflag $downloadbin
rm -rf /tmp/upx-${upx_latest_ver}-${Arch}_linux
fi
echo -e "start copy"
/etc/init.d/AdGuardHome stop nobackup
rm "$binpath"
mv -f "$downloadbin" "$binpath"
if [ "$?" == "1" ]; then
echo "mv failed maybe not enough space please use upx or change bin to /tmp/AdGuardHome"
EXIT 1
fi
/etc/init.d/AdGuardHome start
rm -rf "/tmp/AdGuardHomeupdate" >/dev/null 2>&1
echo -e "Succeeded in updating core."
echo -e "Local version: ${latest_ver}, cloud version: ${latest_ver}.\n"
EXIT 0
}
EXIT(){
rm /var/run/update_core 2>/dev/null
[ "$1" != "0" ] && touch /var/run/update_core_error
exit $1
}
main(){
check_if_already_running
check_latest_version $1
}
trap "EXIT 1" SIGTERM SIGINT
touch /var/run/update_core
rm /var/run/update_core_error 2>/dev/null
main $1

View File

@ -0,0 +1,35 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
count=0
while :
do
ping -c 1 -W 1 -q www.baidu.com 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
ping -c 1 -W 1 -q 202.108.22.5 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
sleep 5
ping -c 1 -W 1 -q www.google.com 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
ping -c 1 -W 1 -q 8.8.8.8 1>/dev/null 2>&1
if [ "$?" == "0" ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
sleep 5
count=$((count+1))
if [ $count -gt 18 ]; then
/etc/init.d/AdGuardHome force_reload
break
fi
done
return 0

View File

@ -0,0 +1,13 @@
#!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
configpath=$(uci get AdGuardHome.AdGuardHome.configpath)
while :
do
sleep 10
if [ -f "$configpath" ]; then
/etc/init.d/AdGuardHome do_redirect 1
break
fi
done
return 0

View File

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

View File

@ -0,0 +1 @@
!function(n){"object"==typeof exports&&"object"==typeof module?n(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],n):n(CodeMirror)}(function(n){"use strict";function e(e,o,i,t){if(i&&i.call){var l=i;i=null}else l=r(e,i,"rangeFinder");"number"==typeof o&&(o=n.Pos(o,0));var f=r(e,i,"minFoldSize");function d(n){var r=l(e,o);if(!r||r.to.line-r.from.line<f)return null;for(var i=e.findMarksAt(r.from),d=0;d<i.length;++d)if(i[d].__isFold&&"fold"!==t){if(!n)return null;r.cleared=!0,i[d].clear()}return r}var u=d(!0);if(r(e,i,"scanUp"))for(;!u&&o.line>e.firstLine();)o=n.Pos(o.line-1,0),u=d(!1);if(u&&!u.cleared&&"unfold"!==t){var a=function(n,e){var o=r(n,e,"widget");if("string"==typeof o){var i=document.createTextNode(o);(o=document.createElement("span")).appendChild(i),o.className="CodeMirror-foldmarker"}else o&&(o=o.cloneNode(!0));return o}(e,i);n.on(a,"mousedown",function(e){c.clear(),n.e_preventDefault(e)});var c=e.markText(u.from,u.to,{replacedWith:a,clearOnEnter:r(e,i,"clearOnEnter"),__isFold:!0});c.on("clear",function(o,r){n.signal(e,"unfold",e,o,r)}),n.signal(e,"fold",e,u.from,u.to)}}n.newFoldFunction=function(n,o){return function(r,i){e(r,i,{rangeFinder:n,widget:o})}},n.defineExtension("foldCode",function(n,o,r){e(this,n,o,r)}),n.defineExtension("isFolded",function(n){for(var e=this.findMarksAt(n),o=0;o<e.length;++o)if(e[o].__isFold)return!0}),n.commands.toggleFold=function(n){n.foldCode(n.getCursor())},n.commands.fold=function(n){n.foldCode(n.getCursor(),null,"fold")},n.commands.unfold=function(n){n.foldCode(n.getCursor(),null,"unfold")},n.commands.foldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"fold")})},n.commands.unfoldAll=function(e){e.operation(function(){for(var o=e.firstLine(),r=e.lastLine();o<=r;o++)e.foldCode(n.Pos(o,0),null,"unfold")})},n.registerHelper("fold","combine",function(){var n=Array.prototype.slice.call(arguments,0);return function(e,o){for(var r=0;r<n.length;++r){var i=n[r](e,o);if(i)return i}}}),n.registerHelper("fold","auto",function(n,e){for(var o=n.getHelpers(e,"fold"),r=0;r<o.length;r++){var i=o[r](n,e);if(i)return i}});var o={rangeFinder:n.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function r(n,e,r){if(e&&void 0!==e[r])return e[r];var i=n.options.foldOptions;return i&&void 0!==i[r]?i[r]:o[r]}n.defineOption("foldOptions",null),n.defineExtension("foldOption",function(n,e){return r(this,n,e)})});

View File

@ -0,0 +1 @@
.CodeMirror-foldmarker{color:blue;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-open,.CodeMirror-foldgutter-folded{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}

View File

@ -0,0 +1 @@
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],t):t(CodeMirror)}(function(t){"use strict";t.defineOption("foldGutter",!1,function(o,e,r){r&&r!=t.Init&&(o.clearGutter(o.state.foldGutter.options.gutter),o.state.foldGutter=null,o.off("gutterClick",a),o.off("changes",d),o.off("viewportChange",u),o.off("fold",l),o.off("unfold",l),o.off("swapDoc",d)),e&&(o.state.foldGutter=new function(t){this.options=t,this.from=this.to=0}(function(t){!0===t&&(t={});null==t.gutter&&(t.gutter="CodeMirror-foldgutter");null==t.indicatorOpen&&(t.indicatorOpen="CodeMirror-foldgutter-open");null==t.indicatorFolded&&(t.indicatorFolded="CodeMirror-foldgutter-folded");return t}(e)),f(o),o.on("gutterClick",a),o.on("changes",d),o.on("viewportChange",u),o.on("fold",l),o.on("unfold",l),o.on("swapDoc",d))});var o=t.Pos;function e(t,e){for(var r=t.findMarks(o(e,0),o(e+1,0)),n=0;n<r.length;++n)if(r[n].__isFold){var i=r[n].find(-1);if(i&&i.line===e)return r[n]}}function r(t){if("string"==typeof t){var o=document.createElement("div");return o.className=t+" CodeMirror-guttermarker-subtle",o}return t.cloneNode(!0)}function n(t,n,f){var a=t.state.foldGutter.options,d=n-1,u=t.foldOption(a,"minFoldSize"),l=t.foldOption(a,"rangeFinder"),c="string"==typeof a.indicatorFolded&&i(a.indicatorFolded),s="string"==typeof a.indicatorOpen&&i(a.indicatorOpen);t.eachLine(n,f,function(n){++d;var i=null,f=n.gutterMarkers;if(f&&(f=f[a.gutter]),e(t,d)){if(c&&f&&c.test(f.className))return;i=r(a.indicatorFolded)}else{var p=o(d,0),m=l&&l(t,p);if(m&&m.to.line-m.from.line>=u){if(s&&f&&s.test(f.className))return;i=r(a.indicatorOpen)}}(i||f)&&t.setGutterMarker(n,a.gutter,i)})}function i(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function f(t){var o=t.getViewport(),e=t.state.foldGutter;e&&(t.operation(function(){n(t,o.from,o.to)}),e.from=o.from,e.to=o.to)}function a(t,r,n){var i=t.state.foldGutter;if(i){var f=i.options;if(n==f.gutter){var a=e(t,r);a?a.clear():t.foldCode(o(r,0),f)}}}function d(t){var o=t.state.foldGutter;if(o){var e=o.options;o.from=o.to=0,clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){f(t)},e.foldOnChangeTimeSpan||600)}}function u(t){var o=t.state.foldGutter;if(o){var e=o.options;clearTimeout(o.changeUpdate),o.changeUpdate=setTimeout(function(){var e=t.getViewport();o.from==o.to||e.from-o.to>20||o.from-e.to>20?f(t):t.operation(function(){e.from<o.from&&(n(t,e.from,o.from),o.from=e.from),e.to>o.to&&(n(t,o.to,e.to),o.to=e.to)})},e.updateViewportTimeSpan||400)}}function l(t,o){var e=t.state.foldGutter;if(e){var r=o.line;r>=e.from&&r<e.to&&n(t,r,r+1)}}});

View File

@ -0,0 +1 @@
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function n(n,t){var i=n.getLine(t),o=i.search(/\S/);return-1==o||/\bcomment\b/.test(n.getTokenTypeAt(e.Pos(t,o+1)))?-1:e.countColumn(i,null,n.getOption("tabSize"))}e.registerHelper("fold","indent",function(t,i){var o=n(t,i.line);if(!(o<0)){for(var r=null,l=i.line+1,f=t.lastLine();l<=f;++l){var u=n(t,l);if(-1==u);else{if(!(u>o))break;r=l}}return r?{from:e.Pos(i.line,t.getLine(i.line).length),to:e.Pos(r,t.getLine(r).length)}:void 0}})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");return{token:function(i,t){var r=i.peek(),n=t.escaped;if(t.escaped=!1,"#"==r&&(0==i.pos||/\s/.test(i.string.charAt(i.pos-1))))return i.skipToEnd(),"comment";if(i.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(t.literal&&i.indentation()>t.keyCol)return i.skipToEnd(),"string";if(t.literal&&(t.literal=!1),i.sol()){if(t.keyCol=0,t.pair=!1,t.pairStart=!1,i.match(/---/))return"def";if(i.match(/\.\.\./))return"def";if(i.match(/\s*-\s+/))return"meta"}if(i.match(/^(\{|\}|\[|\])/))return"{"==r?t.inlinePairs++:"}"==r?t.inlinePairs--:"["==r?t.inlineList++:t.inlineList--,"meta";if(t.inlineList>0&&!n&&","==r)return i.next(),"meta";if(t.inlinePairs>0&&!n&&","==r)return t.keyCol=0,t.pair=!1,t.pairStart=!1,i.next(),"meta";if(t.pairStart){if(i.match(/^\s*(\||\>)\s*/))return t.literal=!0,"meta";if(i.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==t.inlinePairs&&i.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(t.inlinePairs>0&&i.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(i.match(e))return"keyword"}return!t.pair&&i.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(t.pair=!0,t.keyCol=i.indentation(),"atom"):t.pair&&i.match(/^:\s*/)?(t.pairStart=!0,"meta"):(t.pairStart=!1,t.escaped="\\"==r,i.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-yaml","yaml"),e.defineMIME("text/yaml","yaml")});

View File

@ -0,0 +1 @@
.cm-s-dracula.CodeMirror,.cm-s-dracula .CodeMirror-gutters{background-color:#282a36 !important;color:#f8f8f2 !important;border:0}.cm-s-dracula .CodeMirror-gutters{color:#282a36}.cm-s-dracula .CodeMirror-cursor{border-left:solid thin #f8f8f0}.cm-s-dracula .CodeMirror-linenumber{color:#6d8a88}.cm-s-dracula .CodeMirror-selected{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line>span::selection,.cm-s-dracula .CodeMirror-line>span>span::selection{background:rgba(255,255,255,0.10)}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line>span::-moz-selection,.cm-s-dracula .CodeMirror-line>span>span::-moz-selection{background:rgba(255,255,255,0.10)}.cm-s-dracula span.cm-comment{color:#6272a4}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2{color:#f1fa8c}.cm-s-dracula span.cm-number{color:#bd93f9}.cm-s-dracula span.cm-variable{color:#50fa7b}.cm-s-dracula span.cm-variable-2{color:white}.cm-s-dracula span.cm-def{color:#50fa7b}.cm-s-dracula span.cm-operator{color:#ff79c6}.cm-s-dracula span.cm-keyword{color:#ff79c6}.cm-s-dracula span.cm-atom{color:#bd93f9}.cm-s-dracula span.cm-meta{color:#f8f8f2}.cm-s-dracula span.cm-tag{color:#ff79c6}.cm-s-dracula span.cm-attribute{color:#50fa7b}.cm-s-dracula span.cm-qualifier{color:#50fa7b}.cm-s-dracula span.cm-property{color:#66d9ef}.cm-s-dracula span.cm-builtin{color:#50fa7b}.cm-s-dracula span.cm-variable-3,.cm-s-dracula span.cm-type{color:#ffb86c}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,0.1)}.cm-s-dracula .CodeMirror-matchingbracket{text-decoration:underline;color:white !important}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.43.04
PKG_VERSION:=0.43.05
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -133,8 +133,6 @@ dler = Map("openclash")
dler.pageaction = false
dler:section(SimpleSection).template = "openclash/dlercloud"
m:append(Template("openclash/toolbar_show"))
if m.uci:get("openclash", "config", "dler_token") then
return m, dler, form, s, ap, d
else

View File

@ -351,7 +351,7 @@ if not conf_name then conf_name = "config.yaml" end
local sconf = "/etc/openclash/"..conf_name
sev = s:option(TextValue, "user")
sev.description = translate("Modify Your Config file:").." "..font_green..bold_on..conf_name..bold_off..font_off.." "..translate("Here, Except The Settings That Were Taken Over")
sev.description = align_mid..translate("Modify Your Config file:").." "..font_green..bold_on..conf_name..bold_off..font_off.." "..translate("Here, Except The Settings That Were Taken Over")..align_mid_off
sev.rows = 40
sev.wrap = "off"
sev.cfgvalue = function(self, section)
@ -369,9 +369,9 @@ end
def = s:option(TextValue, "default")
if fs.isfile(sconf) then
def.description = translate("Config File Edited By OpenClash For Running")
def.description = align_mid..translate("Config File Edited By OpenClash For Running")..align_mid_off
else
def.description = translate("Default Config File With Correct Template")
def.description = align_mid..translate("Default Config File With Correct Template")..align_mid_off
end
def.rows = 40
def.wrap = "off"
@ -408,6 +408,5 @@ o.write = function()
end
m:append(Template("openclash/config_editor"))
m:append(Template("openclash/toolbar_show"))
return ful , form , p , m

View File

@ -126,7 +126,7 @@ switch_mode.template = "openclash/switch_mode"
---- General Settings
o = s:taboption("settings", ListValue, "interface_name", font_red..bold_on..translate("Bind Network Interface")..bold_off..font_off)
local de_int = SYS.exec("ip route |grep 'default' |awk '{print $5}' 2>/dev/null")
local de_int = SYS.exec("ip route |grep 'default' |awk '{print $5}' 2>/dev/null") or SYS.exec("/usr/share/openclash/openclash_get_network.lua 'dhcp'")
o.description = translate("Default Interface Name:").." "..font_green..bold_on..de_int..bold_off..font_off..translate(",Try Enable If Network Loopback")
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
for interface in string.gmatch(interfaces, "%S+") do
@ -157,7 +157,7 @@ o.description = translate("Set Log File Size (KB)")
o.default=1024
o = s:taboption("settings", Flag, "intranet_allowed", translate("Only intranet allowed"))
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network, Not Support IPv6 Yet")
o.default=0
o = s:taboption("settings", Value, "dns_port")
@ -394,7 +394,7 @@ o.default=0
custom_rules = s:taboption("rules", Value, "custom_rules")
custom_rules:depends("enable_custom_clash_rules", 1)
custom_rules.template = "cbi/tvalue"
custom_rules.description = translate("Custom Priority Rules Here, For More Go:").." "..'<a href="https://lancellc.gitbook.io/clash/clash-config-file/rules">https://lancellc.gitbook.io/clash/clash-config-file/rules</a>'.." ,"..translate("IP To CIDR:").." "..'<a href="http://ip2cidr.com">http://ip2cidr.com</a>'
custom_rules.description = translate("Custom Priority Rules Here, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://lancellc.gitbook.io/clash/clash-config-file/rules\")'>https://lancellc.gitbook.io/clash/clash-config-file/rules</a>".." ,"..translate("IP To CIDR:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"http://ip2cidr.com\")'>http://ip2cidr.com</a>"
custom_rules.rows = 20
custom_rules.wrap = "off"
@ -414,7 +414,7 @@ end
custom_rules_2 = s:taboption("rules", Value, "custom_rules_2")
custom_rules_2:depends("enable_custom_clash_rules", 1)
custom_rules_2.template = "cbi/tvalue"
custom_rules_2.description = translate("Custom Extended Rules Here, For More Go:").." "..'<a href="https://lancellc.gitbook.io/clash/clash-config-file/rules">https://lancellc.gitbook.io/clash/clash-config-file/rules</a>'.." ,"..translate("IP To CIDR:").." "..'<a href="http://ip2cidr.com">http://ip2cidr.com</a>'
custom_rules_2.description = translate("Custom Extended Rules Here, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://lancellc.gitbook.io/clash/clash-config-file/rules\")'>https://lancellc.gitbook.io/clash/clash-config-file/rules</a>".." ,"..translate("IP To CIDR:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"http://ip2cidr.com\")'>http://ip2cidr.com</a>"
custom_rules_2.rows = 20
custom_rules_2.wrap = "off"
@ -784,7 +784,7 @@ s.anonymous = true
custom_hosts = s:option(Value, "custom_hosts")
custom_hosts.template = "cbi/tvalue"
custom_hosts.description = translate("Custom Hosts Here, For More Go:").." "..'<a href="https://lancellc.gitbook.io/clash/clash-config-file/dns/host">https://lancellc.gitbook.io/clash/clash-config-file/dns/host</a>'
custom_hosts.description = translate("Custom Hosts Here, For More Go:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://lancellc.gitbook.io/clash/clash-config-file/dns/host\")'>https://lancellc.gitbook.io/clash/clash-config-file/dns/host</a>"
custom_hosts.rows = 20
custom_hosts.wrap = "off"

View File

@ -191,5 +191,17 @@ if (core_log && oc_log) {
oc_editor.setOption("readOnly","true");
}
var proxy_mg = document.getElementById('cbi-table-1-proxy_mg');
var rule_mg = document.getElementById('cbi-table-1-rule_mg');
var game_mg = document.getElementById('cbi-table-1-game_mg');
var Commit = document.getElementById('cbi-table-1-Commit');
var Apply = document.getElementById('cbi-table-1-Apply');
if (proxy_mg) {
proxy_mg.style.textAlign="center";
rule_mg.style.textAlign="center";
game_mg.style.textAlign="center";
Commit.style.textAlign="center";
Apply.style.textAlign="center";
}
//]]>
</script>

View File

@ -6,7 +6,7 @@
</style>
<fieldset class="cbi-section">
<div class="developer_">
<table><tr><td>
<table width="100%"><tr><td>
<span id="_Dreamacro"><%:Collecting data...%></span>
<span id="_vernesong"><%:Collecting data...%></span>
<span id="_frainzy1477"><%:Collecting data...%></span>
@ -40,6 +40,8 @@
var Tindy_X = document.getElementById('_Tindy_X');
var dlercloud = document.getElementById('_dlercloud');
var immortalwrt = document.getElementById('_immortalwrt');
var enable = document.getElementById('cbi-table-1-enable');
var disable = document.getElementById('cbi-table-1-disable');
Dreamacro.innerHTML = '<img src="https://avatars3.githubusercontent.com/u/8615343?s=460&v=4" loading="lazy" style="border-radius:50%;" title="Dreamacro" alt="Dreamacro" width="50px" onerror="return imgerrorfun(this,this.src)" onclick="return Dreamacro_rediret()" />';
vernesong.innerHTML = '<img src="https://avatars2.githubusercontent.com/u/42875168?s=460&v=4" loading="lazy" style="border-radius:50%;" title="vernesong" alt="vernesong" width="50px" onerror="return imgerrorfun(this,this.src)" onclick="return vernesong_rediret()" />';
frainzy1477.innerHTML = '<img src="https://avatars2.githubusercontent.com/u/49537471?s=460&v=4" loading="lazy" style="border-radius:50%;" title="frainzy1477" alt="frainzy1477" width="50px" onerror="return imgerrorfun(this,this.src)" onclick="return frainzy1477_rediret()" />';
@ -55,6 +57,9 @@
dlercloud.innerHTML = '<img src="https://gblobscdn.gitbook.com/spaces%2F-LA4MIEaZUSjdLrk1eJx%2Favatar-1586188293684.png?alt=media" loading="lazy" style="border-radius:50%;" title="Dler Cloud" alt="Dler Cloud" width="50px" onerror="return imgerrorfun(this,this.src)" onclick="return dlercloud_rediret()" />';
immortalwrt.innerHTML = '<img src="https://avatars.githubusercontent.com/u/82308430?v=4" loading="lazy" style="border-radius:50%;" title="immortalwrt" alt="immortalwrt" width="50px" onerror="return imgerrorfun(this,this.src)" onclick="return immortalwrt_rediret()" />';
enable.style.textAlign="center";
disable.style.textAlign="center";
function dlercloud_rediret()
{
url15='https://dlercloud.com';

View File

@ -192,7 +192,7 @@
</head>
<body>
<fieldset class="cbi-section">
<table><tr><td>
<table width="100%"><tr><td>
<div class="center">
<div id="card" class="card">
<div id="additional" class="additional">

View File

@ -261,7 +261,7 @@ window.onload = function(){
for(var i=0; i<titles.length; i++){
var li = titles[i];
li.id = i;
li.onmousemove = function(){
li.onclick = function(){
for(var j=0; j<titles.length; j++){
titles[j].className = '';
divs[j].style.display = 'none';

View File

@ -226,12 +226,12 @@
update_subscribe.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Config Update%>" onclick="return b_update_subscribe(this)"/>';
update_other_rules.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Third Party Rules Update%>" onclick="return b_update_other_rules(this)"/>';
update_geoip.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check GEOIP Data Update%>" onclick="return b_update_geoip(this)"/>';
if (status.daip != "" && window.location.hostname == status.daip) {
if (status.daip && window.location.hostname == status.daip) {
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
dapo.innerHTML = status.cn_port ? "<b><font color=green>"+status.cn_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port;
}
else if (status.daip != "" && window.location.hostname != status.daip && status.db_foward_domain != "" && status.db_foward_port != "")
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port)
{
daip.innerHTML = status.db_foward_domain ? "<b><font color=green>"+status.db_foward_domain+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
dapo.innerHTML = status.db_foward_port ? "<b><font color=green>"+status.db_foward_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
@ -512,10 +512,10 @@
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', null, function(x, status) {
btn.disabled = true;
btn.value = '<%:Open Panel%>';
if (status.daip != "" && window.location.hostname == status.daip) {
if (status.daip && window.location.hostname == status.daip) {
url1='<%="http://'+window.location.hostname+':'+window.location.port+'/luci-static/openclash?hostname='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
}
else if (status.daip != "" && window.location.hostname != status.daip && status.db_foward_domain != "" && status.db_foward_port != "") {
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port) {
url1='<%="http://'+window.location.hostname+':'+window.location.port+'/luci-static/openclash?hostname='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
}
else {
@ -530,10 +530,10 @@
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', null, function(x, status) {
btn.disabled = true;
btn.value = '<%:Open Panel%>';
if (status.daip != "" && window.location.hostname == status.daip) {
if (status.daip && window.location.hostname == status.daip) {
url2='<%="http://'+window.location.hostname+':'+status.cn_port+'/ui/?host='+ window.location.hostname + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
}
else if (status.daip != "" && window.location.hostname != status.daip && status.db_foward_domain != "" && status.db_foward_port != "") {
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port) {
url2='<%="http://'+status.db_foward_domain+':'+status.db_foward_port+'/ui/?host='+ status.db_foward_domain + '&port=' + status.db_foward_port + '&secret=' + status.dase +'"%>';
}
else {

View File

@ -18,50 +18,79 @@
</div>
<script type="text/javascript">//<![CDATA[
var config_name = document.getElementById('cfg_name');
var tool_label = document.getElementById('tool_label');
var header1 = document.getElementsByClassName("tabmenu-item-log ")[0];
var header2 = document.getElementsByClassName("tabmenu-item-client ")[0];
var header3 = document.getElementsByClassName("tabmenu-item-config ")[0];
var config_name = document.getElementById('cfg_name');
var tool_label = document.getElementById('tool_label');
var Commit = document.getElementById('cbi-table-1-Commit');
var Apply = document.getElementById('cbi-table-1-Apply');
var Load_Config = document.getElementById('cbi-table-1-Load_Config');
var Delete_Unused_Servers = document.getElementById('cbi-table-1-Delete_Unused_Servers');
var Delete_Servers = document.getElementById('cbi-table-1-Delete_Servers');
var Delete_Proxy_Provider = document.getElementById('cbi-table-1-Delete_Proxy_Provider');
var Delete_Groups = document.getElementById('cbi-table-1-Delete_Groups');
var rule_mg = document.getElementById('cbi-table-1-rule_mg');
var pro_mg = document.getElementById('cbi-table-1-pro_mg');
setTimeout("get_header()",100);
if (Commit) {
Commit.style.textAlign="center";
Apply.style.textAlign="center";
}
if (Load_Config) {
Load_Config.style.textAlign="center";
Delete_Unused_Servers.style.textAlign="center";
Delete_Servers.style.textAlign="center";
Delete_Proxy_Provider.style.textAlign="center";
Delete_Groups.style.textAlign="center";
}
if (rule_mg) {
rule_mg.style.textAlign="center";
pro_mg.style.textAlign="center";
}
if (tool_label.style.display != "none") {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "config_name")%>', null, function(x, status) {
if (x && x.status == 200 && status.config_name != "") {
for(var i in status.config_name){
config_name.options.add(new Option(status.config_name[i].name,status.config_name[i].name));
}
if (status.config_path != "") {
config_name.value = status.config_path;
}
else
{
config_name.options.add(new Option("<%:Not Select%>",""));
config_name.value = "";
}
}
else if (x && x.status == 200 && status.config_path != "") {
config_name.options.add(new Option(status.config_path,status.config_path));
config_name.value = status.config_path;
}
else {
tool_label.style.display = "none";
}
});
};
if (header1 && header2.className != "tabmenu-item-client active" && header3.className != "tabmenu-item-config active") {
insertAfter(tool_label,header1);
function get_header() {
var header = document.getElementsByClassName("tabmenu-item-log ")[0];
if (header) {
insertAfter(tool_label,header);
}
else {
setTimeout("get_header()",100);
}
}
else {
tool_label.style.display = "none";
}
if (tool_label.style.display != "none") {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "config_name")%>', null, function(x, status) {
if (x && x.status == 200 && status.config_name != "") {
for(var i in status.config_name){
config_name.options.add(new Option(status.config_name[i].name,status.config_name[i].name));
}
if (status.config_path != "") {
config_name.value = status.config_path;
}
else
{
config_name.options.add(new Option("<%:Not Select%>",""));
config_name.value = "";
}
}
else if (x && x.status == 200 && status.config_path != "") {
config_name.options.add(new Option(status.config_path,status.config_path));
config_name.value = status.config_path;
}
else {
tool_label.style.display = "none";
}
});
}
function insertAfter( newElement, targetElement ){
function insertAfter(newElement, targetElement) {
var parent = targetElement.parentNode;
if( parent.lastChild == targetElement ){
parent.appendChild( newElement, targetElement );
}else{
parent.insertBefore( newElement, targetElement.nextSibling );
if(parent.lastChild == targetElement) {
parent.appendChild(newElement, targetElement);
}
else {
parent.insertBefore(newElement, targetElement.nextSibling);
};
};
@ -81,4 +110,12 @@
return false;
}
}
function winOpen(url)
{
var winOpen = window.open(url);
if(winOpen == null || typeof(winOpen) == 'undefined'){
window.location.href=url;
}
}
//]]></script>

View File

@ -1,6 +1,6 @@
<fieldset class="cbi-section">
<table>
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center" id="update_tip">
<b><%:Note: if the update fails, you can manually download and upload%></b>
@ -48,7 +48,7 @@
</table>
</fieldset>
<fieldset class="cbi-section">
<table>
<table width="100%">
<tr><td width="100%" colspan="4">
<p align="center">
<b><%:Client Update%></b>
@ -223,8 +223,8 @@
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update%>" onclick="return all_one_key_update(this)"/>';
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-remove" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
function core_update(btn,type)
{

View File

@ -203,8 +203,8 @@ msgstr "切换日志等级"
msgid "Only intranet allowed"
msgstr "仅允许内网"
msgid "When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network"
msgstr "启用后将禁止从公网访问控制面板和连接代理端口"
msgid "When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network, Not Support IPv6 Yet"
msgstr "启用后将禁止从公网访问控制面板和连接代理端口, 暂不支持和IPv6代理同时启用"
msgid "Redirect Local DNS Setting"
msgstr "*本地DNS劫持"
@ -2330,9 +2330,6 @@ msgstr "当前配置文件"
msgid "Official Website"
msgstr "官方网站"
msgid "Up"
msgstr "上传"
msgid "Up:"
msgstr "上传:"

View File

@ -308,20 +308,42 @@ sys_dns_append()
if [ "$1" = 1 ]; then
wan_dns=$(/usr/share/openclash/openclash_get_network.lua "dns")
wan6_dns=$(/usr/share/openclash/openclash_get_network.lua "dns6")
if [ -n "$wan_dns" ]; then
wan_gate=$(/usr/share/openclash/openclash_get_network.lua "gateway")
wan6_gate=$(/usr/share/openclash/openclash_get_network.lua "gateway6")
dhcp_iface=$(/usr/share/openclash/openclash_get_network.lua "dhcp")
if [ -z "$dhcp_iface" ]; then
if [ -n "$wan_dns" ]; then
if [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
echo " nameserver:" >/tmp/yaml_config.namedns.yaml
fi
for i in $wan_dns; do
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
done
fi
if [ -n "$wan6_dns" ] && [ "$2" = 1 ]; then
if [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
echo " nameserver:" >/tmp/yaml_config.namedns.yaml
fi
for i in $wan6_dns; do
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
done
fi
else
if [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
echo " nameserver:" >/tmp/yaml_config.namedns.yaml
fi
for i in $wan_dns; do
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
done
fi
if [ -n "$wan6_dns" ] && [ "$2" = 1 ]; then
if [ -z "$(grep "^ \{0,\}nameserver:$" /tmp/yaml_config.namedns.yaml 2>/dev/null)" ]; then
echo " nameserver:" >/tmp/yaml_config.namedns.yaml
if [ -n "$wan_gate" ]; then
for i in $wan_gate; do
echo " - \"$i\"" >>/tmp/yaml_config.namedns.yaml
done
fi
for i in $wan6_dns; do
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
if [ -n "$wan6_gate" ] && [ "$2" = 1 ]; then
for i in $wan6_gate; do
echo " - \"[${i}]:53\"" >>/tmp/yaml_config.namedns.yaml
done
fi
for i in $dhcp_iface; do
echo " - dhcp://\"$i\"" >>/tmp/yaml_config.namedns.yaml
done
fi
fi
@ -331,7 +353,7 @@ sys_dns_append()
yml_dns_get()
{
local section="$1"
local section="$1" regex='^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$'
local enabled port type ip group dns_type dns_address
config_get_bool "enabled" "$section" "enabled" "1"
config_get "port" "$section" "port" ""
@ -347,7 +369,7 @@ yml_dns_get()
return
fi
if [ -n "$(echo $ip |grep ":" 2>/dev/null)" ]; then
if [[ $ip =~ $regex ]]; then
ip="[${ip}]"
fi
@ -399,11 +421,13 @@ yml_dns_custom()
if [ -z "$(ruby_read "$2" "['dns']")" ]; then
ruby_cover "$2" "['dns']" "/tmp/yaml_config.namedns.yaml"
ruby_merge "$2" "['dns']" "/tmp/yaml_config.falldns.yaml"
else
elif [ "$1" = 1 ]; then
ruby_edit "$2" "['dns'].delete('nameserver')"
ruby_edit "$2" "['dns'].delete('fallback')"
ruby_merge "$2" "['dns']" "/tmp/yaml_config.namedns.yaml"
ruby_merge "$2" "['dns']" "/tmp/yaml_config.falldns.yaml"
else
ruby_merge "$2" "['dns']" "/tmp/yaml_config.namedns.yaml"
fi
else
LOG_OUT "Error: Nameserver Option Must Be Setted, Stop Customing DNS Servers"
@ -986,7 +1010,7 @@ do_run_file()
config_foreach yml_other_rules_get "other_rules" "$CONFIG_NAME"
fi
if [ "$proxy_mode" = "script" ] || [ "$rule_name" = "ConnersHua" ] || [ "$rule_name" = "lhie1" ] || [ -n "$(ruby_read "$CONFIG_FILE" "['rules'].grep(/^RULE-SET,/)")" ]; then
if [ "$proxy_mode" = "script" ] || [ "$rule_name" = "ConnersHua" ] || [ "$rule_name" = "lhie1" ] || [ -n "$(ruby_read "$CONFIG_FILE" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ] || [ -n "$(ruby_read "/etc/openclash/custom/openclash_custom_rules_2.list" "['rules'].grep(/(^RULE-SET,|^SCRIPT,)/)")" ]; then
if [ "$en_mode_tun" != "2" ]; then
rm -rf "/etc/openclash/clash"
ln -s "$tun_core_path" /etc/openclash/clash 2>/dev/null
@ -1499,7 +1523,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then
iptables -t nat -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t nat -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
fi
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A PREROUTING -p tcp -j openclash
@ -1522,7 +1548,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
fi
iptables -t mangle -A openclash -p udp --dport 53 -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -p udp -j TPROXY --on-port "$proxy_port" --tproxy-mark "$PROXY_FWMARK"
@ -1548,7 +1576,9 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then
iptables -t nat -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
fi
if [ "$intranet_allowed" -eq 1 ]; then
iptables -t nat -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j DNAT --to-destination "$lan_ip:$proxy_port"
@ -1610,7 +1640,9 @@ if [ -n "$en_mode_tun" ]; then
iptables -t mangle -A openclash_output -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -I OUTPUT -j openclash_output
fi
@ -1628,7 +1660,9 @@ if [ -n "$en_mode_tun" ]; then
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then
iptables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip_route" = "1" ]; then
iptables -t mangle -A openclash -m set --match-set china_ip_route dst -j RETURN >/dev/null 2>&1
fi
fi
iptables -t mangle -A openclash -j MARK --set-mark "$PROXY_FWMARK"
@ -1719,7 +1753,9 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
ip6tables -t mangle -A openclash -m set ! --match-set lan_ac_white_macs src -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
fi
ip6tables -t mangle -A openclash -m set --match-set china_ip6_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip6_route" = "1" ]; then
ip6tables -t mangle -A openclash -m set --match-set china_ip6_route dst -j RETURN >/dev/null 2>&1
fi
ip6tables -t mangle -A openclash -p tcp -m comment --comment "OpenClash" -j TPROXY --on-port "$tproxy_port" --tproxy-mark "$PROXY_FWMARK"
ip6tables -t mangle -A PREROUTING -j openclash
@ -1729,7 +1765,9 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
ip6tables -t mangle -A openclash_output -m set --match-set localnetwork6 dst -j RETURN
ip6tables -t mangle -A openclash_output -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
ip6tables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip6_route dst -j RETURN >/dev/null 2>&1
if [ "$china_ip6_route" = "1" ]; then
ip6tables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set --match-set china_ip6_route dst -j RETURN >/dev/null 2>&1
fi
ip6tables -t mangle -A openclash_output -p tcp -m owner ! --uid-owner 65534 -j MARK --set-xmark "$PROXY_FWMARK"
ip6tables -t mangle -A OUTPUT -j openclash_output
fi
@ -1762,9 +1800,6 @@ revert_firewall()
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip route del local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip -6 rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
ip -6 route del local ::/0 dev lo table "$PROXY_ROUTE_TABLE"
iptables -t nat -D PREROUTING -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1
#quic
iptables -D INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT >/dev/null 2>&1
@ -1833,6 +1868,9 @@ revert_firewall()
iptables -t mangle -X openclash_output >/dev/null 2>&1
#Revert IPv6 rules
ip -6 rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip -6 route del local ::/0 dev lo table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
pre_lines=$(ip6tables -nvL PREROUTING -t mangle |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
for pre_line in $pre_lines; do
@ -1915,6 +1953,7 @@ get_config()
append_wan_dns=$(uci -q get openclash.config.append_wan_dns || echo 1)
_koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null)
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
[ "$ipv6_enable" -eq 1 ] && [ "$intranet_allowed" -eq 1 ] && intranet_allowed=0 && uci -q set openclash.config.intranet_allowed=0
uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash
}
@ -2062,6 +2101,7 @@ restart()
reload()
{
if pidof clash >/dev/null; then
set_lock
revert_firewall 2>/dev/null
do_run_mode 2>/dev/null
get_config 2>/dev/null
@ -2069,5 +2109,6 @@ reload()
/etc/init.d/dnsmasq restart >/dev/null 2>&1
LOG_OUT "Reload OpenClash Firewall Rules..."
SLOG_CLEAN
del_lock
fi
}

View File

@ -86,4 +86,8 @@ stun.*.*.*
heartbeat.belkin.com
*.linksys.com
*.linksyssmartwifi.com
+.battlenet.com.cn
+.battlenet.com.cn
+.wotgame.cn
+.wggames.cn
+.wowsgame.cn
+.wargaming.net

View File

@ -1,11 +1,21 @@
##- DOMAIN-SUFFIX,google.com,Proxy 匹配域名后缀(交由Proxy代理服务器组)
##- DOMAIN-KEYWORD,google,Proxy 匹配域名关键字(交由Proxy代理服务器组)
##- DOMAIN,google.com,Proxy 匹配域名(交由Proxy代理服务器组)
##- DOMAIN-SUFFIX,ad.com,REJECT 匹配域名后缀(拒绝)
##- IP-CIDR,127.0.0.0/8,DIRECT 匹配数据目标IP(直连)
##- SRC-IP-CIDR,192.168.1.201/32,DIRECT 匹配数据发起IP(直连)
##- DST-PORT,80,DIRECT 匹配数据目标端口(直连)
##- SRC-PORT,7777,DIRECT 匹配数据源端口(直连)
script:
## shortcuts:
## quic: network == 'udp' and dst_port == 443 and (geoip(resolve_ip(host)) != 'CN' or geoip(dst_ip) != 'CN')
## time-limit: in_cidr(src_ip,'192.168.1.2/32') and time.now().hour < 20 or time.now().hour > 21
## time-limit: src_ip == '192.168.1.2' and time.now().hour < 20 or time.now().hour > 21
rules:
##- SCRIPT,quic,REJECT #shortcuts rule
##- SCRIPT,time-limit,REJECT #shortcuts rule
##- DOMAIN-SUFFIX,google.com,Proxy #匹配域名后缀(交由Proxy代理服务器组)
##- DOMAIN-KEYWORD,google,Proxy #匹配域名关键字(交由Proxy代理服务器组)
##- DOMAIN,google.com,Proxy #匹配域名(交由Proxy代理服务器组)
##- DOMAIN-SUFFIX,ad.com,REJECT #匹配域名后缀(拒绝)
##- IP-CIDR,127.0.0.0/8,DIRECT #匹配数据目标IP(直连)
##- SRC-IP-CIDR,192.168.1.201/32,DIRECT #匹配数据发起IP(直连)
##- DST-PORT,80,DIRECT #匹配数据目标端口(直连)
##- SRC-PORT,7777,DIRECT #匹配数据源端口(直连)
##排序在上的规则优先生效,如添加(去除规则前的#号):
##IP段192.168.1.2-192.168.1.200 直连

View File

@ -1,3 +1,10 @@
script:
## shortcuts:
## common_port: dst_port not in [21, 22, 23, 53, 80, 123, 143, 194, 443, 465, 587, 853, 993, 995, 998, 2052, 2053, 2082, 2083, 2086, 2095, 2096, 5222, 5228, 5229, 5230, 8080, 8443, 8880, 8888, 8889]
rules:
##- SCRIPT,common_port,DIRECT #shortcuts rule
##- DOMAIN-SUFFIX,google.com,Proxy 匹配域名后缀(交由Proxy代理服务器组)
##- DOMAIN-KEYWORD,google,Proxy 匹配域名关键字(交由Proxy代理服务器组)
##- DOMAIN,google.com,Proxy 匹配域名(交由Proxy代理服务器组)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,9 +8,9 @@
<meta name="description" content="Clash web port" />
<!--meta name="external-controller" content="http://secret@example.com:9090"-->
<title>Clash</title>
<script type="module" crossorigin src="./assets/index.725cdcb9.js"></script>
<link rel="modulepreload" href="./assets/vendor.11da2308.js">
<link rel="stylesheet" href="./assets/index.e2b47fed.css">
<script type="module" crossorigin src="./assets/index.40138383.js"></script>
<link rel="modulepreload" href="./assets/vendor.ca4c5569.js">
<link rel="stylesheet" href="./assets/index.9669bf8a.css">
<link rel="manifest" href="./manifest.webmanifest"><script>if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1 +1 @@
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise((async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()}))),s.then((()=>{if(!r[e])throw new Error(`Module ${e} didnt register its module`);return r[e]}))},s=(s,r)=>{Promise.all(s.map(e)).then((e=>r(1===e.length?e[0]:e)))},r={require:Promise.resolve(s)};self.define=(s,i,t)=>{r[s]||(r[s]=Promise.resolve().then((()=>{let r={};const n={uri:location.origin+s.slice(1)};return Promise.all(i.map((s=>{switch(s){case"exports":return r;case"module":return n;default:return e(s)}}))).then((e=>{const s=t(...e);return r.default||(r.default=s),r}))})))}}define("./sw.js",["./workbox-7ce2238d"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.725cdcb9.js",revision:"349bed05c49f44ce3e7f81e20240ef6d"},{url:"assets/index.e2b47fed.css",revision:"eb753d52246b24a0f5d62ccc94b411ac"},{url:"assets/vendor.11da2308.js",revision:"f2c978274e385ee8f53d2b948178be35"},{url:"index.html",revision:"197cff66b73fd086a988b87efc4ece9b"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise((async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()}))),s.then((()=>{if(!r[e])throw new Error(`Module ${e} didnt register its module`);return r[e]}))},s=(s,r)=>{Promise.all(s.map(e)).then((e=>r(1===e.length?e[0]:e)))},r={require:Promise.resolve(s)};self.define=(s,i,t)=>{r[s]||(r[s]=Promise.resolve().then((()=>{let r={};const n={uri:location.origin+s.slice(1)};return Promise.all(i.map((s=>{switch(s){case"exports":return r;case"module":return n;default:return e(s)}}))).then((e=>{const s=t(...e);return r.default||(r.default=s),r}))})))}}define("./sw.js",["./workbox-7ce2238d"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.40138383.js",revision:"ad3ebbb49720af75865f7231103d23c2"},{url:"assets/index.9669bf8a.css",revision:"7358d310707ca4d73b0e7bbf84ae0508"},{url:"assets/vendor.ca4c5569.js",revision:"666b91029a285b5ee221d762844f5e73"},{url:"index.html",revision:"029e58461a28083e201511c74efd4f72"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));

View File

@ -6,57 +6,110 @@ require "luci.sys"
local ntm = require "luci.model.network".init()
local type = arg[1]
local rv = {}
local wan, wan6
local wan = ntm:get_wannet()
local wan6 = ntm:get_wan6net()
if not type then os.exit(0) end
if pcall(function() local x = ntm:get_wannet(); local y = ntm:get_wan6net(); end) then
wan = {}
wan6 = {}
wan[1] = ntm:get_wannet()
wan6[1] = ntm:get_wan6net()
elseif pcall(function() local x = ntm:get_wan_networks(); local y = ntm:get_wan6_networks(); end) then
wan = ntm:get_wan_networks()
wan6 = ntm:get_wan6_networks()
else
os.exit(0)
end
if wan then
rv.wan = {
ipaddr = wan:ipaddr(),
gwaddr = wan:gwaddr(),
netmask = wan:netmask(),
dns = wan:dnsaddrs(),
expires = wan:expires(),
uptime = wan:uptime(),
proto = wan:proto(),
ifname = wan:ifname()
}
rv.wan = {}
for i = 1, #wan do
rv.wan[i] = {
ipaddr = wan[i]:ipaddr(),
gwaddr = wan[i]:gwaddr(),
netmask = wan[i]:netmask(),
dns = wan[i]:dnsaddrs(),
expires = wan[i]:expires(),
uptime = wan[i]:uptime(),
proto = wan[i]:proto(),
ifname = wan[i]:ifname()
}
end
end
if wan6 then
rv.wan6 = {
ip6addr = wan6:ip6addr(),
gw6addr = wan6:gw6addr(),
dns = wan6:dns6addrs(),
ip6prefix = wan6:ip6prefix(),
uptime = wan6:uptime(),
proto = wan6:proto(),
ifname = wan6:ifname()
}
rv.wan6 = {}
for i = 1, #wan6 do
rv.wan6[i] = {
ip6addr = wan6[i]:ip6addr(),
gw6addr = wan6[i]:gw6addr(),
dns = wan6[i]:dns6addrs(),
ip6prefix = wan6[i]:ip6prefix(),
uptime = wan6[i]:uptime(),
proto = wan6[i]:proto(),
ifname = wan6[i]:ifname()
}
end
end
if type == "dns" then
if wan then
if #(rv.wan.dns) >= 1 then
for i=1, #(rv.wan.dns) do
if rv.wan.dns[i] ~= rv.wan.gwaddr then
print(rv.wan.dns[i])
for o = 1, #(rv.wan) do
for i = 1, #(rv.wan[o].dns) do
if rv.wan[o].dns[i] ~= rv.wan[o].gwaddr and rv.wan[o].dns[i] ~= rv.wan[o].ipaddr then
print(rv.wan[o].dns[i])
end
end
print(rv.wan[o].gwaddr)
end
print(rv.wan.gwaddr)
end
end
if type == "dns6" then
if wan6 then
if #(rv.wan6.dns) >= 1 then
for i=1, #(rv.wan6.dns) do
if rv.wan6.dns[i] ~= rv.wan6.gw6addr then
print(rv.wan6.dns[i])
for o = 1, #(rv.wan6) do
for i = 1, #(rv.wan6[o].dns) do
if rv.wan6[o].dns[i] ~= rv.wan6[o].gw6addr and rv.wan6[o].ip6addr then
print(rv.wan6[o].dns[i])
end
end
print(rv.wan6[o].gw6addr)
end
print(rv.wan6.gw6addr)
end
end
end
if type == "gateway" then
if wan then
for o = 1, #(rv.wan) do
print(rv.wan[o].gwaddr)
end
end
end
if type == "gateway6" then
if wan6 then
for o = 1, #(rv.wan6) do
print(rv.wan6[o].gw6addr)
end
end
end
if type == "dhcp" then
if wan then
for o = 1, #(rv.wan) do
if rv.wan[o].proto == "dhcp" then
print(rv.wan[o].ifname)
end
end
end
if wan6 then
for o = 1, #(rv.wan6) do
if rv.wan6[o].proto == "dhcpv6" then
print(rv.wan6[o].ifname)
end
end
end
end
os.exit(0)

View File

@ -10,7 +10,7 @@ enable_redirect_dns=$(uci -q get openclash.config.enable_redirect_dns)
dns_port=$(uci -q get openclash.config.dns_port)
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
cfg_update_interval=$(uci -q get openclash.config.config_update_interval)
log_size=$(uci -q get openclash.config.log_size || 1024)
log_size=$(uci -q get openclash.config.log_size || echo 1024)
core_type=$(uci -q get openclash.config.core_type)
_koolshare=$(cat /usr/lib/os-release 2>/dev/null |grep OPENWRT_RELEASE 2>/dev/null |grep -i koolshare 2>/dev/null)
CRASH_NUM=0

View File

@ -239,9 +239,12 @@ proxies: # 节点设置此部分与proxy-provider两者不能同时删除
# skip-cert-verify: true
# servername: example.com # priority over wss host
# network: ws
# ws-path: /path
# ws-headers:
# Host: v2ray.com
# ws-opts:
# path: /path
# headers:
# Host: v2ray.com
# max-early-data: 2048
# early-data-header-name: Sec-WebSocket-Protocol
- name: "vmess-http"
type: vmess

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import{V as t,A as e}from"./vendor.55942996.js";var n,i,a={exports:{}};
import{V as t,A as e}from"./vendor.3b6f54f7.js";var n,i,a={exports:{}};
//! moment.js
//! version : 2.29.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors

View File

@ -0,0 +1 @@
._root_1tdl3_1,._section_1tdl3_2{display:grid;grid-template-columns:repeat(auto-fill,minmax(345px,1fr));max-width:900px;gap:5px}@media screen and (min-width: 30em){._root_1tdl3_1,._section_1tdl3_2{gap:15px}}._root_1tdl3_1,._section_1tdl3_2{padding:6px 15px 10px}@media screen and (min-width: 30em){._root_1tdl3_1,._section_1tdl3_2{padding:10px 40px 15px}}._wrapSwitch_1tdl3_26{height:40px;display:flex;align-items:center}._sep_1tdl3_32{max-width:900px;padding:0 15px}@media screen and (min-width: 30em){._sep_1tdl3_32{padding:0 40px}}._sep_1tdl3_32>div{border-top:1px dashed #373737}._label_1tdl3_45{padding:11px 0}._fieldset_1ghjp_1{margin:0;padding:0;border:0;display:flex;flex-wrap:wrap}._input_1ghjp_9+._cnt_1ghjp_9{border:1px solid transparent;border-radius:8px;cursor:pointer;margin-right:5px;margin-bottom:5px}._input_1ghjp_9:focus+._cnt_1ghjp_9{border-color:#387cec}._input_1ghjp_9:checked+._cnt_1ghjp_9{border-color:#387cec}

View File

@ -1 +0,0 @@
._root_1tdl3_1,._section_1tdl3_2{display:grid;grid-template-columns:repeat(auto-fill,minmax(345px,1fr));max-width:900px;gap:5px}@media screen and (min-width:30em){._root_1tdl3_1,._section_1tdl3_2{gap:15px}}._root_1tdl3_1,._section_1tdl3_2{padding:6px 15px 10px}@media screen and (min-width:30em){._root_1tdl3_1,._section_1tdl3_2{padding:10px 40px 15px}}._wrapSwitch_1tdl3_26{height:40px;display:flex;align-items:center}._sep_1tdl3_32{max-width:900px;padding:0 15px}@media screen and (min-width:30em){._sep_1tdl3_32{padding:0 40px}}._sep_1tdl3_32>div{border-top:1px dashed #373737}._label_1tdl3_45{padding:11px 0}._fieldset_1ghjp_1{margin:0;padding:0;border:0;display:flex;flex-wrap:wrap}._input_1ghjp_9+._cnt_1ghjp_9{border:1px solid transparent;border-radius:8px;cursor:pointer;margin-right:5px;margin-bottom:5px}._input_1ghjp_9:focus+._cnt_1ghjp_9{border-color:#387cec}._input_1ghjp_9:checked+._cnt_1ghjp_9{border-color:#387cec}

View File

@ -0,0 +1 @@
.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{margin:0 0 10px;padding:0 30px}.react-tabs__tab{display:inline-flex;align-items:center;border:1px solid transparent;border-radius:5px;bottom:-1px;position:relative;list-style:none;padding:6px 10px;cursor:pointer;font-size:1.2em;opacity:.5}.react-tabs__tab--selected{opacity:1}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{border-color:#0188fe;outline:none}.react-tabs__tab:focus:after{content:"";position:absolute}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}._placeHolder_12xws_1{height:100%;display:flex;align-items:center;justify-content:center;color:var(--color-background);opacity:.1}._connQty_12xws_10{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._inputWrapper_12xws_22{margin:0 30px;width:100%;max-width:350px;justify-self:flex-end}._input_12xws_22{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:18px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:36px;outline:none;padding:0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._tr_198pq_1{display:grid;grid-template-columns:repeat(11,minmax(-webkit-max-content,auto));grid-template-columns:repeat(11,minmax(max-content,auto))}._th_198pq_7{padding:8px 10px;height:50px;background:var(--color-background);position:sticky;top:0;font-size:.8em;text-align:center;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:space-between}._th_198pq_7:hover{color:var(--color-text-highlight)}._td_198pq_24{padding:8px 13px;font-size:.9em;font-family:var(--font-normal)}._td_198pq_24._odd_198pq_30{background:var(--color-row-odd)}._du_198pq_35{text-align:right}._sortIconContainer_198pq_39{display:inline-flex;margin-left:10px;width:16px;height:16px}._rotate180_198pq_46{-webkit-transform:rotate(180deg);transform:rotate(180deg)}._overlay_148w6_1{background-color:#0009}._cnt_148w6_5{background-color:var(--bg-modal);color:var(--color-text);max-width:300px;line-height:1.4;-webkit-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);opacity:.6;transition:all .3s ease}._afterOpen_148w6_15{opacity:1;-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}._btngrp_148w6_20{display:flex;align-items:center;justify-content:center;margin-top:30px}

View File

@ -1 +0,0 @@
.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{margin:0 0 10px;padding:0 30px}.react-tabs__tab{display:inline-flex;align-items:center;border:1px solid transparent;border-radius:5px;bottom:-1px;position:relative;list-style:none;padding:6px 10px;cursor:pointer;font-size:1.2em;opacity:.5}.react-tabs__tab--selected{opacity:1}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{border-color:#0187fd;outline:0}.react-tabs__tab:focus:after{content:'';position:absolute}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}._placeHolder_12xws_1{height:100%;display:flex;align-items:center;justify-content:center;color:var(--color-background);opacity:.1}._connQty_12xws_10{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._inputWrapper_12xws_22{margin:0 30px;width:100%;max-width:350px;justify-self:flex-end}._input_12xws_22{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:18px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:36px;outline:0;padding:0 15px;transition:border-color .2s cubic-bezier(.645, .045, .355, 1);width:100%}._tr_198pq_1{display:grid;grid-template-columns:repeat(11,minmax(-webkit-max-content,auto));grid-template-columns:repeat(11,minmax(max-content,auto))}._th_198pq_7{padding:8px 10px;height:50px;background:var(--color-background);position:-webkit-sticky;position:sticky;top:0;font-size:.8em;text-align:center;-webkit-user-select:none;user-select:none;display:flex;align-items:center;justify-content:space-between}._th_198pq_7:hover{color:var(--color-text-highlight)}._td_198pq_24{padding:8px 13px;font-size:.9em;font-family:var(--font-normal)}._td_198pq_24._odd_198pq_30{background:var(--color-row-odd)}._du_198pq_35{text-align:right}._sortIconContainer_198pq_39{display:inline-flex;margin-left:10px;width:16px;height:16px}._rotate180_198pq_46{transform:rotate(180deg)}._overlay_148w6_1{background-color:rgba(0,0,0,.6)}._cnt_148w6_5{background-color:var(--bg-modal);color:var(--color-text);max-width:300px;line-height:1.4;transform:translate(-50%,-50%) scale(1.2);opacity:.6;transition:all .3s ease}._afterOpen_148w6_15{opacity:1;transform:translate(-50%,-50%) scale(1)}._btngrp_148w6_20{display:flex;align-items:center;justify-content:center;margin-top:30px}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
.rtf{box-sizing:border-box;margin:25px;position:fixed;white-space:nowrap;z-index:9998;padding-left:0;list-style:none}.rtf.open .rtf--mb{box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)}.rtf.open .rtf--mb>ul{list-style:none;margin:0;padding:0}.rtf.open .rtf--ab__c:hover>span{transition:ease-in-out opacity .2s;opacity:.9}.rtf.open .rtf--ab__c>span.always-show{transition:ease-in-out opacity .2s;opacity:.9}.rtf.open .rtf--ab__c:nth-child(1){transform:translateY(-60px) scale(1);transition-delay:30ms}.rtf.open .rtf--ab__c:nth-child(1).top{transform:translateY(60px) scale(1)}.rtf.open .rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(1);transition-delay:90ms}.rtf.open .rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(1)}.rtf.open .rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(1);transition-delay:0.12s}.rtf.open .rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(1)}.rtf.open .rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(1);transition-delay:0.15s}.rtf.open .rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(1)}.rtf.open .rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(1);transition-delay:0.18s}.rtf.open .rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(1)}.rtf.open .rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(1);transition-delay:0.21s}.rtf.open .rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(1)}.rtf--mb__c{padding:25px;margin:-25px}.rtf--mb__c :last-child{margin-bottom:0}.rtf--mb__c:hover>span{transition:ease-in-out opacity .2s;opacity:.9}.rtf--mb__c>span.always-show{transition:ease-in-out opacity .2s;opacity:.9}.rtf--mb__c>span{opacity:0;transition:ease-in-out opacity .2s;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;margin-left:4px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--mb__c>span.right{right:100%}.rtf--mb{width:48px;height:48px;background:var(--btn-bg);z-index:9999;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:0;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;font-size:18px}.rtf--mb>*{transition:ease-in-out transform .2s}.rtf--ab__c{display:block;position:absolute;top:0;right:1px;padding:10px 0;margin:-10px 0;transition:ease-in-out transform .2s}.rtf--ab__c>span{opacity:0;transition:ease-in-out opacity .2s;position:absolute;top:50%;transform:translateY(-50%);margin-right:6px;background:rgba(0,0,0,.75);padding:2px 4px;border-radius:2px;color:#fff;font-size:13px;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28)}.rtf--ab__c>span.right{right:100%}.rtf--ab__c:nth-child(1){transform:translateY(-60px) scale(0);transition-delay:0.21s}.rtf--ab__c:nth-child(1).top{transform:translateY(60px) scale(0)}.rtf--ab__c:nth-child(2){transform:translateY(-120px) scale(0);transition-delay:0.18s}.rtf--ab__c:nth-child(2).top{transform:translateY(120px) scale(0)}.rtf--ab__c:nth-child(3){transform:translateY(-180px) scale(0);transition-delay:0.15s}.rtf--ab__c:nth-child(3).top{transform:translateY(180px) scale(0)}.rtf--ab__c:nth-child(4){transform:translateY(-240px) scale(0);transition-delay:0.12s}.rtf--ab__c:nth-child(4).top{transform:translateY(240px) scale(0)}.rtf--ab__c:nth-child(5){transform:translateY(-300px) scale(0);transition-delay:90ms}.rtf--ab__c:nth-child(5).top{transform:translateY(300px) scale(0)}.rtf--ab__c:nth-child(6){transform:translateY(-360px) scale(0);transition-delay:30ms}.rtf--ab__c:nth-child(6).top{transform:translateY(360px) scale(0)}.rtf--ab{height:40px;width:40px;margin-right:4px;background-color:#aaa;display:inline-flex;justify-content:center;align-items:center;position:relative;border:none;border-radius:50%;box-shadow:0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28);cursor:pointer;outline:0;padding:0;-webkit-user-drag:none;font-weight:700;color:#f1f1f1;font-size:16px;z-index:10000}.rtf--ab:hover{background:#387cec;border:1px solid #387cec;color:#fff}.rtf--ab:focus{border-color:var(--color-focus-blue)}._spining_4i8sg_1{position:relative;border-radius:50%;background:linear-gradient(60deg,#e66465,#9198e5);width:48px;height:48px;display:flex;justify-content:center;align-items:center}._spining_4i8sg_1:before{content:"";position:absolute;top:0;bottom:0;left:0;right:0;border:2px solid transparent;border-top-color:currentColor;border-radius:50%;animation:_spining_keyframes_4i8sg_1 1s linear infinite}@keyframes _spining_keyframes_4i8sg_1{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}

View File

@ -0,0 +1 @@
._RuleSearch_1gcst_1{padding:0 40px 5px}._RuleSearchContainer_1gcst_5{position:relative;height:40px}._inputWrapper_1gcst_10{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:0;width:100%}._input_1gcst_10{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px 0 35px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._iconWrapper_1gcst_35{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px}._logMeta_zl5cd_1{display:flex;align-items:center;flex-wrap:wrap;font-size:.9em}._logType_zl5cd_8{color:#eee;flex-shrink:0;text-align:center;width:66px;border-radius:100px;padding:3px 5px;margin:0 8px}._logTime_zl5cd_18{flex-shrink:0;color:#999;font-size:14px}._logText_zl5cd_24{flex-shrink:0;display:flex;font-family:"Roboto Mono",Menlo,monospace;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._logsWrapper_zl5cd_37{margin:0;padding:0;color:var(--color-text)}._logsWrapper_zl5cd_37 li{background:var(--color-background)}._logsWrapper_zl5cd_37 li.even{background:var(--color-background)}._log_zl5cd_1{padding:10px 40px}._logPlaceholder_zl5cd_54{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#2d2d30}._logPlaceholder_zl5cd_54 div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._logPlaceholderIcon_zl5cd_67{opacity:.3}

View File

@ -1 +1 @@
var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,o=(t,a,r)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,c=(e,t)=>{for(var a in t||(t={}))s.call(t,a)&&o(e,a,t[a]);if(r)for(var a of r(t))l.call(t,a)&&o(e,a,t[a]);return e};import{r as n,R as i,J as m,k as p,j as d,g}from"./vendor.55942996.js";import{a as _,F as u}from"./index.esm.54899aec.js";import{f as v}from"./logs.c73f6324.js";import{c as x,w as f,x as E,y as h,C as b,S as y,z as j,A as N,g as z}from"./index.fbdc8494.js";import{d as w}from"./debounce.cc85a806.js";import{u as C}from"./useRemainingViewPortHeight.c4100a43.js";var O="_RuleSearch_1gcst_1",P="_RuleSearchContainer_1gcst_5",S="_inputWrapper_1gcst_10",T="_input_1gcst_10",k="_iconWrapper_1gcst_35";var L=x((e=>({searchText:f(e),updateSearchText:E})))((function({dispatch:e,searchText:t,updateSearchText:a}){const[r,s]=n.exports.useState(t),l=n.exports.useCallback((t=>{e(a(t))}),[e,a]),o=n.exports.useMemo((()=>w(l,300)),[l]);return i.createElement("div",{className:O},i.createElement("div",{className:P},i.createElement("div",{className:S},i.createElement("input",{type:"text",value:r,onChange:e=>{s(e.target.value),o(e.target.value)},className:T})),i.createElement("div",{className:k},i.createElement(m,{size:20}))))}));var R="_logMeta_zl5cd_1",W="_logType_zl5cd_8",D="_logTime_zl5cd_18",I="_logText_zl5cd_24",M="_logsWrapper_zl5cd_37",A="_log_zl5cd_1",B="_logPlaceholder_zl5cd_54",F="_logPlaceholderIcon_zl5cd_67";const{useCallback:H,memo:J,useEffect:K}=d,V={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function q({time:e,even:t,payload:a,type:r}){const s=g({even:t},A);return n.exports.createElement("div",{className:s},n.exports.createElement("div",{className:R},n.exports.createElement("div",{className:D},e),n.exports.createElement("div",{className:W,style:{backgroundColor:V[r]}},r),n.exports.createElement("div",{className:I},a)))}function G(e,t){return t[e].id}const Q=J((({index:e,style:t,data:a})=>{const r=a[e];return n.exports.createElement("div",{style:t},n.exports.createElement(q,c({},r)))}),_);var U=x((e=>({logs:j(e),logLevel:N(e),apiConfig:z(e)})))((function({dispatch:e,logLevel:r,apiConfig:s,logs:l}){const o=H((t=>e(h(t))),[e]);K((()=>{var e;v((e=c({},s),t(e,a({logLevel:r}))),o)}),[s,r,o]);const[i,m]=C(),{t:d}=p();return n.exports.createElement("div",null,n.exports.createElement(b,{title:d("Logs")}),n.exports.createElement(L,null),n.exports.createElement("div",{ref:i,style:{paddingBottom:30}},0===l.length?n.exports.createElement("div",{className:B,style:{height:m-30}},n.exports.createElement("div",{className:F},n.exports.createElement(y,{width:200,height:200})),n.exports.createElement("div",null,d("no_logs"))):n.exports.createElement("div",{className:M},n.exports.createElement(u,{height:m-30,width:"100%",itemCount:l.length,itemSize:80,itemData:l,itemKey:G},Q))))}));export default U;
var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,o=(t,a,r)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,c=(e,t)=>{for(var a in t||(t={}))s.call(t,a)&&o(e,a,t[a]);if(r)for(var a of r(t))l.call(t,a)&&o(e,a,t[a]);return e};import{r as n,R as i,J as m,k as p,j as d,g}from"./vendor.3b6f54f7.js";import{a as _,F as u}from"./index.esm.023d01c8.js";import{f as v}from"./logs.f9f72571.js";import{c as x,w as f,x as E,y as h,C as b,S as y,z as j,A as N,g as z}from"./index.82cbac0a.js";import{d as w}from"./debounce.cc85a806.js";import{u as C}from"./useRemainingViewPortHeight.c7e29e4e.js";var O="_RuleSearch_1gcst_1",P="_RuleSearchContainer_1gcst_5",S="_inputWrapper_1gcst_10",T="_input_1gcst_10",k="_iconWrapper_1gcst_35";var L=x((e=>({searchText:f(e),updateSearchText:E})))((function({dispatch:e,searchText:t,updateSearchText:a}){const[r,s]=n.exports.useState(t),l=n.exports.useCallback((t=>{e(a(t))}),[e,a]),o=n.exports.useMemo((()=>w(l,300)),[l]);return i.createElement("div",{className:O},i.createElement("div",{className:P},i.createElement("div",{className:S},i.createElement("input",{type:"text",value:r,onChange:e=>{s(e.target.value),o(e.target.value)},className:T})),i.createElement("div",{className:k},i.createElement(m,{size:20}))))}));var R="_logMeta_zl5cd_1",W="_logType_zl5cd_8",D="_logTime_zl5cd_18",I="_logText_zl5cd_24",M="_logsWrapper_zl5cd_37",A="_log_zl5cd_1",B="_logPlaceholder_zl5cd_54",F="_logPlaceholderIcon_zl5cd_67";const{useCallback:H,memo:J,useEffect:K}=d,V={debug:"#28792c",info:"var(--bg-log-info-tag)",warning:"#b99105",error:"#c11c1c"};function q({time:e,even:t,payload:a,type:r}){const s=g({even:t},A);return n.exports.createElement("div",{className:s},n.exports.createElement("div",{className:R},n.exports.createElement("div",{className:D},e),n.exports.createElement("div",{className:W,style:{backgroundColor:V[r]}},r),n.exports.createElement("div",{className:I},a)))}function G(e,t){return t[e].id}const Q=J((({index:e,style:t,data:a})=>{const r=a[e];return n.exports.createElement("div",{style:t},n.exports.createElement(q,c({},r)))}),_);var U=x((e=>({logs:j(e),logLevel:N(e),apiConfig:z(e)})))((function({dispatch:e,logLevel:r,apiConfig:s,logs:l}){const o=H((t=>e(h(t))),[e]);K((()=>{var e;v((e=c({},s),t(e,a({logLevel:r}))),o)}),[s,r,o]);const[i,m]=C(),{t:d}=p();return n.exports.createElement("div",null,n.exports.createElement(b,{title:d("Logs")}),n.exports.createElement(L,null),n.exports.createElement("div",{ref:i,style:{paddingBottom:30}},0===l.length?n.exports.createElement("div",{className:B,style:{height:m-30}},n.exports.createElement("div",{className:F},n.exports.createElement(y,{width:200,height:200})),n.exports.createElement("div",null,d("no_logs"))):n.exports.createElement("div",{className:M},n.exports.createElement(u,{height:m-30,width:"100%",itemCount:l.length,itemSize:80,itemData:l,itemKey:G},Q))))}));export default U;

View File

@ -1 +0,0 @@
._RuleSearch_1gcst_1{padding:0 40px 5px}._RuleSearchContainer_1gcst_5{position:relative;height:40px}._inputWrapper_1gcst_10{position:absolute;top:50%;transform:translateY(-50%);left:0;width:100%}._input_1gcst_10{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:0;padding:0 15px 0 35px;transition:border-color .2s cubic-bezier(.645, .045, .355, 1);width:100%}._iconWrapper_1gcst_35{position:absolute;top:50%;transform:translateY(-50%);left:10px}._logMeta_zl5cd_1{display:flex;align-items:center;flex-wrap:wrap;font-size:.9em}._logType_zl5cd_8{color:#eee;flex-shrink:0;text-align:center;width:66px;border-radius:100px;padding:3px 5px;margin:0 8px}._logTime_zl5cd_18{flex-shrink:0;color:#999;font-size:14px}._logText_zl5cd_24{flex-shrink:0;display:flex;font-family:"Roboto Mono",Menlo,monospace;align-items:center;padding:8px 0;width:100%;white-space:pre;overflow:auto}._logsWrapper_zl5cd_37{margin:0;padding:0;color:var(--color-text)}._logsWrapper_zl5cd_37 li{background:var(--color-background)}._logsWrapper_zl5cd_37 li.even{background:var(--color-background)}._log_zl5cd_1{padding:10px 40px}._logPlaceholder_zl5cd_54{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#2d2d30}._logPlaceholder_zl5cd_54 div:nth-child(2){color:var(--color-text-secondary);font-size:1.4em;opacity:.6}._logPlaceholderIcon_zl5cd_67{opacity:.3}

View File

@ -0,0 +1 @@
._FlexCenter_1380a_1{display:flex;justify-content:center;align-items:center}._header_1y9js_1{display:flex;align-items:center}._header_1y9js_1:focus{outline:none}._header_1y9js_1 ._arrow_1y9js_8{display:inline-flex;-webkit-transform:rotate(0deg);transform:rotate(0);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}._header_1y9js_1 ._arrow_1y9js_8._isOpen_1y9js_13{-webkit-transform:rotate(180deg);transform:rotate(180deg)}._header_1y9js_1 ._arrow_1y9js_8:focus{outline:var(--color-focus-blue) solid 1px}._btn_1y9js_20{margin-left:5px}._qty_1y9js_25{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._header_1g0y5_1{margin-bottom:12px}._zapWrapper_1g0y5_5{width:20px;height:20px;display:flex;align-items:center;justify-content:center}._proxy_sq0tg_1{margin:3px;padding:5px;position:relative;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;outline:none;border:1px solid transparent;max-width:280px;background-color:var(--color-bg-proxy)}._proxy_sq0tg_1:focus{border:1px solid var(--color-focus-blue)}@media screen and (min-width: 30em){._proxy_sq0tg_1{min-width:200px;border-radius:10px;padding:10px}}._proxy_sq0tg_1._now_sq0tg_25{background-color:var(--color-focus-blue);color:#ddd}._proxy_sq0tg_1._error_sq0tg_29{opacity:.5}._proxy_sq0tg_1._selectable_sq0tg_32{transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;cursor:pointer}._proxy_sq0tg_1._selectable_sq0tg_32:hover{-webkit-transform:translateY(-2px);transform:translateY(-2px)}._proxyType_sq0tg_40{font-family:var(--font-mono);font-size:.6em;margin-right:3px}@media screen and (min-width: 30em){._proxyType_sq0tg_40{font-size:.85em}}._row_sq0tg_51{display:flex;align-items:center;justify-content:space-between}._proxyName_sq0tg_57{width:100%;margin-bottom:5px;font-size:.85em}@media screen and (min-width: 30em){._proxyName_sq0tg_57{font-size:1em}}._proxySmall_sq0tg_68{width:13px;height:13px;border-radius:50%;border:1px solid var(--color-background)}._proxySmall_sq0tg_68._now_sq0tg_25{border-color:var(--color-text-secondary)}._proxySmall_sq0tg_68._selectable_sq0tg_32{transition:-webkit-transform .1s ease-in-out;transition:transform .1s ease-in-out;transition:transform .1s ease-in-out,-webkit-transform .1s ease-in-out;cursor:pointer}._proxySmall_sq0tg_68._selectable_sq0tg_32:hover{-webkit-transform:scale(1.2);transform:scale(1.2)}._proxyLatency_15kyb_1{border-radius:20px;color:#eee;font-size:.6em}@media screen and (min-width: 30em){._proxyLatency_15kyb_1{font-size:1em}}._list_10y5m_1{display:flex;flex-wrap:wrap;margin:8px 0 8px -3px}._listSummaryView_10y5m_8{margin:8px 0;display:grid;grid-template-columns:repeat(auto-fill,13px);grid-gap:10px}._updatedAt_1ql33_1{margin-bottom:12px}._updatedAt_1ql33_1 small{color:#777}._body_1ql33_8{padding:10px 15px}@media screen and (min-width: 30em){._body_1ql33_8{padding:10px 40px}}._actionFooter_1ql33_17{display:flex}._actionFooter_1ql33_17 button{margin:0 5px}._actionFooter_1ql33_17 button:first-child{margin-left:0}._refresh_1ql33_27{display:flex;justify-content:center;align-items:center;cursor:pointer}._labeledInput_cmki0_1{max-width:85vw;width:400px;display:flex;justify-content:space-between;align-items:center;font-size:13px;padding:13px 0}hr{height:1px;background-color:var(--color-separator);border:none;outline:none;margin:1rem 0}._overlay_uuk3b_1{background-color:#0009}._cnt_uuk3b_5{position:absolute;background-color:var(--bg-modal);color:var(--color-text);line-height:1.4;opacity:.6;transition:all .3s ease;-webkit-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);box-shadow:#0000001f 0 4px 4px,#0000003d 0 16px 32px}._afterOpen_uuk3b_16{opacity:1;-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}._topBar_jgy4z_1{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;z-index:1;background-color:var(--color-background2);-webkit-backdrop-filter:blur(36px);backdrop-filter:blur(36px)}._topBarRight_jgy4z_13{display:flex;align-items:center;flex-wrap:wrap;flex:1;justify-content:flex-end;margin-right:20px}._textFilterContainer_jgy4z_22{max-width:350px;min-width:150px;flex:1;margin-right:8px}._group_jgy4z_29{padding:10px 15px}@media screen and (min-width: 30em){._group_jgy4z_29{padding:10px 40px}}

View File

@ -1 +0,0 @@
._FlexCenter_1380a_1{display:flex;justify-content:center;align-items:center}._header_1y9js_1{display:flex;align-items:center}._header_1y9js_1:focus{outline:0}._header_1y9js_1 ._arrow_1y9js_8{display:inline-flex;transform:rotate(0);transition:transform .3s}._header_1y9js_1 ._arrow_1y9js_8._isOpen_1y9js_13{transform:rotate(180deg)}._header_1y9js_1 ._arrow_1y9js_8:focus{outline:var(--color-focus-blue) solid 1px}._btn_1y9js_20{margin-left:5px}._qty_1y9js_25{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}._header_1g0y5_1{margin-bottom:12px}._zapWrapper_1g0y5_5{width:20px;height:20px;display:flex;align-items:center;justify-content:center}._proxy_sq0tg_1{margin:3px;padding:5px;position:relative;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;outline:0;border:1px solid transparent;max-width:280px;background-color:var(--color-bg-proxy)}._proxy_sq0tg_1:focus{border:1px solid var(--color-focus-blue)}@media screen and (min-width:30em){._proxy_sq0tg_1{min-width:200px;border-radius:10px;padding:10px}}._proxy_sq0tg_1._now_sq0tg_25{background-color:var(--color-focus-blue);color:#ddd}._proxy_sq0tg_1._error_sq0tg_29{opacity:.5}._proxy_sq0tg_1._selectable_sq0tg_32{transition:transform .2s ease-in-out;cursor:pointer}._proxy_sq0tg_1._selectable_sq0tg_32:hover{transform:translateY(-2px)}._proxyType_sq0tg_40{font-family:var(--font-mono);font-size:.6em;margin-right:3px}@media screen and (min-width:30em){._proxyType_sq0tg_40{font-size:.85em}}._row_sq0tg_51{display:flex;align-items:center;justify-content:space-between}._proxyName_sq0tg_57{width:100%;margin-bottom:5px;font-size:.85em}@media screen and (min-width:30em){._proxyName_sq0tg_57{font-size:1em}}._proxySmall_sq0tg_68{width:13px;height:13px;border-radius:50%;border:1px solid var(--color-background)}._proxySmall_sq0tg_68._now_sq0tg_25{border-color:var(--color-text-secondary)}._proxySmall_sq0tg_68._selectable_sq0tg_32{transition:transform .1s ease-in-out;cursor:pointer}._proxySmall_sq0tg_68._selectable_sq0tg_32:hover{transform:scale(1.2)}._proxyLatency_15kyb_1{border-radius:20px;color:#eee;font-size:.6em}@media screen and (min-width:30em){._proxyLatency_15kyb_1{font-size:1em}}._list_10y5m_1{margin:8px 0;display:flex;flex-wrap:wrap;margin-left:-3px}._listSummaryView_10y5m_8{margin:8px 0;display:grid;grid-template-columns:repeat(auto-fill,13px);grid-gap:10px}._updatedAt_1ql33_1{margin-bottom:12px}._updatedAt_1ql33_1 small{color:#777}._body_1ql33_8{padding:10px 15px}@media screen and (min-width:30em){._body_1ql33_8{padding:10px 40px}}._actionFooter_1ql33_17{display:flex}._actionFooter_1ql33_17 button{margin:0 5px}._actionFooter_1ql33_17 button:first-child{margin-left:0}._refresh_1ql33_27{display:flex;justify-content:center;align-items:center;cursor:pointer}._labeledInput_cmki0_1{max-width:85vw;width:400px;display:flex;justify-content:space-between;align-items:center;font-size:13px;padding:13px 0}hr{height:1px;background-color:var(--color-separator);border:none;outline:0;margin:1rem 0}._overlay_uuk3b_1{background-color:rgba(0,0,0,.6)}._cnt_uuk3b_5{position:absolute;background-color:var(--bg-modal);color:var(--color-text);line-height:1.4;opacity:.6;transition:all .3s ease;transform:translate(-50%,-50%) scale(1.2);box-shadow:rgba(0,0,0,.12) 0 4px 4px,rgba(0,0,0,.24) 0 16px 32px}._afterOpen_uuk3b_16{opacity:1;transform:translate(-50%,-50%) scale(1)}._topBar_jgy4z_1{position:-webkit-sticky;position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;z-index:1;background-color:var(--color-background2);-webkit-backdrop-filter:blur(36px);backdrop-filter:blur(36px)}._topBarRight_jgy4z_13{display:flex;align-items:center;flex-wrap:wrap;flex:1;justify-content:flex-end;margin-right:20px}._textFilterContainer_jgy4z_22{max-width:350px;min-width:150px;flex:1;margin-right:8px}._group_jgy4z_29{padding:10px 15px}@media screen and (min-width:30em){._group_jgy4z_29{padding:10px 40px}}

View File

@ -1 +0,0 @@
._RuleProviderItem_ly9yn_1{display:grid;grid-template-columns:40px 1fr 46px;height:100%}._left_ly9yn_7{display:inline-flex;align-items:center;color:var(--color-text-secondary);opacity:.4}._middle_ly9yn_14{display:grid;grid-template-rows:1fr auto auto;align-items:center}._gray_ly9yn_20{color:#777}._refreshButtonWrapper_ly9yn_24{display:grid;place-items:center;opacity:0;transition:opacity .2s}._RuleProviderItem_ly9yn_1:hover ._refreshButtonWrapper_ly9yn_24{opacity:1}._rule_1ymqx_1{display:flex;align-items:center;padding:6px 15px}@media screen and (min-width:30em){._rule_1ymqx_1{padding:10px 40px}}._left_1ymqx_12{width:40px;padding-right:15px;color:var(--color-text-secondary);opacity:.4}._a_1ymqx_19{display:flex;align-items:center;font-size:12px;opacity:.8}._b_1ymqx_26{padding:10px 0;font-family:"Roboto Mono",Menlo,monospace;font-size:16px}@media screen and (min-width:30em){._b_1ymqx_26{font-size:19px}}._type_1ymqx_37{width:110px}._header_1j1w3_1{display:grid;grid-template-columns:1fr minmax(auto,330px);align-items:center;padding-right:15px}@media screen and (min-width:30em){._header_1j1w3_1{padding-right:40px}}._RuleProviderItemWrapper_1j1w3_17{padding:6px 15px}@media screen and (min-width:30em){._RuleProviderItemWrapper_1j1w3_17{padding:10px 40px}}

View File

@ -0,0 +1 @@
._RuleProviderItem_ly9yn_1{display:grid;grid-template-columns:40px 1fr 46px;height:100%}._left_ly9yn_7{display:inline-flex;align-items:center;color:var(--color-text-secondary);opacity:.4}._middle_ly9yn_14{display:grid;grid-template-rows:1fr auto auto;align-items:center}._gray_ly9yn_20{color:#777}._refreshButtonWrapper_ly9yn_24{display:grid;place-items:center;opacity:0;transition:opacity .2s}._RuleProviderItem_ly9yn_1:hover ._refreshButtonWrapper_ly9yn_24{opacity:1}._rule_1ymqx_1{display:flex;align-items:center;padding:6px 15px}@media screen and (min-width: 30em){._rule_1ymqx_1{padding:10px 40px}}._left_1ymqx_12{width:40px;padding-right:15px;color:var(--color-text-secondary);opacity:.4}._a_1ymqx_19{display:flex;align-items:center;font-size:12px;opacity:.8}._b_1ymqx_26{padding:10px 0;font-family:"Roboto Mono",Menlo,monospace;font-size:16px}@media screen and (min-width: 30em){._b_1ymqx_26{font-size:19px}}._type_1ymqx_37{width:110px}._header_1j1w3_1{display:grid;grid-template-columns:1fr minmax(auto,330px);align-items:center;padding-right:15px}@media screen and (min-width: 30em){._header_1j1w3_1{padding-right:40px}}._RuleProviderItemWrapper_1j1w3_17{padding:6px 15px}@media screen and (min-width: 30em){._RuleProviderItemWrapper_1j1w3_17{padding:10px 40px}}

View File

@ -1 +1 @@
import{r as e}from"./vendor.55942996.js";var t="_select_1mr76_1";function o({options:o,selected:r,onChange:a}){return e.exports.createElement("select",{className:t,value:r,onChange:a},o.map((([t,o])=>e.exports.createElement("option",{key:t,value:t},o))))}export{o as S};
import{r as e}from"./vendor.3b6f54f7.js";var t="_select_1mr76_1";function o({options:o,selected:r,onChange:a}){return e.exports.createElement("select",{className:t,value:r,onChange:a},o.map((([t,o])=>e.exports.createElement("option",{key:t,value:t},o))))}export{o as S};

View File

@ -1 +1 @@
._select_1mr76_1{height:40px;line-height:1.5;width:100%;padding-left:8px;-webkit-appearance:none;appearance:none;background-color:var(--color-input-bg);color:var(--color-text);padding-right:20px;border-radius:4px;border:1px solid var(--color-input-border);background-image:url(data:image/svg+xml,%0A%20%20%20%20%3Csvg%20width%3D%228%22%20height%3D%2224%22%20viewBox%3D%220%200%208%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%207L7%2011H1L4%207Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%2017L1%2013L7%2013L4%2017Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%3C%2Fsvg%3E%0A%20%20);background-position:right 8px center;background-repeat:no-repeat}._select_1mr76_1:focus,._select_1mr76_1:hover{border-color:#343434;outline:0!important;color:var(--color-text-highlight);background-image:var(--select-bg-hover)}._select_1mr76_1:focus{box-shadow:rgba(66,153,225,.6) 0 0 0 3px}._select_1mr76_1 option{background-color:var(--color-background)}
._select_1mr76_1{height:40px;line-height:1.5;width:100%;padding-left:8px;-webkit-appearance:none;appearance:none;background-color:var(--color-input-bg);color:var(--color-text);padding-right:20px;border-radius:4px;border:1px solid var(--color-input-border);background-image:url(data:image/svg+xml,%0A%20%20%20%20%3Csvg%20width%3D%228%22%20height%3D%2224%22%20viewBox%3D%220%200%208%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%207L7%2011H1L4%207Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%20%20%3Cpath%20d%3D%22M4%2017L1%2013L7%2013L4%2017Z%22%20fill%3D%22%23999999%22%20%2F%3E%0A%20%20%20%20%3C%2Fsvg%3E%0A%20%20);background-position:right 8px center;background-repeat:no-repeat}._select_1mr76_1:hover,._select_1mr76_1:focus{border-color:#343434;outline:none!important;color:var(--color-text-highlight);background-image:var(--select-bg-hover)}._select_1mr76_1:focus{box-shadow:#4299e199 0 0 0 3px}._select_1mr76_1 option{background-color:var(--color-background)}

View File

@ -1 +1 @@
import{g as e,r as t,N as a,K as s,j as r}from"./vendor.55942996.js";import{d as n}from"./debounce.cc85a806.js";var o="_rotate_1dspl_1",c="_isRotating_1dspl_5";function l({isRotating:s}){const r=e(o,{[c]:s});return t.exports.createElement("span",{className:r},t.exports.createElement(a,{width:16}))}const{useCallback:u,useState:p,useMemo:i}=r;var m="_input_16a1f_1";function _(e){const[a,r]=function(e){const[,t]=s(e),[a,r]=p(""),o=i((()=>n(t,300)),[t]);return[u((e=>{r(e.target.value),o(e.target.value)}),[o]),a]}(e.textAtom);return t.exports.createElement("input",{className:m,type:"text",value:r,onChange:a,placeholder:e.placeholder})}export{l as R,_ as T};
import{g as e,r as t,N as a,K as s,j as r}from"./vendor.3b6f54f7.js";import{d as n}from"./debounce.cc85a806.js";var o="_rotate_1dspl_1",c="_isRotating_1dspl_5";function l({isRotating:s}){const r=e(o,{[c]:s});return t.exports.createElement("span",{className:r},t.exports.createElement(a,{width:16}))}const{useCallback:u,useState:p,useMemo:i}=r;var m="_input_16a1f_1";function _(e){const[a,r]=function(e){const[,t]=s(e),[a,r]=p(""),o=i((()=>n(t,300)),[t]);return[u((e=>{r(e.target.value),o(e.target.value)}),[o]),a]}(e.textAtom);return t.exports.createElement("input",{className:m,type:"text",value:r,onChange:a,placeholder:e.placeholder})}export{l as R,_ as T};

View File

@ -0,0 +1 @@
._rotate_1dspl_1{display:inline-flex}._isRotating_1dspl_5{-webkit-animation:_rotating_1dspl_1 3s infinite linear;animation:_rotating_1dspl_1 3s infinite linear;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@-webkit-keyframes _rotating_1dspl_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes _rotating_1dspl_1{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}._input_16a1f_1{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;outline:none;padding:8px 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._input_16a1f_1:focus{border:1px solid var(--color-focus-blue)}

View File

@ -1 +0,0 @@
._rotate_1dspl_1{display:inline-flex}._isRotating_1dspl_5{animation:_rotating_1dspl_1 3s infinite linear;animation-fill-mode:forwards}@keyframes _rotating_1dspl_1{from{transform:rotate(0)}to{transform:rotate(360deg)}}._input_16a1f_1{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:20px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;outline:0;padding:8px 15px;transition:border-color .2s cubic-bezier(.645, .045, .355, 1);width:100%}._input_16a1f_1:focus{border:1px solid var(--color-focus-blue)}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import{r as t,R as n}from"./vendor.55942996.js";
import{r as t,R as n}from"./vendor.3b6f54f7.js";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;import{r as l,t as c,v as i}from"./index.fbdc8494.js";const g=new TextDecoder("utf-8");let u,f,d,p,b,v=!1,O=!1,m="";function y(e,t){let r;try{r=JSON.parse(e)}catch(s){console.log("JSON.parse error",JSON.parse(e))}const o=new Date,n=function(e){const t=e.getFullYear()%100,r=i(e.getMonth()+1,2),o=i(e.getDate(),2),n=i(e.getHours(),2),s=i(e.getMinutes(),2),a=i(e.getSeconds(),2);return`${t}-${r}-${o} ${n}:${s}:${a}`}(o);r.time=n,r.id=+o-0+Math.floor(65536*(1+Math.random())).toString(16),r.even=v=!v,t(r)}function h(e,t){return e.read().then((({done:r,value:o})=>{const n=g.decode(o,{stream:!r});m+=n;const s=m.split("\n"),a=s[s.length-1];for(let e=0;e<s.length-1;e++)y(s[e],t);return r?(y(a,t),m="",console.log("GET /logs streaming done"),void(O=!1)):(m=a,h(e,t))}))}function j(e){const t=Object.keys(e);return t.sort(),t.map((t=>e[t])).join("|")}function w(e,i){if("uninit"===e.logLevel)return;if(O||1===b)return;f=i,b=1;const g=l(e,"/logs");u=new WebSocket(g),u.addEventListener("error",(()=>{b=3,function(e,l){if(p&&j(e)!==d)p.abort();else if(O)return;O=!0,d=j(e),p=new AbortController;const i=p.signal,{url:g,init:u}=c(e);fetch(g+"/logs?level="+e.logLevel,(f=((e,t)=>{for(var r in t||(t={}))n.call(t,r)&&a(e,r,t[r]);if(o)for(var r of o(t))s.call(t,r)&&a(e,r,t[r]);return e})({},u),b={signal:i},t(f,r(b)))).then((e=>{h(e.body.getReader(),l)}),(e=>{O=!1,i.aborted||console.log("GET /logs error:",e.message)}));var f,b}(e,i)})),u.addEventListener("message",(function(e){y(e.data,i)}))}function S(e){f&&u&&(u.close(),b=3,O=!1,w(e,f))}export{w as f,S as r};
var e=Object.defineProperty,t=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(t,r,o)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;import{r as l,t as c,v as i}from"./index.82cbac0a.js";const g=new TextDecoder("utf-8");let u,f,d,p,b,v=!1,O=!1,m="";function y(e,t){let r;try{r=JSON.parse(e)}catch(s){console.log("JSON.parse error",JSON.parse(e))}const o=new Date,n=function(e){const t=e.getFullYear()%100,r=i(e.getMonth()+1,2),o=i(e.getDate(),2),n=i(e.getHours(),2),s=i(e.getMinutes(),2),a=i(e.getSeconds(),2);return`${t}-${r}-${o} ${n}:${s}:${a}`}(o);r.time=n,r.id=+o-0+Math.floor(65536*(1+Math.random())).toString(16),r.even=v=!v,t(r)}function h(e,t){return e.read().then((({done:r,value:o})=>{const n=g.decode(o,{stream:!r});m+=n;const s=m.split("\n"),a=s[s.length-1];for(let e=0;e<s.length-1;e++)y(s[e],t);return r?(y(a,t),m="",console.log("GET /logs streaming done"),void(O=!1)):(m=a,h(e,t))}))}function j(e){const t=Object.keys(e);return t.sort(),t.map((t=>e[t])).join("|")}function w(e,i){if("uninit"===e.logLevel)return;if(O||1===b)return;f=i,b=1;const g=l(e,"/logs");u=new WebSocket(g),u.addEventListener("error",(()=>{b=3,function(e,l){if(p&&j(e)!==d)p.abort();else if(O)return;O=!0,d=j(e),p=new AbortController;const i=p.signal,{url:g,init:u}=c(e);fetch(g+"/logs?level="+e.logLevel,(f=((e,t)=>{for(var r in t||(t={}))n.call(t,r)&&a(e,r,t[r]);if(o)for(var r of o(t))s.call(t,r)&&a(e,r,t[r]);return e})({},u),b={signal:i},t(f,r(b)))).then((e=>{h(e.body.getReader(),l)}),(e=>{O=!1,i.aborted||console.log("GET /logs error:",e.message)}));var f,b}(e,i)})),u.addEventListener("message",(function(e){y(e.data,i)}))}function S(e){f&&u&&(u.close(),b=3,O=!1,w(e,f))}export{w as f,S as r};

View File

@ -1 +1 @@
import{j as e}from"./vendor.55942996.js";const{useState:n,useRef:t,useCallback:o,useLayoutEffect:r}=e;function s(){const e=t(null),[s,i]=n(200),u=o((()=>{const{top:n}=e.current.getBoundingClientRect();i(window.innerHeight-n)}),[]);return r((()=>(u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)})),[u]),[e,s]}export{s as u};
import{j as e}from"./vendor.3b6f54f7.js";const{useState:n,useRef:t,useCallback:o,useLayoutEffect:r}=e;function s(){const e=t(null),[s,i]=n(200),u=o((()=>{const{top:n}=e.current.getBoundingClientRect();i(window.innerHeight-n)}),[]);return r((()=>(u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)})),[u]),[e,s]}export{s as u};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,10 +13,10 @@
<meta name="description" content="Yet Another Clash Dashboard" />
<meta name="theme-color" content="#202020" />
<title>yacd</title>
<script type="module" crossorigin src="./assets/index.fbdc8494.js"></script>
<link rel="modulepreload" href="./assets/vendor.55942996.js">
<link rel="stylesheet" href="./assets/index.f4bcc580.css">
<link rel="manifest" href="./manifest.webmanifest"></head>
<script type="module" crossorigin src="./assets/index.82cbac0a.js"></script>
<link rel="modulepreload" href="./assets/vendor.3b6f54f7.js">
<link rel="stylesheet" href="./assets/index.acc275a1.css">
<link rel="manifest" href="./manifest.webmanifest"></head>
<body>
<div id="app" data-base-url="http://127.0.0.1:9090"></div>

File diff suppressed because one or more lines are too long

View File

@ -16,13 +16,48 @@ yml_other_set()
end
begin
if $3 == 1 then
#script
for i in ['/etc/openclash/custom/openclash_custom_rules.list','/etc/openclash/custom/openclash_custom_rules_2.list'] do
if File::exist?(i) then
Value_1 = YAML.load_file(i)
if Value_1 != false then
if Value_1.class.to_s == 'Hash' then
if Value_1['script'] then
if Value.key?('script') and not Value['script'].to_a.empty? then
if Value['script'].key?('code') and Value_1['script'].key?('code') then
Value['script']['code'].merge!(Value_1['script']['code']).uniq
elsif Value_1['script'].key?('code') then
Value['script']['code'] = Value_1['script']['code']
end
if Value['script'].key?('shortcuts') and Value_1['script'].key?('shortcuts')
Value['script']['shortcuts'].merge!(Value_1['script']['shortcuts']).uniq
elsif Value_1['script'].key?('shortcuts') then
Value['script']['shortcuts'] = Value_1['script']['shortcuts']
end
else
Value['script'] = Value_1['script']
end
end
end
end
end
end;
#rules
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list')
if Value_1 != false then
Value_2 = Value_1.reverse!
Value_2.each{|x| Value['rules'].insert(0,x)}
Value['rules']=Value['rules'].uniq
if Value_1.class.to_s == 'Hash' then
if not Value_1['rules'].to_a.empty? then
Value_2 = Value_1['rules'].to_a.reverse!
end
else
Value_2 = Value_1.reverse!
end
if defined? Value_2 then
Value_2.each{|x| Value['rules'].insert(0,x)}
Value['rules'] = Value['rules'].uniq
end
end
end
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
@ -30,31 +65,59 @@ yml_other_set()
if Value_3 != false then
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
ruby_add_index ||= -1
Value_4 = Value_3.reverse!
Value_4.each{|x| Value['rules'].insert(ruby_add_index,x)}
Value['rules']=Value['rules'].uniq
if Value_3.class.to_s == 'Hash' then
if not Value_3['rules'].to_a.empty? then
Value_4 = Value_3['rules'].to_a.reverse!
end
else
Value_4 = Value_3.reverse!
end
if defined? Value_4 then
Value_4.each{|x| Value['rules'].insert(ruby_add_index,x)}
Value['rules'] = Value['rules'].uniq
end
end
end
else
if File::exist?('/etc/openclash/custom/openclash_custom_rules.list') then
Value_1 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules.list')
if Value_1 != false then
Value['rules']=Value_1
Value['rules']=Value['rules'].uniq
if Value_1.class.to_s == 'Hash' then
if not Value_1['rules'].to_a.empty? then
Value['rules'] = Value_1['rules']
end
else
Value['rules'] = Value_1
end
Value['rules'] = Value['rules'].uniq
end
end
if File::exist?('/etc/openclash/custom/openclash_custom_rules_2.list') then
Value_2 = YAML.load_file('/etc/openclash/custom/openclash_custom_rules_2.list')
if Value_2 != false then
if Value['rules'].to_a.empty? then
Value['rules']=Value_2
if Value_2.class.to_s == 'Hash' then
if not Value_2['rules'].to_a.empty? then
Value['rules'] = Value_2['rules']
end
else
Value['rules'] = Value_2
end
else
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
ruby_add_index ||= -1
Value_3 = Value_2.reverse!
Value_3.each{|x| Value['rules'].insert(ruby_add_index,x)}
if Value_2.class.to_s == 'Hash' then
if not Value_2['rules'].to_a.empty? then
Value_3 = Value_2['rules'].to_a.reverse!
end
else
Value_3 = Value_2.reverse!
end
if defined? Value_3 then
Value_3.each{|x| Value['rules'].insert(ruby_add_index,x)}
end
end
Value['rules']=Value['rules'].uniq
Value['rules'] = Value['rules'].uniq
end
end
end
@ -120,10 +183,8 @@ yml_other_set()
end
begin
if Value.has_key?('rules') and not Value['rules'].to_a.empty? then
if Value['rules'].to_a.grep(/(?=.*198.18)(?=.*REJECT)/).empty? then
ruby_add_index = Value['rules'].index(Value['rules'].grep(/(GEOIP|MATCH|FINAL)/).first)
ruby_add_index ||= -1
Value['rules']=Value['rules'].to_a.insert(ruby_add_index,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve')
if Value['rules'].to_a.grep(/(?=.*198.18.0)(?=.*REJECT)/).empty? then
Value['rules']=Value['rules'].to_a.insert(0,'IP-CIDR,198.18.0.1/16,REJECT,no-resolve')
end
else
Value['rules']=%w(IP-CIDR,198.18.0.1/16,REJECT,no-resolve)