diff --git a/.gitattributes b/.gitattributes index dfe07704..5208f5ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,7 @@ # Auto detect text files and perform LF normalization * text=auto + +# Templates/scripts Linux : toujours LF, même sur un checkout Windows (sinon les fichiers générés +# depuis ces templates héritent de CRLF, ce qui casse le parsing strict de certains outils Linux, +# ex: Icon=app\r dans un .desktop qui ne matche plus jamais un fichier app.png). +src-tauri/linux/** text eol=lf diff --git a/.github/workflows/local/release_main.yml b/.github/workflows/local/release_main.yml index 239d69ff..05f1cd83 100644 --- a/.github/workflows/local/release_main.yml +++ b/.github/workflows/local/release_main.yml @@ -66,6 +66,12 @@ jobs: build-windows-msi: name: Build de l'installeur Windows (MSI) + # Enchaîné après build-android-apk (au lieu de tourner en parallèle) : sous `act` sur Windows, les + # jobs concurrents partagent le même checkout/dossier de travail réel (contrairement au vrai CI + # GitHub où chaque job a sa propre VM isolée), ce qui a corrompu .env/.env.production pendant un + # build simultané (VITE_API_URL embarqué en "http://localhost:9000" au lieu de la vraie valeur). + # Un seul `act push` reste possible, l'exécution est juste séquentielle au lieu de parallèle. + needs: build-android-apk runs-on: windows-latest steps: - name: Checkout du code @@ -96,6 +102,7 @@ jobs: build-linux-appimage: name: Build de l'AppImage Linux + needs: build-windows-msi # voir commentaire sur build-windows-msi : exécution séquentielle voulue sous act runs-on: ubuntu-latest steps: - name: Checkout du code @@ -118,6 +125,7 @@ jobs: gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ gstreamer1.0-plugins-bad gstreamer1.0-libav \ xdg-utils shared-mime-info + sudo apt-get install -y libfuse2t64 || sudo apt-get install -y libfuse2 # linuxdeploy (AppImage) est lié à l'ABI fuse2, absente par défaut sur ubuntu-24.04+ - name: Génération des fichiers .env run: | @@ -130,7 +138,10 @@ jobs: - name: Build de l'AppImage env: NODE_OPTIONS: --max-old-space-size=6144 - APPIMAGE_EXTRACT_AND_RUN: "1" # linuxdeploy a besoin de FUSE, absent des runners/conteneurs ubuntu-24.04+ + # Pas de APPIMAGE_EXTRACT_AND_RUN ici (contrairement au vrai CI) : sous act/Docker, ce mode + # provoque une race condition sur le plugin gtk (le dossier d'extraction temporaire de + # linuxdeploy est nettoyé avant que le plugin ne s'exécute -> "exit code 127"). En local on + # utilise du vrai FUSE à la place, via `act --privileged` (ou --container-options "--privileged"). NO_STRIP: "true" # le strip des binutils récents (ubuntu-24.04+) plante sur la section .relr.dyn de certaines libs (cf tauri-apps/tauri#15106) run: bun run tauri:build -- --bundles appimage @@ -156,6 +167,7 @@ jobs: build-docker-image: name: Build et push de l'image Docker (front, prod) + needs: build-linux-appimage # voir commentaire sur build-windows-msi : exécution séquentielle voulue sous act runs-on: ubuntu-latest permissions: contents: read @@ -198,7 +210,7 @@ jobs: create-release: name: Création de la release GitHub - needs: [ build-android-apk, build-windows-msi, build-linux-appimage ] + needs: [ build-android-apk, build-windows-msi, build-linux-appimage, build-docker-image ] runs-on: ubuntu-latest steps: - name: Téléchargement des artefacts @@ -208,11 +220,24 @@ jobs: path: release-assets merge-multiple: true + # `github.run_number` est toujours figé à 1 sous act (pas un vrai run GitHub), donc + # `dev-${{ github.run_number }}` écraserait la même release "dev-1" à chaque test local. + # On calcule ici le prochain numéro à partir des releases "dev-N" déjà publiées sur le repo. + - name: Calcul du prochain numéro de build (uniquement pour les tests locaux via act) + id: buildnum + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + LAST=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/releases?per_page=100" \ + | grep -o '"tag_name": *"dev-[0-9]\+"' | grep -o '[0-9]\+' | sort -n | tail -1) + echo "next=$(( ${LAST:-0} + 1 ))" >> "$GITHUB_OUTPUT" + - name: Création de la release uses: softprops/action-gh-release@v2 with: - tag_name: dev-${{ github.run_number }} - name: "Synco dev build #${{ github.run_number }}" + tag_name: dev-${{ steps.buildnum.outputs.next }} + name: "Synco dev build #${{ steps.buildnum.outputs.next }}" prerelease: true generate_release_notes: true - files: release-assets/** + files: release-assets/** \ No newline at end of file diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index d862dc96..416c948b 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -127,13 +127,18 @@ jobs: NODE_OPTIONS: --max-old-space-size=6144 run: bun run tauri:build -- --bundles appimage - - name: Retrait de libwayland-client bundlée (EGL_BAD_PARAMETER sur Mesa 25+, cf tauri-apps/tauri#15665) + - name: Retrait de libs bundlées problématiques (EGL_BAD_PARAMETER sur Mesa 25+ cf tauri-apps/tauri#15665, segfault GStreamer/JACK) run: | cd src-tauri/target/release/bundle/appimage APPIMAGE=$(ls *.AppImage) chmod +x "$APPIMAGE" ./"$APPIMAGE" --appimage-extract rm -f squashfs-root/usr/lib/libwayland-client.so.0 + # libgstfluidsynthmidi.so (rendu MIDI, inutilisé par l'app) dépend de la couche de + # compat JACK de pipewire ; sur certaines distros la version système de pipewire n'a + # pas le symbole attendu (pw_log_topic_register), ce qui fait planter (SIGSEGV) le + # scan des plugins GStreamer au lancement, avant même d'afficher une fenêtre. + rm -f squashfs-root/usr/lib/gstreamer-1.0/libgstfluidsynthmidi.so curl -sL -o appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage chmod +x appimagetool ./appimagetool --appimage-extract-and-run squashfs-root "$APPIMAGE" diff --git a/README.md b/README.md index 129e75d4..9af076a6 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,22 @@ npm run preview # Preview production build npm run type-check # TypeScript validation ``` +### Building the Linux AppImage locally on Fedora + +`linuxdeploy`'s cached tools assume Ubuntu/Debian paths and a `strip` that +understands whatever ELF features your toolchain emits. On Fedora, set these +before `npm run tauri:build -- --bundles appimage` (adjust the GStreamer paths +if `rpm -ql gstreamer1` reports something else on your version): + +```bash +export NO_STRIP=true +export GSTREAMER_PLUGINS_DIR=/usr/lib64/gstreamer-1.0 +export GSTREAMER_HELPERS_DIR=/usr/libexec/gstreamer-1.0 +``` + +`fuse-libs` must also be installed (`sudo dnf install fuse-libs`) since Tauri +runs `linuxdeploy` as an AppImage itself. + ## 🎯 Development Guidelines - **TypeScript Strict**: Zero `any` types allowed diff --git a/ios/App/CapApp-SPM/Package.swift b/ios/App/CapApp-SPM/Package.swift index c7e5b810..2f5acfc4 100644 --- a/ios/App/CapApp-SPM/Package.swift +++ b/ios/App/CapApp-SPM/Package.swift @@ -11,7 +11,7 @@ let package = Package( targets: ["CapApp-SPM"]) ], dependencies: [ - .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.4.2"), + .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", exact: "8.5.0"), .package(name: "CapacitorApp", path: "..\..\..\node_modules\@capacitor\app"), .package(name: "CapacitorBrowser", path: "..\..\..\node_modules\@capacitor\browser") ], diff --git a/public/firebase-messaging-sw.js b/public/firebase-messaging-sw.js index 2b0abb1b..3ab219b3 100644 --- a/public/firebase-messaging-sw.js +++ b/public/firebase-messaging-sw.js @@ -51,9 +51,12 @@ self.addEventListener('notificationclick', (event) => { // Fermer la notification notification.close(); - // Ouvrir l'URL correspondante - if (notification.data && notification.data.url) { - clients.openWindow(notification.data.url); + // Ouvrir l'URL correspondante — le reste de l'app (routes/notifications + // in-app) utilise la clé `route`, pas `url` : sans ce fallback, cliquer + // une notification desktop/web n'amenait jamais qu'à la racine de l'app. + const target = (notification.data && (notification.data.route || notification.data.url)); + if (target) { + clients.openWindow(target); } else { // Ouvrir l'application par défaut clients.openWindow('/'); diff --git a/public/sounds/call_incoming.mp3 b/public/sounds/call_incoming.mp3 index 31486f49..338326b3 100644 Binary files a/public/sounds/call_incoming.mp3 and b/public/sounds/call_incoming.mp3 differ diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a1236565..8505e03e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,5 +1,58 @@ use tauri::{Emitter, Manager}; +// L'AppImage (linuxdeploy) exporte LD_LIBRARY_PATH/GTK_PATH/GIO_EXTRA_MODULES/... pour pointer +// vers ses libs embarquées. Un sous-processus qui hérite de cet environnement (ex: le navigateur +// lancé via xdg-open pour le login OAuth) essaie de charger ces libs au lieu de celles du système +// et plante sur un mismatch de version (ex Firefox: "XPCOMGlueLoad error ... libnss3.so: version +// `NSS_3.126' not found"), donc le navigateur ne s'ouvre jamais. On les retire avant de spawn. +#[cfg(target_os = "linux")] +const APPIMAGE_POLLUTED_ENV_VARS: &[&str] = &[ + "LD_LIBRARY_PATH", + "GTK_PATH", + "GIO_EXTRA_MODULES", + "GDK_PIXBUF_MODULE_FILE", + "GSETTINGS_SCHEMA_DIR", + "GST_PLUGIN_SYSTEM_PATH_1_0", + "GST_PLUGIN_PATH_1_0", + "GST_PLUGIN_SCANNER_1_0", + "GST_PLUGIN_SYSTEM_PATH", + "GST_PTP_HELPER_1_0", + "GST_REGISTRY_REUSE_PLUGIN_SCANNER", +]; + +#[tauri::command] +fn open_external_url(url: String) -> Result<(), String> { + #[cfg(target_os = "linux")] + { + let mut cmd = std::process::Command::new("xdg-open"); + cmd.arg(&url); + for var in APPIMAGE_POLLUTED_ENV_VARS { + cmd.env_remove(var); + } + return cmd.spawn().map(|_| ()).map_err(|e| e.to_string()); + } + #[cfg(target_os = "macos")] + { + return std::process::Command::new("open") + .arg(&url) + .spawn() + .map(|_| ()) + .map_err(|e| e.to_string()); + } + #[cfg(target_os = "windows")] + { + return std::process::Command::new("cmd") + .args(["/C", "start", "", &url]) + .spawn() + .map(|_| ()) + .map_err(|e| e.to_string()); + } + #[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))] + { + Err("open_external_url is not supported on this platform".into()) + } +} + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() @@ -13,7 +66,7 @@ pub fn run() { .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_deep_link::init()) .plugin(tauri_plugin_notification::init()) - .invoke_handler(tauri::generate_handler![]) + .invoke_handler(tauri::generate_handler![open_external_url]) .setup(|app| { if cfg!(debug_assertions) { app.handle().plugin( diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5727a312..2967ec02 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -42,6 +42,7 @@ "icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", + "icons/icon.png", "icons/icon.icns", "icons/icon.ico" ], diff --git a/src/App.vue b/src/App.vue index f6fa883b..142fe372 100644 --- a/src/App.vue +++ b/src/App.vue @@ -396,7 +396,7 @@ onMounted(async () => {
- Logo + Logo

