feat: add VNC toggle to dashboard

- Add x11vnc + noVNC container with Traefik reverse proxy
- Add /api/vnc_status and toggle_vnc action to FastAPI
- Add VNC toggle button to BotVPS dashboard
- VNC off by default, controlled via dashboard
This commit is contained in:
2026-05-03 19:42:00 +00:00
parent 912763b3f1
commit 9762e9b76c
5 changed files with 151 additions and 46 deletions

View File

@@ -767,13 +767,21 @@
</svg>
Limpar Cache
</button>
<button type="button" class="btn btn-danger" onclick="executeAction('reboot_vps')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
Reboot VPS
</button>
</div>
<button type="button" class="btn btn-danger" onclick="executeAction('reboot_vps')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
Reboot VPS
</button>
<button type="button" class="btn" id="vnc-toggle-btn" onclick="executeAction('toggle_vnc')">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
<line x1="8" y1="21" x2="16" y2="21"/>
<line x1="12" y1="17" x2="12" y2="21"/>
</svg>
<span id="vnc-toggle-text">Ligar VNC</span>
</button>
</div>
<div class="section-title">Configuração AI</div>
<div class="card">
@@ -969,14 +977,31 @@
return res;
}
function initDashboard() {
fetchStats();
loadConfig();
loadOrchestratorStatus();
loadLLMModels().then(function() {
loadLLMConfig();
});
}
function initDashboard() {
fetchStats();
loadConfig();
loadOrchestratorStatus();
loadVNCStatus();
loadLLMModels().then(function() {
loadLLMConfig();
});
}
async function loadVNCStatus() {
try {
const res = await apiFetch('/api/vnc_status');
const data = await res.json();
const btn = document.getElementById('vnc-toggle-btn');
const txt = document.getElementById('vnc-toggle-text');
if (data.vnc_status === 'on') {
txt.textContent = 'Desligar VNC';
btn.classList.add('btn-success');
} else {
txt.textContent = 'Ligar VNC';
btn.classList.remove('btn-success');
}
} catch (e) {}
}
// Theme management
function toggleTheme() {
@@ -1049,11 +1074,12 @@
// Actions
async function executeAction(type) {
const messages = {
reboot_vps: '⚠️ Confirma reboot CRÍTICO da VPS?',
clear_cache: 'Limpar cache do servidor?',
restart_bot: 'Reiniciar o agente AI?'
};
const messages = {
reboot_vps: '⚠️ Confirma reboot CRÍTICO da VPS?',
clear_cache: 'Limpar cache do servidor?',
restart_bot: 'Reiniciar o agente AI?',
toggle_vnc: null
};
if (messages[type] && !confirm(messages[type])) return;