From 7022e50b3b873e552811f131c26d0270e6b800bf Mon Sep 17 00:00:00 2001 From: fds2610-bot Date: Mon, 27 Apr 2026 12:50:19 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Cache-Busting=20f=C3=BCr=20statische=20A?= =?UTF-8?q?ssets=20via=20Git-Commit-Hash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + public/index.php | 5 +++++ scripts/update.sh | 4 ++++ src/Views/layout/base.php | 4 ++-- src/Views/login.php | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b42c743..594c920 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ backups/ *.log .claude/ *.csv +public/static/.asset-version diff --git a/public/index.php b/public/index.php index f8f0dfe..eda11df 100644 --- a/public/index.php +++ b/public/index.php @@ -6,6 +6,11 @@ define('BASE_DIR', dirname(__DIR__)); require BASE_DIR . '/vendor/autoload.php'; +// Cache-Buster für statische Assets: Git-Commit-Hash aus Datei lesen +$_assetVersionFile = BASE_DIR . '/public/static/.asset-version'; +define('ASSET_VERSION', file_exists($_assetVersionFile) ? trim(file_get_contents($_assetVersionFile)) : 'dev'); +unset($_assetVersionFile); + use Steuerkram\Auth; use Steuerkram\Config; use Steuerkram\Router; diff --git a/scripts/update.sh b/scripts/update.sh index 5b159b6..c8a6c59 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -161,6 +161,10 @@ else for f in "${CHANGED_FILES[@]}"; do info " $f"; done fi +# Asset-Version aktualisieren (Cache-Buster für CSS/JS) +git rev-parse --short HEAD > "$PROJECT_DIR/public/static/.asset-version" +ok "Asset-Version gesetzt: $(cat "$PROJECT_DIR/public/static/.asset-version")" + # ── Rebuild-Bedarf ermitteln ───────────────────────────────────────────────── NEEDS_REBUILD=false diff --git a/src/Views/layout/base.php b/src/Views/layout/base.php index e502b52..6b64eb8 100644 --- a/src/Views/layout/base.php +++ b/src/Views/layout/base.php @@ -4,7 +4,7 @@ <?= \Steuerkram\View::h($pageTitle ?? 'Steuerkram') ?> – Steuerkram - + @@ -47,6 +47,6 @@ - + diff --git a/src/Views/login.php b/src/Views/login.php index c5c78f4..078ca50 100644 --- a/src/Views/login.php +++ b/src/Views/login.php @@ -4,7 +4,7 @@ Anmelden – Steuerkram - +