luci-app-adguardhome: fix version detection

Reported-by: AmadeusGhost <amadeus@project-openwrt.eu.org>
Signed-off-by: Tianling Shen <cnsztl@project-openwrt.eu.org>
This commit is contained in:
Tianling Shen 2021-02-16 16:50:37 +08:00
parent 807b8507b2
commit 4eb4fd5582
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -37,7 +37,7 @@ 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 ' [0-9.]+' -o ")
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)