Bring back some net context
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
export const AppContext: {
|
||||
export type AppContext = {
|
||||
dufflepudUrl?: string
|
||||
indexerRelays?: string[]
|
||||
} = {
|
||||
indexerRelays: ["wss://purplepag.es/", "wss://relay.nostr.band/", "wss://relay.primal.net/"],
|
||||
}
|
||||
|
||||
export const appContext: AppContext = {}
|
||||
|
||||
@@ -3,7 +3,7 @@ import {MultiRequestOptions} from "@welshman/net"
|
||||
import {tryCatch, fetchJson, uniq, batcher, postJson, last} from "@welshman/lib"
|
||||
import {collection} from "./collection.js"
|
||||
import {deriveProfile} from "./profiles.js"
|
||||
import {AppContext} from "./context.js"
|
||||
import {appContext} from "./context.js"
|
||||
|
||||
export type Handle = {
|
||||
nip05: string
|
||||
@@ -48,7 +48,7 @@ export async function queryProfile(nip05: string) {
|
||||
export const handles = writable<Handle[]>([])
|
||||
|
||||
export const fetchHandles = async (nip05s: string[]) => {
|
||||
const base = AppContext.dufflepudUrl!
|
||||
const base = appContext.dufflepudUrl!
|
||||
const handlesByNip05 = new Map<string, Handle>()
|
||||
|
||||
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
||||
|
||||
@@ -5,7 +5,7 @@ import {RelayProfile} from "@welshman/util"
|
||||
import {normalizeRelayUrl, displayRelayUrl, displayRelayProfile} from "@welshman/util"
|
||||
import {Socket, SocketStatus, SocketEvent, ClientMessage, RelayMessage} from "@welshman/net"
|
||||
import {collection} from "./collection.js"
|
||||
import {AppContext} from "./context.js"
|
||||
import {appContext} from "./context.js"
|
||||
|
||||
export type RelayStats = {
|
||||
first_seen: number
|
||||
@@ -65,7 +65,7 @@ export const relaysByPubkey = derived(relays, $relays =>
|
||||
)
|
||||
|
||||
export const fetchRelayProfiles = async (urls: string[]) => {
|
||||
const base = AppContext.dufflepudUrl
|
||||
const base = appContext.dufflepudUrl
|
||||
|
||||
if (!base) {
|
||||
throw new Error("ctx.app.dufflepudUrl is required to fetch relay metadata")
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
} from "@welshman/lib"
|
||||
import {collection} from "./collection.js"
|
||||
import {deriveProfile} from "./profiles.js"
|
||||
import {AppContext} from "./context.js"
|
||||
import {appContext} from "./context.js"
|
||||
|
||||
export const zappers = writable<Zapper[]>([])
|
||||
|
||||
export const fetchZappers = async (lnurls: string[]) => {
|
||||
const base = AppContext.dufflepudUrl
|
||||
const base = appContext.dufflepudUrl
|
||||
const zappersByLnurl = new Map<string, Zapper>()
|
||||
|
||||
// Use dufflepud if we it's set up to protect user privacy, otherwise fetch directly
|
||||
|
||||
Reference in New Issue
Block a user