e652dece9b
Updates user-visible branding across frontend (PWA manifest, page title, Settings, push fallback), backend (email templates and subjects, LLM system prompt, CalDAV displayname, SMTP from-name default), README, quickstart compose, and MCP server description. Also updates the CI image path and quickstart image reference to git.fabledsword.com/bvandeusen/fabledscribe in preparation for the Forgejo repo rename. Internal Python package, env vars, and database schema unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
// Service Worker for push notifications and PWA support
|
|
self.addEventListener('push', event => {
|
|
if (!event.data) return;
|
|
const data = event.data.json();
|
|
const notifUrl = data.url || '/';
|
|
|
|
event.waitUntil(
|
|
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(clientList => {
|
|
// Suppress notification if the user already has the relevant page focused
|
|
for (const client of clientList) {
|
|
if (client.visibilityState === 'visible' && client.url.includes(notifUrl)) {
|
|
return;
|
|
}
|
|
}
|
|
return self.registration.showNotification(data.title || 'Scribe', {
|
|
body: data.body || '',
|
|
icon: '/favicon.ico',
|
|
badge: '/favicon.ico',
|
|
data: { url: notifUrl },
|
|
});
|
|
})
|
|
);
|
|
});
|
|
|
|
self.addEventListener('notificationclick', event => {
|
|
event.notification.close();
|
|
event.waitUntil(
|
|
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(clientList => {
|
|
const url = event.notification.data.url;
|
|
for (const client of clientList) {
|
|
if (client.url.includes(url) && 'focus' in client) {
|
|
return client.focus();
|
|
}
|
|
}
|
|
if (clients.openWindow) {
|
|
return clients.openWindow(url);
|
|
}
|
|
})
|
|
);
|
|
});
|
|
|
|
// PWA: serve cached assets for offline support (minimal)
|
|
self.addEventListener('fetch', event => {
|
|
// Pass-through — no offline caching in v1
|
|
});
|