From 8d55c06c2b00752da159d40ac742af8ed07176b9 Mon Sep 17 00:00:00 2001 From: unfr Date: Sat, 27 Sep 2025 16:20:25 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20favicon=20dynamique=20personnali?= =?UTF-8?q?s=C3=A9=20bas=C3=A9=20sur=20le=20nom=20de=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Nouvelle fonctionnalité ### Favicon automatique avec initiales - Génération dynamique d'un favicon SVG avec les 2 premières lettres du nom - Route `/favicon.ico` qui utilise la variable `config.name` - Design moderne avec dégradé bleu et coins arrondis - Cache navigateur optimisé (24h) pour les performances ### Intégration dans l'interface - Ajout de la balise favicon dans autopost.html - Support SVG pour une qualité parfaite à toutes les tailles - Personnalisation automatique selon la configuration ## Avantages - Identité visuelle unique pour chaque instance - Aucune configuration manuelle nécessaire - Favicon professionnel généré automatiquement - Optimisation des performances avec mise en cache --- autopost/server.js | 20 ++++++++++++++++++++ autopost/views/autopost.html | 1 + 2 files changed, 21 insertions(+) diff --git a/autopost/server.js b/autopost/server.js index 3fa512b..ffbeb84 100644 --- a/autopost/server.js +++ b/autopost/server.js @@ -280,6 +280,26 @@ autopostRouter.get('/logout', (req, res) => { req.session.destroy(() => res.redirect('/autopost/login')); }); +// --------------------------- Favicon dynamique ----------------------------- +autopostRouter.get('/favicon.ico', (req, res) => { + const initials = config.name.substring(0, 2).toUpperCase(); + const svg = ` + + + + + + + + ${initials} + `; + + res.setHeader('Content-Type', 'image/svg+xml'); + res.setHeader('Cache-Control', 'public, max-age=86400'); // Cache 24h + res.send(svg); +}); + function checkAuth(req, res, next) { if (req.session && req.session.authenticated) { next(); diff --git a/autopost/views/autopost.html b/autopost/views/autopost.html index 94562cb..3f01f3d 100644 --- a/autopost/views/autopost.html +++ b/autopost/views/autopost.html @@ -4,6 +4,7 @@ {{TITLE}} +