From fc90ed68a39008a93d6567d185d6047b163429fc Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 14 Mar 2026 11:37:44 -0700 Subject: [PATCH] Fix debug info copy button failing over HTTP in Docker --- webui/static/docs.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/webui/static/docs.js b/webui/static/docs.js index 80c68c51..0ae99ecc 100644 --- a/webui/static/docs.js +++ b/webui/static/docs.js @@ -2210,9 +2210,31 @@ function initializeDocsPage() { text += '(no log lines)\n'; } - await navigator.clipboard.writeText(text); - debugBtn.innerHTML = '✅ Copied!'; - debugBtn.classList.add('copied'); + // Copy to clipboard — navigator.clipboard requires HTTPS/localhost, + // so fall back to execCommand for Docker/LAN HTTP access + let copied = false; + if (navigator.clipboard && window.isSecureContext) { + try { + await navigator.clipboard.writeText(text); + copied = true; + } catch (_) {} + } + if (!copied) { + const ta = document.createElement('textarea'); + ta.value = text; + ta.style.cssText = 'position:fixed;left:-9999px;top:-9999px'; + document.body.appendChild(ta); + ta.select(); + try { copied = document.execCommand('copy'); } catch (_) {} + document.body.removeChild(ta); + } + if (copied) { + debugBtn.innerHTML = '✅ Copied!'; + debugBtn.classList.add('copied'); + } else { + debugBtn.innerHTML = '❌ Copy failed — open console (F12) to see output'; + console.log(text); + } setTimeout(() => { debugBtn.innerHTML = '📋 Copy Debug Info'; debugBtn.classList.remove('copied');