Spaces:
Runtime error
Runtime error
| <html lang="id" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
| <title>Settings - Botz Control Panel</title> | |
| <link rel="icon" type="image/jpeg" href="https://cdn.yupra.my.id/yp/4r4oy0ze.jpg"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#6366f1', | |
| secondary: '#ec4899', | |
| darkbg: '#0f172a', | |
| cardbg: '#1e293b', | |
| inputbg: '#334155', | |
| sidebar: '#111827' | |
| }, | |
| fontFamily: { | |
| sans: ['Inter', 'sans-serif'], | |
| mono: ['JetBrains Mono', 'monospace'] | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"> | |
| <style> | |
| ::-webkit-scrollbar { width: 6px; } | |
| ::-webkit-scrollbar-track { background: transparent; } | |
| ::-webkit-scrollbar-thumb { background: #475569; border-radius: 20px; } | |
| .glass { background: rgba(30, 41, 59, 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.05); } | |
| </style> | |
| </head> | |
| <body class="bg-[#020617] text-slate-300 font-sans h-screen flex overflow-hidden selection:bg-primary selection:text-white"> | |
| <div id="toast-container" class="fixed top-6 right-6 z-[100] flex flex-col gap-3 pointer-events-none"></div> | |
| <aside class="hidden md:flex flex-col w-64 bg-sidebar border-r border-white/5 h-full relative z-20"> | |
| <div class="p-6 flex items-center gap-3"> | |
| <div class="w-10 h-10 rounded-xl bg-gradient-to-br from-primary to-indigo-700 flex items-center justify-center text-white shadow-lg shadow-primary/20"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg> | |
| </div> | |
| <h1 class="text-lg font-bold text-white tracking-tight">Panel Botz</h1> | |
| </div> | |
| <nav class="flex-1 px-4 space-y-2 py-4"> | |
| <a href="/" class="nav-item w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium text-slate-400 hover:bg-white/5 hover:text-white transition-all border border-transparent"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/></svg> | |
| Dashboard | |
| </a> | |
| <a href="/broadcast" class="nav-item w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium text-slate-400 hover:bg-white/5 hover:text-white transition-all border border-transparent"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z"/></svg> | |
| Broadcast | |
| </a> | |
| <a href="/tools" class="nav-item w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium text-slate-400 hover:bg-white/5 hover:text-white transition-all border border-transparent"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg> | |
| Tools | |
| </a> | |
| <a href="/settings" class="nav-item active w-full flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium text-slate-400 hover:bg-white/5 hover:text-white transition-all border border-transparent"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg> | |
| Settings | |
| </a> | |
| </nav> | |
| <div class="p-4 border-t border-white/5"> | |
| <div class="glass p-3 rounded-xl flex items-center gap-3"> | |
| <div id="status-dot" class="w-2.5 h-2.5 rounded-full bg-red-500 animate-pulse"></div> | |
| <div> | |
| <p id="status-text" class="text-[10px] font-bold uppercase tracking-widest text-red-500">DISCONNECTED</p> | |
| <p id="bot-name-display" class="text-xs text-slate-400 truncate w-32">Connecting...</p> | |
| </div> | |
| </div> | |
| </div> | |
| </aside> | |
| <main class="flex-1 flex flex-col h-full relative overflow-hidden bg-[#020617]"> | |
| <header class="glass sticky top-0 z-30 px-6 py-4 flex md:hidden items-center justify-between border-b border-white/5"> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-9 h-9 rounded-lg bg-gradient-to-br from-primary to-indigo-700 flex items-center justify-center text-white shadow-lg shadow-primary/20"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg> | |
| </div> | |
| <h1 class="text-lg font-bold text-white tracking-tight">Panel Botz</h1> | |
| </div> | |
| <div class="flex items-center gap-2"> | |
| <div id="status-dot-m" class="w-2 h-2 rounded-full bg-red-500 animate-pulse"></div> | |
| </div> | |
| </header> | |
| <div class="flex-1 overflow-y-auto p-4 md:p-8 pb-24 md:pb-8 custom-scroll relative"> | |
| <div class="max-w-4xl mx-auto space-y-6"> | |
| <div> | |
| <h2 class="text-3xl md:text-4xl font-bold text-white mb-2">Settings & Device</h2> | |
| <p class="text-slate-400 text-base">Konfigurasi profile dan koneksi</p> | |
| </div> | |
| <div class="glass p-6 md:p-8 rounded-2xl shadow-xl"> | |
| <h2 class="text-white font-bold mb-6 flex items-center gap-3 text-lg uppercase tracking-wide"> | |
| <span class="w-2 h-7 bg-primary rounded-full"></span> Profile Config | |
| </h2> | |
| <div class="space-y-5"> | |
| <div class="relative"> | |
| <input id="set-name" class="w-full bg-inputbg/50 px-4 py-3 rounded-xl text-sm border border-slate-700 focus:border-primary focus:bg-inputbg outline-none transition-all pr-12 text-white placeholder-slate-500" placeholder="Display Name"> | |
| <button onclick="postSet('name')" class="absolute right-2 top-2 p-1.5 bg-slate-700 hover:bg-primary text-white rounded-lg transition-colors"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg></button> | |
| </div> | |
| <div class="relative"> | |
| <input id="set-bio" class="w-full bg-inputbg/50 px-4 py-3 rounded-xl text-sm border border-slate-700 focus:border-primary focus:bg-inputbg outline-none transition-all pr-12 text-white placeholder-slate-500" placeholder="Status / Bio"> | |
| <button onclick="postSet('bio')" class="absolute right-2 top-2 p-1.5 bg-slate-700 hover:bg-primary text-white rounded-lg transition-colors"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg></button> | |
| </div> | |
| <div class="relative"> | |
| <input id="set-photo" class="w-full bg-inputbg/50 px-4 py-3 rounded-xl text-sm border border-slate-700 focus:border-primary focus:bg-inputbg outline-none transition-all pr-12 text-white placeholder-slate-500" placeholder="Photo URL"> | |
| <button onclick="postSet('photo')" class="absolute right-2 top-2 p-1.5 bg-slate-700 hover:bg-primary text-white rounded-lg transition-colors"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg></button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="glass p-6 md:p-8 rounded-2xl shadow-xl"> | |
| <h2 class="text-white font-bold mb-6 flex items-center gap-3 text-lg uppercase tracking-wide"> | |
| <svg class="w-6 h-6 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"/></svg> | |
| Device Manager | |
| </h2> | |
| <div class="space-y-5"> | |
| <div class="bg-slate-900/50 p-5 rounded-xl border border-white/5"> | |
| <label class="text-sm text-slate-400 font-bold uppercase block mb-2">WhatsApp Number</label> | |
| <div class="flex gap-2"> | |
| <input type="text" id="pair-number" placeholder="628xxxxx" class="w-full bg-inputbg px-3 py-2 rounded-lg text-white border border-slate-700 focus:border-primary outline-none"> | |
| <button onclick="reqPair()" class="bg-primary hover:bg-indigo-600 text-white font-bold px-4 rounded-lg transition-colors">GET</button> | |
| </div> | |
| <div id="code-area" class="mt-3 hidden text-center p-4 bg-black/30 rounded-lg border border-primary/30"> | |
| <p class="text-xs text-slate-500 mb-1">PAIRING CODE</p> | |
| <h2 id="code-text" class="text-3xl font-mono font-bold text-white tracking-widest select-all"></h2> | |
| </div> | |
| </div> | |
| <div class="border-t border-white/10 pt-5"> | |
| <p class="text-sm text-slate-400 mb-3">Zona Berbahaya: Gunakan jika bot error/looping.</p> | |
| <button onclick="resetSession()" class="w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 border border-red-500/20 font-bold py-3 rounded-xl text-sm transition-all flex items-center justify-center gap-2"> | |
| <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg> | |
| HAPUS SESI & RESTART | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <div class="md:hidden fixed bottom-0 inset-x-0 bg-sidebar border-t border-white/5 z-50 flex justify-around items-center p-2 pb-5"> | |
| <a href="/broadcast" class="nav-item flex flex-col items-center gap-1 p-2 rounded-xl text-slate-400"> | |
| <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/></svg> | |
| <span class="text-[11px] font-medium">Home</span> | |
| </a> | |
| <a href="/broadcast" class="nav-item flex flex-col items-center gap-1 p-2 rounded-xl text-slate-400"> | |
| <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z"/></svg> | |
| <span class="text-[11px] font-medium">Broad</span> | |
| </a> | |
| <a href="/tools" class="nav-item flex flex-col items-center gap-1 p-2 rounded-xl text-slate-400"> | |
| <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg> | |
| <span class="text-[11px] font-medium">Tools</span> | |
| </a> | |
| <a href="/settings" class="nav-item flex flex-col items-center gap-1 p-2 rounded-xl text-slate-400"> | |
| <svg class="w-7 h-7" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/></svg> | |
| <span class="text-[11px] font-medium">Set</span> | |
| </a> | |
| </div> | |
| <script> | |
| function showToast(msg, type = 'success') { | |
| const container = document.getElementById('toast-container'); | |
| const div = document.createElement('div'); | |
| const bg = type === 'success' ? 'bg-green-500/10 border-green-500/30 text-green-200' : 'bg-red-500/10 border-red-500/30 text-red-200'; | |
| div.className = `glass px-4 py-3 rounded-xl border backdrop-blur-md shadow-2xl flex items-center gap-3 transform translate-x-full transition-all duration-300 pointer-events-auto min-w-[280px] ${bg}`; | |
| div.innerHTML = `<span class="font-medium text-sm">${msg}</span>`; | |
| container.appendChild(div); | |
| requestAnimationFrame(() => div.classList.remove('translate-x-full')); | |
| setTimeout(() => { | |
| div.classList.add('translate-x-full', 'opacity-0'); | |
| setTimeout(() => div.remove(), 300); | |
| }, 3000); | |
| } | |
| async function postSet(type) { | |
| const el = document.getElementById(`set-${type}`); | |
| const val = el.value; | |
| if(!val) return showToast('Field is empty', 'error'); | |
| try { | |
| const body = {}; body[type === 'photo' ? 'url' : type === 'name' ? 'name' : 'bio'] = val; | |
| const req = await fetch(`/settings/${type}`, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(body) }); | |
| const res = await req.json(); | |
| if(res.status) { showToast(res.message); el.value = ''; } else { showToast(res.error, 'error'); } | |
| } catch(e) { showToast('Connection Error', 'error'); } | |
| } | |
| async function reqPair() { | |
| const num = document.getElementById('pair-number').value; | |
| if(!num) return showToast('Input number', 'error'); | |
| try { | |
| showToast('Requesting...', 'success'); | |
| const req = await fetch('/pair', { | |
| method: 'POST', | |
| headers: {'Content-Type': 'application/json'}, | |
| body: JSON.stringify({ number: num }) | |
| }); | |
| const res = await req.json(); | |
| if(res.status) { | |
| document.getElementById('code-area').classList.remove('hidden'); | |
| document.getElementById('code-text').innerText = res.code; | |
| } else { | |
| showToast(res.message, 'error'); | |
| } | |
| } catch(e) { showToast('Connection failed', 'error'); } | |
| } | |
| async function resetSession() { | |
| if(!confirm('Reset Session? Bot will restart.')) return; | |
| try { | |
| const req = await fetch('/reset-session', { method: 'POST' }); | |
| const res = await req.json(); | |
| showToast(res.message || 'Resetting...'); | |
| setTimeout(() => window.location.reload(), 3000); | |
| } catch(e) { showToast('Failed', 'error'); } | |
| } | |
| async function fetchStats() { | |
| try { | |
| const res = await fetch('/stats'); | |
| if (res.redirected) { | |
| window.location.href = res.url; | |
| return; | |
| } | |
| const data = await res.json(); | |
| const stText = document.getElementById('status-text'); | |
| const stDot = document.getElementById('status-dot'); | |
| const stDotM = document.getElementById('status-dot-m'); | |
| if(data.wa.connected) { | |
| stText.innerText = 'ONLINE'; stText.className = 'text-[10px] font-bold uppercase tracking-widest text-primary'; | |
| stDot.className = 'w-2.5 h-2.5 rounded-full bg-primary shadow-[0_0_12px_#6366f1]'; | |
| stDotM.className = 'w-2 h-2 rounded-full bg-primary shadow-[0_0_12px_#6366f1]'; | |
| if(data.wa.user) document.getElementById('bot-name-display').innerText = data.wa.user.name || data.wa.user.id; | |
| } else { | |
| stText.innerText = 'DISCONNECTED'; stText.className = 'text-[10px] font-bold uppercase tracking-widest text-red-500'; | |
| stDot.className = 'w-2.5 h-2.5 rounded-full bg-red-500 animate-pulse'; | |
| stDotM.className = 'w-2 h-2 rounded-full bg-red-500 animate-pulse'; | |
| } | |
| } catch (e) {} | |
| } | |
| setInterval(fetchStats, 2000); | |
| fetchStats(); | |
| </script> | |
| </body> | |
| </html> |