applesauce-relay 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/relay.js +2 -1
- package/package.json +1 -1
package/dist/relay.js
CHANGED
|
@@ -4,6 +4,7 @@ import { nanoid } from "nanoid";
|
|
|
4
4
|
import { nip42 } from "nostr-tools";
|
|
5
5
|
import { BehaviorSubject, catchError, combineLatest, defer, endWith, filter, finalize, from, ignoreElements, isObservable, map, merge, mergeMap, mergeWith, NEVER, of, retry, scan, share, shareReplay, Subject, switchMap, take, takeUntil, tap, throwError, timeout, timer, } from "rxjs";
|
|
6
6
|
import { webSocket } from "rxjs/webSocket";
|
|
7
|
+
import { ensureHttpURL } from "applesauce-core/helpers";
|
|
7
8
|
import { completeOnEose } from "./operators/complete-on-eose.js";
|
|
8
9
|
import { markFromRelay } from "./operators/mark-from-relay.js";
|
|
9
10
|
/** An error that is thrown when a REQ is closed from the relay side */
|
|
@@ -351,7 +352,7 @@ export class Relay {
|
|
|
351
352
|
}
|
|
352
353
|
/** Static method to fetch the NIP-11 information document for a relay */
|
|
353
354
|
static fetchInformationDocument(url) {
|
|
354
|
-
return from(fetch(url, { headers: { Accept: "application/nostr+json" } }).then((res) => res.json())).pipe(
|
|
355
|
+
return from(fetch(ensureHttpURL(url), { headers: { Accept: "application/nostr+json" } }).then((res) => res.json())).pipe(
|
|
355
356
|
// if the fetch fails, return null
|
|
356
357
|
catchError(() => of(null)),
|
|
357
358
|
// timeout after 10s
|