Poll scrape progress and show page totals

This commit is contained in:
Fisto
2026-09-16 13:52:17 +02:00
parent 5645f55356
commit 2309393e3c
3 changed files with 23 additions and 3 deletions
+4
View File
@@ -40,6 +40,10 @@ mobile draft at 390px.
- [x] C11 preview caching: Discord-hosted image/GIF previews (WebP 320px, hash-addressed, 5 MiB
cap, one attempt) run after every walk in both modes. Live run `...-20260916090722`:
`previewed: 2`; thumbs served over `/api/media/<scrape>/<item>/thumb` (200).
- [x] C25 Live scrape progress. The media tab polls `/api/media/scrapes` every 4 s while open,
so the running row counts update; pages show `X/Yp (~Z%)` from `estimatedMessages` when the
search total is available (some channels deny the bot search with Missing Access, so it stays
optional). Live: pages/messages incremented 2→10 during a walk on `gernal_chut`.
- [x] C24 Embeddable items open straight into their player: clicking a YouTube/Vimeo/Twitch/
Streamable card shows the iframe immediately, no extra play press. Non-embeddable videos keep
the still + play icon.
+4 -1
View File
@@ -164,7 +164,10 @@ that deletion is irreversible. The delete button is disabled for a 5 second coun
downloads, an ffprobe probe. GIF tiles carry a translucent **GIF** label top-left; the cached
preview is a static frame and the animated GIF plays while hovering. The status row reads
`(Images/Videos) | Downloaded I/V | Cached I/V | Loaded I/V` — image counts include GIFs, and
each slot is the count for the active filters. A scrape strip shows live progress with Stop.
each slot is the count for the active filters. A scrape strip shows live progress with Stop; it
polls every 4 seconds while the tab is open and shows `X/Yp (~Z%)` when the search total is
known. Some channels deny the bot the search endpoint (`Missing Access`) even though history
reads work, so the total is optional.
**New scrape…** (rightmost) opens a popup with Server and Group chat trees (servers expand to
channels; each row has Links and Download). Every scrape button asks for confirmation; the
dialog takes optional From/To dates and a **Check Message Count** button (Discord search total,
+15 -2
View File
@@ -176,7 +176,6 @@
setStatus(`media status failed: ${error.message}`);
}
renderScrapes();
if (state.view === "media") renderToolbar();
}
function filterQuery() {
@@ -292,11 +291,20 @@
row.append(el("span", "vk-media-pulse"));
}
// Discord search gives the total, so the page count is known up front.
const estimatedPages =
scrape.estimatedMessages != null ? Math.max(1, Math.ceil(scrape.estimatedMessages / 100)) : null;
const pageText = estimatedPages ? `${scrape.pages}/${estimatedPages}p` : `${scrape.pages}p`;
const percent =
estimatedPages && scrape.state !== "queued"
? ` (~${Math.min(100, Math.round((scrape.pages / estimatedPages) * 100))}%)`
: "";
row.append(
el(
"span",
null,
`${channelLabel(scrape.channelId)} · ${scrape.state} · ${scrape.pages}p · ${scrape.messages}m · ` +
`${channelLabel(scrape.channelId)} · ${scrape.state} · ${pageText}${percent} · ${scrape.messages}m · ` +
`img ${media.image ?? 0} gif ${media.gif ?? 0} vid ${media.video ?? 0} aud ${media.audio ?? 0}` +
(scrape.downloaded ? ` · files ${scrape.downloaded}` : "") +
(scrape.previewed ? ` · previews ${scrape.previewed}` : "")
@@ -754,6 +762,11 @@
if (state.view !== "bot") void refreshErrors();
}, 15000);
// Keep the running-scrape strip live while the media view is open.
setInterval(() => {
if (state.view === "media") void loadScrapes();
}, 4000);
// ---- Scrape popup: server or group-chat trees ----
const scrapeModal = document.createElement("div");