Remove tsc-multi, re-install gts, apply autoformatting and linting
This commit is contained in:
+25
-25
@@ -1,14 +1,21 @@
|
||||
import type {Filter} from '@welshman/util'
|
||||
import {isSignedEvent} from '@welshman/util'
|
||||
import {push as basePush, pull as basePull, sync as baseSync, pushWithoutNegentropy, pullWithoutNegentropy, syncWithoutNegentropy} from "@welshman/net"
|
||||
import {repository} from './core'
|
||||
import {relaysByUrl} from './relays'
|
||||
import type {Filter} from "@welshman/util"
|
||||
import {isSignedEvent} from "@welshman/util"
|
||||
import {
|
||||
push as basePush,
|
||||
pull as basePull,
|
||||
sync as baseSync,
|
||||
pushWithoutNegentropy,
|
||||
pullWithoutNegentropy,
|
||||
syncWithoutNegentropy,
|
||||
} from "@welshman/net"
|
||||
import {repository} from "./core.js"
|
||||
import {relaysByUrl} from "./relays.js"
|
||||
|
||||
export const hasNegentropy = (url: string) => {
|
||||
const p = relaysByUrl.get().get(url)?.profile
|
||||
|
||||
if (p?.supported_nips?.includes(77)) return true
|
||||
if (p?.software?.includes('strfry') && !p?.version?.match(/^0\./)) return true
|
||||
if (p?.software?.includes("strfry") && !p?.version?.match(/^0\./)) return true
|
||||
|
||||
return false
|
||||
}
|
||||
@@ -23,12 +30,10 @@ export const pull = async ({relays, filters}: AppSyncOpts) => {
|
||||
|
||||
await Promise.all(
|
||||
relays.map(async relay => {
|
||||
await (
|
||||
hasNegentropy(relay)
|
||||
? basePull({filters, events, relays: [relay]})
|
||||
: pullWithoutNegentropy({filters, relays: [relay]})
|
||||
)
|
||||
})
|
||||
await (hasNegentropy(relay)
|
||||
? basePull({filters, events, relays: [relay]})
|
||||
: pullWithoutNegentropy({filters, relays: [relay]}))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,12 +42,10 @@ export const push = async ({relays, filters}: AppSyncOpts) => {
|
||||
|
||||
await Promise.all(
|
||||
relays.map(async relay => {
|
||||
await (
|
||||
hasNegentropy(relay)
|
||||
? basePush({filters, events, relays: [relay]})
|
||||
: pushWithoutNegentropy({events, relays: [relay]})
|
||||
)
|
||||
})
|
||||
await (hasNegentropy(relay)
|
||||
? basePush({filters, events, relays: [relay]})
|
||||
: pushWithoutNegentropy({events, relays: [relay]}))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -51,12 +54,9 @@ export const sync = async ({relays, filters}: AppSyncOpts) => {
|
||||
|
||||
await Promise.all(
|
||||
relays.map(async relay => {
|
||||
await (
|
||||
hasNegentropy(relay)
|
||||
? baseSync({filters, events, relays: [relay]})
|
||||
: syncWithoutNegentropy({filters, events, relays: [relay]})
|
||||
)
|
||||
})
|
||||
await (hasNegentropy(relay)
|
||||
? baseSync({filters, events, relays: [relay]})
|
||||
: syncWithoutNegentropy({filters, events, relays: [relay]}))
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user