build: 添加 Flutter Web 构建产物 + 修复部署脚本

- 本地构建 Flutter Web (flutter build web --release)
- 服务器无需 Flutter 环境,直接复制 build/web
- 修复 403 错误(build/web 目录为空导致)
This commit is contained in:
2026-03-26 09:20:38 +08:00
parent b728504577
commit 31dd44b202
143 changed files with 216642 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
'use strict';
self.addEventListener('install', () => {
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
(async () => {
try {
await self.registration.unregister();
} catch (e) {
console.warn('Failed to unregister the service worker:', e);
}
try {
const clients = await self.clients.matchAll({
type: 'window',
});
// Reload clients to ensure they are not using the old service worker.
clients.forEach((client) => {
if (client.url && 'navigate' in client) {
client.navigate(client.url);
}
});
} catch (e) {
console.warn('Failed to navigate some service worker clients:', e);
}
})()
);
});