PHhTTPS commited on
Commit
edfae64
·
1 Parent(s): 2952353

Ensure status auth modal is visible by default (auth at beginning)

Browse files
Files changed (1) hide show
  1. static/status.html +24 -16
static/status.html CHANGED
@@ -84,18 +84,22 @@
84
  margin-bottom: 20px;
85
  }
86
 
87
- /* Login Modal */
88
  .modal-overlay {
89
  position: fixed;
90
  top: 0; left: 0; right: 0; bottom: 0;
91
- background: rgba(0,0,0,0.8);
92
- display: none; /* Hidden by default */
93
  align-items: center;
94
  justify-content: center;
95
  z-index: 1000;
 
 
96
  }
97
- .modal-overlay.active {
98
- display: flex; /* Show when active */
 
 
99
  }
100
  .modal {
101
  background: var(--bg-secondary);
@@ -186,14 +190,17 @@
186
  return localStorage.getItem("managementKey");
187
  }
188
 
189
- function checkAuth() {
 
190
  const key = getKey();
191
- if (!key) {
192
- console.log("No key found, showing login modal");
193
- document.getElementById('login-modal').classList.add('active');
194
- return false;
 
 
 
195
  }
196
- return true;
197
  }
198
 
199
  document.getElementById('login-form').addEventListener('submit', async function(e) {
@@ -216,7 +223,7 @@
216
  if (res.ok) {
217
  localStorage.setItem("managementKey", key);
218
  localStorage.setItem("isLoggedIn", "true");
219
- document.getElementById('login-modal').classList.remove('active');
220
  fetchData();
221
  } else {
222
  showLoginError("Invalid key");
@@ -243,9 +250,10 @@
243
  }
244
 
245
  async function fetchData() {
246
- if (!checkAuth()) return;
 
247
 
248
- const headers = { "Authorization": "Bearer " + getKey() };
249
 
250
  try {
251
  // Parallel fetch
@@ -337,8 +345,8 @@
337
  document.getElementById("activity-log").innerHTML = "<p>Check logs for detailed activity.</p>";
338
  }
339
 
340
- // Initial Load
341
- document.addEventListener('DOMContentLoaded', fetchData);
342
  </script>
343
  </body>
344
  </html>
 
84
  margin-bottom: 20px;
85
  }
86
 
87
+ /* Login Modal - Visible by default for immediate auth */
88
  .modal-overlay {
89
  position: fixed;
90
  top: 0; left: 0; right: 0; bottom: 0;
91
+ background: rgba(0,0,0,0.9); /* Darker background to hide content */
92
+ display: flex;
93
  align-items: center;
94
  justify-content: center;
95
  z-index: 1000;
96
+ opacity: 1;
97
+ transition: opacity 0.3s ease-in-out;
98
  }
99
+ .modal-overlay.hidden {
100
+ opacity: 0;
101
+ pointer-events: none;
102
+ display: none;
103
  }
104
  .modal {
105
  background: var(--bg-secondary);
 
190
  return localStorage.getItem("managementKey");
191
  }
192
 
193
+ // Initialize: Check auth immediately
194
+ function init() {
195
  const key = getKey();
196
+ if (key) {
197
+ // If we have a key, hide the login screen and fetch data
198
+ document.getElementById('login-modal').classList.add('hidden');
199
+ fetchData();
200
+ } else {
201
+ // No key? The login modal is visible by default.
202
+ console.log("No auth key found, waiting for login...");
203
  }
 
204
  }
205
 
206
  document.getElementById('login-form').addEventListener('submit', async function(e) {
 
223
  if (res.ok) {
224
  localStorage.setItem("managementKey", key);
225
  localStorage.setItem("isLoggedIn", "true");
226
+ document.getElementById('login-modal').classList.add('hidden');
227
  fetchData();
228
  } else {
229
  showLoginError("Invalid key");
 
250
  }
251
 
252
  async function fetchData() {
253
+ const key = getKey();
254
+ if (!key) return; // Should be handled by init, but double check
255
 
256
+ const headers = { "Authorization": "Bearer " + key };
257
 
258
  try {
259
  // Parallel fetch
 
345
  document.getElementById("activity-log").innerHTML = "<p>Check logs for detailed activity.</p>";
346
  }
347
 
348
+ // Start everything
349
+ document.addEventListener('DOMContentLoaded', init);
350
  </script>
351
  </body>
352
  </html>