@@ -494,7 +494,7 @@ onMounted(async () => {
- Logo + Logo
diff --git a/src/assets/keycloak.ts b/src/assets/keycloak.ts index 4cccc281..b8421fdf 100644 --- a/src/assets/keycloak.ts +++ b/src/assets/keycloak.ts @@ -3,9 +3,9 @@ import { kcToken } from "./var"; import { Capacitor } from "@capacitor/core"; import { Browser } from "@capacitor/browser"; import { App as CapApp, type URLOpenListenerEvent } from "@capacitor/app"; -import { open } from '@tauri-apps/plugin-shell'; import { onOpenUrl } from '@tauri-apps/plugin-deep-link'; import { listen } from '@tauri-apps/api/event'; +import { invoke } from '@tauri-apps/api/core'; const KC_URL = import.meta.env.VITE_KEYCLOAK_URL || 'http://localhost:8080/auth'; const KC_REALM = import.meta.env.VITE_KEYCLOAK_REALM || 'SilverTeams'; @@ -145,7 +145,7 @@ async function tauriLogin(): Promise<{ token?: string; refreshToken?: string }> + `&response_type=code&scope=openid&state=${state}` + `&code_challenge=${codeChallenge}&code_challenge_method=S256`; - await open(authUrl); + await invoke('open_external_url', { url: authUrl }); const callbackUrl = await deepLinkArrived; unlistenSingleInstance(); diff --git a/src/assets/utils/crypto.ts b/src/assets/utils/crypto.ts index aad6db09..aeac2ad8 100644 --- a/src/assets/utils/crypto.ts +++ b/src/assets/utils/crypto.ts @@ -190,6 +190,91 @@ export async function decryptFromPeer ( }; +// Mêmes fonctions que encryptForPeer/decryptFromPeer, mais sur un ArrayBuffer +// brut plutôt qu'une chaîne — pour le partage de fichiers en session +// éphémère (usePrivatMeet.ts). Pas de base64 ici : les objets envoyés par +// PeerJS DataConnection utilisent sa sérialisation binaire native (le même +// mécanisme qui découpe déjà les gros payloads en chunks), donc encoder en +// base64 n'apporterait que ~33% de taille en plus pour rien. +export async function encryptBufferForPeer (buffer: ArrayBuffer, peerPublicKeyJWK: string, myPublicKeyJWK?: string | object) +{ + + const publicKey = await crypto.subtle.importKey( + "jwk", + JSON.parse(peerPublicKeyJWK), + { name: "RSA-OAEP", hash: "SHA-256" }, + true, + ["encrypt"] + ); + + const fileKey = await crypto.subtle.generateKey( + { name: "AES-GCM", length: 256 }, + true, + ["encrypt"] + ); + + const iv = crypto.getRandomValues(new Uint8Array(12)); + const ciphertext = await crypto.subtle.encrypt( + { name: "AES-GCM", iv }, + fileKey, + buffer + ); + + const exportedAesKey = await crypto.subtle.exportKey("raw", fileKey); + const encryptedAesKey = await crypto.subtle.encrypt( + { name: "RSA-OAEP" }, + publicKey, + exportedAesKey + ); + + let selfEncryptedAesKey: ArrayBuffer | undefined = undefined; + if (myPublicKeyJWK) { + const myPubKey = await crypto.subtle.importKey( + "jwk", + typeof myPublicKeyJWK === 'string' ? JSON.parse(myPublicKeyJWK) : myPublicKeyJWK, + { name: "RSA-OAEP", hash: "SHA-256" }, + false, + ["encrypt"] + ); + selfEncryptedAesKey = await crypto.subtle.encrypt({ name: "RSA-OAEP" }, myPubKey, exportedAesKey); + } + + return { + ciphertext, + encryptedAesKey, + iv: iv.buffer, + selfEncryptedAesKey + }; + +} + +export async function decryptBufferFromPeer ( + ciphertext: ArrayBuffer, + encryptedAesKey: ArrayBuffer, + iv: ArrayBuffer, + myPrivateKey: CryptoKey +): Promise +{ + + const aesKeyRaw = await crypto.subtle.decrypt( + { name: "RSA-OAEP" }, + myPrivateKey, + encryptedAesKey + ); + + const aesKey = await crypto.subtle.importKey( + "raw", aesKeyRaw, "AES-GCM", false, ["decrypt"] + ); + + return await crypto.subtle.decrypt( + { name: "AES-GCM", iv }, + aesKey, + ciphertext + ); + +} + + // For thread E2EE export async function decryptThreadKeyWithRsa( diff --git a/src/assets/utils/peerConfig.ts b/src/assets/utils/peerConfig.ts new file mode 100644 index 00000000..c9b4d788 --- /dev/null +++ b/src/assets/utils/peerConfig.ts @@ -0,0 +1,22 @@ +// Config PeerJS partagée par les deux systèmes P2P de l'app (appels privés +// dans useSecurePeer.ts, sessions éphémères dans usePrivatMeet.ts). +// +// Volontairement STUN-only, sans serveur TURN : PeerJS retombe sinon sur sa +// config par défaut, qui inclut le serveur TURN public turn.peerjs.com — un +// relais tiers accepterait de faire transiter le trafic si la connexion +// directe échoue, ce qui contredit la promesse "peer-to-peer" affichée à +// l'utilisateur. Avec cette config, une connexion qui aboutit est donc +// garantie directe (au prix, en échange, d'un échec pur et simple sur les +// topologies réseau où seul un relais aurait permis de se connecter). +export const PEER_CONFIG = { + sdpSemantics: 'unified-plan' as const, + encodedInsertableStreams: true, + iceServers: [ + { urls: 'stun:stun.l.google.com:19302' }, + { urls: 'stun:stun1.l.google.com:19302' } + ], + iceCandidatePoolSize: 10, + iceTransportPolicy: 'all' as const, + bundlePolicy: 'max-bundle' as const, + rtcpMuxPolicy: 'require' as const +}; diff --git a/src/components/Notifications/NotificationItem.vue b/src/components/Notifications/NotificationItem.vue index 6224f143..6242c758 100644 --- a/src/components/Notifications/NotificationItem.vue +++ b/src/components/Notifications/NotificationItem.vue @@ -103,14 +103,31 @@ const getActionText = (type: string, data: any) => { } }; -// Afficher l'expéditeur +// Afficher l'expéditeur — createAndSendNotification() ne fait jamais +// d'include Prisma sur `sender` (seule la route GET /notifications le fait, +// et sans displayName/username), donc pour une notification reçue en direct +// via le socket, `sender` est quasi toujours vide : on retombe alors sur +// `metadata.senderName`, déjà rempli côté backend pour les messages. const displaySender = computed(() => { if (props.notification.sender) { - return props.notification.sender.displayName || - props.notification.sender.username || + return props.notification.sender.displayName || + props.notification.sender.username || props.notification.sender.id; } - return 'Système'; + return props.notification.metadata?.senderName || 'Système'; +}); + +// PP si on en a une, sinon les initiales générées comme partout ailleurs +// dans l'app (cf. ChatUserBtn.vue, Notifications.vue, ...) — seule une +// notification sans expéditeur identifiable (système, CALL/INVITATION +// sans personne associée) retombe sur l'icône générique du type. +const senderAvatar = computed(() => { + const realAvatar = props.notification.metadata?.senderAvatar as string | undefined; + if (realAvatar) return realAvatar; + if (displaySender.value && displaySender.value !== 'Système') { + return `https://ui-avatars.com/api/?name=${encodeURIComponent(displaySender.value)}&background=128a60&color=fff`; + } + return undefined; }); @@ -121,7 +138,13 @@ const displaySender = computed(() => { @click="handleClick" >
-
+ +
@@ -215,6 +238,14 @@ const displaySender = computed(() => { height: 24px; } +.notification-avatar { + flex-shrink: 0; + width: 32px; + height: 32px; + border-radius: 50%; + object-fit: cover; +} + .notification-icon :deep(svg) { width: 24px; height: 24px; diff --git a/src/components/overlay/Notifications.vue b/src/components/overlay/Notifications.vue index b726ed54..cdee79f2 100644 --- a/src/components/overlay/Notifications.vue +++ b/src/components/overlay/Notifications.vue @@ -34,21 +34,20 @@
+

{{ (notif.msg as any)?.isWebhook ? ((notif.msg as any)?.webhookName || 'Webhook') : $p((notif.msg as any)?.sender?.name) }} APP

-

- - {{ (notif.msg as any).embeds[0].title }} - - {{ notif.msg.content }} +

+ dans {{ (notif.msg as any)?.threadName || 'un salon' }}

@@ -70,12 +69,14 @@ />
+

{{ $p(notif.dmmsg?.sender?.name) }}

-

- {{ notif.dmmsg?.content }} +

+ Nouveau message privé

@@ -90,8 +91,8 @@
-
@@ -134,8 +135,8 @@
-
@@ -149,16 +150,16 @@
- - -
- @@ -195,6 +291,7 @@ import getSpaceIdByThreadId from '@/assets/utils/getSpaceWithThreadId'; import { openedOrg } from '@/assets/var'; import useNotifications, { type Notification, type NotificationType } from '@/composables/useNotifications'; import useSecurePeer from '@/composables/useSecurePeer'; +import usePrivateMeet from '@/composables/usePrivatMeet'; import { computed, onMounted, watch } from 'vue'; import { useRouter } from 'vue-router'; import { SoundService } from '@/services/SoundService'; @@ -211,6 +308,7 @@ import { getCurrentWindow } from '@tauri-apps/api/window'; const { notifications, initListener, remove } = useNotifications(); const router = useRouter(); const { acceptCall, rejectCall } = useSecurePeer(); +const { acceptIncomingMeet, declineIncomingMeet } = usePrivateMeet(); const { Item: privacyMode } = useSettingsItem('privacyMode', false); @@ -253,6 +351,9 @@ const getStyles = (type: NotificationType, toastType?: string) => { case 'notif:dmmsg': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; case 'notif:call': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; case 'notif:privateMeet': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; + case 'notif:privateMeetMsg': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; + case 'notif:missedCall': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; + case 'notif:missedMeet': return 'bg-(--bg2)/80 border border-white/10 rounded-2xl shadow-2xl p-4 backdrop-blur-xl cursor-pointer hover:border-primary/30 transition-colors'; } @@ -352,6 +453,33 @@ const getNativeNotificationContext = (notif: Notification): NativeNotifContext | pluralBody: (count) => `${count} demandes de ${name}` }; } + case 'notif:privateMeetMsg': { + const name = formatName(notif.privateMeetMsg?.user?.name); + return { + key: `privateMeetMsg:${notif.privateMeetMsg?.id}`, + title: 'Session éphémère', + singleBody: `${name} vous a écrit`, + pluralBody: (count) => `${count} nouveaux messages de ${name}` + }; + } + case 'notif:missedCall': { + const name = formatName(notif.missedCall?.user?.name); + return { + key: `missedCall:${notif.missedCall?.id}`, + title: 'Appel manqué', + singleBody: name, + pluralBody: (count) => `${count} appels manqués de ${name}` + }; + } + case 'notif:missedMeet': { + const name = formatName(notif.missedMeet?.user?.name); + return { + key: `missedMeet:${notif.missedMeet?.id}`, + title: 'Session éphémère manquée', + singleBody: name, + pluralBody: (count) => `${count} invitations manquées de ${name}` + }; + } default: return null; } @@ -391,11 +519,20 @@ const showNativeNotification = (notif: Notification) => { }, NATIVE_NOTIF_DEBOUNCE_MS)); }; +// notif:call (appels DM) et notif:privateMeet (invitations éphémères) ont +// déjà leur propre sonnerie en boucle (callSound.wav, démarrée dans +// useSecurePeer.ts / usePrivatMeet.ts dès l'arrivée de l'appel/l'invitation) +// — jouer en plus le "ding" générique par-dessus n'a pas de sens pour un +// appel qui sonne en continu, contrairement à un simple message. +const RINGING_NOTIF_TYPES: NotificationType[] = ['notif:call', 'notif:privateMeet']; + watch(() => notifications.value.length, (newLength, oldLength) => { if (newLength > oldLength) { const latestNotif = notifications.value[notifications.value.length - 1]; if (latestNotif && latestNotif.type !== 'toast') { - playNotificationSound(); + if (!RINGING_NOTIF_TYPES.includes(latestNotif.type)) { + playNotificationSound(); + } showNativeNotification(latestNotif); } } diff --git a/src/components/peer/CallControls.vue b/src/components/peer/CallControls.vue index 38275fea..21f372b1 100644 --- a/src/components/peer/CallControls.vue +++ b/src/components/peer/CallControls.vue @@ -156,6 +156,7 @@