add optional idb "relay" worker
This commit is contained in:
@ -47,7 +47,10 @@ export default class SocialGraph {
|
||||
}
|
||||
}
|
||||
|
||||
handleFollowEvent(event: NostrEvent) {
|
||||
handleEvent(event: NostrEvent) {
|
||||
if (event.kind !== 3) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const author = ID(event.pubkey);
|
||||
const timestamp = event.created_at;
|
||||
|
@ -2,7 +2,7 @@ import debug from "debug";
|
||||
import EventEmitter from "eventemitter3";
|
||||
|
||||
import { unwrap, FeedCache } from "@snort/shared";
|
||||
import { NostrEvent, TaggedNostrEvent } from "./nostr";
|
||||
import { NostrEvent, ReqFilter, TaggedNostrEvent } from "./nostr";
|
||||
import { RelaySettings, ConnectionStateSnapshot, OkResponse } from "./connection";
|
||||
import { Query } from "./query";
|
||||
import { NoteCollection, NoteStore } from "./note-collection";
|
||||
@ -31,6 +31,7 @@ export interface NostrSystemEvents {
|
||||
change: (state: SystemSnapshot) => void;
|
||||
auth: (challenge: string, relay: string, cb: (ev: NostrEvent) => void) => void;
|
||||
event: (subId: string, ev: TaggedNostrEvent) => void;
|
||||
request: (filter: ReqFilter) => void;
|
||||
}
|
||||
|
||||
export interface NostrsystemProps {
|
||||
@ -316,6 +317,10 @@ export class NostrSystem extends EventEmitter<NostrSystemEvents> implements Syst
|
||||
}
|
||||
qSend.filters = fNew;
|
||||
|
||||
fNew.forEach(f => {
|
||||
this.emit("request", f);
|
||||
});
|
||||
|
||||
if (qSend.relay) {
|
||||
this.#log("Sending query to %s %O", qSend.relay, qSend);
|
||||
const s = this.#pool.getConnection(qSend.relay);
|
||||
|
Reference in New Issue
Block a user