From 6971f3438ca6c5e6a305d69571cc2e2c9809dffc Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 12 Feb 2026 03:16:07 -0800 Subject: [PATCH 1/3] Implement error method for gallery progress Handle instances when Web Crypto API is not available. --- javascript/gallery.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/javascript/gallery.js b/javascript/gallery.js index 9fd49e9d2..73b033757 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -223,6 +223,15 @@ class SimpleProgressBar { this.#text.textContent = ''; } + error(message) { + this.#stop(); + clearTimeout(this.#hideTimeout); + this.#text.textContent = message; + this.#hideTimeout = setTimeout(() => { + this.clear(); + }, 2000); + } + #update(loaded, max) { if (this.#hideTimeout) { this.#hideTimeout = null; @@ -655,6 +664,7 @@ async function getHash(str) { return hex; } catch (err) { error('getHash:', err); + galleryProgressBar.error('File hash error'); return undefined; } } From 9f9d67713de5ebf6dd1735bbe35ffe833b28a8a8 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 12 Feb 2026 03:32:38 -0800 Subject: [PATCH 2/3] Fix error message display --- javascript/gallery.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index 73b033757..511815be6 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -183,6 +183,7 @@ class SimpleProgressBar { #hideTimeout = null; #interval = null; #max = 0; + #errorState = false; /** @type {Set} */ #monitoredSet; @@ -199,6 +200,7 @@ class SimpleProgressBar { } start(total) { + if (this.#errorState) return; this.clear(); this.#max = total; this.#interval = setInterval(() => { @@ -215,6 +217,7 @@ class SimpleProgressBar { clear() { this.#stop(); + this.#errorState = false; clearTimeout(this.#hideTimeout); this.#hideTimeout = null; this.#container.style.display = 'none'; @@ -224,12 +227,17 @@ class SimpleProgressBar { } error(message) { - this.#stop(); - clearTimeout(this.#hideTimeout); - this.#text.textContent = message; - this.#hideTimeout = setTimeout(() => { - this.clear(); - }, 2000); + if (!this.#errorState) { + this.#errorState = true; + this.#stop(); + this.#container.style.display = 'block'; + this.#visible = true; + clearTimeout(this.#hideTimeout); + this.#text.textContent = message; + this.#hideTimeout = setTimeout(() => { + this.clear(); + }, 2000); + } } #update(loaded, max) { @@ -653,6 +661,7 @@ async function addSeparators() { const gallerySendImage = (_images) => [currentImage]; // invoked by gradio button async function getHash(str) { + galleryProgressBar.error('File hash error'); try { let hex = ''; const strBuf = new TextEncoder().encode(str); From e683884d5f77080e31caf5314b56236d20932d74 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 12 Feb 2026 03:34:17 -0800 Subject: [PATCH 3/3] Move trigger back to correct location --- javascript/gallery.js | 1 - 1 file changed, 1 deletion(-) diff --git a/javascript/gallery.js b/javascript/gallery.js index 511815be6..7f4d2ad67 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -661,7 +661,6 @@ async function addSeparators() { const gallerySendImage = (_images) => [currentImage]; // invoked by gradio button async function getHash(str) { - galleryProgressBar.error('File hash error'); try { let hex = ''; const strBuf = new TextEncoder().encode(str);