- 添加 Service Worker 支持后台定时检查提醒 - 实现浏览器通知 API 集成 - 添加设置页面通知开关和测试功能 - 创建同步服务自动将提醒同步到 SW - 优化提醒检查逻辑(30秒间隔,10分钟宽限期) 文件变更: - public/sw.js: Service Worker 主文件 - public/sw-register.ts: SW 注册脚本 - public/manifest.json: PWA 清单文件 - src/services/notification.ts: 通知权限管理 - src/services/swSync.ts: 提醒同步服务 - src/stores/index.ts: 添加同步调用 - src/pages/SettingsPage.tsx: 添加通知开关和测试按钮 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
25 lines
750 B
HTML
25 lines
750 B
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="theme-color" content="#faf9f7" />
|
|
<link rel="manifest" href="/manifest.json" />
|
|
<title>掐日子 - AI 纪念日提醒</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script type="module" src="/src/main.tsx"></script>
|
|
<script>
|
|
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('load', () => {
|
|
navigator.serviceWorker.register('/sw.js').catch(() => {
|
|
console.log('SW registration failed');
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|