From e9dba94dd5bdf1887aa3489f42db9e4bf0b8af30 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 9 May 2026 17:58:52 +1200 Subject: [PATCH 1/4] Escape $ in HTML replace function --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 18b1d68bc..608c3dc17 100644 --- a/server/app.js +++ b/server/app.js @@ -593,7 +593,7 @@ export default async function createApp(vite) { html = html.replace( '', - `\n\n${ogMetaTags}` + `\n\n${ogMetaTags}` ); return html; From 82bab129413cc30b0447cfa5d50de172b9e12cf9 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 9 May 2026 18:08:44 +1200 Subject: [PATCH 2/4] Use function instead of pattern escaping --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 608c3dc17..b1e0e1c25 100644 --- a/server/app.js +++ b/server/app.js @@ -593,7 +593,7 @@ export default async function createApp(vite) { html = html.replace( '', - `\n\n${ogMetaTags}` + ()=>{ return `\n\n${ogMetaTags}`; } ); return html; From cc2963b7651095bc03e6ebaf0c0a4500202f388d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 10 May 2026 12:14:54 +1200 Subject: [PATCH 3/4] Increase information about mismatch brew content --- shared/helpers.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/shared/helpers.js b/shared/helpers.js index d2a9c8b73..5cfa8b376 100644 --- a/shared/helpers.js +++ b/shared/helpers.js @@ -160,9 +160,35 @@ const debugTextMismatch = (clientTextRaw, serverTextRaw, label)=>{ // Char-level diff for (let i = 0; i < Math.min(clientText.length, serverText.length); i++) { if(clientText[i] !== serverText[i]) { + const getMismatchContext = (text, index, name, size = 10)=>{ + const lower = Math.max(index - size, 0); + const upper = Math.min(index + size, text.length); + const slice = `${JSON.stringify(text.slice(lower, index - 1)).slice(1, -1)}\u001B[31m${JSON.stringify(text[i]).slice(1, -1)}\u001B[0m${JSON.stringify(text.slice(index+1, upper)).slice(1, -1)}`; + const lineNo = text.slice(0, index).split('\n').length; + const code = `U+${text.charCodeAt(i).toString(16).toUpperCase()}`; + + return { + name, + lineNo, + code, + lower, + upper, + slice + }; + }; + + const boundSize = 10; + + const clientContext = getMismatchContext(clientText, i, 'Client', boundSize); + const serverContext = getMismatchContext(serverText, i, 'Server', boundSize); + + const logContext = (context)=>{ + console.log(` ${context.name} - line ${context.lineNo} : (${context.code})\t${context.slice}`); + }; + console.log(`Char mismatch at index ${i}:`); - console.log(` Client: '${clientText[i]}' (U+${clientText.charCodeAt(i).toString(16).toUpperCase()})`); - console.log(` Server: '${serverText[i]}' (U+${serverText.charCodeAt(i).toString(16).toUpperCase()})`); + logContext(clientContext); + logContext(serverContext); break; } } From 9e4d9ee35d87b15702f3bd51e6bc262e94a3584f Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sun, 10 May 2026 12:23:06 +1200 Subject: [PATCH 4/4] Fix missing character --- shared/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/helpers.js b/shared/helpers.js index 5cfa8b376..eb3dba6d8 100644 --- a/shared/helpers.js +++ b/shared/helpers.js @@ -163,7 +163,7 @@ const debugTextMismatch = (clientTextRaw, serverTextRaw, label)=>{ const getMismatchContext = (text, index, name, size = 10)=>{ const lower = Math.max(index - size, 0); const upper = Math.min(index + size, text.length); - const slice = `${JSON.stringify(text.slice(lower, index - 1)).slice(1, -1)}\u001B[31m${JSON.stringify(text[i]).slice(1, -1)}\u001B[0m${JSON.stringify(text.slice(index+1, upper)).slice(1, -1)}`; + const slice = `${JSON.stringify(text.slice(lower, index)).slice(1, -1)}\u001B[31m${JSON.stringify(text[i]).slice(1, -1)}\u001B[0m${JSON.stringify(text.slice(index+1, upper)).slice(1, -1)}`; const lineNo = text.slice(0, index).split('\n').length; const code = `U+${text.charCodeAt(i).toString(16).toUpperCase()}`;