mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-28 02:34:25 +01:00
loopback: use RelayPool instead of nostr-tools just because it doesn't die so often
This commit is contained in:
@@ -20,7 +20,6 @@ export {
|
||||
nip05,
|
||||
nip19,
|
||||
nip21,
|
||||
relayInit,
|
||||
verifySignature,
|
||||
} from 'npm:nostr-tools@^1.11.2';
|
||||
export { findReplyTag } from 'https://gitlab.com/soapbox-pub/mostr/-/raw/c67064aee5ade5e01597c6d23e22e53c628ef0e2/src/nostr/tags.ts';
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
import { Conf } from '@/config.ts';
|
||||
import { relayInit } from '@/deps.ts';
|
||||
import { RelayPool } from '@/deps.ts';
|
||||
import { trends } from '@/trends.ts';
|
||||
import { nostrDate, nostrNow } from '@/utils.ts';
|
||||
|
||||
import type { Event } from '@/event.ts';
|
||||
|
||||
const relay = relayInit(Conf.relay);
|
||||
await relay.connect();
|
||||
const relay = new RelayPool([Conf.relay]);
|
||||
|
||||
// This file watches all events on your Ditto relay and triggers
|
||||
// side-effects based on them. This can be used for things like
|
||||
// notifications, trending hashtag tracking, etc.
|
||||
relay
|
||||
.sub([{ kinds: [1], since: nostrNow() }])
|
||||
.on('event', handleEvent);
|
||||
relay.subscribe(
|
||||
[{ kinds: [1], since: nostrNow() }],
|
||||
[Conf.relay],
|
||||
handleEvent,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
|
||||
/** Handle events through the loopback pipeline. */
|
||||
function handleEvent(event: Event): void {
|
||||
|
||||
Reference in New Issue
Block a user