Files
cc-web/public/sw.js
Daniel 2c1c64ff30 feat: CC-Web v1.0 — Claude Code Web Chat UI
功能特性:
- WebSocket 流式对话、工具调用折叠、Markdown 渲染
- 多会话管理与续接、模型/权限模式切换
- 后台任务持久化(detached 进程 + PID 恢复)
- 多渠道通知(PushPlus/Telegram/Server酱/飞书/QQ)
- 密码管理(自动生成初始密码、首次改密、Web UI 改密)
- 移动端适配、PWA 通知、斜杠指令

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:45:21 +00:00

29 lines
894 B
JavaScript

// CC-Web Service Worker — handles push notifications on mobile
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SHOW_NOTIFICATION') {
event.waitUntil(
self.registration.showNotification(event.data.title || 'CC-Web', {
body: event.data.body || '',
icon: event.data.icon || undefined,
tag: 'cc-web-task',
renotify: true,
data: event.data.data || {},
})
);
}
});
self.addEventListener('notificationclick', (event) => {
event.notification.close();
event.waitUntil(
self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
for (const client of clientList) {
if (client.url.includes(self.location.origin) && 'focus' in client) {
return client.focus();
}
}
return self.clients.openWindow('/');
})
);
});