diff --git a/app/sovran_systemsos_web/static/js/features.js b/app/sovran_systemsos_web/static/js/features.js
index 5e239bf..afe6547 100644
--- a/app/sovran_systemsos_web/static/js/features.js
+++ b/app/sovran_systemsos_web/static/js/features.js
@@ -223,114 +223,59 @@ function openPortRequirementsModal(featureName, ports, onContinue) {
? ''
: '';
- // Show loading state while fetching port status
- $portReqBody.innerHTML =
- '
Checking port status for ' + escHtml(featureName) + '…
' +
- '
Detecting which ports are open on this machine…
';
+ function renderPortRequirements(internalIp) {
+ var rows = ports.map(function(p) {
+ return '
' + escHtml(p.port) + '
' +
+ '
' + escHtml(p.protocol) + '
' +
+ '
' + escHtml(p.description) + '
';
+ }).join("");
+ var ipLine = internalIp
+ ? '
Forward each port below to this machine\'s internal IP: ' + escHtml(internalIp) + '
'
+ : "
Forward each port below to this machine's internal LAN IP in your router's port forwarding settings.
";
+
+ $portReqBody.innerHTML =
+ '
Port Forwarding Required
' +
+ '
For ' + escHtml(featureName) + " to work with clients outside your local network, " +
+ "you must configure port forwarding in your router's admin panel.
" +
+ ipLine +
+ '
' +
+ '
Port(s)
Protocol
Purpose
' +
+ '' + rows + '' +
+ '
' +
+ "
How to verify: Router-side forwarding cannot be checked from inside your network. " +
+ "To confirm ports are forwarded correctly, test from a device on a different network (e.g. a phone on mobile data) " +
+ "or check your router's port forwarding page.
" +
+ '
ℹ Search "how to set up port forwarding on [your router model]" for step-by-step instructions.
' +
+ '
' +
+ '' +
+ continueBtn +
+ '
';
+
+ document.getElementById("port-req-dismiss-btn").onclick = function() {
+ closePortRequirementsModal();
+ };
+
+ if (onContinue) {
+ document.getElementById("port-req-continue-btn").onclick = function() {
+ closePortRequirementsModal();
+ onContinue();
+ };
+ }
+ }
$portReqModal.classList.add("open");
+ renderPortRequirements(null);
- // Fetch live port status from local system commands (no external calls)
- fetch("/api/ports/status", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ ports: ports }),
- })
+ fetch("/api/network")
.then(function(r) { return r.json(); })
.then(function(data) {
+ if (!$portReqModal.classList.contains("open")) return;
var internalIp = (data.internal_ip && data.internal_ip !== "unavailable")
? data.internal_ip : null;
- var portStatuses = {};
- (data.ports || []).forEach(function(p) {
- portStatuses[p.port + "/" + p.protocol] = p.status;
- });
-
- var rows = ports.map(function(p) {
- var key = p.port + "/" + p.protocol;
- var status = portStatuses[key] || "unknown";
- var statusHtml;
- if (status === "listening") {
- statusHtml = '🟢 Listening';
- } else if (status === "firewall_open") {
- statusHtml = '🟡 Open (idle)';
- } else if (status === "closed") {
- statusHtml = '🔴 Closed';
- } else {
- statusHtml = '⚪ Unknown';
- }
- return '
Forward each port below to this machine\'s internal IP: ' + escHtml(internalIp) + '
'
- : "
Forward each port below to this machine's internal LAN IP in your router's port forwarding settings.
";
-
- $portReqBody.innerHTML =
- '
Port Forwarding Required
' +
- '
For ' + escHtml(featureName) + " to work with clients outside your local network, " +
- "you must configure port forwarding in your router's admin panel.
" +
- ipLine +
- '
' +
- '
Port(s)
Protocol
Purpose
Status
' +
- '' + rows + '' +
- '
' +
- "
How to verify: Router-side forwarding cannot be checked from inside your network. " +
- "To confirm ports are forwarded correctly, test from a device on a different network (e.g. a phone on mobile data) " +
- "or check your router's port forwarding page.
" +
- '
ℹ Search "how to set up port forwarding on [your router model]" for step-by-step instructions.
' +
- '
' +
- '' +
- continueBtn +
- '
';
-
- document.getElementById("port-req-dismiss-btn").addEventListener("click", function() {
- closePortRequirementsModal();
- });
-
- if (onContinue) {
- document.getElementById("port-req-continue-btn").addEventListener("click", function() {
- closePortRequirementsModal();
- onContinue();
- });
- }
+ renderPortRequirements(internalIp);
})
- .catch(function() {
- // Fallback: show static table without status column if fetch fails
- var rows = ports.map(function(p) {
- return '
For ' + escHtml(featureName) + ' to work with clients outside your local network, ' +
- 'you must configure port forwarding in your router\'s admin panel and forward each port below to this machine\'s internal LAN IP.
' +
- '
' +
- '
Port(s)
Protocol
Purpose
' +
- '' + rows + '' +
- '
' +
- '
ℹ Search "how to set up port forwarding on [your router model]" for step-by-step instructions.
' +
- '
' +
- '' +
- continueBtn +
- '
';
-
- document.getElementById("port-req-dismiss-btn").addEventListener("click", function() {
- closePortRequirementsModal();
- });
-
- if (onContinue) {
- document.getElementById("port-req-continue-btn").addEventListener("click", function() {
- closePortRequirementsModal();
- onContinue();
- });
- }
+ .catch(function(err) {
+ console.warn("Failed to fetch network info for port requirements modal:", err);
});
}