Fix some specs, improve config
Allow empty string to unset nostr relay URL config
This commit is contained in:
parent
3284bbf6ca
commit
b91d90d75c
@ -4,7 +4,7 @@ class WellKnownController < ApplicationController
|
|||||||
def nostr
|
def nostr
|
||||||
http_status :unprocessable_entity and return if params[:name].blank?
|
http_status :unprocessable_entity and return if params[:name].blank?
|
||||||
domain = request.headers["X-Forwarded-Host"].presence || Setting.primary_domain
|
domain = request.headers["X-Forwarded-Host"].presence || Setting.primary_domain
|
||||||
relay_url = Setting.nostr_relay_url
|
relay_url = Setting.nostr_relay_url.presence
|
||||||
|
|
||||||
if params[:name] == "_"
|
if params[:name] == "_"
|
||||||
# pubkey for the primary domain without a username (e.g. kosmos.org)
|
# pubkey for the primary domain without a username (e.g. kosmos.org)
|
||||||
|
@ -47,6 +47,10 @@ RSpec.describe "Well-known URLs", type: :request do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "without relay configured" do
|
context "without relay configured" do
|
||||||
|
before do
|
||||||
|
Setting.nostr_relay_url = ""
|
||||||
|
end
|
||||||
|
|
||||||
it "does not include a recommended relay" do
|
it "does not include a recommended relay" do
|
||||||
get "/.well-known/nostr.json?name=bobdylan"
|
get "/.well-known/nostr.json?name=bobdylan"
|
||||||
res = JSON.parse(response.body)
|
res = JSON.parse(response.body)
|
||||||
|
@ -4,6 +4,10 @@ RSpec.describe NostrManager::PublishZapReceipt, type: :model do
|
|||||||
let(:user) { create :user, ln_account: "123456abcdef" }
|
let(:user) { create :user, ln_account: "123456abcdef" }
|
||||||
let(:zap) { create :zap, user: user }
|
let(:zap) { create :zap, user: user }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Setting.nostr_relay_url = ""
|
||||||
|
end
|
||||||
|
|
||||||
describe "Default/delayed execution" do
|
describe "Default/delayed execution" do
|
||||||
it "publishes zap receipts to all requested relays" do
|
it "publishes zap receipts to all requested relays" do
|
||||||
expect(NostrPublishEventJob).to receive(:perform_later)
|
expect(NostrPublishEventJob).to receive(:perform_later)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user