From 7ebebbc3a9de01eb55a49263eb8fd9addadecb56 Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Sat, 3 Oct 2026 08:43:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(icon):=20=E8=A1=A5=20/icons/favicon.ico=20?= =?UTF-8?q?=E2=80=94=E2=80=94=20=E6=A0=87=E7=AD=BE=E6=A0=8F=E6=97=A0?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=9A=84=E7=9C=9F=E5=9B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一版只改 index.html 注入 /favicon.svg,实测仍不显示。用 MutationObserver 在真实浏览器里观察到:**Dashy 前端 JS 在运行时把 改写成 /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 正常。 --- Dockerfile | 4 ++++ deploy/zd-host.sh | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index d51c044..7664269 100644 --- a/Dockerfile +++ b/Dockerfile @@ -90,6 +90,10 @@ 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/ +# 见 zd-host.sh 同名注释:Dashy 前端 JS 运行时会把 icon link 改成 +# /icons/favicon.ico,而镜像里没有 /icons/ 目录,静态改 index.html 无效。 +COPY portal/favicon.ico /app/dashy/icons/favicon.ico +COPY portal/favicon.svg /app/dashy/icons/favicon.svg # 浏览器扩展安装页与安装包(通过 /extension/ 访问) COPY web/extension/install.html /app/dashy/extension/install.html diff --git a/deploy/zd-host.sh b/deploy/zd-host.sh index 1823b6b..39d7add 100644 --- a/deploy/zd-host.sh +++ b/deploy/zd-host.sh @@ -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 在运行时把 +# 改写成 /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