🚀 Auto-deploy: BotVPS atualizado em 03/05/2026 19:48:49
This commit is contained in:
@@ -40,7 +40,9 @@ services:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.vnc.rule=Host(`vnc.claw.reifonas.cloud`)"
|
||||
- "traefik.http.routers.vnc.entrypoints=http"
|
||||
- "traefik.http.routers.vnc.entrypoints=https"
|
||||
- "traefik.http.routers.vnc.tls=true"
|
||||
- "traefik.http.routers.vnc.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.vnc.loadbalancer.server.port=6080"
|
||||
|
||||
networks:
|
||||
|
||||
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")
|
||||
|
||||
@@ -781,6 +781,10 @@
|
||||
</svg>
|
||||
<span id="vnc-toggle-text">Ligar VNC</span>
|
||||
</button>
|
||||
<a href="https://vnc.claw.reifonas.cloud/vnc.html" target="_blank" id="vnc-link" class="hidden" style="color: var(--accent); font-size: 0.75rem; text-decoration: none; display: flex; align-items: center; gap: 0.25rem;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
|
||||
Abrir VNC
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="section-title">Configuração AI</div>
|
||||
@@ -993,12 +997,15 @@
|
||||
const data = await res.json();
|
||||
const btn = document.getElementById('vnc-toggle-btn');
|
||||
const txt = document.getElementById('vnc-toggle-text');
|
||||
const lnk = document.getElementById('vnc-link');
|
||||
if (data.vnc_status === 'on') {
|
||||
txt.textContent = 'Desligar VNC';
|
||||
btn.classList.add('btn-success');
|
||||
if (lnk) lnk.classList.remove('hidden');
|
||||
} else {
|
||||
txt.textContent = 'Ligar VNC';
|
||||
btn.classList.remove('btn-success');
|
||||
if (lnk) lnk.classList.add('hidden');
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ RUN mkdir -p /VNC && cd /VNC \
|
||||
&& ln -sf /usr/share/novnc/vnc.html vnc.html \
|
||||
&& ln -sf /usr/share/novnc/vnc_lite.html vnc_lite.html
|
||||
|
||||
# X11 socket from host (display :10)
|
||||
# Host / is mounted at /host_root by BotVPS compose
|
||||
VOLUME ["/tmp/.X11-unix:/host_x11/X11-unix:rw"]
|
||||
# X11 socket is shared via docker-compose
|
||||
# VOLUME ["/tmp/.X11-unix"]
|
||||
|
||||
|
||||
ENV DISPLAY=:10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user