Expose maintenance and restart controls in UI
The Debug dashboard now shows server-maintenance telemetry, including auth/share row counts and restart scheduler status. The Admin server section now includes a persistent scheduled-restart form with cadence/time options, and controls are disabled when the app is not running under systemd.
@@ -9,9 +9,16 @@
9
9
- start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
10
10
- shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
11
11
- start()/shutdown() - Also starts/stops background auth-session and share-token maintenance loops so stale DB rows and zip cache files are trimmed during long uptime.
12
- start()/shutdown() - Also starts/stops the scheduled-restart coordinator, which can trigger a graceful process shutdown (for systemd restart) after scheduled windows and idle-client checks pass.
12
13
- Express error handler - Logs uncaught route errors to logs.txt before returning a JSON 500 response.
13
14
- GET /share/:token - Calls buildShareOpenGraphPage to serve share.html with injected OG meta tags for all visitors; social media crawlers see rich preview data, browsers get the full interactive page.
14
15
16
## server/restart-scheduler.js
17
- startRestartScheduler({ shutdownForRestart }) - Starts a minute-based scheduler that reads persistent restart cadence/time config and triggers shutdown-for-restart only when running under systemd.
18
- Scheduled restart idle guard - After a scheduled window is reached, restart is delayed until there have been no logged-in clients (non-revoked auth sessions) for at least one hour.
19
- getRestartSchedulerSnapshot() - Returns runtime scheduler state (next due timestamp, pending state, last decision/error) for the debug dashboard.
20
- stopRestartScheduler() - Stops the scheduler interval on process shutdown.
21
15
22
## server/logger.js
16
23
- logError(message, error, details) - Appends error lines to logs.txt, trimming old lines so the file stays under 1 MB; use for route failures and process-level exceptions.
17
24
@@ -57,6 +64,7 @@
57
64
- purgeStaleSessions({ nowMs }) - Physically deletes stale `auth_sessions` rows: revoked sessions older than 24 hours and idle sessions older than idle-timeout + 24 hours.
58
65
- startAuthSessionCleanupLoop() - Starts a 15-minute background purge loop for stale `auth_sessions` rows and runs one purge immediately on startup.
59
66
- stopAuthSessionCleanupLoop() - Stops the background auth-session purge loop during server shutdown.
67
- getAuthSessionCleanupSnapshot() - Returns auth-session cleanup loop runtime diagnostics (last run time, purged row count, duration, last error).
60
68
- getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
61
69
- getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
62
70
- SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
@@ -77,9 +85,12 @@
77
85
- GET /api/admin/orphan-userfolders - Returns non-empty user folders under userPath that no longer match any account, and auto-deletes empty orphan folders.
78
86
- DELETE /api/admin/users/:id - Also removes the deleted user's personal folder when it exists and is empty.
79
87
- normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
88
- normaliseScheduledRestartConfig(value, fallback) - Validates/normalises persistent scheduled restart settings ({enabled, cadence, time}) for admin config reads/writes.
80
89
- ensureUserFolders(userPath) - Ensures configured userPath exists and creates per-user subfolders for all current users.
81
90
- GET /api/admin/config - Returns admin config including userPath and userFolderSizeLimit (bytes, null for unlimited).
91
- GET /api/admin/config - Also returns persistent scheduled restart settings ({enabled, cadence, time}).
82
92
- PUT /api/admin/config - Persists paths plus userPath/userFolderSizeLimit and ensures per-user folders exist.
93
- PUT /api/admin/config - Validates and saves scheduled restart settings globally (`scheduledRestart`); rejects schedule updates when the process is not running under systemd.
83
94
- GET /api/admin/update-status - Returns { underSystemd, commitsAhead[] } where commitsAhead contains non-merge commits as {hash, subject, body}; detects systemd via INVOCATION_ID env var and runs git fetch + git log against origin/HEAD for Restart & Update messaging.
84
95
- GET /api/admin/debug/stream-stats - Admin diagnostics payload with active signed-in users, per-root storage usage, active stream HLS footprint, subtitle cache totals, and per-video rows that also include cached-only videos with zero active viewers.
85
96
@@ -87,6 +98,7 @@
87
98
- GET /api/admin/debug/stream-stats - Computes debug dashboard data by combining auth_sessions activity, root disk usage scans, stream snapshot data, and subtitle cache snapshot data into a per-video view for leak/performance monitoring.
88
99
- GET /api/admin/debug/stream-stats - Also reports host/process memory ({total, free, used, usedPercent, processRssBytes, processHeapUsedBytes}) so streaming lag can be correlated with RAM pressure.
89
100
- GET /api/admin/debug/stream-stats - Also reports the subtitle debug cache directory metadata so admins can open the local subtitle log folder from the debug dashboard.
101
- GET /api/admin/debug/stream-stats - Also reports server maintenance diagnostics: auth/share row counts, auth/share cleanup loop snapshots, and scheduled-restart runtime state.
90
102
91
103
## server/routes/files.js
92
104
- GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
@@ -156,6 +168,7 @@
156
168
- purgeExpiredShareTokens({ nowMs }) - Deletes expired `share_tokens` rows so old public links do not accumulate in SQLite.
157
169
- startShareMaintenanceLoop() / stopShareMaintenanceLoop() - Runs periodic share maintenance every 30 minutes: purge expired share tokens and prune stale zip-cache files; started/stopped from server lifecycle.
158
170
- runShareMaintenanceOnce() - Single-run helper used at startup and by the periodic share maintenance interval.
171
- getShareMaintenanceSnapshot() - Returns share-maintenance loop diagnostics (last run time, deleted token/zip counts, duration, last error).
159
172
- ZIP_CACHE_DIR - Absolute path to the zip-cache/ directory (project root).
160
173
161
174
## server/video-stream.js
@@ -215,7 +228,9 @@
215
228
- Debug dashboard modal - Also exposes the subtitle debug cache folder with an open-folder action for admins.
216
229
- Debug dashboard modal - Each diagnostics sub-panel includes a copy action for quick report sharing: users/storage copy JSON, stream/cache and orphaned output tables copy CSV.
217
230
- Debug dashboard modal - Storage cards include RAM usage and process RSS; stream/cache table includes retention and prune progress columns for troubleshooting segment buildup.
231
- Debug dashboard modal - Includes a server-maintenance section with auth/share row counts, maintenance loop last-run telemetry, and scheduled-restart state.
218
232
- Admin modal - Includes User Folders controls (user path + per-user size limit) and a dedicated save action for that config.
233
- Admin modal - Server section includes persistent scheduled-restart controls (enable toggle, cadence, time); controls are disabled when not running under systemd.
219
234
- Import map - Maps `three` and `three/addons/` to local vendored modules for client-side STL/OBJ previews.
220
235
221
236
## public/app.js
@@ -230,6 +245,7 @@
230
245
- Browser popstate navigation - Maintains an in-app folder navigation array mirrored to History API state; browser back/forward steps through folder history.
231
246
- onBrowserPopState(event) - When history reaches browse index 0, shows: "Do you want to close the application and return to the previous webpage?" and on Yes runs normal browser back navigation.
232
247
- renderDebugDashboardData(data) - Renders the debug dashboard panels, including the subtitle debug cache folder summary and open-folder action.
248
- renderDebugDashboardData(data) - Also renders server-maintenance diagnostics (auth/share row totals, maintenance loop last-run telemetry, scheduled restart status/timing).
233
249
- performLogout() - Explicit logout path that revokes server session and clears local session state.
234
250
- initAuth() - Restores prior session when valid and auto-logins without credential prompt.
235
251
- showConfirm(title, message, { html, okLabel, modalClass }) - In-page confirm dialog; returns Promise<boolean>. `html=true` renders message as innerHTML (caller must escape user data), `okLabel` overrides the OK button text, and `modalClass` temporarily widens/restyles the dialog for rich content.
@@ -265,6 +281,8 @@
265
281
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
266
282
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
267
283
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
284
- syncScheduledRestartControls(underSystemd) - Enables/disables admin scheduled-restart controls based on systemd availability and the local enable-toggle state.
285
- refreshAdminConfig() / refreshAdminUpdateStatus() - Populate scheduled-restart form values from persisted config and enforce systemd-only control availability.
268
286
- openAdminModal() / refreshAdminConfig() / refreshAdminUsers() / refreshAdminOrphanUserFolders() - Admin modal refresh chain now captures stable DOM references and exits safely when the document is torn down, preventing async teardown races from throwing post-close errors in tests or quick navigation flows.
269
287
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
270
288
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
@@ -9,9 +9,16 @@9
- start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
9
- start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
10
- shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
10
- shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
11
- start()/shutdown() - Also starts/stops background auth-session and share-token maintenance loops so stale DB rows and zip cache files are trimmed during long uptime.
11
- start()/shutdown() - Also starts/stops background auth-session and share-token maintenance loops so stale DB rows and zip cache files are trimmed during long uptime.
12
- start()/shutdown() - Also starts/stops the scheduled-restart coordinator, which can trigger a graceful process shutdown (for systemd restart) after scheduled windows and idle-client checks pass.
12
- Express error handler - Logs uncaught route errors to logs.txt before returning a JSON 500 response.
13
- Express error handler - Logs uncaught route errors to logs.txt before returning a JSON 500 response.
13
- GET /share/:token - Calls buildShareOpenGraphPage to serve share.html with injected OG meta tags for all visitors; social media crawlers see rich preview data, browsers get the full interactive page.
14
- GET /share/:token - Calls buildShareOpenGraphPage to serve share.html with injected OG meta tags for all visitors; social media crawlers see rich preview data, browsers get the full interactive page.
14
15
16
## server/restart-scheduler.js
17
- startRestartScheduler({ shutdownForRestart }) - Starts a minute-based scheduler that reads persistent restart cadence/time config and triggers shutdown-for-restart only when running under systemd.
18
- Scheduled restart idle guard - After a scheduled window is reached, restart is delayed until there have been no logged-in clients (non-revoked auth sessions) for at least one hour.
19
- getRestartSchedulerSnapshot() - Returns runtime scheduler state (next due timestamp, pending state, last decision/error) for the debug dashboard.
20
- stopRestartScheduler() - Stops the scheduler interval on process shutdown.
21
15
## server/logger.js
22
## server/logger.js
16
- logError(message, error, details) - Appends error lines to logs.txt, trimming old lines so the file stays under 1 MB; use for route failures and process-level exceptions.
23
- logError(message, error, details) - Appends error lines to logs.txt, trimming old lines so the file stays under 1 MB; use for route failures and process-level exceptions.
17
24
@@ -57,6 +64,7 @@57
- purgeStaleSessions({ nowMs }) - Physically deletes stale `auth_sessions` rows: revoked sessions older than 24 hours and idle sessions older than idle-timeout + 24 hours.
64
- purgeStaleSessions({ nowMs }) - Physically deletes stale `auth_sessions` rows: revoked sessions older than 24 hours and idle sessions older than idle-timeout + 24 hours.
58
- startAuthSessionCleanupLoop() - Starts a 15-minute background purge loop for stale `auth_sessions` rows and runs one purge immediately on startup.
65
- startAuthSessionCleanupLoop() - Starts a 15-minute background purge loop for stale `auth_sessions` rows and runs one purge immediately on startup.
59
- stopAuthSessionCleanupLoop() - Stops the background auth-session purge loop during server shutdown.
66
- stopAuthSessionCleanupLoop() - Stops the background auth-session purge loop during server shutdown.
67
- getAuthSessionCleanupSnapshot() - Returns auth-session cleanup loop runtime diagnostics (last run time, purged row count, duration, last error).
60
- getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
68
- getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
61
- getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
69
- getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
62
- SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
70
- SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
@@ -77,9 +85,12 @@77
- GET /api/admin/orphan-userfolders - Returns non-empty user folders under userPath that no longer match any account, and auto-deletes empty orphan folders.
85
- GET /api/admin/orphan-userfolders - Returns non-empty user folders under userPath that no longer match any account, and auto-deletes empty orphan folders.
78
- DELETE /api/admin/users/:id - Also removes the deleted user's personal folder when it exists and is empty.
86
- DELETE /api/admin/users/:id - Also removes the deleted user's personal folder when it exists and is empty.
79
- normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
87
- normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
88
- normaliseScheduledRestartConfig(value, fallback) - Validates/normalises persistent scheduled restart settings ({enabled, cadence, time}) for admin config reads/writes.
80
- ensureUserFolders(userPath) - Ensures configured userPath exists and creates per-user subfolders for all current users.
89
- ensureUserFolders(userPath) - Ensures configured userPath exists and creates per-user subfolders for all current users.
81
- GET /api/admin/config - Returns admin config including userPath and userFolderSizeLimit (bytes, null for unlimited).
90
- GET /api/admin/config - Returns admin config including userPath and userFolderSizeLimit (bytes, null for unlimited).
91
- GET /api/admin/config - Also returns persistent scheduled restart settings ({enabled, cadence, time}).
82
- PUT /api/admin/config - Persists paths plus userPath/userFolderSizeLimit and ensures per-user folders exist.
92
- PUT /api/admin/config - Persists paths plus userPath/userFolderSizeLimit and ensures per-user folders exist.
93
- PUT /api/admin/config - Validates and saves scheduled restart settings globally (`scheduledRestart`); rejects schedule updates when the process is not running under systemd.
83
- GET /api/admin/update-status - Returns { underSystemd, commitsAhead[] } where commitsAhead contains non-merge commits as {hash, subject, body}; detects systemd via INVOCATION_ID env var and runs git fetch + git log against origin/HEAD for Restart & Update messaging.
94
- GET /api/admin/update-status - Returns { underSystemd, commitsAhead[] } where commitsAhead contains non-merge commits as {hash, subject, body}; detects systemd via INVOCATION_ID env var and runs git fetch + git log against origin/HEAD for Restart & Update messaging.
84
- GET /api/admin/debug/stream-stats - Admin diagnostics payload with active signed-in users, per-root storage usage, active stream HLS footprint, subtitle cache totals, and per-video rows that also include cached-only videos with zero active viewers.
95
- GET /api/admin/debug/stream-stats - Admin diagnostics payload with active signed-in users, per-root storage usage, active stream HLS footprint, subtitle cache totals, and per-video rows that also include cached-only videos with zero active viewers.
85
96
@@ -87,6 +98,7 @@87
- GET /api/admin/debug/stream-stats - Computes debug dashboard data by combining auth_sessions activity, root disk usage scans, stream snapshot data, and subtitle cache snapshot data into a per-video view for leak/performance monitoring.
98
- GET /api/admin/debug/stream-stats - Computes debug dashboard data by combining auth_sessions activity, root disk usage scans, stream snapshot data, and subtitle cache snapshot data into a per-video view for leak/performance monitoring.
88
- GET /api/admin/debug/stream-stats - Also reports host/process memory ({total, free, used, usedPercent, processRssBytes, processHeapUsedBytes}) so streaming lag can be correlated with RAM pressure.
99
- GET /api/admin/debug/stream-stats - Also reports host/process memory ({total, free, used, usedPercent, processRssBytes, processHeapUsedBytes}) so streaming lag can be correlated with RAM pressure.
89
- GET /api/admin/debug/stream-stats - Also reports the subtitle debug cache directory metadata so admins can open the local subtitle log folder from the debug dashboard.
100
- GET /api/admin/debug/stream-stats - Also reports the subtitle debug cache directory metadata so admins can open the local subtitle log folder from the debug dashboard.
101
- GET /api/admin/debug/stream-stats - Also reports server maintenance diagnostics: auth/share row counts, auth/share cleanup loop snapshots, and scheduled-restart runtime state.
90
102
91
## server/routes/files.js
103
## server/routes/files.js
92
- GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
104
- GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
@@ -156,6 +168,7 @@156
- purgeExpiredShareTokens({ nowMs }) - Deletes expired `share_tokens` rows so old public links do not accumulate in SQLite.
168
- purgeExpiredShareTokens({ nowMs }) - Deletes expired `share_tokens` rows so old public links do not accumulate in SQLite.
157
- startShareMaintenanceLoop() / stopShareMaintenanceLoop() - Runs periodic share maintenance every 30 minutes: purge expired share tokens and prune stale zip-cache files; started/stopped from server lifecycle.
169
- startShareMaintenanceLoop() / stopShareMaintenanceLoop() - Runs periodic share maintenance every 30 minutes: purge expired share tokens and prune stale zip-cache files; started/stopped from server lifecycle.
158
- runShareMaintenanceOnce() - Single-run helper used at startup and by the periodic share maintenance interval.
170
- runShareMaintenanceOnce() - Single-run helper used at startup and by the periodic share maintenance interval.
171
- getShareMaintenanceSnapshot() - Returns share-maintenance loop diagnostics (last run time, deleted token/zip counts, duration, last error).
159
- ZIP_CACHE_DIR - Absolute path to the zip-cache/ directory (project root).
172
- ZIP_CACHE_DIR - Absolute path to the zip-cache/ directory (project root).
160
173
161
## server/video-stream.js
174
## server/video-stream.js
@@ -215,7 +228,9 @@215
- Debug dashboard modal - Also exposes the subtitle debug cache folder with an open-folder action for admins.
228
- Debug dashboard modal - Also exposes the subtitle debug cache folder with an open-folder action for admins.
216
- Debug dashboard modal - Each diagnostics sub-panel includes a copy action for quick report sharing: users/storage copy JSON, stream/cache and orphaned output tables copy CSV.
229
- Debug dashboard modal - Each diagnostics sub-panel includes a copy action for quick report sharing: users/storage copy JSON, stream/cache and orphaned output tables copy CSV.
217
- Debug dashboard modal - Storage cards include RAM usage and process RSS; stream/cache table includes retention and prune progress columns for troubleshooting segment buildup.
230
- Debug dashboard modal - Storage cards include RAM usage and process RSS; stream/cache table includes retention and prune progress columns for troubleshooting segment buildup.
231
- Debug dashboard modal - Includes a server-maintenance section with auth/share row counts, maintenance loop last-run telemetry, and scheduled-restart state.
218
- Admin modal - Includes User Folders controls (user path + per-user size limit) and a dedicated save action for that config.
232
- Admin modal - Includes User Folders controls (user path + per-user size limit) and a dedicated save action for that config.
233
- Admin modal - Server section includes persistent scheduled-restart controls (enable toggle, cadence, time); controls are disabled when not running under systemd.
219
- Import map - Maps `three` and `three/addons/` to local vendored modules for client-side STL/OBJ previews.
234
- Import map - Maps `three` and `three/addons/` to local vendored modules for client-side STL/OBJ previews.
220
235
221
## public/app.js
236
## public/app.js
@@ -230,6 +245,7 @@230
- Browser popstate navigation - Maintains an in-app folder navigation array mirrored to History API state; browser back/forward steps through folder history.
245
- Browser popstate navigation - Maintains an in-app folder navigation array mirrored to History API state; browser back/forward steps through folder history.
231
- onBrowserPopState(event) - When history reaches browse index 0, shows: "Do you want to close the application and return to the previous webpage?" and on Yes runs normal browser back navigation.
246
- onBrowserPopState(event) - When history reaches browse index 0, shows: "Do you want to close the application and return to the previous webpage?" and on Yes runs normal browser back navigation.
232
- renderDebugDashboardData(data) - Renders the debug dashboard panels, including the subtitle debug cache folder summary and open-folder action.
247
- renderDebugDashboardData(data) - Renders the debug dashboard panels, including the subtitle debug cache folder summary and open-folder action.
248
- renderDebugDashboardData(data) - Also renders server-maintenance diagnostics (auth/share row totals, maintenance loop last-run telemetry, scheduled restart status/timing).
233
- performLogout() - Explicit logout path that revokes server session and clears local session state.
249
- performLogout() - Explicit logout path that revokes server session and clears local session state.
234
- initAuth() - Restores prior session when valid and auto-logins without credential prompt.
250
- initAuth() - Restores prior session when valid and auto-logins without credential prompt.
235
- showConfirm(title, message, { html, okLabel, modalClass }) - In-page confirm dialog; returns Promise<boolean>. `html=true` renders message as innerHTML (caller must escape user data), `okLabel` overrides the OK button text, and `modalClass` temporarily widens/restyles the dialog for rich content.
251
- showConfirm(title, message, { html, okLabel, modalClass }) - In-page confirm dialog; returns Promise<boolean>. `html=true` renders message as innerHTML (caller must escape user data), `okLabel` overrides the OK button text, and `modalClass` temporarily widens/restyles the dialog for rich content.
@@ -265,6 +281,8 @@265
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
281
- openGlobalFaviconPicker() - Opens a debounced, server-backed image-search modal across all accessible roots and sets/clears global favicon via `/files/global-favicon`.
266
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
282
- refreshGlobalFavicon() - Reads `/files/global-favicon`, updates admin-panel favicon preview button, and applies/removes the page `<link rel="icon">` URL.
267
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
283
- refreshAdminOrphanUserFolders() - Fetches `/admin/orphan-userfolders`, conditionally renders orphaned folder rows, and wires "Open folder" navigation for admins.
284
- syncScheduledRestartControls(underSystemd) - Enables/disables admin scheduled-restart controls based on systemd availability and the local enable-toggle state.
285
- refreshAdminConfig() / refreshAdminUpdateStatus() - Populate scheduled-restart form values from persisted config and enforce systemd-only control availability.
268
- openAdminModal() / refreshAdminConfig() / refreshAdminUsers() / refreshAdminOrphanUserFolders() - Admin modal refresh chain now captures stable DOM references and exits safely when the document is torn down, preventing async teardown races from throwing post-close errors in tests or quick navigation flows.
286
- openAdminModal() / refreshAdminConfig() / refreshAdminUsers() / refreshAdminOrphanUserFolders() - Admin modal refresh chain now captures stable DOM references and exits safely when the document is torn down, preventing async teardown races from throwing post-close errors in tests or quick navigation flows.
269
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
287
- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
270
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
288
- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
@@ -5400,6 +5400,45 @@ async function deleteItem (item)
5400
5400
let _adminUpdateStatus = null;
5401
5401
let _debugRefreshTimer = null;
5402
5402
let _debugLatestData = null;
5403
let _adminConfigCache = null;
5404
5405
function scheduledRestartCadenceLabel (value)
5406
{
5407
const key = String(value || '').trim();
5408
if (key === 'daily') return 'Daily';
5409
if (key === 'every3days') return 'Every 3 days';
5410
if (key === 'weekly') return 'Weekly';
5411
if (key === 'biweekly') return 'Bi-weekly';
5412
if (key === 'monthly') return 'Monthly';
5413
return 'Unknown';
5414
}
5415
5416
function syncScheduledRestartControls (underSystemd)
5417
{
5418
const container = document.getElementById('admin-scheduled-restart');
5419
const enabled = document.getElementById('admin-scheduled-restart-enabled');
5420
const cadence = document.getElementById('admin-scheduled-restart-cadence');
5421
const time = document.getElementById('admin-scheduled-restart-time');
5422
const save = document.getElementById('admin-save-scheduled-restart');
5423
const help = document.getElementById('admin-scheduled-restart-help');
5424
if (!container || !enabled || !cadence || !time || !save || !help) return;
5425
5426
const disabled = !underSystemd;
5427
container.classList.toggle('admin-scheduled-restart--disabled', disabled);
5428
5429
enabled.disabled = disabled;
5430
cadence.disabled = disabled || !enabled.checked;
5431
time.disabled = disabled || !enabled.checked;
5432
save.disabled = disabled;
5433
5434
if (disabled)
5435
{
5436
help.textContent = 'Scheduled restart is available only when the server is started via the systemd service.';
5437
return;
5438
}
5439
5440
help.textContent = 'When the scheduled time is reached, restart waits until there have been no logged-in clients for at least one hour.';
5441
}
5403
5442
5404
5443
function formatTimestamp (ms)
5405
5444
{
@@ -5469,6 +5508,35 @@ function renderDebugDashboardData (data)
5469
5508
].map(([k, v]) => `<div class="debug-summary-item"><span class="k">${escapeHtml(k)}</span><span class="v">${escapeHtml(v)}</span></div>`).join('');
5470
5509
}
5471
5510
5511
const maintenanceSummary = document.getElementById('debug-maintenance-summary');
5512
if (maintenanceSummary)
5513
{
5514
const maintenance = data.maintenance || {};
5515
const rows = maintenance.rows || {};
5516
const authCleanup = maintenance.authCleanup || {};
5517
const shareMaintenance = maintenance.shareMaintenance || {};
5518
const scheduledRestart = maintenance.scheduledRestart || {};
5519
5520
const scheduledLine = !scheduledRestart.underSystemd
5521
? 'Unavailable (not systemd)'
5522
: !scheduledRestart.config || !scheduledRestart.config.enabled
5523
? 'Disabled'
5524
: `${scheduledRestartCadenceLabel(scheduledRestart.config.cadence)} at ${scheduledRestart.config.time || '—'}`;
5525
5526
maintenanceSummary.innerHTML = [
5527
['Auth sessions (total)', String(rows.authSessionsTotal || 0)],
5528
['Auth sessions (active)', String(rows.authSessionsActive || 0)],
5529
['Auth sessions (revoked)', String(rows.authSessionsRevoked || 0)],
5530
['Share tokens (total)', String(rows.shareTokensTotal || 0)],
5531
['Share tokens (expired)', String(rows.shareTokensExpired || 0)],
5532
['Auth cleanup last run', formatTimestamp(authCleanup.lastRunAt)],
5533
['Share cleanup last run', formatTimestamp(shareMaintenance.lastRunAt)],
5534
['Scheduled restart', scheduledLine],
5535
['Next scheduled restart', formatTimestamp(scheduledRestart.nextDueAt)],
5536
['Pending since', formatTimestamp(scheduledRestart.pendingSinceAt)],
5537
].map(([k, v]) => `<div class="debug-summary-item"><span class="k">${escapeHtml(k)}</span><span class="v">${escapeHtml(v)}</span></div>`).join('');
5538
}
5539
5472
5540
renderDebugTable(
5473
5541
'debug-roots',
5474
5542
[
@@ -5586,6 +5654,15 @@ function copyDebugStorageJson ()
5586
5654
void copyDebugText(JSON.stringify(payload, null, 2), 'Copied storage JSON.');
5587
5655
}
5588
5656
5657
function copyDebugMaintenanceJson ()
5658
{
5659
const payload = {
5660
generatedAt: _debugLatestData && _debugLatestData.generatedAt,
5661
maintenance: _debugLatestData && _debugLatestData.maintenance,
5662
};
5663
void copyDebugText(JSON.stringify(payload, null, 2), 'Copied maintenance JSON.');
5664
}
5665
5589
5666
function copyDebugVideoFilesCsv ()
5590
5667
{
5591
5668
const files = Array.isArray(_debugLatestData && _debugLatestData.videoFiles)
@@ -5819,6 +5896,7 @@ async function openAdminModal ()
5819
5896
await refreshAdminConfig();
5820
5897
await refreshAdminUsers();
5821
5898
await refreshAdminUpdateStatus({ pulseIfUpdateAvailable: true });
5899
syncScheduledRestartControls(!!(_adminUpdateStatus && _adminUpdateStatus.underSystemd));
5822
5900
}
5823
5901
5824
5902
async function refreshAdminConfig ()
@@ -5827,6 +5905,7 @@ async function refreshAdminConfig ()
5827
5905
const doc = document;
5828
5906
const data = await api('GET', '/admin/config');
5829
5907
if (!data) return;
5908
_adminConfigCache = data;
5830
5909
if (!doc.defaultView || doc.defaultView.closed) return;
5831
5910
5832
5911
const userPathInput = doc.getElementById('admin-user-path');
@@ -5838,6 +5917,17 @@ async function refreshAdminConfig ()
5838
5917
updateAdminSizeFeedback(sizeInput.value);
5839
5918
}
5840
5919
5920
const srEnabled = doc.getElementById('admin-scheduled-restart-enabled');
5921
const srCadence = doc.getElementById('admin-scheduled-restart-cadence');
5922
const srTime = doc.getElementById('admin-scheduled-restart-time');
5923
const sr = data.scheduledRestart || {};
5924
if (srEnabled) srEnabled.checked = !!sr.enabled;
5925
if (srCadence) srCadence.value = sr.cadence || 'daily';
5926
if (srTime) srTime.value = sr.time || '04:00';
5927
5928
const underSystemd = !!(_adminUpdateStatus && _adminUpdateStatus.underSystemd);
5929
syncScheduledRestartControls(underSystemd);
5930
5841
5931
const container = doc.getElementById('admin-paths');
5842
5932
if (!container) return;
5843
5933
container.innerHTML = '';
@@ -5985,6 +6075,7 @@ async function refreshAdminUpdateStatus (opts = {})
5985
6075
_adminUpdateStatus = null;
5986
6076
btn.textContent = 'Shut down server';
5987
6077
setAdminUpdateBadge(0);
6078
syncScheduledRestartControls(false);
5988
6079
5989
6080
try
5990
6081
{
@@ -6000,20 +6091,24 @@ async function refreshAdminUpdateStatus (opts = {})
6000
6091
if (!data.underSystemd)
6001
6092
{
6002
6093
btn.textContent = 'Shut down server';
6094
syncScheduledRestartControls(false);
6003
6095
}
6004
6096
else if (data.commitsAhead.length === 0)
6005
6097
{
6006
6098
btn.textContent = 'Restart Server';
6099
syncScheduledRestartControls(true);
6007
6100
}
6008
6101
else
6009
6102
{
6010
6103
btn.textContent = 'Restart & Update';
6104
syncScheduledRestartControls(true);
6011
6105
if (pulseIfUpdateAvailable) pulseAdminUpdateButton();
6012
6106
}
6013
6107
}
6014
6108
catch
6015
6109
{
6016
6110
// Not critical; button stays as "Shut down server".
6111
syncScheduledRestartControls(false);
6017
6112
}
6018
6113
}
6019
6114
@@ -6975,6 +7070,8 @@ function wireEvents ()
6975
7070
if (debugCopyUsers) debugCopyUsers.addEventListener('click', copyDebugUsersJson);
6976
7071
const debugCopyStorage = document.getElementById('debug-copy-storage');
6977
7072
if (debugCopyStorage) debugCopyStorage.addEventListener('click', copyDebugStorageJson);
7073
const debugCopyMaintenance = document.getElementById('debug-copy-maintenance');
7074
if (debugCopyMaintenance) debugCopyMaintenance.addEventListener('click', copyDebugMaintenanceJson);
6978
7075
const debugCopyVideoFiles = document.getElementById('debug-copy-video-files');
6979
7076
if (debugCopyVideoFiles) debugCopyVideoFiles.addEventListener('click', copyDebugVideoFilesCsv);
6980
7077
const debugCopyOrphaned = document.getElementById('debug-copy-orphaned');
@@ -7025,6 +7122,59 @@ function wireEvents ()
7025
7122
});
7026
7123
}
7027
7124
7125
const scheduledEnabledInput = document.getElementById('admin-scheduled-restart-enabled');
7126
if (scheduledEnabledInput)
7127
{
7128
scheduledEnabledInput.addEventListener('change', () =>
7129
{
7130
syncScheduledRestartControls(!!(_adminUpdateStatus && _adminUpdateStatus.underSystemd));
7131
});
7132
}
7133
7134
document.getElementById('admin-save-scheduled-restart').addEventListener('click', async () =>
7135
{
7136
if (!(_adminUpdateStatus && _adminUpdateStatus.underSystemd))
7137
{
7138
toast('Scheduled restart is available only under systemd.', 'err');
7139
return;
7140
}
7141
7142
const rows = document.querySelectorAll('#admin-paths .path-row span');
7143
const paths = [...rows].map(s => s.textContent.trim()).filter(Boolean);
7144
7145
const enabled = !!document.getElementById('admin-scheduled-restart-enabled').checked;
7146
const cadence = String(document.getElementById('admin-scheduled-restart-cadence').value || '').trim();
7147
const time = String(document.getElementById('admin-scheduled-restart-time').value || '').trim();
7148
7149
if (!time)
7150
{
7151
toast('Please choose a restart time.', 'err');
7152
return;
7153
}
7154
7155
const existing = _adminConfigCache || {};
7156
7157
try
7158
{
7159
await api('PUT', '/admin/config', {
7160
paths,
7161
userPath: existing.userPath || null,
7162
userFolderSizeLimit: existing.userFolderSizeLimit || null,
7163
scheduledRestart: {
7164
enabled,
7165
cadence,
7166
time,
7167
},
7168
});
7169
toast('Scheduled restart saved.', 'ok');
7170
await refreshAdminConfig();
7171
await refreshAdminUpdateStatus();
7172
} catch (err)
7173
{
7174
toast(err.message || 'Failed to save scheduled restart settings.', 'err');
7175
}
7176
});
7177
7028
7178
document.getElementById('admin-save-userpath').addEventListener('click', async () =>
7029
7179
{
7030
7180
const rows = document.querySelectorAll('#admin-paths .path-row span');
@@ -5400,6 +5400,45 @@ async function deleteItem (item)5400
let _adminUpdateStatus = null;5400
let _adminUpdateStatus = null;5401
let _debugRefreshTimer = null;5401
let _debugRefreshTimer = null;5402
let _debugLatestData = null;5402
let _debugLatestData = null;5403
let _adminConfigCache = null;5404
5405
function scheduledRestartCadenceLabel (value)5406
{5407
const key = String(value || '').trim();5408
if (key === 'daily') return 'Daily';5409
if (key === 'every3days') return 'Every 3 days';5410
if (key === 'weekly') return 'Weekly';5411
if (key === 'biweekly') return 'Bi-weekly';5412
if (key === 'monthly') return 'Monthly';5413
return 'Unknown';5414
}5415
5416
function syncScheduledRestartControls (underSystemd)5417
{5418
const container = document.getElementById('admin-scheduled-restart');5419
const enabled = document.getElementById('admin-scheduled-restart-enabled');5420
const cadence = document.getElementById('admin-scheduled-restart-cadence');5421
const time = document.getElementById('admin-scheduled-restart-time');5422
const save = document.getElementById('admin-save-scheduled-restart');5423
const help = document.getElementById('admin-scheduled-restart-help');5424
if (!container || !enabled || !cadence || !time || !save || !help) return;5425
5426
const disabled = !underSystemd;5427
container.classList.toggle('admin-scheduled-restart--disabled', disabled);5428
5429
enabled.disabled = disabled;5430
cadence.disabled = disabled || !enabled.checked;5431
time.disabled = disabled || !enabled.checked;5432
save.disabled = disabled;5433
5434
if (disabled)5435
{5436
help.textContent = 'Scheduled restart is available only when the server is started via the systemd service.';5437
return;5438
}5439
5440
help.textContent = 'When the scheduled time is reached, restart waits until there have been no logged-in clients for at least one hour.';5441
}5403
5442
5404
function formatTimestamp (ms)5443
function formatTimestamp (ms)5405
{5444
{@@ -5469,6 +5508,35 @@ function renderDebugDashboardData (data)5469
].map(([k, v]) => `<div class="debug-summary-item"><span class="k">${escapeHtml(k)}</span><span class="v">${escapeHtml(v)}</span></div>`).join('');5508
].map(([k, v]) => `<div class="debug-summary-item"><span class="k">${escapeHtml(k)}</span><span class="v">${escapeHtml(v)}</span></div>`).join('');5470
}5509
}5471
5510
5511
const maintenanceSummary = document.getElementById('debug-maintenance-summary');5512
if (maintenanceSummary)5513
{5514
const maintenance = data.maintenance || {};5515
const rows = maintenance.rows || {};5516
const authCleanup = maintenance.authCleanup || {};5517
const shareMaintenance = maintenance.shareMaintenance || {};5518
const scheduledRestart = maintenance.scheduledRestart || {};5519
5520
const scheduledLine = !scheduledRestart.underSystemd5521
? 'Unavailable (not systemd)'5522
: !scheduledRestart.config || !scheduledRestart.config.enabled5523
? 'Disabled'5524
: `${scheduledRestartCadenceLabel(scheduledRestart.config.cadence)} at ${scheduledRestart.config.time || '—'}`;5525
5526
maintenanceSummary.innerHTML = [5527
['Auth sessions (total)', String(rows.authSessionsTotal || 0)],5528
['Auth sessions (active)', String(rows.authSessionsActive || 0)],5529
['Auth sessions (revoked)', String(rows.authSessionsRevoked || 0)],5530
['Share tokens (total)', String(rows.shareTokensTotal || 0)],5531
['Share tokens (expired)', String(rows.shareTokensExpired || 0)],5532
['Auth cleanup last run', formatTimestamp(authCleanup.lastRunAt)],5533
['Share cleanup last run', formatTimestamp(shareMaintenance.lastRunAt)],5534
['Scheduled restart', scheduledLine],5535
['Next scheduled restart', formatTimestamp(scheduledRestart.nextDueAt)],5536
['Pending since', formatTimestamp(scheduledRestart.pendingSinceAt)],5537
].map(([k, v]) => `<div class="debug-summary-item"><span class="k">${escapeHtml(k)}</span><span class="v">${escapeHtml(v)}</span></div>`).join('');5538
}5539
5472
renderDebugTable(5540
renderDebugTable(5473
'debug-roots',5541
'debug-roots',5474
[5542
[@@ -5586,6 +5654,15 @@ function copyDebugStorageJson ()5586
void copyDebugText(JSON.stringify(payload, null, 2), 'Copied storage JSON.');5654
void copyDebugText(JSON.stringify(payload, null, 2), 'Copied storage JSON.');5587
}5655
}5588
5656
5657
function copyDebugMaintenanceJson ()5658
{5659
const payload = {5660
generatedAt: _debugLatestData && _debugLatestData.generatedAt,5661
maintenance: _debugLatestData && _debugLatestData.maintenance,5662
};5663
void copyDebugText(JSON.stringify(payload, null, 2), 'Copied maintenance JSON.');5664
}5665
5589
function copyDebugVideoFilesCsv ()5666
function copyDebugVideoFilesCsv ()5590
{5667
{5591
const files = Array.isArray(_debugLatestData && _debugLatestData.videoFiles)5668
const files = Array.isArray(_debugLatestData && _debugLatestData.videoFiles)@@ -5819,6 +5896,7 @@ async function openAdminModal ()5819
await refreshAdminConfig();5896
await refreshAdminConfig();5820
await refreshAdminUsers();5897
await refreshAdminUsers();5821
await refreshAdminUpdateStatus({ pulseIfUpdateAvailable: true });5898
await refreshAdminUpdateStatus({ pulseIfUpdateAvailable: true });5899
syncScheduledRestartControls(!!(_adminUpdateStatus && _adminUpdateStatus.underSystemd));5822
}5900
}5823
5901
5824
async function refreshAdminConfig ()5902
async function refreshAdminConfig ()@@ -5827,6 +5905,7 @@ async function refreshAdminConfig ()5827
const doc = document;5905
const doc = document;5828
const data = await api('GET', '/admin/config');5906
const data = await api('GET', '/admin/config');5829
if (!data) return;5907
if (!data) return;5908
_adminConfigCache = data;5830
if (!doc.defaultView || doc.defaultView.closed) return;5909
if (!doc.defaultView || doc.defaultView.closed) return;5831
5910
5832
const userPathInput = doc.getElementById('admin-user-path');5911
const userPathInput = doc.getElementById('admin-user-path');@@ -5838,6 +5917,17 @@ async function refreshAdminConfig ()5838
updateAdminSizeFeedback(sizeInput.value);5917
updateAdminSizeFeedback(sizeInput.value);5839
}5918
}5840
5919
5920
const srEnabled = doc.getElementById('admin-scheduled-restart-enabled');5921
const srCadence = doc.getElementById('admin-scheduled-restart-cadence');5922
const srTime = doc.getElementById('admin-scheduled-restart-time');5923
const sr = data.scheduledRestart || {};5924
if (srEnabled) srEnabled.checked = !!sr.enabled;5925
if (srCadence) srCadence.value = sr.cadence || 'daily';5926
if (srTime) srTime.value = sr.time || '04:00';5927
5928
const underSystemd = !!(_adminUpdateStatus && _adminUpdateStatus.underSystemd);5929
syncScheduledRestartControls(underSystemd);5930
5841
const container = doc.getElementById('admin-paths');5931
const container = doc.getElementById('admin-paths');5842
if (!container) return;5932
if (!container) return;5843
container.innerHTML = '';5933
container.innerHTML = '';@@ -5985,6 +6075,7 @@ async function refreshAdminUpdateStatus (opts = {})5985
_adminUpdateStatus = null;6075
_adminUpdateStatus = null;5986
btn.textContent = 'Shut down server';6076
btn.textContent = 'Shut down server';5987
setAdminUpdateBadge(0);6077
setAdminUpdateBadge(0);6078
syncScheduledRestartControls(false);5988
6079
5989
try6080
try5990
{6081
{@@ -6000,20 +6091,24 @@ async function refreshAdminUpdateStatus (opts = {})6000
if (!data.underSystemd)6091
if (!data.underSystemd)6001
{6092
{6002
btn.textContent = 'Shut down server';6093
btn.textContent = 'Shut down server';6094
syncScheduledRestartControls(false);6003
}6095
}6004
else if (data.commitsAhead.length === 0)6096
else if (data.commitsAhead.length === 0)6005
{6097
{6006
btn.textContent = 'Restart Server';6098
btn.textContent = 'Restart Server';6099
syncScheduledRestartControls(true);6007
}6100
}6008
else6101
else6009
{6102
{6010
btn.textContent = 'Restart & Update';6103
btn.textContent = 'Restart & Update';6104
syncScheduledRestartControls(true);6011
if (pulseIfUpdateAvailable) pulseAdminUpdateButton();6105
if (pulseIfUpdateAvailable) pulseAdminUpdateButton();6012
}6106
}6013
}6107
}6014
catch6108
catch6015
{6109
{6016
// Not critical; button stays as "Shut down server".6110
// Not critical; button stays as "Shut down server".6111
syncScheduledRestartControls(false);6017
}6112
}6018
}6113
}6019
6114
@@ -6975,6 +7070,8 @@ function wireEvents ()6975
if (debugCopyUsers) debugCopyUsers.addEventListener('click', copyDebugUsersJson);7070
if (debugCopyUsers) debugCopyUsers.addEventListener('click', copyDebugUsersJson);6976
const debugCopyStorage = document.getElementById('debug-copy-storage');7071
const debugCopyStorage = document.getElementById('debug-copy-storage');6977
if (debugCopyStorage) debugCopyStorage.addEventListener('click', copyDebugStorageJson);7072
if (debugCopyStorage) debugCopyStorage.addEventListener('click', copyDebugStorageJson);7073
const debugCopyMaintenance = document.getElementById('debug-copy-maintenance');7074
if (debugCopyMaintenance) debugCopyMaintenance.addEventListener('click', copyDebugMaintenanceJson);6978
const debugCopyVideoFiles = document.getElementById('debug-copy-video-files');7075
const debugCopyVideoFiles = document.getElementById('debug-copy-video-files');6979
if (debugCopyVideoFiles) debugCopyVideoFiles.addEventListener('click', copyDebugVideoFilesCsv);7076
if (debugCopyVideoFiles) debugCopyVideoFiles.addEventListener('click', copyDebugVideoFilesCsv);6980
const debugCopyOrphaned = document.getElementById('debug-copy-orphaned');7077
const debugCopyOrphaned = document.getElementById('debug-copy-orphaned');@@ -7025,6 +7122,59 @@ function wireEvents ()7025
});7122
});7026
}7123
}7027
7124
7125
const scheduledEnabledInput = document.getElementById('admin-scheduled-restart-enabled');7126
if (scheduledEnabledInput)7127
{7128
scheduledEnabledInput.addEventListener('change', () =>7129
{7130
syncScheduledRestartControls(!!(_adminUpdateStatus && _adminUpdateStatus.underSystemd));7131
});7132
}7133
7134
document.getElementById('admin-save-scheduled-restart').addEventListener('click', async () =>7135
{7136
if (!(_adminUpdateStatus && _adminUpdateStatus.underSystemd))7137
{7138
toast('Scheduled restart is available only under systemd.', 'err');7139
return;7140
}7141
7142
const rows = document.querySelectorAll('#admin-paths .path-row span');7143
const paths = [...rows].map(s => s.textContent.trim()).filter(Boolean);7144
7145
const enabled = !!document.getElementById('admin-scheduled-restart-enabled').checked;7146
const cadence = String(document.getElementById('admin-scheduled-restart-cadence').value || '').trim();7147
const time = String(document.getElementById('admin-scheduled-restart-time').value || '').trim();7148
7149
if (!time)7150
{7151
toast('Please choose a restart time.', 'err');7152
return;7153
}7154
7155
const existing = _adminConfigCache || {};7156
7157
try7158
{7159
await api('PUT', '/admin/config', {7160
paths,7161
userPath: existing.userPath || null,7162
userFolderSizeLimit: existing.userFolderSizeLimit || null,7163
scheduledRestart: {7164
enabled,7165
cadence,7166
time,7167
},7168
});7169
toast('Scheduled restart saved.', 'ok');7170
await refreshAdminConfig();7171
await refreshAdminUpdateStatus();7172
} catch (err)7173
{7174
toast(err.message || 'Failed to save scheduled restart settings.', 'err');7175
}7176
});7177
7028
document.getElementById('admin-save-userpath').addEventListener('click', async () =>7178
document.getElementById('admin-save-userpath').addEventListener('click', async () =>7029
{7179
{7030
const rows = document.querySelectorAll('#admin-paths .path-row span');7180
const rows = document.querySelectorAll('#admin-paths .path-row span');@@ -225,6 +225,28 @@
225
225
</span>
226
226
</button>
227
227
</div>
228
<div id="admin-scheduled-restart" class="admin-scheduled-restart">
229
<label class="checkbox-label admin-scheduled-restart-toggle">
230
<input id="admin-scheduled-restart-enabled" type="checkbox" />
231
Enable scheduled restart
232
</label>
233
<div class="admin-scheduled-restart-grid">
234
<label>Cadence
235
<select id="admin-scheduled-restart-cadence">
236
<option value="daily">Daily</option>
237
<option value="every3days">Every 3 days</option>
238
<option value="weekly">Weekly</option>
239
<option value="biweekly">Bi-weekly</option>
240
<option value="monthly">Monthly</option>
241
</select>
242
</label>
243
<label>Time
244
<input id="admin-scheduled-restart-time" type="time" step="60" />
245
</label>
246
</div>
247
<p id="admin-scheduled-restart-help" class="muted">When the scheduled time is reached, restart waits until there have been no logged-in clients for at least one hour.</p>
248
<button id="admin-save-scheduled-restart" class="primary">Save scheduled restart</button>
249
</div>
228
250
<button id="admin-shutdown-btn" class="danger">Shut down server</button>
229
251
</section>
230
252
</div>
@@ -259,6 +281,14 @@
259
281
<div id="debug-roots" class="debug-table-wrap"></div>
260
282
</section>
261
283
284
<section>
285
<div class="debug-section-head">
286
<h3>Server Maintenance</h3>
287
<button id="debug-copy-maintenance" class="debug-copy-btn" type="button">Copy JSON</button>
288
</div>
289
<div id="debug-maintenance-summary" class="debug-summary-grid"></div>
290
</section>
291
262
292
<section>
263
293
<div class="debug-section-head">
264
294
<h3>Video Streams and Caches</h3>
@@ -225,6 +225,28 @@225
</span>225
</span>226
</button>226
</button>227
</div>227
</div>228
<div id="admin-scheduled-restart" class="admin-scheduled-restart">229
<label class="checkbox-label admin-scheduled-restart-toggle">230
<input id="admin-scheduled-restart-enabled" type="checkbox" />231
Enable scheduled restart232
</label>233
<div class="admin-scheduled-restart-grid">234
<label>Cadence235
<select id="admin-scheduled-restart-cadence">236
<option value="daily">Daily</option>237
<option value="every3days">Every 3 days</option>238
<option value="weekly">Weekly</option>239
<option value="biweekly">Bi-weekly</option>240
<option value="monthly">Monthly</option>241
</select>242
</label>243
<label>Time244
<input id="admin-scheduled-restart-time" type="time" step="60" />245
</label>246
</div>247
<p id="admin-scheduled-restart-help" class="muted">When the scheduled time is reached, restart waits until there have been no logged-in clients for at least one hour.</p>248
<button id="admin-save-scheduled-restart" class="primary">Save scheduled restart</button>249
</div>228
<button id="admin-shutdown-btn" class="danger">Shut down server</button>250
<button id="admin-shutdown-btn" class="danger">Shut down server</button>229
</section>251
</section>230
</div>252
</div>@@ -259,6 +281,14 @@259
<div id="debug-roots" class="debug-table-wrap"></div>281
<div id="debug-roots" class="debug-table-wrap"></div>260
</section>282
</section>261
283
284
<section>285
<div class="debug-section-head">286
<h3>Server Maintenance</h3>287
<button id="debug-copy-maintenance" class="debug-copy-btn" type="button">Copy JSON</button>288
</div>289
<div id="debug-maintenance-summary" class="debug-summary-grid"></div>290
</section>291
262
<section>292
<section>263
<div class="debug-section-head">293
<div class="debug-section-head">264
<h3>Video Streams and Caches</h3>294
<h3>Video Streams and Caches</h3>@@ -184,6 +184,13 @@ button.danger:hover {
184
184
background: var(--border);
185
185
}
186
186
187
button:disabled,
188
input:disabled,
189
select:disabled {
190
opacity: 0.55;
191
cursor: not-allowed;
192
}
193
187
194
button.danger.admin-update-highlight {
188
195
animation: admin-update-pulse 0.9s ease-in-out 2;
189
196
}
@@ -1210,6 +1217,45 @@ button.danger.admin-update-highlight {
1210
1217
background: var(--border);
1211
1218
}
1212
1219
1220
.admin-scheduled-restart {
1221
margin: 0.4rem 0 0.8rem;
1222
padding: 0.6rem;
1223
border: 1px solid var(--border);
1224
border-radius: var(--radius);
1225
background: var(--bg);
1226
}
1227
1228
.admin-scheduled-restart.admin-scheduled-restart--disabled {
1229
opacity: 0.7;
1230
}
1231
1232
.admin-scheduled-restart-toggle {
1233
margin-bottom: 0.5rem;
1234
}
1235
1236
.admin-scheduled-restart-grid {
1237
display: grid;
1238
grid-template-columns: 1fr 1fr;
1239
gap: 0.6rem;
1240
}
1241
1242
.admin-scheduled-restart-grid label {
1243
display: flex;
1244
flex-direction: column;
1245
gap: 0.28rem;
1246
font-size: 0.82rem;
1247
color: var(--text-muted);
1248
}
1249
1250
.admin-scheduled-restart-grid input,
1251
.admin-scheduled-restart-grid select {
1252
background: var(--surface2);
1253
border: 1px solid var(--border);
1254
border-radius: 6px;
1255
color: var(--text);
1256
padding: 0.4rem 0.55rem;
1257
}
1258
1213
1259
/* User list */
1214
1260
.user-row {
1215
1261
display: flex;
@@ -184,6 +184,13 @@ button.danger:hover {184
background: var(--border);
184
background: var(--border);
185
}
185
}
186
186
187
button:disabled,
188
input:disabled,
189
select:disabled {
190
opacity: 0.55;
191
cursor: not-allowed;
192
}
193
187
button.danger.admin-update-highlight {
194
button.danger.admin-update-highlight {
188
animation: admin-update-pulse 0.9s ease-in-out 2;
195
animation: admin-update-pulse 0.9s ease-in-out 2;
189
}
196
}
@@ -1210,6 +1217,45 @@ button.danger.admin-update-highlight {1210
background: var(--border);
1217
background: var(--border);
1211
}
1218
}
1212
1219
1220
.admin-scheduled-restart {
1221
margin: 0.4rem 0 0.8rem;
1222
padding: 0.6rem;
1223
border: 1px solid var(--border);
1224
border-radius: var(--radius);
1225
background: var(--bg);
1226
}
1227
1228
.admin-scheduled-restart.admin-scheduled-restart--disabled {
1229
opacity: 0.7;
1230
}
1231
1232
.admin-scheduled-restart-toggle {
1233
margin-bottom: 0.5rem;
1234
}
1235
1236
.admin-scheduled-restart-grid {
1237
display: grid;
1238
grid-template-columns: 1fr 1fr;
1239
gap: 0.6rem;
1240
}
1241
1242
.admin-scheduled-restart-grid label {
1243
display: flex;
1244
flex-direction: column;
1245
gap: 0.28rem;
1246
font-size: 0.82rem;
1247
color: var(--text-muted);
1248
}
1249
1250
.admin-scheduled-restart-grid input,
1251
.admin-scheduled-restart-grid select {
1252
background: var(--surface2);
1253
border: 1px solid var(--border);
1254
border-radius: 6px;
1255
color: var(--text);
1256
padding: 0.4rem 0.55rem;
1257
}
1258
1213
/* User list */
1259
/* User list */
1214
.user-row {
1260
.user-row {
1215
display: flex;
1261
display: flex;