diff --git a/templates/admin.templ b/templates/admin.templ index 815627b..6687ade 100644 --- a/templates/admin.templ +++ b/templates/admin.templ @@ -37,13 +37,16 @@ templ Admin(user User) {
-
⚙️
+
👁️
-

Settings

-

Configure your preferences

+

Scan Watch Status

+

Auto-detecting new files

- Manage Settings +
+ + Watching 0 libraries +
@@ -53,8 +56,8 @@ templ Admin(user User) {

Quick Actions

Manage Folders
@@ -117,18 +120,6 @@ templ Admin(user User) {
- - } \ No newline at end of file diff --git a/web/src/admin.ts b/web/src/admin.ts index 117351d..0300fec 100644 --- a/web/src/admin.ts +++ b/web/src/admin.ts @@ -128,7 +128,11 @@ async function scanAllLibraries(): Promise { for (const lib of libraries) { const scanResp = await fetch(`/api/libraries/${lib.id}/scan`, { method: 'POST', - headers: { 'Authorization': `Bearer ${token}` } + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ force: true }) }); if (scanResp.ok) { @@ -289,8 +293,33 @@ function hideScanProgress(): void { if (container) container.classList.add('hidden'); } +async function loadWatchStatus(): Promise { + const token = localStorage.getItem('token'); + if (!token) return; + + try { + const response = await fetch('/api/scanner/watch/status', { + headers: { 'Authorization': `Bearer ${token}` } + }); + if (response.ok) { + const data = await response.json(); + const countEl = document.getElementById('watch-count'); + if (countEl) { + countEl.textContent = data.total_watching?.toString() || '0'; + } + } + } catch (error) { + console.error('Failed to load watch status:', error); + } +} + +document.addEventListener('DOMContentLoaded', function() { + loadWatchStatus(); +}); + (window as any).triggerLibraryScan = triggerLibraryScan; (window as any).triggerQuickScan = triggerQuickScan; (window as any).loadSystemStats = loadSystemStats; (window as any).scanAllLibraries = scanAllLibraries; +(window as any).loadWatchStatus = loadWatchStatus; (window as any).hideScanProgress = hideScanProgress;