🚀 Auto-deploy: BotVPS atualizado em 03/05/2026 19:48:49
This commit is contained in:
8
main.py
8
main.py
@@ -122,13 +122,19 @@ async def run_action(data: dict, is_auth: bool = Depends(verify_password)):
|
||||
return {"status": "error", "message": "⚠️ Reboot via Web desabilitado por segurança. Use o terminal SSH."}
|
||||
if action_type == "toggle_vnc":
|
||||
import subprocess
|
||||
# Check if container exists
|
||||
check_exists = subprocess.run(["docker", "ps", "-a", "-q", "-f", "name=vps-vnc"], capture_output=True, text=True)
|
||||
if not check_exists.stdout.strip():
|
||||
return {"status": "error", "message": "Container VNC não encontrado. Certifique-se de que o deploy foi concluído com sucesso."}
|
||||
|
||||
# Check if running
|
||||
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": "success", "message": "VNC ligado. Acesse em: 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")
|
||||
|
||||
Reference in New Issue
Block a user