abualzait commited on
Commit
0a76c82
ยท
verified ยท
1 Parent(s): a29a57c

Upload folder using huggingface_hub

Browse files
Police_Station_Finder.html CHANGED
@@ -844,7 +844,7 @@
844
  <span>MAT</span>
845
  <span style="font-size: 0.8rem; font-weight: 600; color: var(--secondary); background: rgba(0,109,57,0.1); padding: 2px 8px; border-radius: 6px;">ุฏู„ูŠู„ ุงู„ู…ุฑุงูƒุฒ ุงู„ุฃู…ู†ูŠุฉ</span>
846
  </h1>
847
- <p>ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ โ€” ุชุญุฏูŠุฏ ุงู„ู…ูˆุงู‚ุน ุฌุบุฑุงููŠุงู‹ <span class="version-tag">ุงู„ุฅุตุฏุงุฑ 1.34.0</span></p>
848
  </div>
849
  </div>
850
  <div class="header-actions">
 
844
  <span>MAT</span>
845
  <span style="font-size: 0.8rem; font-weight: 600; color: var(--secondary); background: rgba(0,109,57,0.1); padding: 2px 8px; border-radius: 6px;">ุฏู„ูŠู„ ุงู„ู…ุฑุงูƒุฒ ุงู„ุฃู…ู†ูŠุฉ</span>
846
  </h1>
847
+ <p>ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ โ€” ุชุญุฏูŠุฏ ุงู„ู…ูˆุงู‚ุน ุฌุบุฑุงููŠุงู‹ <span class="version-tag">ุงู„ุฅุตุฏุงุฑ 1.35.0</span></p>
848
  </div>
849
  </div>
850
  <div class="header-actions">
README.md CHANGED
@@ -13,7 +13,7 @@ license: mit
13
 
14
  > **Official Arabic Name:** "ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ"
15
  > **Full Acronym Definition:** Modular Assistant Toolkit
