From c8869174e89b0e1879304477bbb434e5048d5b03 Mon Sep 17 00:00:00 2001
From: Dessalines <dessalines@users.noreply.github.com>
Date: Tue, 24 May 2022 23:33:11 -0400
Subject: [PATCH] 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
---
 src/server/index.tsx | 5 +++++
 1 file changed, 5 insertions(+)

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()}
 
-- 
2.44.1