a04ecf7a19
- Voice messages: MediaRecorder → encrypted attachment, custom waveform player via OfflineAudioContext, 60s limit + live mic-level meter - Offline message queue: localStorage outbox, exponential backoff retries, optimistic pending bubble with retry/discard - Delivery indicator: message_deliveries table + RLS (reciprocal receipts), ✓ / ✓✓ / ✓✓-blue tick states, group-aware (all members must ack) - Per-participant volume slider in calls via right-click tile menu, persisted to localStorage, applied to attached audio elements - Group call scaling: grid up to 12 tiles with pagination, active-speaker auto-promotion in fullscreen - Push notifications scaffolding: service worker, VAPID subscription registration, notify-push edge function skeleton - Backup recovery code: 24-char base32 code (~120 bits entropy) as alternative decrypt path, restore UI with mode toggle - Admin panel: conversations list, audit log (admin_audit_log table + admin_log_action RPC), audit entry on user flag toggle - Search v2: sender filter, attachment-only toggle, date range - Reactions pop animation (scale 0.4→1.15→1 on count change) - Message list windowing (150 default, expand via IntersectionObserver) - Stub cleanup: removed dead ScreenshareStub from CallParticipantTile Fixes: - Focus-triggered flicker: dropped window.focus listeners in three spots, throttled visibilitychange/online wake-refreshes to 30s, keep existing data visible during background re-syncs (no more spinner on every click) - Voice attachment audio element collapsed to 0px on peer side — now forces 280px min-width on bubble Migrations (push required): 20260421000001_message_deliveries.sql 20260421000002_admin_audit_log.sql Server TODO: VAPID keys + notify-push edge function deploy
68 lines
2.0 KiB
JavaScript
68 lines
2.0 KiB
JavaScript
// Web Push service worker.
|
|
//
|
|
// Handles browser-delivered push events when the app tab is closed or in the
|
|
// background. Tauri desktop does not install service workers; native OS
|
|
// notifications are routed through the Tauri notification plugin instead
|
|
// (see src/lib/osNotify.ts).
|
|
//
|
|
// Payload contract — server sends JSON of shape:
|
|
// { title: string, body?: string, conversationId?: string, kind?: 'message' | 'call' }
|
|
// Body is intentionally generic; message ciphertext is never included.
|
|
|
|
self.addEventListener('install', (event) => {
|
|
// Activate immediately so updates apply on next page load.
|
|
event.waitUntil(self.skipWaiting());
|
|
});
|
|
|
|
self.addEventListener('activate', (event) => {
|
|
event.waitUntil(self.clients.claim());
|
|
});
|
|
|
|
self.addEventListener('push', (event) => {
|
|
let data = { title: 'Neue Nachricht', body: '' };
|
|
try {
|
|
if (event.data) {
|
|
data = { ...data, ...event.data.json() };
|
|
}
|
|
} catch (_err) {
|
|
/* malformed payload — fall back to defaults */
|
|
}
|
|
|
|
const opts = {
|
|
body: data.body || '',
|
|
icon: '/favicon.svg',
|
|
badge: '/favicon.svg',
|
|
tag: data.conversationId || 'default',
|
|
renotify: true,
|
|
data: {
|
|
conversationId: data.conversationId,
|
|
kind: data.kind,
|
|
},
|
|
};
|
|
|
|
event.waitUntil(self.registration.showNotification(data.title, opts));
|
|
});
|
|
|
|
self.addEventListener('notificationclick', (event) => {
|
|
event.notification.close();
|
|
const conversationId = event.notification.data && event.notification.data.conversationId;
|
|
const target = conversationId ? '/chats/' + conversationId : '/';
|
|
|
|
event.waitUntil(
|
|
self.clients
|
|
.matchAll({ type: 'window', includeUncontrolled: true })
|
|
.then((clientList) => {
|
|
for (const client of clientList) {
|
|
if ('focus' in client) {
|
|
client.postMessage({ type: 'navigate', to: target });
|
|
return client.focus();
|
|
}
|
|
}
|
|
if (self.clients.openWindow) {
|
|
return self.clients.openWindow(target);
|
|
}
|
|
return undefined;
|
|
}),
|
|
);
|
|
});
|