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:
15
main.py
15
main.py
@@ -120,8 +120,23 @@ async def run_action(data: dict, is_auth: bool = Depends(verify_password)):
|
||||
return {"status": "success", "message": "Cache do servidor limpo com sucesso."}
|
||||
if action_type == "reboot_vps":
|
||||
return {"status": "error", "message": "⚠️ Reboot via Web desabilitado por segurança. Use o terminal SSH."}
|
||||
if action_type == "toggle_vnc":
|
||||
import subprocess
|
||||
result = subprocess.run(["docker", "ps", "-q", "-f", "name=vps-vnc"], capture_output=True, text=True)
|
||||
if result.stdout.strip():
|
||||
subprocess.run(["docker", "stop", "vps-vnc"], capture_output=True)
|
||||
return {"status": "success", "message": "VNC desligado.", "vnc_status": "off"}
|
||||
else:
|
||||
subprocess.run(["docker", "start", "vps-vnc"], capture_output=True)
|
||||
return {"status": "success", "message": "VNC ligado. https://vnc.claw.reifonas.cloud/vnc.html", "vnc_status": "on"}
|
||||
return {"status": "error", "message": f"Ação {action_type} desconhecida."}
|
||||
|
||||
@app.get("/api/vnc_status")
|
||||
async def vnc_status():
|
||||
import subprocess
|
||||
result = subprocess.run(["docker", "ps", "-q", "-f", "name=vps-vnc"], capture_output=True, text=True)
|
||||
return {"vnc_status": "on" if result.stdout.strip() else "off"}
|
||||
|
||||
@app.get("/api/test_llm")
|
||||
async def test_llm_latency(is_auth: bool = Depends(verify_password)):
|
||||
t0 = time.time()
|
||||
|
||||
Reference in New Issue
Block a user