diff --git a/deploy/appliquer-caddy-perf.sh b/deploy/appliquer-caddy-perf.sh new file mode 100644 index 0000000..02881bd --- /dev/null +++ b/deploy/appliquer-caddy-perf.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Phase 0 perf gastinel.me : Brotli/gzip precompresses + Cache-Control. +# Ne modifie QUE le handle final du bloc "gastinel.me, www.gastinel.me". +# Sauvegarde -> modification -> caddy validate -> reload ; retour arriere si echec. +# Usage (sur cornafsuisse) : sudo bash ~/appliquer-caddy-perf.sh +set -euo pipefail +[ "$(id -u)" = 0 ] || { echo "A lancer avec sudo"; exit 1; } + +CF=/etc/caddy/Caddyfile +BAK="$CF.avant-perf-$(date +%Y%m%d-%H%M%S)" +cp -a "$CF" "$BAK" +echo "Sauvegarde : $BAK" + +python3 - "$CF" <<'PY' +import sys +p = sys.argv[1] +s = open(p).read() +old = "\thandle {\n\t\troot * /srv/gastinel.me\n\t\tfile_server\n\t}\n" +new = ( + "\t# Assets (polices, images) : cache navigateur 30 jours.\n" + "\t# Passer a immutable/1 an quand les noms de fichiers seront hashes.\n" + "\thandle /assets/* {\n" + "\t\theader Cache-Control \"public, max-age=2592000\"\n" + "\t\troot * /srv/gastinel.me\n" + "\t\tfile_server\n" + "\t}\n" + "\n" + "\t# HTML/JSON : revalidation a chaque visite (304 via ETag si inchange).\n" + "\t# Sert les .br/.gz precompresses s'ils existent (sinon encode zstd/gzip).\n" + "\thandle {\n" + "\t\theader Cache-Control \"no-cache\"\n" + "\t\troot * /srv/gastinel.me\n" + "\t\tfile_server {\n" + "\t\t\tprecompressed br gzip\n" + "\t\t}\n" + "\t}\n" +) +n = s.count(old) +if n != 1: + sys.exit("Bloc attendu introuvable ou ambigu (%d) : aucune modification." % n) +open(p, "w").write(s.replace(old, new)) +PY + +if caddy validate --config "$CF" --adapter caddyfile && systemctl reload caddy; then + echo "OK : Caddy recharge." +else + echo "ECHEC : restauration de $BAK" + cp -a "$BAK" "$CF" + systemctl reload caddy || true + exit 1 +fi diff --git a/gws/download/index.html b/gws/download/index.html index b709ef3..cb2c592 100644 --- a/gws/download/index.html +++ b/gws/download/index.html @@ -4,7 +4,7 @@
Compatible Windows 10 et Windows 11 (64-bit) — configuration requise. Déjà installé ? Le paquet de mise à jour .gws se trouve plus bas.
@@ -516,7 +517,7 @@ body {