mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-24 00:34:25 +01:00
pipeline: remove broadcast function
This commit is contained in:
@@ -9,7 +9,7 @@ import { isEphemeralKind } from '@/kinds.ts';
|
|||||||
import { DVM } from '@/pipeline/DVM.ts';
|
import { DVM } from '@/pipeline/DVM.ts';
|
||||||
import { updateStats } from '@/stats.ts';
|
import { updateStats } from '@/stats.ts';
|
||||||
import { hydrateEvents, purifyEvent } from '@/storages/hydrate.ts';
|
import { hydrateEvents, purifyEvent } from '@/storages/hydrate.ts';
|
||||||
import { cache, client, eventsDB, reqmeister } from '@/storages.ts';
|
import { cache, eventsDB, reqmeister } from '@/storages.ts';
|
||||||
import { Sub } from '@/subs.ts';
|
import { Sub } from '@/subs.ts';
|
||||||
import { getTagSet } from '@/tags.ts';
|
import { getTagSet } from '@/tags.ts';
|
||||||
import { eventAge, isRelay, nostrDate, nostrNow, parseNip05, Time } from '@/utils.ts';
|
import { eventAge, isRelay, nostrDate, nostrNow, parseNip05, Time } from '@/utils.ts';
|
||||||
@@ -43,7 +43,6 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise<void
|
|||||||
processMedia(event),
|
processMedia(event),
|
||||||
payZap(event, signal),
|
payZap(event, signal),
|
||||||
streamOut(event),
|
streamOut(event),
|
||||||
broadcast(event, signal),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,22 +256,6 @@ function streamOut(event: NostrEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Publish the event to other relays.
|
|
||||||
* This should only be done in certain circumstances, like mentioning a user or publishing deletions.
|
|
||||||
*/
|
|
||||||
async function broadcast(event: DittoEvent, signal: AbortSignal) {
|
|
||||||
if (!event.user || !isFresh(event)) return;
|
|
||||||
|
|
||||||
if (event.kind === 5) {
|
|
||||||
try {
|
|
||||||
await client.event(event, { signal });
|
|
||||||
} catch (e) {
|
|
||||||
debug(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** NIP-20 command line result. */
|
/** NIP-20 command line result. */
|
||||||
class RelayError extends Error {
|
class RelayError extends Error {
|
||||||
constructor(prefix: 'duplicate' | 'pow' | 'blocked' | 'rate-limited' | 'invalid' | 'error', message: string) {
|
constructor(prefix: 'duplicate' | 'pow' | 'blocked' | 'rate-limited' | 'invalid' | 'error', message: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user