]> Untitled Git - lemmy-ui.git/commitdiff
Adding a LEMMY_UI_DEBUG flag for eruda debugging (#624)
authorDessalines <dessalines@users.noreply.github.com>
Wed, 13 Apr 2022 15:33:00 +0000 (11:33 -0400)
committerGitHub <noreply@github.com>
Wed, 13 Apr 2022 15:33:00 +0000 (15:33 +0000)
src/server/index.tsx

index 7b83760511c13cc2e047a97745a4aae7f92f123b..b6db4981094b193e71d437fcdf434d887a2db7cb 100644 (file)
@@ -171,6 +171,14 @@ server.get("/*", async (req, res) => {
       />
     );
 
+    const eruda = (
+      <>
+        <script src="//cdn.jsdelivr.net/npm/eruda"></script>
+        <script>eruda.init();</script>
+      </>
+    );
+    const erudaStr = process.env["LEMMY_UI_DEBUG"] ? renderToString(eruda) : "";
+
     const root = renderToString(wrapper);
     const symbols = renderToString(SYMBOLS);
     const cspStr = process.env.LEMMY_EXTERNAL_HOST
@@ -187,10 +195,8 @@ server.get("/*", async (req, res) => {
            <script>window.isoData = ${serialize(isoData)}</script>
            <script>window.lemmyConfig = ${serialize(config)}</script>
 
-           <!-- A remote debugging utility for mobile
-           <script src="//cdn.jsdelivr.net/npm/eruda"></script>
-           <script>eruda.init();</script>
-           -->
+           <!-- A remote debugging utility for mobile -->
+           ${erudaStr}
 
            ${helmet.title.toString()}
            ${helmet.meta.toString()}