From 2304717de57a78abbed1db8d3917bf12f2766c1d Mon Sep 17 00:00:00 2001 From: cosmo Date: Sat, 18 Apr 2026 16:51:10 +0200 Subject: [PATCH] add clipboard copy functionality and restrict firewall commands to localhost --- static/app.js | 17 +++++++++++++++++ static/index.html | 14 ++++++++++++-- static/style.css | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/static/app.js b/static/app.js index 2f63caf..ce1c9c7 100644 --- a/static/app.js +++ b/static/app.js @@ -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 = ''; + 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() diff --git a/static/index.html b/static/index.html index f00e2ed..ea535ab 100644 --- a/static/index.html +++ b/static/index.html @@ -50,11 +50,21 @@

Run these commands on the machine running XIVLauncher to allow incoming connections on the specified port.

UFW - sudo ufw allow 4646/tcp +
+ sudo ufw allow from localhost to any port 4646 proto tcp + +
iptables - sudo iptables -I INPUT -p tcp --dport 4646 -j ACCEPT +
+ sudo iptables -I INPUT -p tcp -s localhost --dport 4646 -j ACCEPT + +
diff --git a/static/style.css b/static/style.css index 6669adb..86be407 100644 --- a/static/style.css +++ b/static/style.css @@ -262,4 +262,38 @@ input:focus { .code-block code { color: #34d399; + word-break: break-all; +} + +.code-wrapper { + display: flex; + justify-content: space-between; + align-items: center; + gap: 1rem; +} + +.btn-copy { + background: transparent; + border: none; + color: var(--text-muted); + cursor: pointer; + padding: 0.25rem; + border-radius: 4px; + transition: all 0.2s; + display: flex; + align-items: center; + justify-content: center; +} + +.btn-copy:hover { + background-color: rgba(255, 255, 255, 0.1); + color: var(--text-main); +} + +.btn-copy:active { + transform: scale(0.95); +} + +.btn-copy.copied { + color: var(--status-online); }