Limit number of relays to publish zap receipts to
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2024-05-10 13:57:25 +02:00
parent 2d1ff29eca
commit 48041630ca
4 changed files with 42 additions and 6 deletions

View File

@@ -169,6 +169,9 @@ class Setting < RailsSettings::Base
field :nostr_public_key, type: :string,
default: ENV["NOSTR_PUBLIC_KEY"].presence
field :nostr_zaps_relay_limit, type: :integer,
default: 12
#
# OpenCollective
#

View File

@@ -7,8 +7,7 @@ module NostrManager
def call
tags = parse_tags(@zap.request_event.tags)
# TODO limit to 15 or so relays
tags[:relays].each do |relay_url|
tags[:relays].take(Setting.nostr_zaps_relay_limit).each do |relay_url|
if @delayed
NostrPublishEventJob.perform_later(event: @zap.receipt, relay: relay_url)
else

View File

@@ -19,5 +19,15 @@
title: "Public key",
description: "The corresponding public key of the accounts service"
) %>
<% end %>
</ul>
</section>
<section>
<h3>Zaps</h3>
<ul role="list">
<%= render FormElements::FieldsetResettableSettingComponent.new(
key: :nostr_zaps_relay_limit,
title: "Relay limit",
description: "The maximum number of relays to publish zap receipts to"
) %>
</ul>
<% end %>