mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-06-04 09:41:32 +02:00
fix: Normalize relay URLs in connection check to improve accuracy (#97)
Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
@@ -36,7 +36,14 @@ export function ManageCustomRelays() {
|
||||
|
||||
// Check if a relay is currently connected
|
||||
const isConnected = (relayUrl: string) => {
|
||||
return connectedRelays?.some(relay => relay.url === relayUrl && relay.status === 1) || false;
|
||||
// Normalize the URL by removing trailing slash
|
||||
const normalizedRelayUrl = relayUrl.endsWith('/') ? relayUrl.slice(0, -1) : relayUrl;
|
||||
|
||||
return connectedRelays?.some(relay => {
|
||||
// Normalize connected relay URL too
|
||||
const normalizedConnectedUrl = relay.url.endsWith('/') ? relay.url.slice(0, -1) : relay.url;
|
||||
return normalizedConnectedUrl === normalizedRelayUrl && relay.status === 1;
|
||||
}) || false;
|
||||
};
|
||||
|
||||
if (customRelays.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user