Fix debug info copy button failing over HTTP in Docker

This commit is contained in:
Broque Thomas 2026-03-14 11:37:44 -07:00
parent fead6db379
commit fc90ed68a3

View file

@ -2210,9 +2210,31 @@ function initializeDocsPage() {
text += '(no log lines)\n'; text += '(no log lines)\n';
} }
await navigator.clipboard.writeText(text); // Copy to clipboard — navigator.clipboard requires HTTPS/localhost,
debugBtn.innerHTML = '✅ Copied!'; // so fall back to execCommand for Docker/LAN HTTP access
debugBtn.classList.add('copied'); 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(() => { setTimeout(() => {
debugBtn.innerHTML = '📋 Copy Debug Info'; debugBtn.innerHTML = '📋 Copy Debug Info';
debugBtn.classList.remove('copied'); debugBtn.classList.remove('copied');