diff --git a/ELECTRON_SUMMARY.md b/ELECTRON_SUMMARY.md deleted file mode 100644 index 4bf924e..0000000 --- a/ELECTRON_SUMMARY.md +++ /dev/null @@ -1,322 +0,0 @@ -# 📋 RĂ©sumĂ© - Application Desktop PTT Live - -## ✅ Ce qui a Ă©tĂ© créé - -### Structure ComplĂšte - -``` -electron/ -├── package.json # Config Electron + electron-builder -├── main.js # Main Process (333 lignes) -├── preload.js # IPC bridge sĂ©curisĂ© (31 lignes) -├── .gitignore # Git exclusions -│ -├── ui/ # Interface frontend -│ ├── index.html # Structure UI (187 lignes) -│ ├── styles.css # Dark theme (556 lignes) -│ ├── app.js # Logic frontend (626 lignes) -│ └── qrcode.min.js # Placeholder QR Code -│ -└── Documentation - ├── README.md # Doc technique complĂšte - ├── QUICKSTART.md # Guide dĂ©marrage rapide - └── CHANGELOG.md # Historique v0.3.0 -``` - -**Total : 1733 lignes de code** (hors node_modules) - ---- - -## 🎯 FonctionnalitĂ©s ImplĂ©mentĂ©es - -### ✅ Core - -- [x] Main Process spawn serveur Node.js automatiquement -- [x] IPC sĂ©curisĂ© (contextBridge + preload.js) -- [x] DĂ©marrage/arrĂȘt serveur avec feedback visuel -- [x] DĂ©tection statut serveur (polling) -- [x] Gestion logs temps rĂ©el (Main → Renderer) - -### ✅ Dashboard - -- [x] Stats temps rĂ©el (uptime, utilisateurs, connexions, groupes) -- [x] Liste utilisateurs connectĂ©s avec dĂ©tails -- [x] GĂ©nĂ©ration QR Code automatique (dĂ©tection IP rĂ©seau) -- [x] Bouton copier URL clients -- [x] Polling automatique toutes les 2 secondes - -### ✅ Configuration Audio - -- [x] Auto-dĂ©tection devices (input/output) -- [x] SĂ©lection depuis dropdown -- [x] Sample rate configurable (44.1/48/96 kHz) -- [x] Bitrate par dĂ©faut (32-320 kbps) -- [x] Jitter buffer (20-100 ms) -- [x] Sauvegarde dans config.yaml via API - -### ✅ Gestion Groupes - -- [x] Liste groupes existants -- [x] CrĂ©ation nouveau groupe (nom + bitrate) -- [x] Affichage infos groupe (ID, bitrate) -- [x] API admin `/admin/groups` CRUD - -### ✅ Monitoring - -- [x] Logs serveur en temps rĂ©el -- [x] Buffer 500 logs max en mĂ©moire -- [x] Filtrage par niveau (error/warn/info/debug) -- [x] Bouton effacer logs -- [x] Format : timestamp + niveau + message - -### ✅ Notifications - -- [x] Toast visuelles (4 types : success/error/warning/info) -- [x] Auto-dismiss aprĂšs 5 secondes -- [x] Bouton fermeture manuelle -- [x] Animation slide-in/out -- [x] IcĂŽnes par type (✅❌⚠â„č) - -### ✅ Packaging - -- [x] electron-builder configurĂ© -- [x] Build macOS (.dmg + .app) -- [x] Build Linux (.deb + .AppImage) -- [x] Scripts npm : `build:mac` / `build:linux` - ---- - -## 🚧 À ImplĂ©menter (TODO) - -### PrioritĂ© Haute - -- [ ] **WebSocket audio levels** : `/audio-levels` pour VU-mĂštres temps rĂ©el -- [ ] **IcĂŽnes** : icon.icns (macOS) + icon.png (Linux) + tray-icon.png -- [ ] **Tray icon** : menu contextuel (start/stop/open/quit) - -### PrioritĂ© Moyenne - -- [ ] **Graphiques monitoring** : Chart.js pour latence/bande passante -- [ ] **Export logs** : bouton tĂ©lĂ©charger CSV/JSON -- [ ] **Matrice routing** : interface graphique drag & drop -- [ ] **Notifications desktop** : Electron Notification API - -### PrioritĂ© Basse - -- [ ] **Auth admin** : mot de passe pour accĂšs dashboard -- [ ] **ThĂšme toggle** : dark/light mode -- [ ] **Auto-update** : electron-updater -- [ ] **I18n** : français/anglais -- [ ] **Tests** : Spectron ou Playwright - ---- - -## 📩 API Admin UtilisĂ©es - -L'application consomme toutes les routes existantes : - -| Endpoint | Usage | Statut | -|----------|-------|--------| -| `/admin/stats` | Dashboard metrics | ✅ | -| `/admin/users` | Liste utilisateurs | ✅ | -| `/admin/groups` | Liste groupes | ✅ | -| `POST /admin/groups` | CrĂ©er groupe | ✅ | -| `/admin/config` | Config complĂšte | ✅ | -| `PUT /admin/config/audio` | Config audio | ✅ | -| `/admin/devices/list` | Auto-dĂ©tection devices | ✅ | -| `POST /admin/audio/device` | SĂ©lectionner device | ✅ | -| `/health` | Health check | ✅ | -| `WS /audio-levels` | VU-mĂštres (WebSocket) | 🚧 | - ---- - -## 🚀 Lancement - -```bash -# Depuis la racine du projet -./start-desktop.sh - -# OU depuis electron/ -cd electron -npm start - -# Mode dĂ©veloppement (avec DevTools) -npm run dev -``` - ---- - -## đŸ—ïž Build Distribution - -```bash -cd electron - -# macOS -npm run build:mac -# → dist/PTT Live Server.dmg -# → dist/mac/PTT Live Server.app - -# Linux -npm run build:linux -# → dist/PTT Live Server-0.3.0.deb -# → dist/PTT Live Server-0.3.0.AppImage - -# Les deux -npm run build -``` - ---- - -## 🎹 Architecture Technique - -### Communication - -``` -┌─────────────────────────────────────────┐ -│ MAIN PROCESS (Node.js) │ -│ │ -│ ‱ spawn server/index.js │ -│ ‱ IPC handlers: │ -│ - server:start() │ -│ - server:stop() │ -│ - server:status() │ -│ ‱ Forward logs → Renderer │ -│ │ -└─────────────────────────────────────────┘ - ↕ IPC (contextBridge) -┌─────────────────────────────────────────┐ -│ RENDERER PROCESS (Frontend) │ -│ │ -│ ‱ Fetch API REST :3000/admin/* │ -│ ‱ Update UI (vanilla JS) │ -│ ‱ Generate QR Code │ -│ ‱ Display notifications (toast) │ -│ │ -└─────────────────────────────────────────┘ - ↕ HTTP -┌─────────────────────────────────────────┐ -│ SERVEUR PTT LIVE (spawned) │ -│ │ -│ ‱ LiveKit Server (binaire Go) │ -│ ‱ Audio Bridge Manager │ -│ ‱ API REST Express :3000 │ -│ ‱ WebSocket Audio Levels │ -│ │ -└─────────────────────────────────────────┘ -``` - -### SĂ©curitĂ© - -- ✅ `contextIsolation: true` (isoler Node.js du renderer) -- ✅ `nodeIntegration: false` (pas d'accĂšs Node direct) -- ✅ `preload.js` (whitelist API via contextBridge) -- ⚠ CSP manquant (Ă  ajouter en prod) - ---- - -## 📚 Documentation Créée - -1. **[electron/README.md](electron/README.md)** (doc technique complĂšte) - - Architecture - - API utilisĂ©es - - Build & packaging - - Debug - -2. **[electron/QUICKSTART.md](electron/QUICKSTART.md)** (guide rapide) - - Lancement en 30s - - Checklist premiĂšre utilisation - - ProblĂšmes courants - -3. **[electron/CHANGELOG.md](electron/CHANGELOG.md)** (historique v0.3.0) - - FonctionnalitĂ©s - - Technique - - TODO - -4. **[DESKTOP-APP.md](DESKTOP-APP.md)** (doc utilisateur complĂšte) - - Aperçu fonctionnalitĂ©s - - Guide utilisation - - Build distribution - - FAQ - -5. **Mises Ă  jour** - - [README.md](README.md) : section "Application Desktop" - - [CLAUDE.md](CLAUDE.md) : section "Application Desktop (v0.3.0)" - ---- - -## ✅ Checklist Validation - -### Fonctionnel - -- [x] Application se lance sans erreur -- [x] Serveur dĂ©marre automatiquement -- [x] Dashboard affiche stats -- [x] Configuration devices fonctionne -- [x] Groupes CRUD opĂ©rationnel -- [x] Logs temps rĂ©el -- [x] Notifications toast - -### Code - -- [x] Syntaxe JS valide (main.js, preload.js, app.js) -- [x] HTML valide -- [x] CSS sans erreur -- [x] eslint compatible (pas de lint errors) - -### Documentation - -- [x] README technique complet -- [x] QUICKSTART guide rapide -- [x] CHANGELOG historique -- [x] DESKTOP-APP doc utilisateur -- [x] README principal mis Ă  jour -- [x] CLAUDE.md mis Ă  jour - -### Packaging - -- [x] package.json configurĂ© -- [x] electron-builder configurĂ© -- [x] Scripts build:mac / build:linux -- [x] .gitignore créé - ---- - -## 🎓 Points d'Apprentissage - -### Electron - -- Main Process vs Renderer Process -- IPC sĂ©curisĂ© via contextBridge -- spawn child_process pour serveur -- electron-builder pour packaging - -### APIs - -- RĂ©utilisation 100% API admin existante -- Polling vs WebSocket (stats vs audio levels) -- DĂ©tection IP rĂ©seau depuis serveur - -### Frontend - -- Vanilla JS (pas de framework pour lĂ©gĂšretĂ©) -- Navigation SPA manuelle -- Toast notifications custom -- QR Code gĂ©nĂ©ration (lib CDN) - ---- - -## 🏆 RĂ©sultat - -**Application desktop professionnelle complĂšte** pour gĂ©rer PTT Live : -- ✅ Interface graphique intuitive -- ✅ Toutes les fonctionnalitĂ©s admin accessibles -- ✅ PackagĂ©e pour distribution (macOS/Linux) -- ✅ Documentation exhaustive - -**PrĂȘt pour tests utilisateurs** et itĂ©rations futures. - ---- - -**DĂ©veloppĂ© avec Claude Code** -**Date : 2026-06-19** -**Version : 0.3.0** diff --git a/SSL-SOLUTION.md b/SSL-SOLUTION.md deleted file mode 100644 index 3c93a89..0000000 --- a/SSL-SOLUTION.md +++ /dev/null @@ -1,295 +0,0 @@ -# 🔐 Solution SSL 100% Locale - RĂ©sumĂ© - -## ✅ ProblĂšme RĂ©solu - -**Avant** : -- ❌ Certificats self-signed bloquĂ©s par navigateurs -- ❌ Warnings "Connexion non sĂ©curisĂ©e" -- ❌ WebRTC refuse de fonctionner en HTTPS invalide -- ❌ Configuration complexe manuelle - -**AprĂšs** : -- ✅ Certificats **automatiquement approuvĂ©s** par systĂšme et navigateurs -- ✅ Cadenas vert 🔒 sans warnings -- ✅ WebRTC fonctionne parfaitement -- ✅ Installation automatique en 2 minutes - ---- - -## 🎯 Solution : mkcert - -**mkcert** = gĂ©nĂ©rateur de certificats SSL locaux **de confiance** - -### Principe - -1. Installe une **Certificate Authority (CA) locale** sur votre machine -2. GĂ©nĂšre des certificats signĂ©s par cette CA -3. SystĂšme et navigateurs font **automatiquement confiance** Ă  cette CA -4. RĂ©sultat : certificats locaux = certificats valides ✅ - -### Avantages - -- ✅ **100% local** : pas de cloud, pas de domaine requis -- ✅ **Automatique** : script d'installation complet -- ✅ **Multi-plateforme** : macOS, Linux, Windows -- ✅ **Multi-navigateurs** : Chrome, Safari, Edge, Firefox -- ✅ **Valable 10 ans** : pas de renouvellement - ---- - -## 🚀 Installation - -### Un Seul Script - -```bash -# Depuis la racine du projet -./setup-certificates.sh -``` - -Ce script fait **automatiquement** : - -1. ✅ Installe `mkcert` (via Homebrew sur macOS, apt sur Linux) -2. ✅ Installe la CA locale dans le systĂšme -3. ✅ DĂ©tecte votre **IP rĂ©seau** (ex: 192.168.1.10) -4. ✅ GĂ©nĂšre certificats pour : - - `localhost` - - `127.0.0.1` - - Votre IP rĂ©seau - - `*.local` -5. ✅ Configure automatiquement : - - `server/.env` (chemins certificats) - - `client/.env` (URL HTTPS serveur) - - `client/vite.config.js` (HTTPS Vite) - - `server/index.js` (dĂ©jĂ  compatible) - -**Temps : ~2 minutes** - ---- - -## 📁 Fichiers Créés - -``` -PTT Live/ -├── certs/ # NOUVEAU -│ ├── localhost.pem # Certificat public -│ └── localhost-key.pem # ClĂ© privĂ©e -│ -├── server/.env # MIS À JOUR -│ ENABLE_HTTPS=true -│ SSL_CERT=/path/to/localhost.pem -│ SSL_KEY=/path/to/localhost-key.pem -│ NETWORK_IP=192.168.1.10 -│ -└── client/ - ├── .env # CRÉÉ - │ VITE_SERVER_URL=https://192.168.1.10:3000 - │ - └── vite.config.js # MIS À JOUR - server: { - https: { key, cert } - } -``` - ---- - -## 🌐 Utilisation - -### DĂ©marrage - -```bash -# Mode dĂ©veloppement (2 terminaux) -./start.sh --dev - -# OU Mode desktop (1 terminal) -./start-desktop.sh -``` - -### URLs d'AccĂšs - -**Depuis l'ordinateur serveur** : -``` -https://localhost:3000 (serveur) -https://localhost:5173 (client dev) -``` - -**Depuis smartphone (mĂȘme WiFi)** : -``` -https://192.168.1.10:3000 (serveur) -https://192.168.1.10:5173 (client dev) - -OU scanner le QR Code affichĂ© au dĂ©marrage -``` - -### PremiĂšre Connexion Smartphone - -1. Scanner QR Code -2. Le navigateur ouvre l'URL HTTPS -3. **Accepter le certificat** (une seule fois) - - iOS : "Continuer" → "Visiter ce site web" - - Android : "AvancĂ©" → "Continuer" -4. La PWA se charge normalement -5. Installer sur Ă©cran d'accueil - -**Pourquoi accepter manuellement ?** -La CA locale est installĂ©e sur le **serveur**, pas sur chaque smartphone. -C'est normal et **sĂ©curisĂ©** sur rĂ©seau local privĂ©. - ---- - -## 🔧 Code ModifiĂ© - -### server/index.js - -```javascript -// Avant (chemins hardcodĂ©s) -const httpsOptions = { - key: readFileSync(join(certPath, 'localhost+3-key.pem')), - cert: readFileSync(join(certPath, 'localhost+3.pem')) -}; - -// AprĂšs (depuis .env avec fallback) -const certPath = process.env.SSL_CERT || join(__dirname, '..', 'certs', 'localhost.pem'); -const keyPath = process.env.SSL_KEY || join(__dirname, '..', 'certs', 'localhost-key.pem'); - -if (!existsSync(certPath) || !existsSync(keyPath)) { - log('error', '❌ Certificats SSL introuvables'); - log('info', '💡 ExĂ©cutez : ./setup-certificates.sh'); - process.exit(1); -} - -const httpsOptions = { - key: readFileSync(keyPath), - cert: readFileSync(certPath) -}; -``` - ---- - -## ✅ Avantages vs Autres Solutions - -| Solution | Local | Auto-approuvĂ© | Setup | Renouvellement | -|----------|-------|---------------|-------|----------------| -| **mkcert** | ✅ | ✅ | 2 min | 10 ans | -| Self-signed manuel | ✅ | ❌ | 30 min | Annuel | -| Let's Encrypt | ❌ | ✅ | 1h+ | 90 jours | -| Certificat commercial | ❌ | ✅ | Payant | Annuel | - -**Verdict** : mkcert = solution idĂ©ale pour dĂ©veloppement et dĂ©ploiement local - ---- - -## đŸ“± Mobile : Pourquoi Accepter Manuellement ? - -### Explication Technique - -1. **CA locale installĂ©e sur serveur** : - - SystĂšme macOS/Linux fait confiance Ă  la CA - - Navigateurs desktop (Chrome/Safari/Firefox) font confiance - -2. **Smartphones non configurĂ©s** : - - La CA locale n'est pas sur iOS/Android - - Les mobiles ne connaissent pas cette CA - - Normal et **sĂ©curisĂ©** sur rĂ©seau privĂ© - -### Options - -**A) Accepter manuellement (recommandĂ©)** -- 2 clics par appareil -- Une seule fois -- Simple et rapide - -**B) Installer CA sur chaque mobile (optionnel)** -- iOS : RĂ©glages → VPN → Profils -- Android : SĂ©curitĂ© → Certificats -- Plus complexe, pas nĂ©cessaire - -💡 **Recommandation** : Option A, largement suffisant - ---- - -## 🐛 DĂ©pannage - -### Serveur refuse de dĂ©marrer - -**Erreur** : "Certificats SSL introuvables" - -**Solution** : -```bash -# VĂ©rifier -ls certs/ - -# RĂ©gĂ©nĂ©rer -./setup-certificates.sh -``` - -### Warning SSL sur Desktop - -**ProblĂšme** : Cadenas rouge sur Chrome - -**Solution** : -```bash -# RĂ©installer CA -mkcert -install - -# RedĂ©marrer navigateur -``` - -### Firefox : Certificat non approuvĂ© - -**ProblĂšme** : Firefox affiche warning (Chrome OK) - -**Solution** : -```bash -# Installer NSS -brew install nss # macOS -sudo apt install libnss3-tools # Linux - -# RĂ©installer CA -mkcert -install -``` - ---- - -## 🎓 Pourquoi Cette Solution ? - -### Contraintes du Projet - -1. ✅ **100% local** : pas de dĂ©pendance cloud/internet -2. ✅ **Pas de domaine** : fonctionne sur IP locale -3. ✅ **HTTPS requis** : WebRTC + Service Workers -4. ✅ **Multi-devices** : desktop + smartphones -5. ✅ **ÉvĂ©nementiel** : WiFi privĂ©, changement IP frĂ©quent - -### mkcert RĂ©pond Ă  Tout - -- Local ✅ -- Pas de domaine ✅ -- HTTPS valide ✅ -- Multi-devices (avec acceptation manuelle) ✅ -- Re-gĂ©nĂ©ration rapide si IP change ✅ - ---- - -## 📚 Documentation - -- **[SSL-SETUP.md](SSL-SETUP.md)** : Guide complet dĂ©taillĂ© -- **[setup-certificates.sh](setup-certificates.sh)** : Script d'installation -- **[README.md](README.md)** : Mis Ă  jour avec Ă©tape certificats - ---- - -## 🏆 RĂ©sultat - -**HTTPS 100% local fonctionnel** : -- ✅ Certificats approuvĂ©s automatiquement -- ✅ Cadenas vert sur desktop -- ✅ WebRTC fonctionne -- ✅ PWA installable -- ✅ Pas de cloud, pas de domaine -- ✅ Installation en 2 minutes - -**Production ready** pour dĂ©ploiement Ă©vĂ©nementiel WiFi local ! 🎉 - ---- - -**Commande magique** : `./setup-certificates.sh`