File size: 7,985 Bytes
208fbf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Control Center</title>
    <link rel="stylesheet" href="/static/style.css">
    <style>

        .admin-container {

            width: 100%;

            max-width: 900px;

            margin: 0 auto;

            display: none;

        }

        

        #login-section {

            max-width: 400px;

            margin: 100px auto;

        }



        .keys-table {

            width: 100%;

            border-collapse: collapse;

            margin-top: 1.5rem;

            color: var(--text-main);

            background: rgba(15, 23, 42, 0.4);

            border-radius: 8px;

            overflow: hidden;

        }



        .keys-table th, .keys-table td {

            padding: 1rem;

            text-align: left;

            border-bottom: 1px solid var(--panel-border);

        }



        .keys-table th {

            background: rgba(255, 255, 255, 0.05);

            font-weight: 600;

            color: #fff;

        }



        .badge {

            padding: 0.25rem 0.6rem;

            border-radius: 4px;

            font-size: 0.8rem;

            font-weight: 600;

        }



        .badge-active { background: rgba(16, 185, 129, 0.2); color: #10b981; }

        .badge-expired { background: rgba(244, 63, 94, 0.2); color: #f43f5e; }

        .badge-revoked { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }



        .action-btn {

            background: rgba(244, 63, 94, 0.2);

            color: #fca5a5;

            border: 1px solid rgba(244, 63, 94, 0.3);

            border-radius: 6px;

            padding: 0.4rem 0.8rem;

            cursor: pointer;

            transition: all 0.2s;

            font-size: 0.85rem;

        }



        .action-btn:hover {

            background: rgba(244, 63, 94, 0.4);

        }



        .key-text {

            font-family: 'Courier New', Courier, monospace;

            background: rgba(0, 0, 0, 0.3);

            padding: 0.3rem 0.5rem;

            border-radius: 4px;

            user-select: all;

            color: #93c5fd;

        }



        .header-flex {

            display: flex;

            justify-content: space-between;

            align-items: center;

            margin-bottom: 1.5rem;

        }

    </style>
</head>
<body>
    <nav>
        <div class="nav-container">
            <div class="nav-logo">
                <span style="font-size: 1.5rem;">⚙️</span>
                <span class="logo-text">Admin Control Center</span>
            </div>
            <div class="nav-links">
                <a href="/" class="nav-link">← Back to App</a>
                <a href="#" class="nav-link" id="logout-btn" style="display: none;">Logout</a>
            </div>
        </div>
    </nav>

    <div class="main-content">
        <!-- LOGIN SECTION -->
        <div id="login-section" class="glass-panel">
            <div class="page-header" style="margin-bottom: 1.5rem;">
                <h1 style="font-size: 2rem;">Admin Access</h1>
            </div>
            <div class="form-group">
                <label>Master Key</label>
                <div class="input-wrapper">
                    <input type="password" id="master-key-input" placeholder="Enter Master Key..." />
                </div>
            </div>
            <button class="generate-btn" id="login-btn" style="margin-top: 1.5rem;">Unlock Console</button>
            <div id="login-error" class="error-message" style="margin-top: 1rem; text-align: center;"></div>
        </div>

        <!-- ADMIN PANEL SECTION -->
        <div id="admin-section" class="admin-container">
            <!-- Generate Key Card -->
            <div class="glass-panel" style="margin-bottom: 2rem;">
                <div class="header-flex">
                    <h2 style="font-family: var(--font-heading); color: #fff;">Generate New Key</h2>
                </div>
                <div class="form-grid" style="align-items: end;">
                    <div class="form-group">
                        <label>Expiration Time (Hours)</label>
                        <select id="key-hours">
                            <option value="1">1 Hour</option>
                            <option value="12">12 Hours</option>
                            <option value="24">24 Hours (1 Day)</option>
                            <option value="168">168 Hours (7 Days)</option>
                            <option value="720">720 Hours (30 Days)</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <button class="generate-btn" id="generate-key-btn" style="margin-top: 0;">Generate Key</button>
                    </div>
                </div>
                <div id="new-key-result" style="margin-top: 1.5rem; display: none;">
                    <p style="color: var(--text-muted); margin-bottom: 0.5rem;">Successfully Generated Key:</p>
                    <div style="display: flex; gap: 1rem; align-items: center;">
                        <span class="key-text" id="new-key-display" style="font-size: 1.5rem; padding: 0.8rem 1rem;"></span>
                        <button id="copy-btn" class="action-btn" style="background: rgba(59, 130, 246, 0.2); color: #93c5fd; border-color: rgba(59, 130, 246, 0.3);">Copy to Clipboard</button>
                    </div>
                </div>
            </div>

            <!-- Active Keys Card -->
            <div class="glass-panel">
                <div class="header-flex">
                    <h2 style="font-family: var(--font-heading); color: #fff;">Access Keys Database</h2>
                    <div>
                        <button id="revoke-all-btn" class="action-btn" style="margin-right: 1rem; color: #f87171; border-color: #f87171;">⚠️ Revoke All Active</button>
                        <button id="refresh-btn" class="action-btn" style="background: rgba(255,255,255,0.1); color: #fff; border: none;">↻ Refresh</button>
                    </div>
                </div>
                <table class="keys-table">
                    <thead>
                        <tr>
                            <th>Key</th>
                            <th>Status</th>
                            <th>Created</th>
                            <th>Expires</th>
                            <th>IP Used</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody id="keys-table-body">
                        <!-- Populated via JS -->
                    </tbody>
                </table>
            </div>

            <!-- Access Logs Card -->
            <div class="glass-panel" style="margin-top: 2rem;">
                <div class="header-flex">
                    <h2 style="font-family: var(--font-heading); color: #fff;">System Access Logs (Last 24h)</h2>
                    <button id="refresh-logs-btn" class="action-btn" style="background: rgba(255,255,255,0.1); color: #fff; border: none;">↻ Refresh Logs</button>
                </div>
                <div id="logs-container" style="background: rgba(0,0,0,0.5); padding: 1rem; border-radius: 8px; max-height: 300px; overflow-y: auto; font-family: monospace; font-size: 0.85rem; color: #a1a1aa; line-height: 1.5;">
                    <!-- Populated via JS -->
                </div>
            </div>
        </div>
    </div>


    <footer style="text-align: center; padding: 2rem 0; margin-top: 3rem; border-top: 1px solid rgba(255,255,255,0.05); color: var(--text-muted); font-size: 0.9rem;">
        &copy; 2026 All Rights Reserved. Wealth Engine.
    </footer>
    <script src="/static/admin.js"></script>
</body>
</html>