luci-app-adguardhome: fix ver display

This commit is contained in:
CN_SZTL 2020-08-03 00:49:11 +08:00
parent 9506f4b197
commit ad8c278f1e
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -37,8 +37,8 @@ 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.." -c /dev/null --check-config 2>&1| grep -m 1 -E 'v[0-9.]+' -o")
version=string.sub(tmp, 1, -2)
local tmp=luci.sys.exec(binpath.." -c /dev/null --check-config 2>&1| grep -m 1 -E '(version |v)[0-9.]+' -o")
version=string.sub(tmp, -7)
if version=="" then version="core error" end
uci:set("AdGuardHome","AdGuardHome","version",version)
uci:set("AdGuardHome","AdGuardHome","binmtime",testtime)
@ -301,4 +301,4 @@ function m.on_commit(map)
uci:save("AdGuardHome")
end
end
return m
return m