<%+AdGuardHome/head%> <% local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() local sys = require "luci.sys" local dsp = require "luci.dispatcher" local binpath = uci:get("AdGuardHome", "AdGuardHome", "binpath") or "/usr/bin/AdGuardHome" local configpath = uci:get("AdGuardHome", "AdGuardHome", "configpath") or "/etc/AdGuardHome.yaml" local httpport = uci:get("AdGuardHome", "AdGuardHome", "httpport") or "3000" local redirect = uci:get("AdGuardHome", "AdGuardHome", "redirect") or "none" local version = uci:get("AdGuardHome", "AdGuardHome", "version") or "-" local has_bin = fs.access(binpath) local has_config = fs.access(configpath) local toggle_url = dsp.build_url("admin", "services", "AdGuardHome", "toggle") local base_url = dsp.build_url("admin", "services", "AdGuardHome", "base") local tools_url = dsp.build_url("admin", "services", "AdGuardHome", "tools") local log_url = dsp.build_url("admin", "services", "AdGuardHome", "log") local redirect_label = { none = translate("未启用"), ["dnsmasq-upstream"] = translate("作为 dnsmasq 上游"), redirect = translate("53 端口劫持"), exchange = translate("替代 dnsmasq") } local redirect_text = redirect_label[redirect] or redirect %>
<%:服务状态%>
<%:正在检测…%>
 
<%:重定向模式%>
<%= redirect_text %>
<%:配置「基础设置 → 5553 重定向」%>
<%:核心版本%>
<% if has_bin then %> <%= version %> <% else %> <%:未安装%> <% end %>
<% if not has_config then %> <%:配置文件缺失%> <% elseif not has_bin then %> <%:点击「基础设置 → 更新核心版本」下载%> <% else %> <%= binpath %> <% end %>
<%:打开 Web 控制台%> :<%=httpport%> <%:基础设置%> <%:运维%> <%:查看日志%>