Spaces:
Running
Running
Tu Nombre commited on
Commit ·
715d17a
1
Parent(s): be5db62
html puro sin gradio
Browse files- cliente_template.py +39 -22
cliente_template.py
CHANGED
|
@@ -126,26 +126,43 @@ def get_yt_status():
|
|
| 126 |
def get_stats():
|
| 127 |
return f"📊 Videos publicados: {CONTADOR_VIDEOS} | 🎬 Último: {ULTIMO_VIDEO} | ⚡ Estado: {STATUS}"
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
h1{color:#ff2d2d!important;font-family:'Bebas Neue',sans-serif!important;font-size:3rem!important;text-align:center!important;}
|
| 133 |
-
.label{color:#ff2d2d!important;font-weight:700!important;}
|
| 134 |
-
textarea{background:#111!important;color:#D4AF37!important;font-family:monospace!important;border:1px solid #333!important;}
|
| 135 |
-
""", title="TubeBot") as demo:
|
| 136 |
-
gr.Markdown(f"# 🤖 TUBEBOT — {NICHO.upper()}")
|
| 137 |
-
gr.Markdown(f"### Tu canal de YouTube publica solo cada 4 horas")
|
| 138 |
-
gr.Markdown("---")
|
| 139 |
-
|
| 140 |
-
with gr.Row():
|
| 141 |
-
gr.Textbox(label="📊 Panel de control", every=3, value=lambda: get_stats(), interactive=False)
|
| 142 |
-
|
| 143 |
-
gr.Markdown("### 📜 Logs en tiempo real")
|
| 144 |
-
gr.Textbox(label="", lines=20, every=4,
|
| 145 |
-
value=lambda: "\n".join(LOGS[-18:]) if LOGS else "Iniciando sistema...")
|
| 146 |
-
gr.Markdown("---")
|
| 147 |
-
gr.Textbox(label="🎬 Estado YouTube", every=5, value=lambda: get_yt_status(), interactive=False)
|
| 148 |
-
gr.HTML(value='<div style="text-align:center;padding:16px"><a href="https://cristobal299-iaweb.hf.space/oauth-youtube?email={CLIENT_EMAIL}".format(CLIENT_EMAIL=CLIENT_EMAIL)" target="_blank" style="background:#ff0000;color:#fff;padding:14px 28px;border-radius:8px;text-decoration:none;font-weight:800;font-size:1.1rem">📺 CONECTAR MI CANAL DE YOUTUBE</a></div>')
|
| 149 |
-
gr.Markdown(f"### 💡 ¿Problemas? Escríbeme al WhatsApp: +34656691085")
|
| 150 |
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
def get_stats():
|
| 127 |
return f"📊 Videos publicados: {CONTADOR_VIDEOS} | 🎬 Último: {ULTIMO_VIDEO} | ⚡ Estado: {STATUS}"
|
| 128 |
|
| 129 |
+
from fastapi import FastAPI
|
| 130 |
+
from fastapi.responses import HTMLResponse
|
| 131 |
+
import uvicorn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
+
app = FastAPI()
|
| 134 |
+
|
| 135 |
+
@app.get("/", response_class=HTMLResponse)
|
| 136 |
+
async def panel():
|
| 137 |
+
yt_status = "✅ YouTube conectado" if os.path.exists("token.json") else "❌ YouTube NO conectado"
|
| 138 |
+
logs_html = "<br>".join(LOGS[-20:]) if LOGS else "Iniciando..."
|
| 139 |
+
return f"""<!DOCTYPE html><html><head><meta charset="utf-8"><title>TubeBot</title>
|
| 140 |
+
<meta http-equiv="refresh" content="5">
|
| 141 |
+
<style>
|
| 142 |
+
body{{background:#0a0a0a;color:#fff;font-family:system-ui;margin:0;padding:20px;max-width:900px;margin:0 auto}}
|
| 143 |
+
h1{{color:#ff2d2d;font-size:3rem;text-align:center;font-weight:900;letter-spacing:2px}}
|
| 144 |
+
.box{{background:#111;border:1px solid #333;border-radius:12px;padding:20px;margin:20px 0}}
|
| 145 |
+
.stat{{font-size:1.1rem;color:#D4AF37}}
|
| 146 |
+
.logs{{background:#000;color:#D4AF37;padding:15px;border-radius:8px;font-family:monospace;height:400px;overflow-y:auto;font-size:0.9rem;line-height:1.6}}
|
| 147 |
+
.btn{{display:block;background:#ff0000;color:#fff;padding:18px;border-radius:10px;text-decoration:none;font-weight:800;text-align:center;font-size:1.2rem;margin:20px 0}}
|
| 148 |
+
.btn:hover{{background:#cc0000}}
|
| 149 |
+
hr{{border:none;border-top:1px solid #333;margin:25px 0}}
|
| 150 |
+
</style></head>
|
| 151 |
+
<body>
|
| 152 |
+
<h1>🤖 TUBEBOT — {NICHO.upper()}</h1>
|
| 153 |
+
<p style="text-align:center;color:#888">Tu canal publica solo cada 4 horas</p>
|
| 154 |
+
<div class="box">
|
| 155 |
+
<div class="stat">📊 <b>Videos publicados:</b> {CONTADOR_VIDEOS}</div>
|
| 156 |
+
<div class="stat">🎬 <b>Último video:</b> {ULTIMO_VIDEO}</div>
|
| 157 |
+
<div class="stat">⚡ <b>Estado:</b> {STATUS}</div>
|
| 158 |
+
<div class="stat">📺 <b>YouTube:</b> {yt_status}</div>
|
| 159 |
+
</div>
|
| 160 |
+
<a class="btn" href="https://cristobal299-iaweb.hf.space/oauth-youtube?email={CLIENT_EMAIL}" target="_blank">📺 CONECTAR MI CANAL DE YOUTUBE</a>
|
| 161 |
+
<hr>
|
| 162 |
+
<h3 style="color:#ff2d2d">📜 Logs en tiempo real</h3>
|
| 163 |
+
<div class="logs">{logs_html}</div>
|
| 164 |
+
<hr>
|
| 165 |
+
<p style="text-align:center;color:#888">💡 ¿Problemas? WhatsApp: +34656691085</p>
|
| 166 |
+
</body></html>"""
|
| 167 |
+
|
| 168 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|