fix(ui): 登录页页脚被当纯文本显示(html/template 转义)+ 三处页脚统一

用户发现登录页出现 `<div class="navi-footer">…` 这串标记文字。

① 根因:auth.go 把 beianFooter() 的字符串塞进 Go html/template(map[string]string),
   模板自动转义整段 HTML → 页面上直接显示标记源码。
   修法:改用 map[string]any + template.HTML(beianFooter 内部已对备案号做 html.EscapeString,
   注入合法)。
② 登录页与门户页此前**都无视**后台的「页脚」自定义字段(后台提示语写的是"填写后以这里为准")。
   新增统一入口 siteFooter(info):自定义 footer 优先,否则按 icp/gongan/座右铭生成;
   pages.go(门户页)与 auth.go(登录页)都改走它。
③ 页脚座右铭此前只由 navi.js 在 Dashy 页客户端注入 → 登录页/门户页永远没有。
   新增 pageInfo 字段 motto(换行或 | 分行,留空用内置默认),
   footerMarkup() 生成时一并输出 .navi-quote 两行;navi.js 已有幂等判断不会重复注入。
   后台「站点信息」新增座右铭输入框,并登记进 /api/schema。
④ 登录页 / 门户页补页脚样式:左列两行备案号、右列两行座右铭;窄屏退化为居中单列。
This commit is contained in:
HomeDash Bot
2026-09-13 07:56:38 +08:00
parent ba22d3a1de
commit 3d18fb59ce
6 changed files with 341 additions and 248 deletions

View File

@ -168,6 +168,7 @@ html[data-theme="dark"] .toast{ box-shadow:0 10px 30px rgba(0,0,0,.5) }
<div class="fg"><label>ICP 备案号</label><input id="p-icp" placeholder="京ICP备00000000号-1"></div>
<div class="fg"><label>公安备案号(可选)</label><input id="p-gongan" placeholder="京公网安备00000000000000号"></div>
</div>
<div class="fg"><label>页脚座右铭(每行一句,留空用内置默认)</label><textarea id="p-motto" rows="2" placeholder="不念往昔之繁华&#10;无谓前路之沧桑"></textarea></div>
<details style="margin:12px 0">
<summary style="cursor:pointer;font-size:13px;color:#475569">认证页与门户页文案(留空=用内置默认)</summary>
<div class="row" style="margin-top:8px">
@ -503,6 +504,7 @@ async function loadPageInfo() {
document.getElementById('p-gongan').value = gongan;
// 能从备案号字段还原时,高级 HTML 留空,保存时按模板重新生成
document.getElementById('p-footer').value = (icp || gongan) ? '' : (PAGE.footer || '');
document.getElementById('p-motto').value = PAGE.motto || '';
if (!PAGE.navLinks && PAGE.navLinks !== null) PAGE.navLinks = [];
renderNavLinks();
}
@ -521,6 +523,7 @@ document.getElementById('save-info').addEventListener('click', async () => {
gongan: document.getElementById('p-gongan').value,
// 留空 = 交给服务端按备案号生成模板;填写则整段覆盖
footer: document.getElementById('p-footer').value,
motto: document.getElementById('p-motto').value,
authTitle: document.getElementById('p-auth-title').value.trim(),
authSubtitle: document.getElementById('p-auth-sub').value.trim(),