From bde024adf3239aac434162ea3ec0c2b5b374dc06 Mon Sep 17 00:00:00 2001 From: unfr Date: Sun, 12 Oct 2025 14:48:08 +0200 Subject: [PATCH] update mime --- autopost/server.js | 24 ++++++++++++++++++++---- install.sh | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/autopost/server.js b/autopost/server.js index df3c6cc..1c42aa0 100644 --- a/autopost/server.js +++ b/autopost/server.js @@ -173,21 +173,37 @@ app.use('/autopost', express.static(path.join(__dirname, 'public'), { // Servez aussi les vendors sous /autopost app.use('/js', express.static( path.join(__dirname, '../node_modules/@tailwindcss/browser/dist'), - { setHeaders: (res) => res.type('application/javascript') } + { setHeaders: (res, filepath) => { + if (filepath.endsWith('.js')) { + res.setHeader('Content-Type', 'application/javascript'); + } + }} )); app.use('/jquery', express.static( path.join(__dirname, '../node_modules/jquery/dist'), - { setHeaders: (res) => res.type('application/javascript') } + { setHeaders: (res, filepath) => { + if (filepath.endsWith('.js')) { + res.setHeader('Content-Type', 'application/javascript'); + } + }} )); // Miroir des vendors sous /autopost (si reverse-proxy ne forwarde que /autopost/*) app.use('/autopost/js', express.static( path.join(__dirname, '../node_modules/@tailwindcss/browser/dist'), - { setHeaders: (res) => res.type('application/javascript') } + { setHeaders: (res, filepath) => { + if (filepath.endsWith('.js')) { + res.setHeader('Content-Type', 'application/javascript'); + } + }} )); app.use('/autopost/jquery', express.static( path.join(__dirname, '../node_modules/jquery/dist'), - { setHeaders: (res) => res.type('application/javascript') } + { setHeaders: (res, filepath) => { + if (filepath.endsWith('.js')) { + res.setHeader('Content-Type', 'application/javascript'); + } + }} )); // --------------------------- Auth non protégée ----------------------------- diff --git a/install.sh b/install.sh index 9a09eda..2fef50a 100644 --- a/install.sh +++ b/install.sh @@ -344,7 +344,7 @@ fi log "Vérification modules npm" pushd "$AUTOPOST_DIR" >/dev/null [ -f package.json ] || npm init -y >/dev/null 2>&1 || true -modules=(express express-session sqlite3 ansi-to-html @tailwindcss/browser autoprefixer jquery mysql2 session-file-store chokidar) +modules=(express express-session sqlite3 ansi-to-html @tailwindcss/browser autoprefixer jquery mysql2 session-file-store chokidar argon2) missing=() for m in "${modules[@]}"; do npm list "$m" --depth=0 >/dev/null 2>&1 || missing+=("$m")