refactor: centralize relay vs direct E2EE

This commit is contained in:
Mohamed Boudra
2026-02-03 14:13:03 +07:00
parent 4fb93d92ed
commit d68596bcbe
12 changed files with 83 additions and 68 deletions
@@ -22,11 +22,11 @@ function buildCandidateUrls(daemon: HostProfile): string[] {
};
const isLastKnownRelay = !!relayEndpoint && lastKnownGood === relayEndpoint;
const directEndpoints = relayEndpoint
? endpoints.filter((endpoint) => endpoint !== relayEndpoint)
: endpoints;
const directEndpoints = endpoints;
if (lastKnownGood && !isLastKnownRelay) {
if (sessionId && relayEndpoint && isLastKnownRelay) {
push(buildRelayWebSocketUrl({ endpoint: relayEndpoint, sessionId }));
} else if (lastKnownGood) {
push(buildDaemonWebSocketUrl(lastKnownGood));
}
@@ -35,9 +35,6 @@ function buildCandidateUrls(daemon: HostProfile): string[] {
}
if (sessionId && relayEndpoint) {
if (isLastKnownRelay) {
push(buildRelayWebSocketUrl({ endpoint: relayEndpoint, sessionId }));
}
push(buildRelayWebSocketUrl({ endpoint: relayEndpoint, sessionId }));
}