Brozy123 commited on
Commit
075fd33
·
verified ·
1 Parent(s): 208099c

Create dashboard.html

Browse files
Files changed (1) hide show
  1. dashboard.html +718 -0
dashboard.html ADDED
@@ -0,0 +1,718 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FriendlyBot — Dashboard</title>
7
+ <link rel="icon" href="/logo.png">
8
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
9
+ <style>
10
+ *, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
11
+
12
+ :root {
13
+ --bg: #0a0a1a;
14
+ --surface: #12122a;
15
+ --surface2: #1a1a3a;
16
+ --border: rgba(255,255,255,0.06);
17
+ --accent: #5865F2;
18
+ --accent-glow: rgba(88,101,242,0.3);
19
+ --green: #57F287;
20
+ --red: #ED4245;
21
+ --yellow: #FEE75C;
22
+ --text: #ffffff;
23
+ --text-dim: rgba(255,255,255,0.5);
24
+ --text-mid: rgba(255,255,255,0.7);
25
+ --radius: 16px;
26
+ --radius-sm: 10px;
27
+ }
28
+
29
+ body {
30
+ font-family: 'Inter', -apple-system, sans-serif;
31
+ background: var(--bg);
32
+ color: var(--text);
33
+ min-height: 100vh;
34
+ overflow-x: hidden;
35
+ }
36
+
37
+ /* ===== LOGIN ===== */
38
+ #login-screen {
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ min-height: 100vh;
43
+ background: radial-gradient(ellipse at 50% 0%, rgba(88,101,242,0.15) 0%, transparent 60%);
44
+ }
45
+
46
+ .login-card {
47
+ background: var(--surface);
48
+ border: 1px solid var(--border);
49
+ border-radius: var(--radius);
50
+ padding: 48px 40px;
51
+ width: 420px;
52
+ max-width: 90vw;
53
+ text-align: center;
54
+ backdrop-filter: blur(20px);
55
+ box-shadow: 0 24px 80px rgba(0,0,0,0.5);
56
+ animation: fadeUp 0.6s ease;
57
+ }
58
+
59
+ @keyframes fadeUp {
60
+ from { opacity:0; transform:translateY(30px); }
61
+ to { opacity:1; transform:translateY(0); }
62
+ }
63
+
64
+ .login-card img { width: 80px; border-radius: 50%; margin-bottom: 20px; box-shadow: 0 0 40px var(--accent-glow); }
65
+ .login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
66
+ .login-card p { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }
67
+
68
+ .login-card input {
69
+ width: 100%;
70
+ padding: 14px 18px;
71
+ background: var(--bg);
72
+ border: 1px solid var(--border);
73
+ border-radius: var(--radius-sm);
74
+ color: var(--text);
75
+ font-size: 15px;
76
+ font-family: 'Inter', sans-serif;
77
+ outline: none;
78
+ transition: border 0.2s;
79
+ margin-bottom: 14px;
80
+ }
81
+ .login-card input:focus { border-color: var(--accent); }
82
+
83
+ .login-card button {
84
+ width: 100%;
85
+ padding: 14px;
86
+ background: var(--accent);
87
+ color: white;
88
+ border: none;
89
+ border-radius: var(--radius-sm);
90
+ font-size: 15px;
91
+ font-weight: 600;
92
+ font-family: 'Inter', sans-serif;
93
+ cursor: pointer;
94
+ transition: all 0.2s;
95
+ }
96
+ .login-card button:hover { background: #4752c4; transform: translateY(-1px); box-shadow: 0 8px 30px var(--accent-glow); }
97
+
98
+ .login-error { color: var(--red); font-size: 13px; margin-top: 10px; display: none; }
99
+
100
+ /* ===== DASHBOARD ===== */
101
+ #dashboard { display: none; }
102
+
103
+ .sidebar {
104
+ position: fixed;
105
+ top: 0; left: 0;
106
+ width: 260px;
107
+ height: 100vh;
108
+ background: var(--surface);
109
+ border-right: 1px solid var(--border);
110
+ padding: 24px 16px;
111
+ z-index: 100;
112
+ display: flex;
113
+ flex-direction: column;
114
+ }
115
+
116
+ .sidebar-brand {
117
+ display: flex;
118
+ align-items: center;
119
+ gap: 12px;
120
+ padding: 0 8px 24px;
121
+ border-bottom: 1px solid var(--border);
122
+ margin-bottom: 20px;
123
+ }
124
+ .sidebar-brand img { width: 40px; border-radius: 50%; }
125
+ .sidebar-brand span { font-weight: 700; font-size: 17px; }
126
+
127
+ .sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
128
+
129
+ .nav-item {
130
+ display: flex;
131
+ align-items: center;
132
+ gap: 12px;
133
+ padding: 12px 14px;
134
+ border-radius: var(--radius-sm);
135
+ color: var(--text-mid);
136
+ font-size: 14px;
137
+ font-weight: 500;
138
+ cursor: pointer;
139
+ transition: all 0.15s;
140
+ text-decoration: none;
141
+ }
142
+ .nav-item:hover { background: var(--surface2); color: var(--text); }
143
+ .nav-item.active { background: var(--accent); color: white; }
144
+ .nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
145
+
146
+ .sidebar-footer {
147
+ padding: 16px 8px 0;
148
+ border-top: 1px solid var(--border);
149
+ }
150
+ .sidebar-footer .nav-item { color: var(--red); }
151
+ .sidebar-footer .nav-item:hover { background: rgba(237,66,69,0.1); }
152
+
153
+ .main { margin-left: 260px; padding: 32px 40px; min-height: 100vh; }
154
+
155
+ .topbar {
156
+ display: flex;
157
+ justify-content: space-between;
158
+ align-items: center;
159
+ margin-bottom: 32px;
160
+ }
161
+ .topbar h2 { font-size: 26px; font-weight: 700; }
162
+ .topbar-right { display: flex; align-items: center; gap: 12px; }
163
+
164
+ .status-pill {
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 8px;
168
+ background: rgba(87,242,135,0.1);
169
+ color: var(--green);
170
+ padding: 8px 16px;
171
+ border-radius: 100px;
172
+ font-size: 13px;
173
+ font-weight: 600;
174
+ }
175
+ .status-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
176
+ @keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
177
+
178
+ /* Stats Cards */
179
+ .stats-grid {
180
+ display: grid;
181
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
182
+ gap: 20px;
183
+ margin-bottom: 32px;
184
+ }
185
+
186
+ .stat-card {
187
+ background: var(--surface);
188
+ border: 1px solid var(--border);
189
+ border-radius: var(--radius);
190
+ padding: 24px;
191
+ position: relative;
192
+ overflow: hidden;
193
+ transition: all 0.25s;
194
+ }
195
+ .stat-card:hover { border-color: rgba(88,101,242,0.3); transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
196
+ .stat-card::after { content:''; position:absolute; top:0; right:0; width:120px; height:120px; background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%); opacity:0.15; pointer-events: none; }
197
+ .stat-card .label { font-size: 13px; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
198
+ .stat-card .value { font-size: 36px; font-weight: 800; margin-top: 8px; line-height: 1; }
199
+ .stat-card .sub { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
200
+
201
+ /* Panels */
202
+ .panel {
203
+ background: var(--surface);
204
+ border: 1px solid var(--border);
205
+ border-radius: var(--radius);
206
+ overflow: hidden;
207
+ margin-bottom: 24px;
208
+ }
209
+ .panel-header {
210
+ padding: 20px 24px;
211
+ border-bottom: 1px solid var(--border);
212
+ display: flex;
213
+ justify-content: space-between;
214
+ align-items: center;
215
+ }
216
+ .panel-header h3 { font-size: 16px; font-weight: 600; }
217
+ .panel-body { padding: 0; }
218
+
219
+ /* Server List */
220
+ .server-row {
221
+ display: flex;
222
+ align-items: center;
223
+ justify-content: space-between;
224
+ padding: 16px 24px;
225
+ border-bottom: 1px solid var(--border);
226
+ transition: background 0.15s;
227
+ }
228
+ .server-row:last-child { border-bottom: none; }
229
+ .server-row:hover { background: var(--surface2); }
230
+ .server-info { display: flex; align-items: center; gap: 14px; }
231
+ .server-icon {
232
+ width: 40px; height: 40px;
233
+ border-radius: 50%;
234
+ background: var(--accent);
235
+ display: flex; align-items: center; justify-content: center;
236
+ font-weight: 700; font-size: 16px; color: white; flex-shrink: 0;
237
+ }
238
+ .server-name { font-weight: 600; font-size: 14px; }
239
+ .server-members { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
240
+ .server-rank { font-size: 13px; color: var(--text-dim); font-weight: 600; min-width: 30px; }
241
+ .member-badge {
242
+ background: var(--surface2);
243
+ padding: 6px 14px;
244
+ border-radius: 100px;
245
+ font-size: 13px;
246
+ font-weight: 500;
247
+ color: var(--text-mid);
248
+ }
249
+
250
+ /* Command List */
251
+ .cmd-row {
252
+ display: flex;
253
+ align-items: center;
254
+ justify-content: space-between;
255
+ padding: 14px 24px;
256
+ border-bottom: 1px solid var(--border);
257
+ }
258
+ .cmd-row:last-child { border-bottom: none; }
259
+ .cmd-row:hover { background: var(--surface2); }
260
+ .cmd-name { font-family: 'Courier New', monospace; font-weight: 600; color: var(--accent); font-size: 14px; }
261
+ .cmd-desc { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
262
+ .cmd-badge {
263
+ padding: 4px 12px;
264
+ border-radius: 100px;
265
+ font-size: 11px;
266
+ font-weight: 600;
267
+ text-transform: uppercase;
268
+ letter-spacing: 0.5px;
269
+ }
270
+ .cmd-badge.admin { background: rgba(237,66,69,0.15); color: var(--red); }
271
+ .cmd-badge.public { background: rgba(87,242,135,0.15); color: var(--green); }
272
+ .cmd-badge.staff { background: rgba(254,231,92,0.15); color: var(--yellow); }
273
+
274
+ /* Pages */
275
+ .page { display: none; }
276
+ .page.active { display: block; }
277
+
278
+ /* Invite Section */
279
+ .invite-box {
280
+ background: linear-gradient(135deg, #5865F2 0%, #4752c4 100%);
281
+ border-radius: var(--radius);
282
+ padding: 40px;
283
+ text-align: center;
284
+ margin-bottom: 24px;
285
+ }
286
+ .invite-box h3 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
287
+ .invite-box p { color: rgba(255,255,255,0.8); margin-bottom: 24px; font-size: 15px; }
288
+ .invite-btn {
289
+ display: inline-flex;
290
+ align-items: center;
291
+ gap: 10px;
292
+ padding: 14px 32px;
293
+ background: white;
294
+ color: var(--accent);
295
+ border: none;
296
+ border-radius: var(--radius-sm);
297
+ font-size: 15px;
298
+ font-weight: 700;
299
+ font-family: 'Inter', sans-serif;
300
+ cursor: pointer;
301
+ transition: all 0.2s;
302
+ text-decoration: none;
303
+ }
304
+ .invite-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
305
+
306
+ /* Quick Actions */
307
+ .actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 24px; }
308
+ .action-card {
309
+ background: var(--bg);
310
+ border: 1px solid var(--border);
311
+ border-radius: var(--radius-sm);
312
+ padding: 20px;
313
+ cursor: pointer;
314
+ transition: all 0.2s;
315
+ }
316
+ .action-card:hover { border-color: var(--accent); transform: translateY(-2px); }
317
+ .action-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
318
+ .action-card p { font-size: 12px; color: var(--text-dim); }
319
+ .action-icon { font-size: 24px; margin-bottom: 12px; }
320
+
321
+ /* Logs */
322
+ .log-area {
323
+ background: var(--bg);
324
+ padding: 20px 24px;
325
+ font-family: 'Courier New', monospace;
326
+ font-size: 13px;
327
+ color: var(--green);
328
+ max-height: 400px;
329
+ overflow-y: auto;
330
+ line-height: 1.8;
331
+ }
332
+ .log-line { opacity: 0.85; }
333
+ .log-line.error { color: var(--red); }
334
+ .log-line.warn { color: var(--yellow); }
335
+
336
+ /* Responsive */
337
+ @media (max-width: 768px) {
338
+ .sidebar { display: none; }
339
+ .main { margin-left: 0; padding: 20px; }
340
+ }
341
+
342
+ /* Scrollbar */
343
+ ::-webkit-scrollbar { width: 6px; }
344
+ ::-webkit-scrollbar-track { background: transparent; }
345
+ ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
346
+ ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
347
+
348
+ /* Loading shimmer */
349
+ .shimmer {
350
+ background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
351
+ background-size: 200% 100%;
352
+ animation: shimmer 1.5s infinite;
353
+ }
354
+ @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
355
+ </style>
356
+ </head>
357
+ <body>
358
+
359
+ <!-- ===== LOGIN SCREEN ===== -->
360
+ <div id="login-screen">
361
+ <div class="login-card">
362
+ <img src="/logo.png" alt="FriendlyBot">
363
+ <h1>FriendlyBot</h1>
364
+ <p>Enter your dashboard password to continue</p>
365
+ <input type="password" id="login-password" placeholder="Dashboard Password" autocomplete="current-password">
366
+ <button onclick="attemptLogin()">Sign In</button>
367
+ <div class="login-error" id="login-error">Incorrect password. Please try again.</div>
368
+ </div>
369
+ </div>
370
+
371
+ <!-- ===== DASHBOARD ===== -->
372
+ <div id="dashboard">
373
+ <!-- Sidebar -->
374
+ <div class="sidebar">
375
+ <div class="sidebar-brand">
376
+ <img src="/logo.png" alt="">
377
+ <span>FriendlyBot</span>
378
+ </div>
379
+ <div class="sidebar-nav">
380
+ <div class="nav-item active" onclick="showPage('overview', this)">
381
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>
382
+ Overview
383
+ </div>
384
+ <div class="nav-item" onclick="showPage('servers', this)">
385
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>
386
+ Servers
387
+ </div>
388
+ <div class="nav-item" onclick="showPage('commands', this)">
389
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>
390
+ Commands
391
+ </div>
392
+ <div class="nav-item" onclick="showPage('invite', this)">
393
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><line x1="20" y1="8" x2="20" y2="14"/><line x1="23" y1="11" x2="17" y2="11"/></svg>
394
+ Invite Bot
395
+ </div>
396
+ <div class="nav-item" onclick="showPage('logs', this)">
397
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
398
+ Logs
399
+ </div>
400
+ </div>
401
+ <div class="sidebar-footer">
402
+ <div class="nav-item" onclick="logout()">
403
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
404
+ Sign Out
405
+ </div>
406
+ </div>
407
+ </div>
408
+
409
+ <!-- Main Content -->
410
+ <div class="main">
411
+ <!-- ===== OVERVIEW PAGE ===== -->
412
+ <div class="page active" id="page-overview">
413
+ <div class="topbar">
414
+ <h2>Dashboard</h2>
415
+ <div class="topbar-right">
416
+ <div class="status-pill"><div class="status-dot"></div> Online</div>
417
+ </div>
418
+ </div>
419
+
420
+ <div class="stats-grid">
421
+ <div class="stat-card">
422
+ <div class="label">Servers</div>
423
+ <div class="value" id="stat-servers">—</div>
424
+ <div class="sub">Connected guilds</div>
425
+ </div>
426
+ <div class="stat-card">
427
+ <div class="label">Total Members</div>
428
+ <div class="value" id="stat-members">—</div>
429
+ <div class="sub">Across all servers</div>
430
+ </div>
431
+ <div class="stat-card">
432
+ <div class="label">Uptime</div>
433
+ <div class="value" id="stat-uptime">—</div>
434
+ <div class="sub">Since last restart</div>
435
+ </div>
436
+ <div class="stat-card">
437
+ <div class="label">Commands</div>
438
+ <div class="value" id="stat-commands">—</div>
439
+ <div class="sub">Registered globally</div>
440
+ </div>
441
+ </div>
442
+
443
+ <div class="panel">
444
+ <div class="panel-header"><h3>⚡ Quick Actions</h3></div>
445
+ <div class="actions-grid">
446
+ <div class="action-card" onclick="triggerAction('sync')">
447
+ <div class="action-icon">🔄</div>
448
+ <h4>Sync Commands</h4>
449
+ <p>Force-sync all slash commands to every server immediately.</p>
450
+ </div>
451
+ <div class="action-card" onclick="triggerAction('backup')">
452
+ <div class="action-icon">☁️</div>
453
+ <h4>Cloud Backup</h4>
454
+ <p>Trigger an immediate backup of all bot data to Discord.</p>
455
+ </div>
456
+ <div class="action-card" onclick="window.open('/api/invite','_blank')">
457
+ <div class="action-icon">🤖</div>
458
+ <h4>Add to Server</h4>
459
+ <p>Generate a fresh invite link and add the bot to a new server.</p>
460
+ </div>
461
+ <div class="action-card" onclick="triggerAction('restart')">
462
+ <div class="action-icon">🔁</div>
463
+ <h4>Restart Bot</h4>
464
+ <p>Gracefully restart the bot process on Hugging Face.</p>
465
+ </div>
466
+ </div>
467
+ </div>
468
+ </div>
469
+
470
+ <!-- ===== SERVERS PAGE ===== -->
471
+ <div class="page" id="page-servers">
472
+ <div class="topbar">
473
+ <h2>Server Registry</h2>
474
+ <div class="topbar-right">
475
+ <div class="status-pill"><div class="status-dot"></div> <span id="server-count-label">0 Servers</span></div>
476
+ </div>
477
+ </div>
478
+ <div class="panel">
479
+ <div class="panel-header"><h3>🌐 All Connected Servers</h3><span style="color:var(--text-dim);font-size:13px">Sorted by members</span></div>
480
+ <div class="panel-body" id="server-list">
481
+ <div class="server-row shimmer" style="height:72px"></div>
482
+ <div class="server-row shimmer" style="height:72px"></div>
483
+ <div class="server-row shimmer" style="height:72px"></div>
484
+ </div>
485
+ </div>
486
+ </div>
487
+
488
+ <!-- ===== COMMANDS PAGE ===== -->
489
+ <div class="page" id="page-commands">
490
+ <div class="topbar"><h2>Command Registry</h2></div>
491
+ <div class="panel">
492
+ <div class="panel-header"><h3>📋 All Registered Commands</h3></div>
493
+ <div class="panel-body" id="command-list"></div>
494
+ </div>
495
+ </div>
496
+
497
+ <!-- ===== INVITE PAGE ===== -->
498
+ <div class="page" id="page-invite">
499
+ <div class="topbar"><h2>Invite Bot</h2></div>
500
+ <div class="invite-box">
501
+ <h3>Add FriendlyBot to Your Server</h3>
502
+ <p>Give your server the ultimate match management experience with lineup boards, formations, match tracking, and more.</p>
503
+ <a class="invite-btn" id="invite-link" href="#" target="_blank">
504
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><line x1="20" y1="8" x2="20" y2="14"/><line x1="23" y1="11" x2="17" y2="11"/></svg>
505
+ Invite to Discord
506
+ </a>
507
+ </div>
508
+ <div class="panel">
509
+ <div class="panel-header"><h3>🔒 Required Permissions</h3></div>
510
+ <div class="actions-grid">
511
+ <div class="action-card" style="cursor:default">
512
+ <div class="action-icon">💬</div>
513
+ <h4>Send Messages</h4>
514
+ <p>Post lineup boards, match polls, and announcements.</p>
515
+ </div>
516
+ <div class="action-card" style="cursor:default">
517
+ <div class="action-icon">👤</div>
518
+ <h4>Manage Roles</h4>
519
+ <p>Assign and manage staff whitelist roles.</p>
520
+ </div>
521
+ <div class="action-card" style="cursor:default">
522
+ <div class="action-icon">📌</div>
523
+ <h4>Manage Messages</h4>
524
+ <p>Clear messages, pin important updates, bulk delete.</p>
525
+ </div>
526
+ <div class="action-card" style="cursor:default">
527
+ <div class="action-icon">🔒</div>
528
+ <h4>Manage Channels</h4>
529
+ <p>Lock/unlock channels during matches or events.</p>
530
+ </div>
531
+ </div>
532
+ </div>
533
+ </div>
534
+
535
+ <!-- ===== LOGS PAGE ===== -->
536
+ <div class="page" id="page-logs">
537
+ <div class="topbar"><h2>Live Logs</h2></div>
538
+ <div class="panel">
539
+ <div class="panel-header"><h3>📄 Recent Activity</h3></div>
540
+ <div class="log-area" id="log-area">
541
+ <div class="log-line">[*] Waiting for log data...</div>
542
+ </div>
543
+ </div>
544
+ </div>
545
+ </div>
546
+ </div>
547
+
548
+ <script>
549
+ // ===== AUTH =====
550
+ const DASH_KEY = 'fb_dash_auth';
551
+
552
+ function attemptLogin() {
553
+ const pw = document.getElementById('login-password').value;
554
+ fetch('/api/login', {
555
+ method: 'POST',
556
+ headers: { 'Content-Type': 'application/json' },
557
+ body: JSON.stringify({ password: pw })
558
+ })
559
+ .then(r => r.json())
560
+ .then(data => {
561
+ if (data.success) {
562
+ localStorage.setItem(DASH_KEY, pw);
563
+ showDashboard();
564
+ } else {
565
+ document.getElementById('login-error').style.display = 'block';
566
+ }
567
+ })
568
+ .catch(() => {
569
+ document.getElementById('login-error').textContent = 'Connection failed.';
570
+ document.getElementById('login-error').style.display = 'block';
571
+ });
572
+ }
573
+
574
+ // Enter key for login
575
+ document.addEventListener('DOMContentLoaded', () => {
576
+ document.getElementById('login-password').addEventListener('keydown', e => {
577
+ if (e.key === 'Enter') attemptLogin();
578
+ });
579
+ // Auto-login
580
+ const saved = localStorage.getItem(DASH_KEY);
581
+ if (saved) {
582
+ fetch('/api/login', {
583
+ method: 'POST',
584
+ headers: { 'Content-Type': 'application/json' },
585
+ body: JSON.stringify({ password: saved })
586
+ })
587
+ .then(r => r.json())
588
+ .then(data => { if (data.success) showDashboard(); })
589
+ .catch(() => {});
590
+ }
591
+ });
592
+
593
+ function showDashboard() {
594
+ document.getElementById('login-screen').style.display = 'none';
595
+ document.getElementById('dashboard').style.display = 'block';
596
+ loadStats();
597
+ loadServers();
598
+ loadCommands();
599
+ loadLogs();
600
+ // Auto-refresh every 10s
601
+ setInterval(loadStats, 10000);
602
+ setInterval(loadLogs, 8000);
603
+ }
604
+
605
+ function logout() {
606
+ localStorage.removeItem(DASH_KEY);
607
+ location.reload();
608
+ }
609
+
610
+ function getAuth() {
611
+ return localStorage.getItem(DASH_KEY);
612
+ }
613
+
614
+ // ===== NAVIGATION =====
615
+ function showPage(name, el) {
616
+ document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
617
+ document.querySelectorAll('.nav-item').forEach(n => n.classList.remove('active'));
618
+ document.getElementById('page-' + name).classList.add('active');
619
+ if (el) el.classList.add('active');
620
+ }
621
+
622
+ // ===== DATA LOADERS =====
623
+ function loadStats() {
624
+ fetch('/api/stats', { headers: { 'x-auth': getAuth() } })
625
+ .then(r => r.json())
626
+ .then(data => {
627
+ document.getElementById('stat-servers').textContent = data.servers || 0;
628
+ document.getElementById('stat-members').textContent = (data.members || 0).toLocaleString();
629
+ document.getElementById('stat-uptime').textContent = data.uptime || '—';
630
+ document.getElementById('stat-commands').textContent = data.commands || 0;
631
+ document.getElementById('server-count-label').textContent = (data.servers || 0) + ' Servers';
632
+
633
+ // Update invite link
634
+ if (data.inviteUrl) {
635
+ document.getElementById('invite-link').href = data.inviteUrl;
636
+ }
637
+ }).catch(() => {});
638
+ }
639
+
640
+ function loadServers() {
641
+ fetch('/api/servers', { headers: { 'x-auth': getAuth() } })
642
+ .then(r => r.json())
643
+ .then(data => {
644
+ const container = document.getElementById('server-list');
645
+ container.innerHTML = '';
646
+ data.sort((a, b) => b.members - a.members);
647
+ data.forEach((s, i) => {
648
+ container.innerHTML += `
649
+ <div class="server-row">
650
+ <div class="server-info">
651
+ <span class="server-rank">#${i + 1}</span>
652
+ <div class="server-icon">${s.name.charAt(0).toUpperCase()}</div>
653
+ <div>
654
+ <div class="server-name">${escapeHtml(s.name)}</div>
655
+ <div class="server-members">${s.id}</div>
656
+ </div>
657
+ </div>
658
+ <div class="member-badge">${s.members.toLocaleString()} members</div>
659
+ </div>`;
660
+ });
661
+ }).catch(() => {});
662
+ }
663
+
664
+ function loadCommands() {
665
+ fetch('/api/commands', { headers: { 'x-auth': getAuth() } })
666
+ .then(r => r.json())
667
+ .then(data => {
668
+ const container = document.getElementById('command-list');
669
+ container.innerHTML = '';
670
+ data.forEach(c => {
671
+ const badge = c.admin ? '<span class="cmd-badge admin">Admin</span>'
672
+ : c.staff ? '<span class="cmd-badge staff">Staff</span>'
673
+ : '<span class="cmd-badge public">Public</span>';
674
+ container.innerHTML += `
675
+ <div class="cmd-row">
676
+ <div>
677
+ <div class="cmd-name">/${c.name}</div>
678
+ <div class="cmd-desc">${escapeHtml(c.description)}</div>
679
+ </div>
680
+ ${badge}
681
+ </div>`;
682
+ });
683
+ }).catch(() => {});
684
+ }
685
+
686
+ function loadLogs() {
687
+ fetch('/api/logs', { headers: { 'x-auth': getAuth() } })
688
+ .then(r => r.json())
689
+ .then(data => {
690
+ const area = document.getElementById('log-area');
691
+ area.innerHTML = '';
692
+ (data.logs || []).forEach(line => {
693
+ const cls = line.includes('Error') || line.includes('CRITICAL') ? 'error'
694
+ : line.includes('Warning') || line.includes('Deprecation') ? 'warn' : '';
695
+ area.innerHTML += `<div class="log-line ${cls}">${escapeHtml(line)}</div>`;
696
+ });
697
+ area.scrollTop = area.scrollHeight;
698
+ }).catch(() => {});
699
+ }
700
+
701
+ // ===== ACTIONS =====
702
+ function triggerAction(action) {
703
+ fetch('/api/action/' + action, { method: 'POST', headers: { 'x-auth': getAuth() } })
704
+ .then(r => r.json())
705
+ .then(data => {
706
+ alert(data.message || 'Action triggered!');
707
+ loadStats();
708
+ }).catch(() => alert('Failed to trigger action.'));
709
+ }
710
+
711
+ function escapeHtml(str) {
712
+ const d = document.createElement('div');
713
+ d.textContent = str;
714
+ return d.innerHTML;
715
+ }
716
+ </script>
717
+ </body>
718
+ </html>