mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-03 17:40:19 +00:00
Merge pull request #1946 from RoboSats/fix-relay-connection
Fix relay connection
This commit is contained in:
@ -305,10 +305,11 @@ export class Coordinator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getRelayUrl = (network: 'mainnet' | 'testnet', hostUrl: string, selfHosted: boolean): string => {
|
getRelayUrl = (network: 'mainnet' | 'testnet', hostUrl: string, selfHosted: boolean): string => {
|
||||||
|
const protocol = hostUrl.includes('https') ? 'wss' : 'ws';
|
||||||
if (selfHosted && this.shortAlias !== 'local') {
|
if (selfHosted && this.shortAlias !== 'local') {
|
||||||
return `ws://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay`;
|
return `${protocol}://${hostUrl.replace(/^https?:\/\//, '')}/${network}/${this.shortAlias}/relay/`;
|
||||||
} else {
|
} else {
|
||||||
return `ws://${this.url.replace(/^https?:\/\//, '')}/relay`;
|
return `${protocol}://${this.url.replace(/^https?:\/\//, '')}/relay/`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ class RoboPool {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (settings.host) {
|
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)) {
|
if (federationRelays.includes(hostNostr)) {
|
||||||
this.relays.push(hostNostr);
|
this.relays.push(hostNostr);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user