From 64fb579248745d8ea1152fef945f32c1aca253f4 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 4 Feb 2026 18:07:48 +0100 Subject: [PATCH] feat(exposure): Sort services by DNS domain names first, then by port Services with HAProxy DNS domains are now displayed at the top of the table sorted alphabetically by domain, followed by remaining services sorted by port number. Co-Authored-By: Claude Opus 4.5 --- .../resources/view/exposure/services.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package/secubox/luci-app-exposure/htdocs/luci-static/resources/view/exposure/services.js b/package/secubox/luci-app-exposure/htdocs/luci-static/resources/view/exposure/services.js index cffc7a0e..5a5e03de 100644 --- a/package/secubox/luci-app-exposure/htdocs/luci-static/resources/view/exposure/services.js +++ b/package/secubox/luci-app-exposure/htdocs/luci-static/resources/view/exposure/services.js @@ -71,6 +71,23 @@ return view.extend({ var sslCount = sslBackends.length; var domainCount = haproxyVhosts.filter(function(v) { return v.enabled; }).length; + // Sort: services with DNS domains first (alphabetically), then by port + services.sort(function(a, b) { + var aDomains = domainsByPort[a.port] || []; + var bDomains = domainsByPort[b.port] || []; + var aHas = aDomains.length > 0; + var bHas = bDomains.length > 0; + if (aHas && !bHas) return -1; + if (!aHas && bHas) return 1; + if (aHas && bHas) { + var aName = aDomains[0].domain.toLowerCase(); + var bName = bDomains[0].domain.toLowerCase(); + if (aName < bName) return -1; + if (aName > bName) return 1; + } + return a.port - b.port; + }); + var rows = services.map(function(svc) { var torInfo = torByPort[svc.port] || torByName[svc.name] || torByName[svc.process] || null; var sslInfo = sslByPort[svc.port] || sslByName[svc.name] || sslByName[svc.process] || null;