From 0e25793f0ae0536440de00f0dcb87a0b8b68160c Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 13 Apr 2022 19:35:51 +1200 Subject: [PATCH 1/3] Add publicUrl to global.config & update template --- client/template.js | 2 +- server/app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/template.js b/client/template.js index fd8bc22b6..b9f76fdde 100644 --- a/client/template.js +++ b/client/template.js @@ -1,5 +1,5 @@ module.exports = async(name, title = '', props = {})=>{ - const HOMEBREWERY_PUBLIC_URL=props.publicUrl; + const HOMEBREWERY_PUBLIC_URL=props.config.publicUrl; return ` diff --git a/server/app.js b/server/app.js index 381113a4a..adb741b32 100644 --- a/server/app.js +++ b/server/app.js @@ -281,11 +281,11 @@ app.use((req, res)=>{ // Create configuration object const configuration = { local : isLocalEnvironment, + publicUrl : config.get('publicUrl') ?? '', environment : nodeEnv }; const props = { version : require('./../package.json').version, - publicUrl : config.get('publicUrl') ?? '', url : req.originalUrl, brew : req.brew, brews : req.brews, From a73b3648ae665cf75d4e8bc9ea5790dfb0c9bf69 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 13 Apr 2022 19:40:33 +1200 Subject: [PATCH 2/3] Update editPage links to use publicUrl --- client/homebrew/pages/editPage/editPage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index a77321e6f..a0a262038 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -352,7 +352,7 @@ const EditPage = createClass({ const title = `${this.props.brew.title} ${systems}`; const text = `Hey guys! I've been working on this homebrew. I'd love your feedback. Check it out. -**[Homebrewery Link](https://homebrewery.naturalcrit.com/share/${shareLink})**`; +**[Homebrewery Link](${global.config.publicUrl}/share/${shareLink})**`; return `https://www.reddit.com/r/UnearthedArcana/submit?title=${encodeURIComponent(title)}&text=${encodeURIComponent(text)}`; }, @@ -387,7 +387,7 @@ const EditPage = createClass({ view - {navigator.clipboard.writeText(`https://homebrewery.naturalcrit.com/share/${shareLink}`);}}> + {navigator.clipboard.writeText(`${global.config.publicUrl}/share/${shareLink}`);}}> copy url From b2bcc9ef95352a121aa2111afaa533e3f89f5098 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 14 Apr 2022 13:58:51 +1200 Subject: [PATCH 3/3] Shift to logical OR operator (cherry picked from commit 0fb0f4b6b0e7389af0909dcc5ceb91ece810b095) --- client/template.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/template.js b/client/template.js index b9f76fdde..482e49c25 100644 --- a/client/template.js +++ b/client/template.js @@ -9,10 +9,10 @@ module.exports = async(name, title = '', props = {})=>{ - + - - + +