From 1ccdf70bdfa0eba95ac5690beda4ca17f8847816 Mon Sep 17 00:00:00 2001 From: remotetohome <178868468+remotetohome@users.noreply.github.com> Date: Thu, 5 Feb 2026 01:27:45 -0600 Subject: [PATCH] Fix IP address sorting to use numeric comparison --- templates/status.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/status.html b/templates/status.html index aff7643..112a729 100644 --- a/templates/status.html +++ b/templates/status.html @@ -33,6 +33,13 @@ Connected Peers let currentSortDirection = null; const originalRowOrders = new Map(); // Store original order per table + function ipToNumber(ip) { + // Extract IP from formats like "10.9.0.132/32" or "99.92.101.230:56078" + const match = ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/); + if (!match) return 0; + return (parseInt(match[1]) << 24) + (parseInt(match[2]) << 16) + (parseInt(match[3]) << 8) + parseInt(match[4]); + } + function getSortValue(cell, sortType) { switch (sortType) { case 'number': @@ -43,6 +50,8 @@ Connected Peers return cell.getAttribute('data-value') === '1' ? 1 : 0; case 'date': return new Date(cell.getAttribute('data-value') || 0).getTime(); + case 'ip': + return ipToNumber(cell.textContent || ''); case 'text': default: return (cell.textContent || '').toLowerCase().trim(); @@ -164,8 +173,8 @@ Connected Peers # Name Email - Allocated IPs - Endpoint + Allocated IPs + Endpoint Public Key Received Transmitted