diff --git a/public/js/app.js b/public/js/app.js index 066db17..ca8445a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -6,9 +6,9 @@ const $ = (id) => document.getElementById(id); // ---- Konstanten (leicht justierbar) ---- const START_TIME = 22; // Sekunden zu Beginn -const MAX_TIME = 30; // Deckel (Timerleiste = timeLeft / MAX_TIME) -const BONUS = 2.0; // Zeit pro Treffer -const PENALTY = 2.0; // Zeitabzug pro Fehlklick +const MAX_TIME = 20; // Deckel (Timerleiste = timeLeft / MAX_TIME) +const BONUS = 1.0; // Zeit pro Treffer +const PENALTY = 3.0; // Zeitabzug pro Fehlklick const NAME_KEY = 'fuesse_name'; // ---- Zustand ---- diff --git a/server/index.js b/server/index.js index 91c5145..e88fe26 100644 --- a/server/index.js +++ b/server/index.js @@ -49,13 +49,27 @@ if (feet.length < 2) { const app = express(); app.use(express.json()); +// Caching komplett verhindern (Browser UND Proxys wie Cloudflare). Sonst laden bei +// manchen Nutzern nach einem Update alte JS/CSS-Dateien -> "laedt nicht richtig". +const NO_STORE = 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; +function noStore(res) { + res.setHeader('Cache-Control', NO_STORE); + res.setHeader('Pragma', 'no-cache'); + res.setHeader('Expires', '0'); +} +app.use((req, res, next) => { + noStore(res); + next(); +}); + // Die HTML-Shells nie direkt ausliefern -> immer ueber die Mode-Gates unten // (verhindert, dass man den private-Modus per /index.html umgeht). app.get(['/index.html', '/blocked.html'], (req, res) => res.redirect(302, '/')); -// Statische Assets (CSS/JS/Emoji), aber KEIN automatisches index.html (index:false) -app.use(express.static(PUBLIC_DIR, { index: false, setHeaders: (res) => res.setHeader('Cache-Control', 'no-cache') })); -app.use('/library', express.static(LIBRARY_DIR)); +// Statische Assets (CSS/JS/Emoji), aber KEIN automatisches index.html (index:false). +// etag/lastModified aus + no-store -> keine (bedingten) Caches, auch nicht in Proxys. +app.use(express.static(PUBLIC_DIR, { index: false, etag: false, lastModified: false, setHeaders: noStore })); +app.use('/library', express.static(LIBRARY_DIR, { etag: false, lastModified: false, setHeaders: noStore })); // Verfuegbare Bildchen app.get('/api/feet', (req, res) => { @@ -125,7 +139,7 @@ app.post('/api/score', (req, res) => { // ---- Mode-Gates (Live: getMode() liest pro Request die Datei) ---- function sendHtml(res, file) { - res.set('Cache-Control', 'no-cache'); + noStore(res); res.sendFile(join(PUBLIC_DIR, file)); }