mirror of
https://github.com/coracle-social/coracle.git
synced 2024-10-06 11:43:30 +00:00
Fall back to normal relay connections if multiplexer fails to connect
This commit is contained in:
parent
3ba160c123
commit
681d36d443
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -46,7 +46,7 @@
|
||||
"lru-cache": "^7.18.3",
|
||||
"nostr-tools": "^1.7.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"paravel": "^0.1.10",
|
||||
"paravel": "^0.1.11",
|
||||
"qr-scanner": "^1.4.2",
|
||||
"qrcode": "^1.5.1",
|
||||
"ramda": "^0.28.0",
|
||||
|
@ -159,11 +159,22 @@ function getExecutor(urls) {
|
||||
urls = forceUrls
|
||||
}
|
||||
|
||||
const executor = new Executor(
|
||||
Config.multiplextrUrl
|
||||
? new Plex(urls, pool.get(Config.multiplextrUrl))
|
||||
: new Relays(urls.map(url => pool.get(url)))
|
||||
)
|
||||
let target
|
||||
|
||||
// Try to use our multiplexer, but if it fails to connect fall back to relays
|
||||
if (Config.multiplextrUrl) {
|
||||
const socket = pool.get(Config.multiplextrUrl)
|
||||
|
||||
if (!socket.error) {
|
||||
target = new Plex(urls, pool.get(Config.multiplextrUrl))
|
||||
}
|
||||
}
|
||||
|
||||
if (!target) {
|
||||
target = new Relays(urls.map(url => pool.get(url)))
|
||||
}
|
||||
|
||||
const executor = new Executor(target)
|
||||
|
||||
executor.handleAuth({
|
||||
onAuth(url, challenge) {
|
||||
|
Loading…
Reference in New Issue
Block a user