add PWA mode

This commit is contained in:
2026-09-04 21:51:04 +08:00
parent e489fc68eb
commit 1c675b2fc2
7 changed files with 140 additions and 1 deletions
+15 -1
View File
@@ -8,8 +8,22 @@
<meta name="theme-color" content="#3964FE">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Agent">
<link rel="manifest" href="/manifest.json">
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png">
<link rel="stylesheet" href="/css/style.css">
</head>
<script>
// 注册 Service Worker(PWA / 离线缓存)
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch((err) => {
console.warn('[SW] register failed:', err);
});
});
}
</script>
</head>
<body>
<div id="app">