Spaces:
Running
Running
Tu Nombre commited on
Commit ·
68454b8
1
Parent(s): 9fc7641
pagina espera
Browse files
main.py
CHANGED
|
@@ -471,6 +471,69 @@ async def crear(request: Request):
|
|
| 471 |
return {"success": True, "url": url}
|
| 472 |
return JSONResponse({"error": "No se pudo crear el Space"}, status_code=500)
|
| 473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
@app.get("/clientes")
|
| 475 |
async def ver_clientes():
|
| 476 |
return CLIENTES
|
|
|
|
| 471 |
return {"success": True, "url": url}
|
| 472 |
return JSONResponse({"error": "No se pudo crear el Space"}, status_code=500)
|
| 473 |
|
| 474 |
+
@app.get("/esperando", response_class=HTMLResponse)
|
| 475 |
+
async def esperando(url: str = ""):
|
| 476 |
+
return f"""<!DOCTYPE html>
|
| 477 |
+
<html lang="es">
|
| 478 |
+
<head>
|
| 479 |
+
<meta charset="UTF-8">
|
| 480 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 481 |
+
<title>TubeBot — Preparando tu canal...</title>
|
| 482 |
+
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Manrope:wght@400;700&display=swap" rel="stylesheet">
|
| 483 |
+
<style>
|
| 484 |
+
*{{box-sizing:border-box;margin:0;padding:0;}}
|
| 485 |
+
body{{background:#080808;color:#f0f0f0;font-family:'Manrope',sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;}}
|
| 486 |
+
.card{{background:#111;border:1px solid #222;border-radius:20px;padding:40px 32px;max-width:480px;width:100%;text-align:center;}}
|
| 487 |
+
h1{{font-family:'Bebas Neue',sans-serif;font-size:2.5rem;color:#ff2d2d;margin-bottom:16px;}}
|
| 488 |
+
.spinner{{width:60px;height:60px;border:4px solid #222;border-top:4px solid #ff2d2d;border-radius:50%;animation:spin 1s linear infinite;margin:24px auto;}}
|
| 489 |
+
@keyframes spin{{to{{transform:rotate(360deg);}}}}
|
| 490 |
+
p{{color:#888;font-size:.95rem;line-height:1.6;margin-bottom:12px;}}
|
| 491 |
+
.status{{color:#ff2d2d;font-weight:700;font-size:1rem;margin-top:16px;}}
|
| 492 |
+
.btn{{display:block;margin-top:24px;background:#ff2d2d;color:#fff;padding:14px;border-radius:10px;text-decoration:none;font-weight:800;font-family:'Bebas Neue',sans-serif;font-size:1.2rem;}}
|
| 493 |
+
</style>
|
| 494 |
+
</head>
|
| 495 |
+
<body>
|
| 496 |
+
<div class="card">
|
| 497 |
+
<h1>🤖 CREANDO TU CANAL</h1>
|
| 498 |
+
<div class="spinner"></div>
|
| 499 |
+
<p>Tu sistema está siendo construido en nuestros servidores.</p>
|
| 500 |
+
<p>Este proceso tarda entre <strong style="color:#fff;">3-5 minutos</strong> la primera vez.</p>
|
| 501 |
+
<p class="status" id="status">⚡ Instalando dependencias...</p>
|
| 502 |
+
<a href="{url}" class="btn" id="enlace" target="_blank" style="display:none;">🚀 ENTRAR A MI CANAL</a>
|
| 503 |
+
</div>
|
| 504 |
+
<script>
|
| 505 |
+
const url = "{url}";
|
| 506 |
+
const mensajes = [
|
| 507 |
+
"⚡ Instalando dependencias...",
|
| 508 |
+
"🧠 Configurando IA...",
|
| 509 |
+
"🎙️ Preparando síntesis de voz...",
|
| 510 |
+
"🎬 Configurando motor de video...",
|
| 511 |
+
"🔥 Casi listo...",
|
| 512 |
+
];
|
| 513 |
+
let i = 0;
|
| 514 |
+
const statusEl = document.getElementById('status');
|
| 515 |
+
const msgInterval = setInterval(() => {{
|
| 516 |
+
i = (i+1) % mensajes.length;
|
| 517 |
+
statusEl.textContent = mensajes[i];
|
| 518 |
+
}}, 8000);
|
| 519 |
+
|
| 520 |
+
async function checkReady() {{
|
| 521 |
+
try {{
|
| 522 |
+
const r = await fetch(url, {{mode:'no-cors'}});
|
| 523 |
+
clearInterval(msgInterval);
|
| 524 |
+
clearInterval(checkInterval);
|
| 525 |
+
statusEl.textContent = "✅ ¡Tu canal está listo!";
|
| 526 |
+
statusEl.style.color = "#4caf50";
|
| 527 |
+
document.getElementById('enlace').style.display = 'block';
|
| 528 |
+
setTimeout(() => window.location.href = url, 2000);
|
| 529 |
+
}} catch(e) {{}}
|
| 530 |
+
}}
|
| 531 |
+
const checkInterval = setInterval(checkReady, 15000);
|
| 532 |
+
setTimeout(checkReady, 30000);
|
| 533 |
+
</script>
|
| 534 |
+
</body>
|
| 535 |
+
</html>"""
|
| 536 |
+
|
| 537 |
@app.get("/clientes")
|
| 538 |
async def ver_clientes():
|
| 539 |
return CLIENTES
|