diff --git a/backend/src/index.js b/backend/src/index.js index 84c7335..ca628d3 100644 --- a/backend/src/index.js +++ b/backend/src/index.js @@ -88,6 +88,12 @@ app.use(express.static(PUBLIC, { if (filePath.match(/\.(js|css)$/) && !filePath.includes('sw.js')) { res.setHeader('Cache-Control', 'public, max-age=31536000, immutable'); } + // index.html niemals cachen – auch nicht über express.static + if (filePath.endsWith('index.html')) { + res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate'); + res.setHeader('Pragma', 'no-cache'); + res.setHeader('Expires', '0'); + } } })); @@ -95,6 +101,7 @@ app.use(express.static(PUBLIC, { app.get('*', (_req, res) => { res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate'); res.setHeader('Pragma', 'no-cache'); + res.setHeader('Expires', '0'); res.sendFile(path.join(PUBLIC, 'index.html')); }); diff --git a/frontend/src/tools/devtools.jsx b/frontend/src/tools/devtools.jsx index 031288e..e99908b 100644 --- a/frontend/src/tools/devtools.jsx +++ b/frontend/src/tools/devtools.jsx @@ -1902,11 +1902,30 @@ function RegexBuilder({ toast, mobile }) { // Typografische Anführungszeichen und andere häufige Probleme beheben function sanitizeJson(raw) { - return raw - .replace(/[\u201C\u201D\u201E\u201F\u2018\u2019\u02BC]/g, '"') // „" "" usw → " - .replace(/[\u2018\u2019\u02BC\u0060]/g, '"') // ' ` → " - .replace(/,\s*([}\]])/g, '$1') // trailing commas - .replace(/([{,]\s*)([a-zA-Z_][a-zA-Z0-9_]*)\s*:/g, '$1"$2":'); // unquoted keys + let s = raw + // Alle typografischen/deutschen Anführungszeichen → gerade " + .replace(/[\u201C\u201D\u201E\u201F\u00AB\u00BB\u2039\u203A]/g, '"') + // Einfache typografische → gerade " + .replace(/[\u2018\u2019\u02BC\u0060]/g, '"') + // Trailing commas vor } oder ] + .replace(/,\s*([}\]])/g, '$1') + // Unquoted keys: {key: ...} → {"key": ...} + .replace(/([{,]\s*)([a-zA-Z_\u00C0-\u024F][a-zA-Z0-9_\u00C0-\u024F]*)\s*:/g, '$1"$2":'); + + const trimmed = s.trim(); + + // Falls kein vollständiges JSON-Objekt/Array → versuche als Objekt-Fragment wrappen + // z.B. "Mitarbeiter": [...] → {"Mitarbeiter": [...]} + if (trimmed && !trimmed.startsWith('{') && !trimmed.startsWith('[') + && !trimmed.startsWith('"') && trimmed !== 'null' + && trimmed !== 'true' && trimmed !== 'false') { + s = '{' + trimmed + '}'; + } else if (trimmed && trimmed.startsWith('"') && trimmed.includes(':')) { + // Quoted key at root level: "key": value → {"key": value} + s = '{' + trimmed + '}'; + } + + return s; } // JSON → XML string @@ -2183,11 +2202,26 @@ function JsonTool({ toast, mobile }) { {/* Anleitung */}
{ex}
+ {ex}
+