fix: usar /api/health em vez de localhost:3002 (corrige CORS)

This commit is contained in:
Hermes
2026-05-17 22:30:44 +00:00
parent 5ff5f4feb9
commit 207fd1b0a0
+8 -8
View File
@@ -100,8 +100,8 @@ async function checkServiceStatus() {
const statusIndicator = document.getElementById('serviceStatus'); const statusIndicator = document.getElementById('serviceStatus');
try { try {
// Verificar o serviço WGET na porta 3002 (não 3001) // Verificar o serviço WGET via proxy do servidor (mesma origem)
const response = await fetch('http://localhost:3002/health', { const response = await fetch('/api/health', {
method: 'GET' method: 'GET'
}); });
@@ -582,18 +582,18 @@ function saveSettings() {
// Utility Functions // Utility Functions
function openClonedSite(directory) { function openClonedSite(directory) {
// Try to open via server endpoint // Try to open via server endpoint
fetch('http://localhost:8080', { fetch('/api/health', {
method: 'GET' method: 'GET'
}).then(response => { }).then(response => {
if (response.ok) { if (response.ok) {
// Server is running, open the site // Server is running, open the site via same origin
const siteName = directory.split('\\').pop(); const siteName = directory.split('/').pop();
window.open(`http://localhost:8080/${siteName}/`, '_blank'); window.open(`/${siteName}/index.html`, '_blank');
} else { } else {
showToast('Servidor HTTP não está rodando. Inicie o servidor na porta 8080.', 'error'); showToast('Servidor não está respondendo.', 'error');
} }
}).catch(error => { }).catch(error => {
showToast('Servidor HTTP não está rodando. Inicie o servidor na porta 8080.', 'error'); showToast('Servidor não está respondendo.', 'error');
}); });
} }