Spaces:
Running
Running
Tu Nombre commited on
Commit ·
caa0844
1
Parent(s): f6ca537
dashboard mi cuenta
Browse files
main.py
CHANGED
|
@@ -641,6 +641,48 @@ async def crear(request: Request):
|
|
| 641 |
return {"success": True, "url": u, "total": len(urls), "limite": limite}
|
| 642 |
|
| 643 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 644 |
def enviar_email_multi(email, urls):
|
| 645 |
try:
|
| 646 |
import requests
|
|
|
|
| 641 |
return {"success": True, "url": u, "total": len(urls), "limite": limite}
|
| 642 |
|
| 643 |
|
| 644 |
+
@app.get("/mi-cuenta", response_class=HTMLResponse)
|
| 645 |
+
async def mi_cuenta(email: str = ""):
|
| 646 |
+
email = email.strip().lower()
|
| 647 |
+
if not email or email not in CLIENTES:
|
| 648 |
+
return HTMLResponse("<html><body style='background:#080808;color:#fff;text-align:center;padding:60px;font-family:sans-serif'><h1 style='color:#ff2d2d'>Cuenta no encontrada</h1><p>Verifica el email correcto.</p></body></html>", status_code=404)
|
| 649 |
+
cliente = CLIENTES[email]
|
| 650 |
+
plan = cliente.get("plan", "basico")
|
| 651 |
+
limite = PLANES_CANALES.get(plan, 1)
|
| 652 |
+
canales = cliente.get("canales", [])
|
| 653 |
+
restantes = limite - len(canales)
|
| 654 |
+
lista_html = ""
|
| 655 |
+
for i, ch in enumerate(canales, 1):
|
| 656 |
+
lista_html += f'<div style="background:#111;border:1px solid #222;border-radius:10px;padding:18px;margin:10px 0"><div style="color:#D4AF37;font-weight:700;margin-bottom:8px">Canal {i}: {ch.get("nicho","-")}</div><a href="{ch.get("url","#")}" target="_blank" style="color:#ff2d2d;word-break:break-all">{ch.get("url","-")}</a></div>'
|
| 657 |
+
if not lista_html:
|
| 658 |
+
lista_html = '<p style="color:#888;text-align:center;padding:20px">Aun no has creado ningun canal</p>'
|
| 659 |
+
boton_nuevo = ""
|
| 660 |
+
if restantes > 0:
|
| 661 |
+
boton_nuevo = f'<a href="/activar-canal?token=micuenta_{email}" style="display:block;background:#ff2d2d;color:#fff;padding:18px;border-radius:10px;text-decoration:none;text-align:center;font-weight:900;margin:30px 0">+ CREAR NUEVO CANAL</a>'
|
| 662 |
+
TOKENS_VALIDOS[f"micuenta_{email}"] = {"plan": plan}
|
| 663 |
+
else:
|
| 664 |
+
boton_nuevo = '<p style="text-align:center;color:#D4AF37;padding:20px;background:#1a1400;border-radius:10px">Has alcanzado el limite de tu plan. Contacta soporte para subir de nivel.</p>'
|
| 665 |
+
return HTMLResponse(f"""<!DOCTYPE html>
|
| 666 |
+
<html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Mi Cuenta - TubeBot</title>
|
| 667 |
+
<style>body{{background:#080808;color:#fff;font-family:system-ui,sans-serif;margin:0;padding:30px 20px;max-width:700px;margin:0 auto}}h1{{color:#ff2d2d;font-size:2rem;margin:0 0 10px}}.plan{{display:inline-block;background:#D4AF37;color:#000;padding:4px 14px;border-radius:20px;font-weight:900;text-transform:uppercase;font-size:.85rem}}.stats{{background:#111;border:1px solid #222;border-radius:12px;padding:20px;margin:20px 0}}.stat-num{{font-size:2.5rem;color:#ff2d2d;font-weight:900}}.stat-lbl{{color:#888;font-size:.9rem}}</style></head>
|
| 668 |
+
<body>
|
| 669 |
+
<h1>🤖 Mi Cuenta TubeBot</h1>
|
| 670 |
+
<p style="color:#888;margin:0 0 16px">{email}</p>
|
| 671 |
+
<span class="plan">Plan {plan}</span>
|
| 672 |
+
<div class="stats">
|
| 673 |
+
<div style="display:flex;justify-content:space-between;text-align:center">
|
| 674 |
+
<div><div class="stat-num">{len(canales)}</div><div class="stat-lbl">Canales creados</div></div>
|
| 675 |
+
<div><div class="stat-num">{restantes}</div><div class="stat-lbl">Disponibles</div></div>
|
| 676 |
+
<div><div class="stat-num">{limite}</div><div class="stat-lbl">Limite plan</div></div>
|
| 677 |
+
</div>
|
| 678 |
+
</div>
|
| 679 |
+
{boton_nuevo}
|
| 680 |
+
<h2 style="font-size:1.3rem;margin-top:30px;color:#fff">Mis canales</h2>
|
| 681 |
+
{lista_html}
|
| 682 |
+
<p style="text-align:center;color:#666;margin-top:40px;font-size:.85rem">WhatsApp soporte: +34 656 691 085</p>
|
| 683 |
+
</body></html>""")
|
| 684 |
+
|
| 685 |
+
|
| 686 |
def enviar_email_multi(email, urls):
|
| 687 |
try:
|
| 688 |
import requests
|