add clipboard copy functionality and restrict firewall commands to localhost

This commit is contained in:
CPTN Cosmo 2026-04-18 16:51:10 +02:00
parent f57d2fc6be
commit 2304717de5
3 changed files with 63 additions and 2 deletions

View file

@ -123,6 +123,23 @@ document.addEventListener('DOMContentLoaded', () => {
}
};
window.copyToClipboard = async (elementId) => {
const text = document.getElementById(elementId).textContent;
const btn = event.currentTarget;
try {
await navigator.clipboard.writeText(text);
const originalHtml = btn.innerHTML;
btn.classList.add('copied');
btn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>';
setTimeout(() => {
btn.classList.remove('copied');
btn.innerHTML = originalHtml;
}, 2000);
} catch (err) {
console.error('Failed to copy: ', err);
}
};
function escapeHtml(unsafe) {
if (!unsafe) return '';
return unsafe.toString()