From 207fd1b0a00236278813b7e1d196763b1fef8f43 Mon Sep 17 00:00:00 2001 From: Hermes Date: Sun, 17 May 2026 22:30:44 +0000 Subject: [PATCH] fix: usar /api/health em vez de localhost:3002 (corrige CORS) --- web-interface/public/app-new.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web-interface/public/app-new.js b/web-interface/public/app-new.js index c48c381..a5178df 100644 --- a/web-interface/public/app-new.js +++ b/web-interface/public/app-new.js @@ -100,8 +100,8 @@ async function checkServiceStatus() { const statusIndicator = document.getElementById('serviceStatus'); try { - // Verificar o serviço WGET na porta 3002 (não 3001) - const response = await fetch('http://localhost:3002/health', { + // Verificar o serviço WGET via proxy do servidor (mesma origem) + const response = await fetch('/api/health', { method: 'GET' }); @@ -582,18 +582,18 @@ function saveSettings() { // Utility Functions function openClonedSite(directory) { // Try to open via server endpoint - fetch('http://localhost:8080', { + fetch('/api/health', { method: 'GET' }).then(response => { if (response.ok) { - // Server is running, open the site - const siteName = directory.split('\\').pop(); - window.open(`http://localhost:8080/${siteName}/`, '_blank'); + // Server is running, open the site via same origin + const siteName = directory.split('/').pop(); + window.open(`/${siteName}/index.html`, '_blank'); } else { - showToast('Servidor HTTP não está rodando. Inicie o servidor na porta 8080.', 'error'); + showToast('Servidor não está respondendo.', 'error'); } }).catch(error => { - showToast('Servidor HTTP não está rodando. Inicie o servidor na porta 8080.', 'error'); + showToast('Servidor não está respondendo.', 'error'); }); }