From 702ece66718c5c7d5c5818a4d53380c15f771760 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Mon, 30 Jun 2025 12:39:30 -0500 Subject: [PATCH 1/5] Add brew locale to opengraph localization --- server/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/app.js b/server/app.js index 7b12baacd..07aa1f815 100644 --- a/server/app.js +++ b/server/app.js @@ -383,6 +383,7 @@ app.get('/edit/:id', asyncHandler(getBrew('edit')), asyncHandler(async(req, res, title : req.brew.title || 'Untitled Brew', description : req.brew.description || 'No description.', image : req.brew.thumbnail || defaultMetaTags.image, + local : req.brew.lang, type : 'article' }; From 7e56ae201926b663a45047a6c8c93574545ebe6c Mon Sep 17 00:00:00 2001 From: David Bolack Date: Wed, 16 Jul 2025 10:34:16 -0500 Subject: [PATCH 2/5] locale typo. --- server/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 07aa1f815..869fe6555 100644 --- a/server/app.js +++ b/server/app.js @@ -383,7 +383,7 @@ app.get('/edit/:id', asyncHandler(getBrew('edit')), asyncHandler(async(req, res, title : req.brew.title || 'Untitled Brew', description : req.brew.description || 'No description.', image : req.brew.thumbnail || defaultMetaTags.image, - local : req.brew.lang, + locale : req.brew.lang, type : 'article' }; From b87c78474d3a10d59222487dbef1ea672de25bfb Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 19 Jul 2025 14:49:02 +1200 Subject: [PATCH 3/5] Fix for diff patching using encodeURI --- client/homebrew/pages/editPage/editPage.jsx | 2 +- server/homebrew.api.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index b2c21a157..29dad9de0 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -266,7 +266,7 @@ const EditPage = createClass({ brew.text = brew.text.normalize('NFC'); this.savedBrew.text = this.savedBrew.text.normalize('NFC'); brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1; - brew.patches = stringifyPatches(makePatches(this.savedBrew.text, brew.text)); + brew.patches = stringifyPatches(makePatches(encodeURI(this.savedBrew.text), encodeURI(brew.text))); brew.hash = await md5(this.savedBrew.text); //brew.text = undefined; - Temporary parallel path brew.textBin = undefined; diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 82d64c1a3..e6582d363 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -375,7 +375,7 @@ const api = { try { const patches = parsePatch(brewFromClient.patches); // Patch to a throwaway variable while parallelizing - we're more concerned with error/no error. - const patchedResult = applyPatches(patches, brewFromServer.text, { allowExceedingIndices: true })[0]; + const patchedResult = decodeURI(applyPatches(patches, encodeURI(brewFromServer.text))[0]); if(patchedResult != brewFromClient.text) throw("Patches did not apply cleanly, text mismatch detected"); // brew.text = applyPatches(patches, brewFromServer.text)[0]; From f16598f2384db68c06cdff7df4d795c1eafc247f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 22 Jul 2025 14:39:09 -0400 Subject: [PATCH 4/5] Fix Google ID Validation Regex Google IDs with underscores were failing. Regex found in Google drive documentation: https://developers.google.com/workspace/docs/api/concepts/document --- server/homebrew.api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index e6582d363..0af6e458c 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -52,13 +52,13 @@ const api = { // ID Validation Checks // Homebrewery ID // Typically 12 characters, but the DB shows a range of 7 to 14 characters - if(!id.match(/^[A-Za-z0-9_-]{7,14}$/)){ + if(!id.match(/^[a-zA-Z0-9-_]{7,14}$/)){ throw { name: 'ID Error', message: 'Invalid ID', status: 404, HBErrorCode: '11', brewId: id }; } // Google ID // Typically 33 characters, old format is 44 - always starts with a 1 // Managed by Google, may change outside of our control, so any length between 33 and 44 is acceptable - if(googleId && !googleId.match(/^1(?:[A-Za-z0-9+\/]{32,43})$/)){ + if(googleId && !googleId.match(/^1(?:[a-zA-Z0-9-_]{32,43})$/)){ throw { name: 'Google ID Error', message: 'Invalid ID', status: 404, HBErrorCode: '12', brewId: id }; } @@ -537,4 +537,4 @@ router.delete('/api/:id', checkClientVersion, asyncHandler(api.deleteBrew)); router.get('/api/remove/:id', checkClientVersion, asyncHandler(api.deleteBrew)); router.get('/api/theme/:renderer/:id', asyncHandler(api.getThemeBundle)); -export default api; \ No newline at end of file +export default api; From 990bf80b59f3a23061af522e7c43fae6f6a0ad24 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 22 Jul 2025 14:45:57 -0400 Subject: [PATCH 5/5] Comment out patch contents from logs patch contents on failed patches clogging logs with pages and pages of text --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 0af6e458c..3221638ab 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -382,7 +382,7 @@ const api = { } catch (err) { //debugTextMismatch(brewFromClient.text, brewFromServer.text, `edit/${brewFromClient.editId}`); console.error('Failed to apply patches:', { - patches : brewFromClient.patches, + //patches : brewFromClient.patches, brewId : brewFromClient.editId || 'unknown', error : err });