This commit is contained in:
Shusui MOYATANI
2023-04-03 10:47:53 +09:00
parent 3e52a24f87
commit ed03386e50
21 changed files with 483 additions and 348 deletions

View File

@@ -3,6 +3,7 @@ import type { Event as NostrEvent, Filter, SubscriptionOptions } from 'nostr-too
import uniqBy from 'lodash/uniqBy';
import usePool from '@/nostr/usePool';
import useStats from './useStats';
import useConfig from './useConfig';
export type UseSubscriptionProps = {
relayUrls: string[];
@@ -34,6 +35,7 @@ setInterval(() => {
}, 1000);
const useSubscription = (propsProvider: () => UseSubscriptionProps | null) => {
const { config } = useConfig();
const pool = usePool();
const [events, setEvents] = createSignal<NostrEvent[]>([]);
@@ -56,6 +58,9 @@ const useSubscription = (propsProvider: () => UseSubscriptionProps | null) => {
if (onEvent != null) {
onEvent(event as NostrEvent & { id: string });
}
if (config().mutedPubkeys.includes(event.pubkey)) {
return;
}
if (props.clientEventFilter != null && !props.clientEventFilter(event)) {
return;
}