Reaperxxxx commited on
Commit
69010d2
·
verified ·
1 Parent(s): 7998d46

Create index.html

Browse files
Files changed (1) hide show
  1. public/index.html +106 -0
public/index.html ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Commands API Dashboard</title>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ margin: 20px;
9
+ background: #f4f4f4;
10
+ }
11
+ h1 {
12
+ text-align: center;
13
+ }
14
+ .category {
15
+ background: #fff;
16
+ margin-bottom: 20px;
17
+ padding: 15px;
18
+ border-radius: 8px;
19
+ box-shadow: 0px 2px 6px rgba(0,0,0,0.1);
20
+ }
21
+ .category h2 {
22
+ margin-bottom: 10px;
23
+ border-bottom: 2px solid #ddd;
24
+ padding-bottom: 5px;
25
+ }
26
+ table {
27
+ width: 100%;
28
+ border-collapse: collapse;
29
+ margin-top: 8px;
30
+ }
31
+ th, td {
32
+ padding: 8px;
33
+ border-bottom: 1px solid #ddd;
34
+ text-align: left;
35
+ }
36
+ th {
37
+ background: #eee;
38
+ }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <h1>📜 Commands API</h1>
43
+ <div id="commands-container">Loading commands...</div>
44
+
45
+ <script>
46
+ async function fetchCommands() {
47
+ try {
48
+ const res = await fetch('/api/commands');
49
+ const commands = await res.json();
50
+
51
+ if (!commands.length) {
52
+ document.getElementById('commands-container').innerHTML = "<p>No commands found.</p>";
53
+ return;
54
+ }
55
+
56
+ // Group commands by category
57
+ const grouped = {};
58
+ commands.forEach(cmd => {
59
+ const category = cmd.category;
60
+ if (!grouped[category]) grouped[category] = [];
61
+ grouped[category].push(cmd);
62
+ });
63
+
64
+ // Render categories
65
+ const container = document.getElementById('commands-container');
66
+ container.innerHTML = '';
67
+
68
+ for (const [category, cmds] of Object.entries(grouped)) {
69
+ const div = document.createElement('div');
70
+ div.className = 'category';
71
+
72
+ div.innerHTML = `
73
+ <h2>${category}</h2>
74
+ <table>
75
+ <thead>
76
+ <tr>
77
+ <th>Name</th>
78
+ <th>Info</th>
79
+ <th>Added</th>
80
+ </tr>
81
+ </thead>
82
+ <tbody>
83
+ ${cmds.map(c => `
84
+ <tr>
85
+ <td>${c.name}</td>
86
+ <td>${c.info}</td>
87
+ <td>${new Date(c.createdAt).toLocaleString()}</td>
88
+ </tr>
89
+ `).join('')}
90
+ </tbody>
91
+ </table>
92
+ `;
93
+
94
+ container.appendChild(div);
95
+ }
96
+
97
+ } catch (err) {
98
+ console.error('Error fetching commands:', err);
99
+ document.getElementById('commands-container').innerHTML = "<p style='color:red'>Error loading commands.</p>";
100
+ }
101
+ }
102
+
103
+ fetchCommands();
104
+ </script>
105
+ </body>
106
+ </html>