diff --git a/docker-compose.yml b/docker-compose.yml index 5801191..1820e12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: . container_name: xivlauncher-remote-otp ports: - - "127.0.0.1:${WEB_PORT:-8814}:8080" + - "${WEB_PORT:-8814}:8080" volumes: - ./data:/app/data environment: diff --git a/static/app.js b/static/app.js index ee05f2b..e81466b 100644 --- a/static/app.js +++ b/static/app.js @@ -6,11 +6,15 @@ document.addEventListener('DOMContentLoaded', () => { const ufwCmd = document.getElementById('ufw-cmd'); const iptablesCmd = document.getElementById('iptables-cmd'); - portInput.addEventListener('input', (e) => { - const port = e.target.value || '4646'; - ufwCmd.textContent = `sudo ufw allow ${port}/tcp`; - iptablesCmd.textContent = `sudo iptables -I INPUT -p tcp --dport ${port} -j ACCEPT`; - }); + const updateFirewallCmds = () => { + const port = portInput.value || '4646'; + const hostIp = window.location.hostname; + ufwCmd.textContent = `sudo ufw allow from ${hostIp} to any port ${port} proto tcp`; + iptablesCmd.textContent = `sudo iptables -I INPUT -p tcp -s ${hostIp} --dport ${port} -j ACCEPT`; + }; + + portInput.addEventListener('input', updateFirewallCmds); + updateFirewallCmds(); const fetchInstances = async () => { try {