From 622cd2875c2ce0e09ab61cbac59a2e35254fb5a9 Mon Sep 17 00:00:00 2001 From: legop3 Date: Fri, 23 Jan 2026 02:16:37 -0500 Subject: [PATCH] no more ips in session data --- server/src/services/sessionService.js | 29 ++------------------ webui/src/components/AdminPanel.jsx | 38 --------------------------- 2 files changed, 2 insertions(+), 65 deletions(-) diff --git a/server/src/services/sessionService.js b/server/src/services/sessionService.js index 4c966103..2a3dd912 100644 --- a/server/src/services/sessionService.js +++ b/server/src/services/sessionService.js @@ -22,33 +22,10 @@ logger.info('Discord invite loaded:', discordInvite ? 'present' : 'not configure logger.info('Ko-fi link loaded:', kofiLink ? 'present' : 'not configured'); const ACTIVITY_SYNC_COOLDOWN_MS = 3000; -const ADMIN_ROLES = new Set(['admin', 'lockdown', 'lockdown-admin']); let lastActivitySync = 0; let pendingActivitySync = null; -function extractSocketIp(socket) { - if (!socket) return null; - const headers = socket.handshake?.headers || {}; - const forwardedFor = headers['x-forwarded-for']; - if (typeof forwardedFor === 'string' && forwardedFor.trim()) { - return forwardedFor.split(',')[0].trim(); - } - if (Array.isArray(forwardedFor) && forwardedFor.length) { - return String(forwardedFor[0]).trim(); - } - const realIp = headers['x-real-ip']; - if (typeof realIp === 'string' && realIp.trim()) { - return realIp.trim(); - } - return ( - socket.handshake?.address || - socket.conn?.remoteAddress || - socket.request?.connection?.remoteAddress || - null - ); -} - -function buildUserEntry(socket, includeIp = false) { +function buildUserEntry(socket) { if (!socket) return null; const role = getRole(socket); const assignment = assignmentService.describeAssignment(socket.id); @@ -58,14 +35,12 @@ function buildUserEntry(socket, includeIp = false) { nickname: getNickname(socket) || null, role, roverId: primaryRover || assignment?.roverId || null, - ip: includeIp ? extractSocketIp(socket) : null, }; } function buildSession(socket) { - const includeIps = ADMIN_ROLES.has(getRole(socket)); const users = Array.from(io.sockets.sockets.values()) - .map((sock) => buildUserEntry(sock, includeIps)) + .map((sock) => buildUserEntry(sock)) .filter(Boolean); return { socketId: socket?.id || null, diff --git a/webui/src/components/AdminPanel.jsx b/webui/src/components/AdminPanel.jsx index 4967d28d..50b152cf 100644 --- a/webui/src/components/AdminPanel.jsx +++ b/webui/src/components/AdminPanel.jsx @@ -17,16 +17,6 @@ export default function AdminPanel() { const currentGoal = session?.communityGoal?.text || ''; const goalUpdatedAt = session?.communityGoal?.updatedAt || null; const [goalDraft, setGoalDraft] = useState(currentGoal); - const socketIps = useMemo(() => { - const users = session?.users ?? []; - return users - .map((user) => ({ - socketId: user.socketId, - label: user.nickname || user.socketId?.slice(0, 6) || 'unknown', - ip: user.ip || null, - })) - .filter((entry) => entry.ip); - }, [session?.users]); const isAdmin = session?.role === 'admin' || @@ -145,7 +135,6 @@ export default function AdminPanel() { )} /> - ); } @@ -211,30 +200,3 @@ function ReplaySnapshotHealth({ health }) { ); } - -function WebsocketIpPanel({ entries }) { - const total = entries?.length || 0; - const uniqueCount = useMemo(() => new Set((entries || []).map((entry) => entry.ip)).size, [entries]); - return ( -
-
- Websocket IPs - - {uniqueCount} unique / {total} sockets - -
-
- {total === 0 ? ( -

No IPs reported yet.

- ) : ( - entries.map((entry) => ( -
- {entry.label} - {entry.ip} -
- )) - )} -
-
- ); -}