feat: add PowerShell firewall configuration command to UI
This commit is contained in:
parent
e153a76b77
commit
c15f965a2b
2 changed files with 12 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const portInput = document.getElementById('port');
|
const portInput = document.getElementById('port');
|
||||||
const ufwCmd = document.getElementById('ufw-cmd');
|
const ufwCmd = document.getElementById('ufw-cmd');
|
||||||
const iptablesCmd = document.getElementById('iptables-cmd');
|
const iptablesCmd = document.getElementById('iptables-cmd');
|
||||||
|
const winCmd = document.getElementById('win-cmd');
|
||||||
const loginOverlay = document.getElementById('login-overlay');
|
const loginOverlay = document.getElementById('login-overlay');
|
||||||
const loginForm = document.getElementById('login-form');
|
const loginForm = document.getElementById('login-form');
|
||||||
const loginError = document.getElementById('login-error');
|
const loginError = document.getElementById('login-error');
|
||||||
|
|
@ -86,11 +87,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateFirewallCmds = () => {
|
const updateFirewallCmds = () => {
|
||||||
if (!ufwCmd || !iptablesCmd) return;
|
if (!ufwCmd || !iptablesCmd || !winCmd) return;
|
||||||
const port = portInput.value || '4646';
|
const port = portInput.value || '4646';
|
||||||
const hostIp = config.firewall_host_ip || window.location.hostname;
|
const hostIp = config.firewall_host_ip || window.location.hostname;
|
||||||
ufwCmd.textContent = `sudo ufw allow from ${hostIp} to any port ${port} proto tcp`;
|
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`;
|
iptablesCmd.textContent = `sudo iptables -I INPUT -p tcp -s ${hostIp} --dport ${port} -j ACCEPT`;
|
||||||
|
winCmd.textContent = `New-NetFirewallRule -DisplayName "XIVLauncher OTP" -Direction Inbound -RemoteAddress ${hostIp} -LocalPort ${port} -Protocol TCP -Action Allow`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchConfig = async () => {
|
const fetchConfig = async () => {
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,15 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="code-block">
|
||||||
|
<span class="code-label">Windows (PowerShell)</span>
|
||||||
|
<div class="code-wrapper">
|
||||||
|
<code id="win-cmd">New-NetFirewallRule -DisplayName "XIVLauncher OTP" -Direction Inbound -RemoteAddress localhost -LocalPort 4646 -Protocol TCP -Action Allow</code>
|
||||||
|
<button class="btn-copy" onclick="copyToClipboard('win-cmd')" title="Copy to clipboard">
|
||||||
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue