Merge pull request #1946 from RoboSats/fix-relay-connection

Fix relay connection
This commit is contained in:
KoalaSat
2025-05-20 12:08:04 +00:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@ -305,10 +305,11 @@ export class Coordinator {
};
getRelayUrl = (network: 'mainnet' | 'testnet', hostUrl: string, selfHosted: boolean): string => {
const protocol = hostUrl.includes('https') ? 'wss' : 'ws';
if (selfHosted && this.shortAlias !== 'local') {
return `ws://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay`;
return `${protocol}://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay/`;
} else {
return `ws://${this.url.replace(/^https?:\/\//, '')}/relay`;
return `${protocol}://${this.url.replace(/^https?:\/\//, '')}/relay/`;
}
};
}

View File

@ -19,7 +19,8 @@ class RoboPool {
);
if (settings.host) {
const hostNostr = `ws://${settings.host.replace(/^https?:\/\//, '')}/relay`;
const protocol = hostUrl.includes('https') ? 'wss' : 'ws';
const hostNostr = `${protocol}://${settings.host.replace(/^https?:\/\//, '')}/relay/`;
if (federationRelays.includes(hostNostr)) {
this.relays.push(hostNostr);
}