<%+header%> <% local sys = require "luci.sys" local fs = require "nixio.fs" local code = fs.readfile("/etc/lasersharp/pairing_code") or "未生成" code = code:gsub("%s+", "") local formatted_code = code if #code == 6 then formatted_code = code:sub(1,3) .. "-" .. code:sub(4,6) end local printer_ip = fs.readfile("/etc/lasersharp/printer_ip") or "" printer_ip = printer_ip:gsub("%s+", "") local detected_printer = fs.readfile("/etc/lasersharp/detected_printer") or "正在自动搜索局域网打印机..." local has_python = (sys.call("command -v python3 >/dev/null 2>&1") == 0) local is_running = (sys.call("pgrep -f lasersharp-gateway.py >/dev/null 2>&1") == 0) local log_tail = sys.exec("tail -n 18 /tmp/lasersharp_gateway.log 2>/dev/null") or "暂无日志" %>

☁️ 鹰眼打印 (HawkEye Print) — 家中 OpenWrt 远程打印网关

本路由器的 6 位远程配对码永久固定不变。外出时打开手机【鹰眼打印】App ->【远程打印】输入下方 6 位配对码并自定义名称保存,即可随时随地一键远程打印!
固定远程配对码 & 运行状态
本路由器专属 6 位远程配对码(永久不变):
<%=formatted_code%>
运行状态: <% if is_running then %> 🟢 远程打印网关已在线守护中 <% elseif not has_python then %> ⚠️ 缺少 python3-light 运行环境(请点击下方『一键安装环境并启动』) <% else %> 🔄 正在启动或扫描打印机中(可点击下方『刷新状态』查看) <% end %>
🖨️ 局域网打印机:<%=luci.util.pcdata(detected_printer)%>
🔄 刷新状态 <% if not has_python then %> <% end %>
实时运行日志(仅自动保留最近 1 天记录 · /tmp/lasersharp_gateway.log)
<%=luci.util.pcdata(log_tail)%>
<%+footer%>