Add screenshot page, add polling screenshots, better screenshot memory cleanup, better visualization/no jitter when screenshots are shown now.

This commit is contained in:
KingKDot
2026-05-17 22:02:23 -05:00
parent 7574988e3b
commit bab5054b47
21 changed files with 1209 additions and 45 deletions
-18
View File
@@ -4,14 +4,12 @@ import { digestData } from "./utils.js";
const POLL_INTERVAL_MS = 5000;
const FALLBACK_POLL_MS = 30000;
const PREF_REFRESH_KEY = "overlord_refresh_interval_seconds";
const THUMBNAIL_COOLDOWN_MS = 60000;
let pollTimer = null;
let render = () => {};
let dashboardWs = null;
let dashboardWsConnected = false;
let wsReconnectTimer = null;
const manuallyDisconnecting = new Set();
const thumbnailRequestedAt = new Map();
function moveClientCardImmediately(msg) {
const clientId = typeof msg?.clientId === "string" ? msg.clientId : "";
@@ -77,8 +75,6 @@ export async function loadWithOptions(options = {}) {
render(data, { reorder });
const pag = document.getElementById("pagination");
if (pag) pag.style.visibility = "";
requestThumbnailsForClients(data.items);
} catch (err) {
console.error("load clients", err);
} finally {
@@ -93,19 +89,6 @@ export async function loadWithOptions(options = {}) {
}
}
async function requestThumbnailsForClients(items) {
const now = Date.now();
const onlineClientsWithoutThumbnail = items.filter(c => {
if (!c.online || c.thumbnail) return false;
const last = thumbnailRequestedAt.get(c.id);
return !last || now - last > THUMBNAIL_COOLDOWN_MS;
});
for (const client of onlineClientsWithoutThumbnail) {
thumbnailRequestedAt.set(client.id, now);
await requestThumbnail(client.id);
}
}
function updateOsFilter(items) {
const osSelect = document.getElementById("filter-os");
if (!osSelect) return;
@@ -183,7 +166,6 @@ function connectDashboardWs() {
console.warn("[dashboard] ws closed");
dashboardWs = null;
dashboardWsConnected = false;
thumbnailRequestedAt.clear();
adjustPollingForWs();
scheduleDashboardReconnect();
};