更新WEB登陆按钮,更醒目。

This commit is contained in:
SirPdboy 2023-02-24 14:28:34 +08:00 committed by GitHub
parent 8956caed4e
commit 4775539efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 56 deletions

View File

@ -24,25 +24,24 @@ o.placeholder=3000
o.default=3000 o.default=3000
o.datatype="port" o.datatype="port"
o.optional = false 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.."/')\"/>") o.description = translate("<input type='button' style='width:210px; border-color:Teal; text-align:center; font-weight:bold;color:Green;background:#f36c21;' value='AdGuardHome Web:" .. httpport .. "' onclick=\"window.open('http://'+window.location.hostname+':" .. httpport .. "')\"/>")
---- update warning not safe ---- update warning not safe
local binmtime=uci:get("AdGuardHome","AdGuardHome","binmtime") or "0" local binmtime=uci:get("AdGuardHome","AdGuardHome","binmtime") or "0"
local e="" local e=""
if not fs.access(configpath) then if not fs.access(configpath) then e = e .. " " .. translate("no config") end
e=e.." "..translate("no config")
end
if not fs.access(binpath) then if not fs.access(binpath) then
e=e.." "..translate("no core") e=e.." "..translate("no core")
else else
local version=uci:get("AdGuardHome","AdGuardHome","version") local version=uci:get("AdGuardHome","AdGuardHome","version")
local testtime=fs.stat(binpath,"mtime") local testtime=fs.stat(binpath,"mtime")
if testtime~=tonumber(binmtime) or version==nil then if testtime~=tonumber(binmtime) or version==nil then
local tmp=luci.sys.exec(binpath.." --version | grep -m 1 -E 'v[0-9.]+' -o ") -- local tmp=luci.sys.exec(binpath.." -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o")
version=string.sub(tmp, 1) -- version=string.sub(tmp, 1, -2)
if version=="" then version="core error" end version = luci.sys.exec(string.format("echo -n $(%s --version 2>&1 | awk -F 'version ' '{print $2}' | awk -F ',' '{print $1}')", binpath))
uci:set("AdGuardHome","AdGuardHome","version",version) if version == "" then version = "core error" end
uci:set("AdGuardHome","AdGuardHome","binmtime",testtime) uci:set("AdGuardHome", "AdGuardHome", "version", version)
uci:save("AdGuardHome") uci:set("AdGuardHome", "AdGuardHome", "binmtime", testtime)
uci:commit("AdGuardHome")
end end
e=version..e e=version..e
end end

View File

@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
binpath=$(uci get AdGuardHome.AdGuardHome.binpath) binpath=$(uci get AdGuardHome.AdGuardHome.binpath)
if [ -z "$binpath" ]; then if [[ -z ${binpath} ]]; then
uci set AdGuardHome.AdGuardHome.binpath="/usr/bin/AdGuardHome" uci set AdGuardHome.AdGuardHome.binpath="/tmp/AdGuardHome/AdGuardHome"
binpath="/usr/bin/AdGuardHome" binpath="/tmp/AdGuardHome/AdGuardHome"
fi fi
mkdir -p ${binpath%/*} [[ ! -d ${binpath%/*} ]] && mkdir -p ${binpath%/*}
upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null) upxflag=$(uci get AdGuardHome.AdGuardHome.upxflag 2>/dev/null)
LOCKU=/var/lock/AdGuardHome-update.lock LOCKU=/var/lock/AdGuardHome-update.lock
[ -f $LOCKU ] && EXIT 1 [ -f $LOCKU ] && EXIT 1
@ -126,48 +126,37 @@ doupdate_core(){
mkdir -p "/tmp/AdGuardHomeupdate" mkdir -p "/tmp/AdGuardHomeupdate"
rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1 rm -rf /tmp/AdGuardHomeupdate/* >/dev/null 2>&1
Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')" Archt="$(opkg info kernel | grep Architecture | awk -F "[ _]" '{print($2)}')"
case $Archt in case "${Archt}" in
"i386") i386)
Arch="386" Arch=i386
;; ;;
"i686") i686)
Arch="386" Arch=i386
;; ;;
"x86") x86)
Arch="amd64" Arch=amd64
;; ;;
"mipsel") mipsel)
Arch="mipsle" Arch=mipsle_softfloat
;; ;;
"mips64el") mips)
Arch="mips64le" Arch=mips_softfloat
Arch="mipsle" ;;
echo -e "mips64el use $Arch may have bug" mips64el)
;; Arch=mips64le_softfloat
"mips") ;;
Arch="mips" mips64)
;; Arch=mips64_softfloat
"mips64") ;;
Arch="mips64" arm)
Arch="mips" Arch=arm
echo -e "mips64 use $Arch may have bug" ;;
;; armeb)
"arm") Arch=armeb
Arch="arm" ;;
;; aarch64)
"aarch64") Arch=arm64
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" echo -e "error not support $Archt if you can use offical release please issue a bug"
EXIT 1 EXIT 1