From: Dessalines <dessalines@users.noreply.github.com>
Date: Wed, 25 May 2022 03:33:11 +0000 (-0400)
Subject: Add LEMMY_UI_CUSTOM_SCRIPT env var. Fixes #655 (#656)
X-Git-Url: http://these/git/%7B%60/feeds/README.md?a=commitdiff_plain;h=c8869174e89b0e1879304477bbb434e5048d5b03;p=lemmy-ui.git

Add LEMMY_UI_CUSTOM_SCRIPT env var. Fixes #655 (#656)

* Add LEMMY_UI_CUSTOM_SCRIPT env var. Fixes #655

* Change name to LEMMY_UI_CUSTOM_HTML

* Change name to LEMMY_UI_CUSTOM_HTML_HEADER
---

diff --git a/src/server/index.tsx b/src/server/index.tsx
index 41a6ec8..a45e1b0 100644
--- a/src/server/index.tsx
+++ b/src/server/index.tsx
@@ -36,6 +36,8 @@ if (process.env.NODE_ENV !== "development") {
     next();
   });
 }
+const customHtmlHeader = process.env["LEMMY_UI_CUSTOM_HTML_HEADER"] || "";
+
 server.use(express.json());
 server.use(express.urlencoded({ extended: false }));
 server.use("/static", express.static(path.resolve("./dist")));
@@ -198,6 +200,9 @@ server.get("/*", async (req, res) => {
            <!-- A remote debugging utility for mobile -->
            ${erudaStr}
 
+           <!-- Custom injected script -->
+           ${customHtmlHeader}
+
            ${helmet.title.toString()}
            ${helmet.meta.toString()}