add clipboard copy functionality and restrict firewall commands to localhost
This commit is contained in:
parent
f57d2fc6be
commit
2304717de5
3 changed files with 63 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue