fix: first find metadata on purplepag relay and then try other relays
All checks were successful
Release / build_and_release (push) Successful in 41s
All checks were successful
Release / build_and_release (push) Successful in 41s
This commit is contained in:
parent
962b2bcea6
commit
6981bef65a
@ -20,10 +20,6 @@ export class MetadataController {
|
||||
}
|
||||
|
||||
public findMetadata = async (hexKey: string) => {
|
||||
const mostPopularRelays = import.meta.env.VITE_MOST_POPULAR_RELAYS
|
||||
const hardcodedPopularRelays = (mostPopularRelays || '').split(' ')
|
||||
const relays = [...hardcodedPopularRelays, this.specialMetadataRelay]
|
||||
|
||||
const eventFilter: Filter = {
|
||||
kinds: [kinds.Metadata],
|
||||
authors: [hexKey]
|
||||
@ -31,6 +27,25 @@ export class MetadataController {
|
||||
|
||||
const pool = new SimplePool()
|
||||
|
||||
const metadataEvent = await pool
|
||||
.get([this.specialMetadataRelay], eventFilter)
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
return null
|
||||
})
|
||||
|
||||
if (
|
||||
metadataEvent &&
|
||||
validateEvent(metadataEvent) &&
|
||||
verifyEvent(metadataEvent)
|
||||
) {
|
||||
return metadataEvent
|
||||
}
|
||||
|
||||
const mostPopularRelays = import.meta.env.VITE_MOST_POPULAR_RELAYS
|
||||
const hardcodedPopularRelays = (mostPopularRelays || '').split(' ')
|
||||
const relays = [...hardcodedPopularRelays]
|
||||
|
||||
const events = await pool.querySync(relays, eventFilter).catch((err) => {
|
||||
console.error(err)
|
||||
return null
|
||||
@ -67,7 +82,7 @@ export class MetadataController {
|
||||
if (event.sig.length < 1) {
|
||||
const timestamp = Math.floor(Date.now() / 1000)
|
||||
|
||||
// Metadata event to publish to the nquiz relay
|
||||
// Metadata event to publish to the wss://purplepag.es relay
|
||||
const newMetadataEvent: Event = {
|
||||
...event,
|
||||
created_at: timestamp
|
||||
|
Loading…
Reference in New Issue
Block a user