feat: solution SSL 100% locale avec mkcert pour HTTPS de confiance
Problème résolu : certificats self-signed bloqués par navigateurs Solution : mkcert génère certificats automatiquement approuvés - CA locale installée sur système - Certificats signés par cette CA - Navigateurs font confiance automatiquement - Pas de warnings SSL - 100% local, pas de cloud/domaine Nouveau script : setup-certificates.sh - Installe mkcert (Homebrew/apt) - Installe CA locale (mkcert -install) - Détecte IP réseau automatiquement - Génère certificats localhost + IP + *.local - Configure server/.env (SSL_CERT, SSL_KEY) - Configure client/.env (VITE_SERVER_URL) - Met à jour vite.config.js avec HTTPS Serveur modifié : server/index.js - Lit certificats depuis process.env.SSL_CERT/SSL_KEY - Fallback : ../certs/localhost.pem - Message erreur si certificats introuvables Documentation : - SSL-SETUP.md : guide complet installation manuelle/auto - SSL-SOLUTION.md : résumé technique - README.md : ajout étape setup-certificates.sh Résultat : - Cadenas vert sur desktop (Chrome/Safari/Firefox) - WebRTC fonctionne en HTTPS - Smartphones : accepter certificat une fois (normal) - Valable 10 ans, pas de renouvellement Usage : ./setup-certificates.sh (2 minutes) Ensuite : ./start.sh --dev ou ./start-desktop.sh
This commit is contained in:
+12
-4
@@ -437,11 +437,19 @@ async function start() {
|
||||
let server;
|
||||
|
||||
if (ENABLE_HTTPS) {
|
||||
// Charger certificats SSL (mêmes que Vite)
|
||||
const certPath = join(__dirname, '..', 'client');
|
||||
// Charger certificats SSL depuis .env ou 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(join(certPath, 'localhost+3-key.pem')),
|
||||
cert: readFileSync(join(certPath, 'localhost+3.pem'))
|
||||
key: readFileSync(keyPath),
|
||||
cert: readFileSync(certPath)
|
||||
};
|
||||
|
||||
server = https.createServer(httpsOptions, app);
|
||||
|
||||
Reference in New Issue
Block a user