Files
butubb 8305243b33
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s
fix(webui): 拔掉 index.html 的 Google Fonts 外链 —— 内网连不上它,整页被钉住 20 秒
`<head>` 里那个指向 fonts.googleapis.com 的阻塞样式表,在连不上 Google 的机器上会一路
挂到连接超时;而它**后面**的 `<script type="module">` 必须等它 —— 于是整个 React 应用
在这 20 秒里一个请求都发不出去。从浏览器里看,就是「所有接口都卡了 20 秒」。

用 Playwright 复现(把字体请求挂住 20 秒再失败):

    字体请求      20014ms
    DOM 就绪      20.070s
    首个接口请求   导航后 20055ms

把字体请求掐掉之后:DOM 就绪 0.058s,首个接口请求 58ms。

字体栈里 Inter / JetBrains Mono 后面本来就跟着 system-ui / Consolas,缺字体只是回退,
不影响可用性 —— 何况内网这台机器从来就没成功加载到过它们,当前显示的一直是回退字体。
所以这是一个视觉上零变化、却省掉 20 秒白屏的修复。

tests/test_static_cache.py 加了断言,禁止外壳再出现任何外网 link/script。
2026-10-15 16:43:03 +08:00

23 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>综合采集平台</title>
<!--
**这里故意不放任何外部字体。** 曾经挂过一个 fonts.googleapis.com 的
<link rel="stylesheet">,而这是个内网部署,那台机器连不上 Google ——
<head> 里阻塞渲染的样式表拿不到,它后面的 <script type="module"> 就不执行,
于是整个 React 应用一个请求都发不出去,页面白白卡满一次 TCP 连接超时(实测
20.07 秒,DOM 就绪时间与字体请求耗时一毫秒不差)。字体栈里的
Inter / JetBrains Mono 后面本来就跟了 system-ui / Consolas,字体没到位时
回退即可 —— 为了一个装饰性的字体把整个界面拖住 20 秒,不划算。
-->
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>