16
- > **Project Version:** 1.34.0
17
  > **Official Short URL:** [https://abualzait.github.io/MAT](https://abualzait.github.io/MAT)
18
  > **Hugging Face Live Space:** [https://abualzait-mat.hf.space](https://abualzait-mat.hf.space)
19
  > **Direct Live Deployment:** [https://mat-ee756.containers.snapdeploy.app](https://mat-ee756.containers.snapdeploy.app)
 
13
 
14
  > **Official Arabic Name:** "ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ"
15
  > **Full Acronym Definition:** Modular Assistant Toolkit
16
+ > **Project Version:** 1.35.0
17
  > **Official Short URL:** [https://abualzait.github.io/MAT](https://abualzait.github.io/MAT)
18
  > **Hugging Face Live Space:** [https://abualzait-mat.hf.space](https://abualzait-mat.hf.space)
19
  > **Direct Live Deployment:** [https://mat-ee756.containers.snapdeploy.app](https://mat-ee756.containers.snapdeploy.app)
complaints/app.html CHANGED
@@ -36,7 +36,7 @@
36
  <h1 class="header-main-title">ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ</h1>
37
  <p class="header-jurisdiction">
38
  <span>ู…ุญุงูุธุฉ ุงู„ุนุงุตู…ุฉ</span>
39
- <span class="badge badge-purple" style="font-size:0.62rem; padding:1px 5px; border-radius:4px;">v1.34.0</span>
40
  </p>
41
  </div>
42
  <button class="sidebar-close-btn" onclick="closeSidebarDrawer()" title="ุฅุบู„ุงู‚ ุงู„ู‚ุงุฆู…ุฉ" aria-label="ุฅุบู„ุงู‚ ุงู„ู‚ุงุฆู…ุฉ">
 
36
  <h1 class="header-main-title">ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ</h1>
37
  <p class="header-jurisdiction">
38
  <span>ู…ุญุงูุธุฉ ุงู„ุนุงุตู…ุฉ</span>
39
+ <span class="badge badge-purple" style="font-size:0.62rem; padding:1px 5px; border-radius:4px;">v1.35.0</span>
40
  </p>
41
  </div>
42
  <button class="sidebar-close-btn" onclick="closeSidebarDrawer()" title="ุฅุบู„ุงู‚ ุงู„ู‚ุงุฆู…ุฉ" aria-label="ุฅุบู„ุงู‚ ุงู„ู‚ุงุฆู…ุฉ">
complaints/js/app.js CHANGED
@@ -59,10 +59,15 @@ document.addEventListener('DOMContentLoaded', async () => {
59
  // Default tab: Dashboard for all users
60
  switchTab('dashboard');
61
 
62
- // Start notifications & online users polling
63
  startNotificationsPolling();
64
  loadOnlineUsers();
65
  setInterval(loadOnlineUsers, 10000);
 
 
 
 
 
66
 
67
  // Setup Sidebar Hover Expansion for Collapsed State
68
  const sidebarEl = document.getElementById('mainSidebar');
 
59
  // Default tab: Dashboard for all users
60
  switchTab('dashboard');
61
 
62
+ // Start notifications & online users polling & keep-alive ping
63
  startNotificationsPolling();
64
  loadOnlineUsers();
65
  setInterval(loadOnlineUsers, 10000);
66
+ setInterval(() => {
67
+ if (BACKEND_HOST) {
68
+ fetch('/api/v1/mat/active-users').catch(() => {});
69
+ }
70
+ }, 45000);
71
 
72
  // Setup Sidebar Hover Expansion for Collapsed State
73
  const sidebarEl = document.getElementById('mainSidebar');
complaints/login.html CHANGED
@@ -224,7 +224,7 @@
224
 
225
  <div style="margin-top: 2rem; font-size: 0.8rem; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border-color); padding-top: 1rem;">
226
  <p style="font-weight: 700; color: var(--accent-primary);">ุงู„ู…ู…ู„ูƒุฉ ุงู„ุฃุฑุฏู†ูŠุฉ ุงู„ู‡ุงุดู…ูŠุฉ โ€” ูˆุฒุงุฑุฉ ุงู„ุฏุงุฎู„ูŠุฉ</p>
227
- <p style="margin-top: 0.25rem;">MAT (Modular Assistant Toolkit) โ€” ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ โ€” ุงู„ุฅุตุฏุงุฑ 1.34.0</p>
228
  </div>
229
  </div>
230
  </div>
@@ -292,7 +292,19 @@
292
  }
293
  }
294
 
295
- document.addEventListener('DOMContentLoaded', loadActiveUsers);
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
  function selectUser(username, btnEl) {
298
  document.querySelectorAll('.avatar-btn').forEach(b => b.classList.remove('selected'));
@@ -303,7 +315,7 @@
303
  handleLogin(new Event('submit'));
304
  }
305
 
306
- async function handleLogin(e) {
307
  if (e) e.preventDefault();
308
  const errorDiv = document.getElementById('loginError');
309
  const username = document.getElementById('selectedUsername').value;
@@ -353,12 +365,17 @@
353
  }
354
  return;
355
  }
 
 
 
 
 
356
  }
357
  } catch (err) {
358
  console.warn('Backend API connection offline/unavailable, activating local session fallback:', err);
359
  }
360
 
361
- // Fallback for standalone/offline or when backend is down
362
  if (!loggedInUser && (defaultUsersMap[username] || username)) {
363
  loggedInUser = defaultUsersMap[username] || { username, name: username, role: 'officer' };
364
  if (secret_code === '123' || secret_code === '12345' || secret_code === 'admin' || secret_code === 'mat') {
 
224
 
225
  <div style="margin-top: 2rem; font-size: 0.8rem; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border-color); padding-top: 1rem;">
226
  <p style="font-weight: 700; color: var(--accent-primary);">ุงู„ู…ู…ู„ูƒุฉ ุงู„ุฃุฑุฏู†ูŠุฉ ุงู„ู‡ุงุดู…ูŠุฉ โ€” ูˆุฒุงุฑุฉ ุงู„ุฏุงุฎู„ูŠุฉ</p>
227
+ <p style="margin-top: 0.25rem;">MAT (Modular Assistant Toolkit) โ€” ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ โ€” ุงู„ุฅุตุฏุงุฑ 1.35.0</p>
228
  </div>
229
  </div>
230
  </div>
 
292
  }
293
  }
294
 
295
+ async function wakeUpBackend() {
296
+ if (!BACKEND_HOST) return;
297
+ try {
298
+ await fetch('/api/v1/mat/active-users', { cache: 'no-cache' });
299
+ } catch (e) {
300
+ console.warn('Background wake-up ping sent to SnapDeploy container.');
301
+ }
302
+ }
303
+
304
+ document.addEventListener('DOMContentLoaded', () => {
305
+ loadActiveUsers();
306
+ wakeUpBackend();
307
+ });
308
 
309
  function selectUser(username, btnEl) {
310
  document.querySelectorAll('.avatar-btn').forEach(b => b.classList.remove('selected'));
 
315
  handleLogin(new Event('submit'));
316
  }
317
 
318
+ async function handleLogin(e, retryCount = 0) {
319
  if (e) e.preventDefault();
320
  const errorDiv = document.getElementById('loginError');
321
  const username = document.getElementById('selectedUsername').value;
 
365
  }
366
  return;
367
  }
368
+ } else if ((res.status === 503 || res.status === 502 || res.status === 504) && retryCount < 2) {
369
+ errorDiv.innerHTML = 'โณ ุงู„ุฎุงุฏู… ุงู„ุณุญุงุจูŠ ููŠ ู…ุฑุญู„ุฉ ุงู„ุฅุญู…ุงุก (SnapDeploy)... ูŠุฑุฌู‰ ุงู„ุงู†ุชุธุงุฑ ุซูˆุงู†ู';
370
+ errorDiv.classList.add('show');
371
+ await new Promise(r => setTimeout(r, 2500));
372
+ return handleLogin(null, retryCount + 1);
373
  }
374
  } catch (err) {
375
  console.warn('Backend API connection offline/unavailable, activating local session fallback:', err);
376
  }
