Add the media downloader with hash storage and local file serving

This commit is contained in:
Fisto
2026-09-16 10:35:55 +02:00
parent 3ea72f587d
commit f7664256d1
15 changed files with 431 additions and 28 deletions
+4 -3
View File
@@ -170,15 +170,16 @@
function renderGrid() {
grid.replaceChildren();
for (const item of state.items) {
const source = item.localUrl || item.url;
const card = el("a", "vk-media-card");
card.href = item.url;
card.href = source;
card.target = "_blank";
card.rel = "noreferrer";
if ((item.kind === "image" || item.kind === "gif") && /^https?:/.test(item.url)) {
if ((item.kind === "image" || item.kind === "gif") && /^(https?:|\/)/.test(source)) {
const img = document.createElement("img");
img.loading = "lazy";
img.src = item.url;
img.src = source;
img.alt = item.kind;
card.append(img);
} else {