<%+cbi/valueheader%> <% local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() local binpath = uci:get("AdGuardHome", "AdGuardHome", "binpath") or "/usr/bin/AdGuardHome" local configpath = uci:get("AdGuardHome", "AdGuardHome", "configpath") or "/etc/AdGuardHome.yaml" local channel = uci:get("AdGuardHome", "AdGuardHome", "release_channel") or "stable" local ver = "" if not fs.access(configpath) then ver = translate("no config") end if not fs.access(binpath) then ver = ver .. " " .. translate("no core") else local v = uci:get("AdGuardHome", "AdGuardHome", "version") local mtime = uci:get("AdGuardHome", "AdGuardHome", "binmtime") or "0" local fmtime = fs.stat(binpath, "mtime") if fmtime ~= tonumber(mtime) or not v then local raw = luci.sys.exec(binpath .. " --version 2>/dev/null | grep -oE 'v[0-9.]+(-[A-Za-z0-9.]+)?' | head -1") v = (raw or ""):match("v[0-9.]+%-?[%w.]*") or "core error" v = v:gsub("%s+$", "") if v == "core error" or v == "" then v = "core error" end uci:set("AdGuardHome", "AdGuardHome", "version", v) uci:set("AdGuardHome", "AdGuardHome", "binmtime", fmtime) uci:save("AdGuardHome") end ver = v .. " " .. ver end %>
<% if self.showfastconfig then %> <%end%> <%:核心版本%>: <%=ver%><%= channel == "beta" and "beta" or "stable" %>
<%+cbi/valuefooter%>