From 5a4939dac83ceab5e18c609e2e7d581777110724 Mon Sep 17 00:00:00 2001 From: Benoit Date: Wed, 27 May 2026 15:00:35 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20suppression=20fichiers=20r=C3=A9capitu?= =?UTF-8?q?latifs=20markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selon CLAUDE.md : ne pas créer de fichiers récapitulatifs. Suppression de CHANGELOG-PORTABLE.md et FEATURES-QR-HTTPS.md. L'historique git suffit pour le changelog. README-PORTABLE.md reste (documentation utilisateur). --- CHANGELOG-PORTABLE.md | 245 ------------------------------------------ FEATURES-QR-HTTPS.md | 237 ---------------------------------------- 2 files changed, 482 deletions(-) delete mode 100644 CHANGELOG-PORTABLE.md delete mode 100644 FEATURES-QR-HTTPS.md diff --git a/CHANGELOG-PORTABLE.md b/CHANGELOG-PORTABLE.md deleted file mode 100644 index 6fe8bd7..0000000 --- a/CHANGELOG-PORTABLE.md +++ /dev/null @@ -1,245 +0,0 @@ -# Changelog - Version Portable 0.2.0 - -**Date** : 2026-05-27 -**Objectif** : Rendre PTT Live entièrement portable, sans configuration manuelle d'IP ou de devices audio - ---- - -## 🎯 Problèmes Résolus - -### Avant (v0.1.0) -❌ IP hardcodée dans `config.yaml` → impossible à déployer sur autre réseau -❌ Devices audio hardcodés → non portable entre machines -❌ Client `vite.config.js` avec proxy hardcodé → dev uniquement sur machine d'origine -❌ Installation manuelle complexe (multiples étapes, .env à créer manuellement) -❌ Pas de script de démarrage unifié - -### Après (v0.2.0) -✅ **Auto-détection IP réseau** au démarrage (mode AUTO) -✅ **Auto-détection devices audio** via API `/admin/devices/list` -✅ **Génération .env automatique** lors de l'installation -✅ **Vite config dynamique** avec `loadEnv()` -✅ **Scripts portables** : `./install.sh` + `./start.sh` - ---- - -## 📝 Changements Détaillés - -### 1. Configuration Auto-Détectée - -**Fichier : `server/config/config.yaml`** -```diff -server: - livekit: -- url: ws://192.168.0.146:7880 -+ url: AUTO # Détection automatique IP réseau -``` - -```diff -audio: - device: -- inputDeviceId: Microphone MacBook Pro -- outputDeviceId: Haut-parleurs MacBook Pro -+ inputDeviceId: null # Auto-détection device par défaut -+ outputDeviceId: null -``` - -### 2. Client Dynamique - -**Fichier : `client/vite.config.js`** -```diff --import { defineConfig } from 'vite'; -+import { defineConfig, loadEnv } from 'vite'; - --export default defineConfig({ -+export default defineConfig(({ mode }) => { -+ const env = loadEnv(mode, process.cwd(), ''); -+ const apiUrl = env.VITE_API_URL || 'http://localhost:3000'; -+ -+ return { - server: { - proxy: { - '/api': { -- target: 'http://192.168.0.146:3000', -+ target: apiUrl.startsWith('/') ? 'http://localhost:3000' : apiUrl, -``` - -**Nouveau fichier : `client/.env.example`** -```bash -VITE_API_URL=/api # Dev local (proxy Vite) -# VITE_API_URL=http://192.168.1.100:3000 # Réseau -``` - -### 3. API Auto-Détection Devices - -**Nouveau endpoint : `GET /admin/devices/list`** - -Détecte automatiquement les devices audio selon la plateforme : -- **macOS** : sox (CoreAudio) -- **Linux** : JACK → PipeWire → PulseAudio (fallback cascade) -- **Windows** : Placeholder (Phase 3) - -Exemple réponse : -```json -{ - "inputs": [ - { "id": 0, "name": "Microphone MacBook Pro" }, - { "id": 4, "name": "Focusrite Scarlett 2i2" } - ], - "outputs": [ - { "id": 0, "name": "Haut-parleurs MacBook Pro" }, - { "id": 1, "name": "Focusrite Scarlett 2i2" } - ], - "platform": "darwin" -} -``` - -### 4. Scripts Portables - -**`install.sh`** (nouveau) -- Détection OS automatique (macOS/Linux) -- Lance le script d'installation approprié -- Détecte IP réseau locale -- Génère `server/.env` et `client/.env` automatiquement - -**`install/macos.sh`** (amélioré) -```bash -# Détection IP -NETWORK_IP=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1) - -# Génération server/.env -cat > server/.env << EOF -LIVEKIT_URL=AUTO -LIVEKIT_API_KEY=devkey -LIVEKIT_API_SECRET=secret -PORT=3000 -EOF - -# Génération client/.env -cat > client/.env << EOF -VITE_API_URL=/api -# VITE_API_URL=http://${NETWORK_IP}:3000 -EOF -``` - -**`install/linux.sh`** (amélioré) -- Même logique que macOS -- Support Ubuntu/Debian/Arch/Fedora -- Installation PipeWire/JACK automatique - -**`start.sh`** (nouveau) -- Lance serveur + client en une commande -- Modes : `./start.sh` (prod) ou `./start.sh --dev` (dev) -- Détection IP au démarrage -- Cleanup propre (SIGINT/SIGTERM) -- Health check serveur avant lancement client - -### 5. Documentation - -**`README-PORTABLE.md`** (nouveau) -- Guide complet déploiement portable -- Installation zéro-config -- Configuration avancée (IP manuelle, devices, ports) -- Mode production (build, nginx, systemd) -- Dépannage détaillé - -**`README.md`** (mis à jour) -- Installation automatique en premier (recommandé) -- Installation manuelle LiveKit Cloud en alternatif -- Version bump 0.2.0 - -### 6. .gitignore et Templates - -**`.gitignore`** (amélioré) -```diff -# Environment variables -.env -+server/.env -+client/.env -+ -+# Keep .env.example (templates) -+!.env.example -+!client/.env.example -+!server/.env.example -+ -+# Runtime files -+server.log -+/tmp/ptt-live.pid -``` - -**`server/.env.example`** (nouveau) -Template documenté avec mode AUTO expliqué. - ---- - -## 🚀 Utilisation - -### Installation (1 commande) - -```bash -./install.sh -``` - -### Démarrage (1 commande) - -```bash -# Mode développement -./start.sh --dev - -# Mode production -./start.sh -``` - -### Accès réseau - -L'IP est **affichée automatiquement** au démarrage : - -``` -📡 IP réseau détectée : 192.168.1.100 -🌐 Accès : - • Local : https://localhost:5173 - • Réseau : https://192.168.1.100:5173 -``` - -Depuis smartphone : `https://192.168.1.100:5173` - ---- - -## 📊 Statistiques - -**Commits** : 4 commits atomiques -- `b35f80f` - feat: configuration portable - URLs et devices auto-détectés -- `324ff11` - feat: scripts portables et API détection devices audio -- `ec06732` - docs: guide portable complet et mise à jour README -- `94e03fc` - chore: amélioration .gitignore et templates .env - -**Fichiers modifiés** : 10 -**Fichiers créés** : 5 -- `install.sh` -- `start.sh` -- `README-PORTABLE.md` -- `client/.env.example` -- `server/.env.example` - -**Lignes de code ajoutées** : ~950 -**Lignes de documentation** : ~600 - ---- - -## 🎯 Résultat - -PTT Live est maintenant **entièrement portable** : -- ✅ Déploiement sur n'importe quelle machine macOS/Linux -- ✅ Installation en 1 script (~3 minutes) -- ✅ Démarrage en 1 commande -- ✅ Zéro configuration manuelle d'IP -- ✅ Auto-détection devices audio -- ✅ Accès réseau WiFi automatique -- ✅ Documentation complète - -**Production-ready** pour événements en conditions réelles. - ---- - -**Auteur** : Claude Code -**Date** : 2026-05-27 diff --git a/FEATURES-QR-HTTPS.md b/FEATURES-QR-HTTPS.md deleted file mode 100644 index 467ddd4..0000000 --- a/FEATURES-QR-HTTPS.md +++ /dev/null @@ -1,237 +0,0 @@ -# Nouvelles Fonctionnalités : QR Code + HTTPS - -## 🚀 Ce qui a été ajouté - -### 1. QR Code dans le Terminal - -Lorsque le serveur démarre, il affiche automatiquement un **QR code scannable** dans le terminal : - -``` -=== PTT Live Server === - -📡 IP réseau détectée : 192.168.1.100 -🔗 URL LiveKit clients : ws://192.168.1.100:7880 - -✓ LiveKit Server local démarré sur port 7880 -✓ API REST démarrée sur http://0.0.0.0:3000 - -Serveur prêt ! -Groupes configurés: Production, Technique, Sonorisation - -📱 Accès réseau WiFi : - - Dev : https://192.168.1.100:5173 - Prod : http://192.168.1.100:3000 (redirige → HTTPS) - -📲 Scannez le QR code avec votre smartphone : - -█████████████████████████████████ -██ ▄▄▄▄▄ █▀ █▀▀██▀▀█ ▄▄▄▄▄ ██ -██ █ █ █▀▀▄ ▄▀█ ▄ █ █ ██ -██ █▄▄▄█ █ ▀█▄▀██▀▄ █▄▄▄█ ██ -██▄▄▄▄▄▄▄█▄█▄█ █ █ █▄▄▄▄▄▄▄██ -██ ▄▄█ ▄▄ ▀▄█▀▀▄▀▀▄▄ ▄▄▀▄▄██ -██▀▄▀█▄ ▄▄█ ▀█ █▀▀ █▀▄█▀ ▀███ -██▀ ▀▀█▄▄ █▄██▄▀ ▀██▄▄▀▀ ▄ ██ -██ █▀▀ ▄▄▀▀▄▀ █▀▀█▄ ▀██▄█ ▀██ -██▄███▄▄▄█▀ ▄█▀▄▀ ▄▄▄ █ ▄▀██ -██ ▄▄▄▄▄ █▄▄ ▀▄█ █▄█ ▀ ▄ ▀██ -██ █ █ █ ▀ ▀▀▄█ ▄ ▄▄█▄▀██ -██ █▄▄▄█ █ ▄▀▀█▀ ▀ ▄█▄ ▄ ██ -██▄▄▄▄▄▄▄█▄▄███▄█▄██▄▄█▄▄▄▄███ -█████████████████████████████████ -``` - -**Avantages** : -- ✅ **Scan rapide** depuis smartphone (appareil photo) -- ✅ **Pas de frappe d'URL** manuelle -- ✅ **Automatique** : bonne URL selon mode dev/prod -- ✅ **Fonctionne offline** (réseau local WiFi) - ---- - -### 2. Redirection HTTP → HTTPS Automatique - -Le serveur Express **redirige automatiquement** les requêtes HTTP vers HTTPS en mode développement : - -**Avant** : -``` -Smartphone → http://192.168.1.100:3000 -❌ Erreur : L'app nécessite HTTPS (microphone) -``` - -**Après** : -``` -Smartphone → http://192.168.1.100:3000 -↪️ Redirection 301 → https://192.168.1.100:5173 -✅ Accès direct à la PWA avec HTTPS -``` - -**Code serveur** : -```javascript -app.use((req, res, next) => { - const isProd = existsSync(clientDistPath); - - // Mode dev : rediriger HTTP → HTTPS (Vite) - if (!isProd && req.protocol === 'http' && req.hostname !== 'localhost') { - const devHttpsUrl = `https://${req.hostname}:5173${req.url}`; - return res.redirect(301, devHttpsUrl); - } - - next(); -}); -``` - ---- - -### 3. URLs Corrigées Partout - -Tous les scripts et messages affichent maintenant **HTTPS** : - -**install/macos.sh** : -```bash -🌐 Accès après démarrage : - • Développement local : https://localhost:5173 - • Depuis smartphone (WiFi) : https://192.168.1.100:5173 - • Admin : https://192.168.1.100:5173/admin -``` - -**start.sh** : -```bash -✅ PTT Live démarré (mode dev) - -🌐 Accès client : - • Local : https://localhost:5173 - • Réseau : https://192.168.1.100:5173 - -📊 API serveur : http://192.168.1.100:3000 (→ redirige vers HTTPS) -``` - ---- - -## 🎯 Workflow Utilisateur Amélioré - -### Avant (v0.2.0) - -1. Lancer `./start.sh --dev` -2. Noter l'IP affichée -3. Sur smartphone : taper manuellement `https://192.168.1.100:5173` -4. ⚠️ Si typo HTTP → erreur microphone - -### Après (v0.2.1) - -1. Lancer `./start.sh --dev` -2. **Scanner le QR code** affiché -3. ✅ Accès direct HTTPS automatique -4. ✅ Même si QR pointe vers HTTP → redirection auto - -**Gain de temps** : ~30 secondes par connexion -**Réduction erreurs** : 100% (plus de typo URL) - ---- - -## 📦 Dépendances Ajoutées - -```json -{ - "dependencies": { - "qrcode-terminal": "^0.12.0" - } -} -``` - -**Package** : `qrcode-terminal` -**Taille** : ~50KB -**Licence** : Apache 2.0 -**Fonction** : Génération QR codes ASCII dans le terminal - ---- - -## 🔧 Utilisation Avancée - -### Générer QR code pour URL custom - -```javascript -import qrcode from 'qrcode-terminal'; - -const url = 'https://mon-serveur.local:5173'; -qrcode.generate(url, { small: true }, (qr) => { - console.log(qr); -}); -``` - -### Options QR code - -```javascript -qrcode.generate(url, { - small: true // QR code compact (recommandé terminal) - // small: false // QR code large (meilleure scannabilité) -}); -``` - ---- - -## 🚨 Notes de Production - -### HTTPS en Production Réelle - -Pour un déploiement production avec domaine, utiliser **nginx** ou **Caddy** : - -**nginx** : -```nginx -server { - listen 443 ssl http2; - server_name ptt.example.com; - - ssl_certificate /etc/letsencrypt/live/ptt.example.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/ptt.example.com/privkey.pem; - - # Client PWA - location / { - proxy_pass http://localhost:3000; - proxy_set_header Host $host; - } - - # WebSocket LiveKit - location /livekit { - proxy_pass http://localhost:7880; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - } -} - -# Redirection HTTP → HTTPS -server { - listen 80; - server_name ptt.example.com; - return 301 https://$host$request_uri; -} -``` - -**Caddy** (configuration automatique HTTPS) : -```caddyfile -ptt.example.com { - reverse_proxy localhost:3000 - reverse_proxy /livekit localhost:7880 -} -``` - ---- - -## ✅ Résumé - -| Fonctionnalité | Avant | Après | -|----------------|-------|-------| -| Connexion smartphone | Taper URL manuellement | Scanner QR code | -| Temps connexion | ~30-60s | ~5s | -| Erreurs typo URL | Fréquentes | Zéro | -| Redirection HTTPS | Manuelle | Automatique | -| Messages URL | HTTP (obsolète) | HTTPS (correct) | - -**PTT Live est maintenant encore plus simple d'accès** 🎉 - ---- - -**Date** : 2026-05-27 -**Version** : 0.2.1 (QR + HTTPS)