Files
Python-Profiler-Visualizer/src/renderer/index.html
2026-09-12 14:19:56 +08:00

44 lines
2.0 KiB
HTML
Raw 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" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--
CSP。注意两点
1. 不要放 frame-ancestors —— 按规范它在 <meta> 里会被忽略,只有 HTTP 响应头有效,
Chromium 还会为此在控制台报一条 errore2e 断言"零 console error"会因此变红)。
这里也不需要它窗口由主进程创建nodeIntegration 关闭,不存在被外部页面嵌套的场景。
2. worker-src 显式写出来。ELK 布局跑在 Web Worker 里,而 default-src 'none' 下
worker-src 的回退链worker-src → child-src → script-src不够直观
写死 'self' 免得以后有人调 script-src 时把 worker 一起弄挂。
-->
<meta
http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src 'self'; worker-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'none'; form-action 'none';"
/>
<title>Python 耗时可视化分析</title>
<!--
主题早应用:在 main.tsx 之前同步读 localStorage给 <html> 加 .light / .dark class。
React 挂载前已经处于正确主题,避免整页白闪再变暗。
必须 try/catchfile:// 协议下某些 Electron 配置下 localStorage 抛 SecurityError。
-->
<script>
try {
var t = localStorage.getItem('pyrof.theme')
if (t === 'light') {
document.documentElement.classList.remove('dark')
document.documentElement.classList.add('light')
} else {
document.documentElement.classList.add('dark')
}
var l = localStorage.getItem('pyrof.lang')
if (l === 'en-US') document.documentElement.lang = 'en-US'
} catch (_) {}
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>