diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7a1bd13 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Scripts executes sur le serveur Linux : toujours en LF, sinon bash casse. +*.sh text eol=lf diff --git a/data/news.json.br b/data/news.json.br deleted file mode 100644 index 4c9d245..0000000 Binary files a/data/news.json.br and /dev/null differ diff --git a/data/news.json.gz b/data/news.json.gz deleted file mode 100644 index fa90462..0000000 Binary files a/data/news.json.gz and /dev/null differ diff --git a/deploy/appliquer-caddy-build.sh b/deploy/appliquer-caddy-build.sh new file mode 100644 index 0000000..327ee0a --- /dev/null +++ b/deploy/appliquer-caddy-build.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Phase 1 perf gastinel.me : /assets/build/* (fichiers a empreinte produits par +# tools/build.js) -> cache 1 an immutable + .br/.gz precompresses. +# Ne fait qu'AJOUTER un handle dans le bloc "gastinel.me, www.gastinel.me". +# Sauvegarde -> modification -> caddy validate -> reload ; retour arriere si echec. +# Usage (sur cornafsuisse) : sudo bash ~/appliquer-caddy-build.sh +set -euo pipefail +[ "$(id -u)" = 0 ] || { echo "A lancer avec sudo"; exit 1; } + +CF=/etc/caddy/Caddyfile +BAK="$CF.avant-build-$(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() +if "handle /assets/build/*" in s: + sys.exit("Deja applique : aucune modification.") +anchor = "\t# Assets (polices, images) : cache navigateur 30 jours.\n" +new = ( + "\t# Assets a empreinte (tools/build.js) : le nom change avec le contenu,\n" + "\t# donc cache 1 an sans revalidation.\n" + "\thandle /assets/build/* {\n" + "\t\theader Cache-Control \"public, max-age=31536000, immutable\"\n" + "\t\troot * /srv/gastinel.me\n" + "\t\tfile_server {\n" + "\t\t\tprecompressed br gzip\n" + "\t\t}\n" + "\t}\n" + "\n" +) +n = s.count(anchor) +if n != 1: + sys.exit("Point d'insertion introuvable ou ambigu (%d) : aucune modification." % n) +open(p, "w").write(s.replace(anchor, new + anchor)) +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/index.html.br b/index.html.br deleted file mode 100644 index 630ca52..0000000 Binary files a/index.html.br and /dev/null differ diff --git a/index.html.gz b/index.html.gz deleted file mode 100644 index e2dc82d..0000000 Binary files a/index.html.gz and /dev/null differ diff --git a/llms.txt.br b/llms.txt.br deleted file mode 100644 index 6c6c512..0000000 Binary files a/llms.txt.br and /dev/null differ diff --git a/llms.txt.gz b/llms.txt.gz deleted file mode 100644 index ec31e14..0000000 Binary files a/llms.txt.gz and /dev/null differ diff --git a/robots.txt.br b/robots.txt.br deleted file mode 100644 index be33905..0000000 Binary files a/robots.txt.br and /dev/null differ diff --git a/robots.txt.gz b/robots.txt.gz deleted file mode 100644 index 82159ef..0000000 Binary files a/robots.txt.gz and /dev/null differ diff --git a/sitemap.xml.br b/sitemap.xml.br deleted file mode 100644 index c00b3c3..0000000 Binary files a/sitemap.xml.br and /dev/null differ diff --git a/sitemap.xml.gz b/sitemap.xml.gz deleted file mode 100644 index 5fe9a81..0000000 Binary files a/sitemap.xml.gz and /dev/null differ diff --git a/tools/build.js b/tools/build.js new file mode 100644 index 0000000..047557e --- /dev/null +++ b/tools/build.js @@ -0,0 +1,167 @@ +#!/usr/bin/env node +/** + * tools/build.js + * + * Build de production de gastinel.me — zéro dépendance (Node natif). + * + * Source : index.html (on continue à l'éditer tel quel, CSS/JS inline). + * Sortie : dist/ (miroir de /srv/gastinel.me, prêt à déployer) + * - index.html HTML allégé (commentaires, indentation retirés) + * - assets/build/app..css tous les