diff --git a/templates/index.html b/templates/index.html index 6f532a7..8e05380 100644 --- a/templates/index.html +++ b/templates/index.html @@ -864,6 +864,29 @@ + +
Credenciais Carregadas
+
+
+ + Credenciais sincronizadas dos serviços (Coolify, Gitea, Supabase, etc) + + +
+ +
+ Clique em "Atualizar" para carregar as credenciais +
+
+
Terminal & Insights da IA
@@ -1333,6 +1356,76 @@ showToast('Erro ao sincronizar.', true); } } + + async function loadCredentials() { + const loadingEl = document.getElementById('credentials-loading'); + const containerEl = document.getElementById('credentials-container'); + const listEl = document.getElementById('credentials-list'); + + if (loadingEl) loadingEl.innerHTML = 'Carregando...'; + + try { + // Sync first + await apiFetch('/api/sync-credentials', { method: 'POST' }); + + // Get orchestrator status which has services info + const res = await apiFetch('/api/orchestrator-status'); + const data = await res.json(); + + const services = data.credentials || {}; + const serviceNames = { + coolify: 'Coolify (Orquestrador)', + supabase: 'Supabase (BaaS)', + gitea: 'Gitea (Git Server)', + logto: 'Logto (Autenticação)' + }; + + let html = '
'; + + for (const [key, info] of Object.entries(services)) { + const name = serviceNames[key] || key; + const status = info.exists ? 'Disponivel' : 'Nao disponivel'; + const keysCount = info.keys_count || 0; + + html += ` +
+
+ ${name} + ${status} +
+
+ Caminho: ${info.path || 'N/A'} +
+
+ ${keysCount} chave(s) encontrada(s) +
+
+ `; + } + + html += '
'; + + if (loadingEl) loadingEl.style.display = 'none'; + if (containerEl) containerEl.style.display = 'block'; + if (listEl) listEl.innerHTML = html; + + } catch (e) { + if (loadingEl) { + loadingEl.innerHTML = 'Erro ao carregar credenciais'; + loadingEl.style.color = 'var(--danger)'; + } + console.error('Erro ao carregar credenciais:', e); + } + } + + async function copyToClipboard(text, label) { + try { + await navigator.clipboard.writeText(text); + showToast(label + ' copiado!'); + } catch (e) { + showToast('Erro ao copiar.', true); + } + } async function testLLMSpeed() { const btn = document.getElementById('btn-test-llm');