From 8455a96674321ad35ed862402a3c80319aaa2d53 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 23 Apr 2026 18:06:42 +0200 Subject: [PATCH] Atlas: Versions-Tag rechts unten auf allen Hauptseiten MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - App/version.json mit Commit-SHA + Build-Datum - App/assets/js/version-tag.js โ€” rendert kleines Tag rechts unten - Eingebunden in schueler, teacher, index, login, admin, profil - Ermoeglicht Vergleich lokal vs. geograsim.at auf einen Blick Co-Authored-By: Claude Opus 4.7 (1M context) --- App/admin.html | 1 + App/assets/js/version-tag.js | 59 ++++++++++++++++++++++++++++++++++++ App/index.html | 1 + App/login.html | 1 + App/profil.html | 1 + App/schueler.html | 1 + App/teacher.html | 4 ++- App/version.json | 1 + 8 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 App/assets/js/version-tag.js create mode 100644 App/version.json diff --git a/App/admin.html b/App/admin.html index 1969824..24c1fc1 100644 --- a/App/admin.html +++ b/App/admin.html @@ -104,5 +104,6 @@ api({action:'status'}).then(function(r) { document.getElementById('a-pass').addEventListener('keydown', function(e) { if(e.key==='Enter') doLogin(); }); document.getElementById('a-pin').addEventListener('keydown', function(e) { if(e.key==='Enter') doVerify(); }); + diff --git a/App/assets/js/version-tag.js b/App/assets/js/version-tag.js new file mode 100644 index 0000000..a1825b4 --- /dev/null +++ b/App/assets/js/version-tag.js @@ -0,0 +1,59 @@ +/** + * GeoGraSim โ€” Versions-Tag + * Rendert kleinen Hinweis rechts unten auf jeder Seite, damit lokal vs. + * produktiv schnell abzugleichen ist. + * + * Einbinden: + * (Pfad relativ zur Datei, die es einbindet. Im PHP-Wrapper aus BASE_PATH.) + * + * Liest version.json, zeigt Commit-SHA + Datum. Bei Fetch-Fehler (z.B. + * CORS, offline) zeigt es nichts โ€” stumm, statt kaputt. + */ +(function () { + 'use strict'; + if (window.__GGS_VERSION_TAG_DONE__) return; + window.__GGS_VERSION_TAG_DONE__ = true; + + // Pfad zur version.json ermitteln + var script = document.currentScript; + var versionUrl = 'version.json'; + if (script && script.src) { + // Script-Src: .../assets/js/version-tag.js -> version.json auf gleicher Ebene wie assets/ + var base = script.src.replace(/\/assets\/js\/version-tag\.js.*$/, '/'); + versionUrl = base + 'version.json'; + } + + fetch(versionUrl, { cache: 'no-store' }) + .then(function (r) { return r.ok ? r.json() : null; }) + .then(function (v) { + if (!v) return; + var el = document.createElement('div'); + el.className = 'ggs-version-tag'; + el.title = 'Commit ' + v.commit + ' ยท ' + v.date; + el.innerHTML = '' + v.commit + '' + + '' + v.date + ''; + Object.assign(el.style, { + position: 'fixed', + right: '6px', + bottom: '6px', + zIndex: '99998', + background: 'rgba(20,40,50,0.7)', + color: 'rgba(255,255,255,0.75)', + fontFamily: 'ui-monospace, Menlo, Consolas, monospace', + fontSize: '10px', + lineHeight: '1.2', + padding: '3px 7px', + borderRadius: '4px', + pointerEvents: 'auto', + userSelect: 'all', + cursor: 'help', + display: 'flex', + gap: '6px', + alignItems: 'center' + }); + el.querySelector('.ggs-version-sha').style.fontWeight = '700'; + el.querySelector('.ggs-version-date').style.opacity = '0.7'; + document.body.appendChild(el); + }) + .catch(function () { /* stumm */ }); +})(); diff --git a/App/index.html b/App/index.html index 3733111..17919ed 100644 --- a/App/index.html +++ b/App/index.html @@ -727,5 +727,6 @@ function frame() { } frame(); + diff --git a/App/login.html b/App/login.html index bdcb777..76bbe2b 100644 --- a/App/login.html +++ b/App/login.html @@ -280,5 +280,6 @@ if (!resetToken) { }); } + diff --git a/App/profil.html b/App/profil.html index 0583c48..a4d3a59 100644 --- a/App/profil.html +++ b/App/profil.html @@ -229,5 +229,6 @@ async function deleteAccount() { loadProfile(); + diff --git a/App/schueler.html b/App/schueler.html index 0682a3d..03a1b64 100644 --- a/App/schueler.html +++ b/App/schueler.html @@ -297,5 +297,6 @@ async function renderProfile() { init(); + diff --git a/App/teacher.html b/App/teacher.html index af05e8a..e5a35ad 100644 --- a/App/teacher.html +++ b/App/teacher.html @@ -557,7 +557,8 @@ function printBatchTickets() { html += '
Passwort:'+s.password+'
'; html += '
geograsim.at
'; }); - html += ''; + html += ' +'; w.document.write(html); w.document.close(); } @@ -762,5 +763,6 @@ async function redeemLicenses() { loadLicenses(); } + diff --git a/App/version.json b/App/version.json new file mode 100644 index 0000000..53a3df7 --- /dev/null +++ b/App/version.json @@ -0,0 +1 @@ +{"commit":"b356c79","date":"2026-04-23 16:05 UTC"}