55 lines
2.3 KiB
HTML
55 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh">
|
||
<head>
|
||
<meta charset="UTF-8"/>
|
||
<!-- 版本号:每次发布时自动更新 -->
|
||
<meta name="version" content="20251209-154559">
|
||
<!-- HTML文件不缓存,但允许静态资源缓存 -->
|
||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||
<meta http-equiv="Pragma" content="no-cache">
|
||
<meta http-equiv="Expires" content="0">
|
||
<script>
|
||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||
CSS.supports('top: constant(a)'))
|
||
document.write(
|
||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||
(coverSupport ? ', viewport-fit=cover' : '') + '" />');
|
||
var log = false;
|
||
|
||
// 版本检查:如果检测到新版本,清除缓存并刷新
|
||
(function() {
|
||
try {
|
||
const currentVersion = document.querySelector('meta[name="version"]')?.getAttribute('content');
|
||
const storedVersion = localStorage.getItem('app_version');
|
||
|
||
if (storedVersion && storedVersion !== currentVersion && currentVersion) {
|
||
// 检测到新版本,清除所有缓存
|
||
if ('caches' in window) {
|
||
caches.keys().then(names => {
|
||
names.forEach(name => caches.delete(name));
|
||
});
|
||
}
|
||
// 更新版本号
|
||
localStorage.setItem('app_version', currentVersion);
|
||
// 强制刷新页面
|
||
window.location.reload(true);
|
||
} else if (currentVersion) {
|
||
// 首次访问或版本相同,保存版本号
|
||
localStorage.setItem('app_version', currentVersion);
|
||
}
|
||
} catch (e) {
|
||
// 版本检查失败不影响页面加载
|
||
console.warn('Version check failed:', e);
|
||
}
|
||
})();
|
||
</script>
|
||
<title></title>
|
||
<!--preload-links-->
|
||
<!--app-context-->
|
||
</head>
|
||
<body>
|
||
<div id="app"><!--app-html--></div>
|
||
<script type="module" src="/src/main.ts"></script>
|
||
</body>
|
||
</html>
|