somratpro commited on
Commit
d455ed7
·
1 Parent(s): dbb4ecf

refactor: update n8n editor path to /home/workflows and include templates in proxy allowlist

Browse files
Files changed (1) hide show
  1. health-server.js +14 -10
health-server.js CHANGED
@@ -7,7 +7,6 @@ const PORT = Number(process.env.PUBLIC_PORT || 7861);
7
  const TARGET_PORT = Number(process.env.N8N_PORT || 5678);
8
  const TARGET_HOST = "127.0.0.1";
9
  const SYNC_STATUS_FILE = "/tmp/hugging8n-sync-status.json";
10
- const APP_BASE = "/app";
11
  const startTime = Date.now();
12
 
13
  function parseRequestUrl(url) {
@@ -326,11 +325,11 @@ function renderDashboard(data) {
326
  <div class="stat-label">Sync Status</div>
327
  ${getBadge(data.sync.status)}
328
  </div>
329
- <div class="stat-value" style="font-size: 1rem; margin-bottom: 4px;">Last Activity: ${data.sync.timestamp.split('.')[0]}Z</div>
330
  <div class="stat-label" style="text-transform: none;">${data.sync.message}</div>
331
  </div>
332
 
333
- <a href="/app/" target="_blank" class="btn-primary">Open n8n Editor</a>
334
 
335
  <div class="keep-alive helper-card">
336
  <span class="stat-label">Keep Space Awake</span>
@@ -540,7 +539,10 @@ async function createUptimeRobotMonitor(apiKey, host) {
540
  ? existing.monitors.find((m) => m.url === monitorUrl)
541
  : null;
542
  if (existingMonitor) {
543
- return { created: false, message: `Monitor already exists for ${monitorUrl}` };
 
 
 
544
  }
545
  const created = await postUptimeRobot("/v2/newMonitor", {
546
  api_key: apiKey,
@@ -620,13 +622,10 @@ const server = http.createServer(async (req, res) => {
620
  pathname.startsWith("/signup") ||
621
  pathname.startsWith("/logout") ||
622
  pathname.startsWith("/nodes/") ||
 
623
  pathname.startsWith("/healthz");
624
 
625
- // Special case: /app/ redirects to /home/workflows
626
- if (pathname === "/app" || pathname === "/app/") {
627
- res.writeHead(302, { Location: "/home/workflows" });
628
- return res.end();
629
- }
630
 
631
  if (isN8nPath) {
632
  const proxyHeaders = {
@@ -653,7 +652,12 @@ const server = http.createServer(async (req, res) => {
653
 
654
  proxyReq.on("error", () => {
655
  res.writeHead(503, { "Content-Type": "application/json" });
656
- res.end(JSON.stringify({ status: "starting", message: "n8n is initializing..." }));
 
 
 
 
 
657
  });
658
 
659
  req.pipe(proxyReq);
 
7
  const TARGET_PORT = Number(process.env.N8N_PORT || 5678);
8
  const TARGET_HOST = "127.0.0.1";
9
  const SYNC_STATUS_FILE = "/tmp/hugging8n-sync-status.json";
 
10
  const startTime = Date.now();
11
 
12
  function parseRequestUrl(url) {
 
325
  <div class="stat-label">Sync Status</div>
326
  ${getBadge(data.sync.status)}
327
  </div>
328
+ <div class="stat-value" style="font-size: 1rem; margin-bottom: 4px;">Last Activity: ${data.sync.timestamp.split(".")[0]}Z</div>
329
  <div class="stat-label" style="text-transform: none;">${data.sync.message}</div>
330
  </div>
331
 
332
+ <a href="/home/workflows" target="_blank" class="btn-primary">Open n8n Editor</a>
333
 
334
  <div class="keep-alive helper-card">
335
  <span class="stat-label">Keep Space Awake</span>
 
539
  ? existing.monitors.find((m) => m.url === monitorUrl)
540
  : null;
541
  if (existingMonitor) {
542
+ return {
543
+ created: false,
544
+ message: `Monitor already exists for ${monitorUrl}`,
545
+ };
546
  }
547
  const created = await postUptimeRobot("/v2/newMonitor", {
548
  api_key: apiKey,
 
622
  pathname.startsWith("/signup") ||
623
  pathname.startsWith("/logout") ||
624
  pathname.startsWith("/nodes/") ||
625
+ pathname.startsWith("/templates/") ||
626
  pathname.startsWith("/healthz");
627
 
628
+
 
 
 
 
629
 
630
  if (isN8nPath) {
631
  const proxyHeaders = {
 
652
 
653
  proxyReq.on("error", () => {
654
  res.writeHead(503, { "Content-Type": "application/json" });
655
+ res.end(
656
+ JSON.stringify({
657
+ status: "starting",
658
+ message: "n8n is initializing...",
659
+ }),
660
+ );
661
  });
662
 
663
  req.pipe(proxyReq);