diff --git a/.env b/.env index 9b861961..c0e3342b 100644 --- a/.env +++ b/.env @@ -2,5 +2,6 @@ VITE_THEME_DARK=transparent:transparent,black:#0f0f0e,white:#FFFFFF,accent:#EB5E VITE_THEME_LIGHT=transparent:transparent,black:#0f0f0e,white:#FFFFFF,accent:#EB5E28,accent-light:#FB652C,gray-8:#FFFFFF,gray-7:#FAF6F1,gray-6:#F2EBE1,gray-5:#B3AA98,gray-4:#B3AA98,gray-3:#565249,gray-2:#393530,gray-1:#252422,danger:#ff0000,warning:#ebd112,success:#37ab51,input:#FAF6F1,input-hover:#F2EBE1 VITE_DUFFLEPUD_URL=https://dufflepud.onrender.com VITE_DEFAULT_FOLLOWS=97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322,3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d,82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2,6e468422dfb74a5738702a8823b9b28168abab8655faacb6853cd0ee15deee93 +VITE_ENABLE_ZAPS=true VITE_FORCE_RELAYS= VITE_LOGO_URL= diff --git a/src/agent/network.ts b/src/agent/network.ts index 51a6cfaf..8ad4d67f 100644 --- a/src/agent/network.ts +++ b/src/agent/network.ts @@ -15,6 +15,7 @@ import { import {personKinds, appDataKeys, findReplyId} from "src/util/nostr" import {chunk, ensurePlural} from "hurdak/lib/hurdak" import {batch, now, timedelta} from "src/util/misc" +import {enableZaps} from "src/agent/settings" import { getRelaysForEventParent, getAllPubkeyWriteRelays, @@ -252,6 +253,7 @@ const loadParents = (notes, opts = {}) => { const streamContext = ({notes, onChunk, maxDepth = 2}) => { const subs = [] const seen = new Set() + const kinds = enableZaps ? [1, 7, 9735] : [1, 7] const relays = sampleRelays(aggregateScores(notes.map(getRelaysForEventChildren))) const loadChunk = (events, depth) => { @@ -274,7 +276,7 @@ const streamContext = ({notes, onChunk, maxDepth = 2}) => { subs.push( listen({ relays, - filter: [{kinds: [1, 7, 9735], "#e": ids, since: now()}], + filter: [{kinds, "#e": ids, since: now()}], onChunk: newEvents => { onChunk(newEvents) @@ -296,7 +298,7 @@ const streamContext = ({notes, onChunk, maxDepth = 2}) => { chunk(256, newIds).forEach(ids => { load({ relays, - filter: [{kinds: [1, 7, 9735], "#e": ids}], + filter: [{kinds, "#e": ids}], onChunk: newEvents => { onChunk(newEvents) diff --git a/src/agent/settings.ts b/src/agent/settings.ts new file mode 100644 index 00000000..364e1fc5 --- /dev/null +++ b/src/agent/settings.ts @@ -0,0 +1 @@ +export const enableZaps = JSON.parse(import.meta.env.VITE_ENABLE_ZAPS) diff --git a/src/app/shared/NoteActions.svelte b/src/app/shared/NoteActions.svelte index 3e9d6988..0e8a5264 100644 --- a/src/app/shared/NoteActions.svelte +++ b/src/app/shared/NoteActions.svelte @@ -15,6 +15,7 @@ import CopyValue from "src/partials/CopyValue.svelte" import PersonBadge from "src/app/shared/PersonBadge.svelte" import RelayCard from "src/app/shared/RelayCard.svelte" + import {enableZaps} from "src/agent/settings" import {getEventPublishRelays} from "src/agent/relays" import {getPersonWithFallback} from "src/agent/db" import pool from "src/agent/pool" @@ -126,16 +127,18 @@ })} /> {$likesCount} - + {#if enableZaps} + + {/if}