Files
wrong-notebook/public/offline.html
margrop 07ba47ccd4 feat: 完善 PWA,补齐多尺寸图标并加入 Service Worker 与离线页
- manifest 增加 192/512 与 maskable 图标、id、scope,屏幕方向改为 any 以支持平板横屏
- 新增 public/sw.js:静态资源缓存优先,页面导航断网时显示离线页,API 不缓存
- iOS 主屏幕图标改用 180px 的 apple-touch-icon
- 中间件放行 sw.js 与 offline.html

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:50:18 +08:00

62 lines
2.2 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#4f46e5">
<title>智能错题本</title>
<style>
:root { color-scheme: light dark; }
body {
margin: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
background: #f8fafc;
color: #0f172a;
}
main { max-width: 360px; padding: 32px 16px; text-align: center; }
img { width: 96px; height: 96px; border-radius: 22px; }
h1 { font-size: 20px; margin: 24px 0 8px; }
p { margin: 0 0 24px; color: #475569; line-height: 1.6; }
button {
border: 0;
border-radius: 8px;
padding: 10px 24px;
font-size: 16px;
color: #fff;
background: #4f46e5;
}
@media (prefers-color-scheme: dark) {
body { background: #0f172a; color: #f1f5f9; }
p { color: #94a3b8; }
}
</style>
</head>
<body>
<main>
<img src="/icons/icon-192.png" alt="">
<h1 id="title">无法连接到服务器</h1>
<p id="message">请检查网络连接,或确认错题本服务已启动,然后重试。</p>
<button id="retry" type="button">重试</button>
</main>
<script>
if (!/^zh/i.test(navigator.language || '')) {
document.documentElement.lang = 'en';
document.title = 'Wrong Notebook';
document.getElementById('title').textContent = 'Cannot reach the server';
document.getElementById('message').textContent = 'Check your network connection or make sure the Wrong Notebook server is running, then try again.';
document.getElementById('retry').textContent = 'Retry';
}
document.getElementById('retry').addEventListener('click', function () {
location.reload();
});
window.addEventListener('online', function () {
location.reload();
});
</script>
</body>
</html>