coracle
coracle copied to clipboard
Can't Add Relay URI with Port Definition
When I try to use ws://dev.local:7777 as a relay, I receive the following error: "Please provide a valid relay URL."
This error is triggered by the isShareableRelayUrl function in node_modules/@welshman/util/build/Relay.mjs:
export const isShareableRelayUrl = (url) => {
var _a;
return Boolean(typeof url === 'string' &&
// Is it actually a websocket url and has a dot
url.match(/^wss:\/\/.+\..+/) &&
// Sometimes bugs cause multiple relays to get concatenated
((_a = url.match(/:\/\//g)) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
// It shouldn't have any whitespace, url-encoded or otherwise
!url.match(/\s|%/) &&
// Don't match stuff with a port number
!url.slice(6).match(/:\d+/) &&
// Don't match stuff with a numeric tld
!url.slice(6).match(/\.\d+\b/) &&
// Don't match raw ip addresses
!url.slice(6).match(/\d+\.\d+\.\d+\.\d+/) &&
// Skip nostr.wine's virtual relays
!url.slice(6).match(/\/npub/));
};
The relevant part is:
// Don't match stuff with a port number
!url.slice(6).match(/:\d+/) &&
This doesn't seem right. ws://dev.local:7777 is a valid relay URI and should be allowed.
My intention is to use a local cache relay as read-only and other relays as write-only to achieve the fastest possible experience with my locally running client.
This is on my radar, I'm just not sure yet how to handle it, since you don't want to hit other people's local urls.
It would be nice to support https://github.com/CodyTseng/nostr-relay-tray
I have the same issue. Running nostr-rs-relay locally and can't connect to it with Coracle.
Please fix this ;-D
Fixed in 4651a158