fix(icon): 补 /icons/favicon.ico —— 标签栏无图标的真因

上一版只改 index.html 注入 /favicon.svg,实测仍不显示。用 MutationObserver
在真实浏览器里观察到:**Dashy 前端 JS 在运行时把 <link rel=icon> 改写成
/icons/favicon.ico**,服务端注入的标签被它覆盖;而镜像里从来不存在
/icons/ 目录 ⇒ 请求落到 try_files 兜底的 index.html,content-type 是
text/html,浏览器当无效图标忽略(于是表现为「图标消失」)。

静态改 index.html 治不了本,只能把这个路径补上:
Dockerfile 与 zd-host.sh 都 COPY favicon.{ico,svg} 到 /app/dashy/icons/。
已先在 106 上热修(只 cp 不重启,无闪断)恢复显示。

实测:/icons/favicon.ico → 200 image/x-icon,浏览器解码 16x16 成功;
apple-touch-icon 180x180 正常。
This commit is contained in:
JianFeeeee
2026-10-03 08:43:35 +08:00
parent fe1c14b7ae
commit 7ebebbc3a9
2 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,13 @@ COPY portal/favicon.svg /app/dashy/favicon.svg
COPY portal/favicon.ico /app/dashy/favicon.ico
COPY portal/apple-touch-icon.png /app/dashy/apple-touch-icon.png
COPY portal/web-icons/ /app/dashy/web-icons/
# /icons/favicon.ico 才是 Dashy 前端实际用的那个:它的 JS 在运行时把
# <link rel=icon> 改写成 /icons/favicon.ico(实测:服务端注入的 /favicon.svg
# 会被它覆盖),而镜像里从来没有 /icons/ 这个目录 —— 所以标签栏一直拿不到图标,
# 请求落到 try_files 兜底的 index.html(content-type: text/html),浏览器直接忽略。
# 静态改 index.html 治不了本,必须把这个路径补上。
COPY portal/favicon.ico /app/dashy/icons/favicon.ico
COPY portal/favicon.svg /app/dashy/icons/favicon.svg
COPY web/extension/install.html /app/dashy/extension/install.html
COPY ext/navi-chrome.zip /app/dashy/extension/navi-chrome.zip
COPY ext/navi-firefox.xpi /app/dashy/extension/navi-firefox.xpi