From 2830bf48f2d9e1f0a2b02e2e7868fb0903156c06 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Mon, 27 Apr 2026 05:18:01 +0000 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20ralph.html=20URL=20prefix=20/?= =?UTF-8?q?echo/api/ralph=20(was=20/api/ralph=20=E2=86=92=20502)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tailscale Serve mapează /echo/* → 127.0.0.1:8088 (dashboard) și / → :18789 (alt backend). Browser-ul calling /api/ralph/status (relative cu absolute path la root domain) ajungea la 18789 care nu are endpoint Ralph → 502 Bad Gateway. Fix: toate cele 6 URL-uri (5x fetch + 1x EventSource) folosesc acum prefix /echo/api/ralph/* pentru a respecta routing-ul tailscale. Pattern consistent cu workspace.html și index.html (verificat manual). Endpoints atinse: /status, //log, //prd, //stop, //rollback, /stream (SSE). Co-Authored-By: Claude Opus 4.7 (1M context) --- dashboard/ralph.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dashboard/ralph.html b/dashboard/ralph.html index 6b665c8..e377467 100644 --- a/dashboard/ralph.html +++ b/dashboard/ralph.html @@ -569,7 +569,7 @@ async function fetchStatus() { try { - const res = await fetch('/api/ralph/status', { cache: 'no-store' }); + const res = await fetch('/echo/api/ralph/status', { cache: 'no-store' }); if (!res.ok) throw new Error('HTTP ' + res.status); const data = await res.json(); renderSnapshot(data); @@ -585,7 +585,7 @@ drawerBody.textContent = 'Se încarcă...'; drawer.dataset.open = 'true'; try { - const res = await fetch(`/api/ralph/${encodeURIComponent(slug)}/log?lines=200`); + const res = await fetch(`/echo/api/ralph/${encodeURIComponent(slug)}/log?lines=200`); const data = await res.json(); drawerBody.textContent = (data.lines || []).join('\n'); } catch (err) { @@ -598,7 +598,7 @@ drawerBody.textContent = 'Se încarcă...'; drawer.dataset.open = 'true'; try { - const res = await fetch(`/api/ralph/${encodeURIComponent(slug)}/prd`); + const res = await fetch(`/echo/api/ralph/${encodeURIComponent(slug)}/prd`); const data = await res.json(); drawerBody.textContent = JSON.stringify(data, null, 2); } catch (err) { @@ -609,7 +609,7 @@ async function stopRalph(slug) { if (!confirm(`Oprești Ralph pe ${slug}?`)) return; try { - const res = await fetch(`/api/ralph/${encodeURIComponent(slug)}/stop`, { method: 'POST' }); + const res = await fetch(`/echo/api/ralph/${encodeURIComponent(slug)}/stop`, { method: 'POST' }); const data = await res.json(); if (!data.success) { alert('Eșec: ' + (data.error || 'unknown')); @@ -624,7 +624,7 @@ async function rollbackRalph(slug) { if (!confirm(`Asta va da git revert HEAD pe ${slug} și va decrementa ultima story trecută. Continui?`)) return; try { - const res = await fetch(`/api/ralph/${encodeURIComponent(slug)}/rollback`, { method: 'POST' }); + const res = await fetch(`/echo/api/ralph/${encodeURIComponent(slug)}/rollback`, { method: 'POST' }); const data = await res.json(); if (!data.success) { alert('Rollback eşuat: ' + (data.message || 'unknown')); @@ -686,7 +686,7 @@ return; } try { - eventSource = new EventSource('/api/ralph/stream'); + eventSource = new EventSource('/echo/api/ralph/stream'); } catch (err) { startPolling(); return;