377
 
378
+ // Fallback for standalone/offline or when backend is down/sleeping
379
  if (!loggedInUser && (defaultUsersMap[username] || username)) {
380
  loggedInUser = defaultUsersMap[username] || { username, name: username, role: 'officer' };
381
  if (secret_code === '123' || secret_code === '12345' || secret_code === 'admin' || secret_code === 'mat') {
index.html CHANGED
@@ -95,7 +95,7 @@
95
  <div class="card">
96
  <img src="./amman_logo.png" alt="ุดุนุงุฑ ุงู„ู…ุญุงูุธุฉ" class="logo-img">
97
  <h1>ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ (MAT)</h1>
98
- <p class="subtitle">ุงู„ู…ู…ู„ูƒุฉ ุงู„ุฃุฑุฏู†ูŠุฉ ุงู„ู‡ุงุดู…ูŠุฉ โ€” ูˆุฒุงุฑุฉ ุงู„ุฏุงุฎู„ูŠุฉ โ€” ู…ุญุงูุธุฉ ุงู„ุนุงุตู…ุฉ (ุงู„ุฅุตุฏุงุฑ 1.34.0)</p>
99
 
100
  <div class="btn-group">
101
  <a href="./complaints/login.html" class="btn-portal btn-primary">
 
95
  <div class="card">
96
  <img src="./amman_logo.png" alt="ุดุนุงุฑ ุงู„ู…ุญุงูุธุฉ" class="logo-img">
97
  <h1>ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ (MAT)</h1>
98
+ <p class="subtitle">ุงู„ู…ู…ู„ูƒุฉ ุงู„ุฃุฑุฏู†ูŠุฉ ุงู„ู‡ุงุดู…ูŠุฉ โ€” ูˆุฒุงุฑุฉ ุงู„ุฏุงุฎู„ูŠุฉ โ€” ู…ุญุงูุธุฉ ุงู„ุนุงุตู…ุฉ (ุงู„ุฅุตุฏุงุฑ 1.35.0)</p>
99
 
100
  <div class="btn-group">
101
  <a href="./complaints/login.html" class="btn-portal btn-primary">
server.py CHANGED
@@ -2,7 +2,7 @@
2
  # -*- coding: utf-8 -*-
3
  """
4
  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
5
- โ•‘ MAT (Modular Assistant Toolkit) โ€” ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ (1.34.0) โ•‘
6
  โ•‘ โ•‘
7
  โ•‘ ูŠุนู…ู„ ุจุฏูˆู† ุฅู†ุชุฑู†ุช ุนู„ู‰ ุงู„ุดุจูƒุฉ ุงู„ู…ุญู„ูŠุฉ โ•‘
8
  โ•‘ ู„ุง ูŠุญุชุงุฌ ุชุซุจูŠุช ุฃูŠ ู…ูƒุชุจุงุช ุฅุถุงููŠุฉ โ•‘
 
2
  # -*- coding: utf-8 -*-
3
  """
4
  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
5
+ โ•‘ MAT (Modular Assistant Toolkit) โ€” ุญู‚ูŠุจุฉ ุงู„ุฃุฏูˆุงุช ุงู„ู…ุณุงุนุฏุฉ (1.35.0) โ•‘
6
  โ•‘ โ•‘
7
  โ•‘ ูŠุนู…ู„ ุจุฏูˆู† ุฅู†ุชุฑู†ุช ุนู„ู‰ ุงู„ุดุจูƒุฉ ุงู„ู…ุญู„ูŠุฉ โ•‘
8
  โ•‘ ู„ุง ูŠุญุชุงุฌ ุชุซุจูŠุช ุฃูŠ ู…ูƒุชุจุงุช ุฅุถุงููŠุฉ โ•‘