Compare commits
No commits in common. "7489d4a32fa3d0dcbecfb03a60ab5f7db6a2f7e8" and "4909dac5c2ac8701a9f3daa5c2efe7e8bbbf521d" have entirely different histories.
7489d4a32f
...
4909dac5c2
@ -10,14 +10,8 @@ class WellKnownController < ApplicationController
|
||||
relay_url = Setting.nostr_relay_url.presence
|
||||
|
||||
if params[:name] == "_"
|
||||
if domain == Setting.primary_domain
|
||||
# pubkey for the primary domain without a username (e.g. kosmos.org)
|
||||
res = { names: { "_": Setting.nostr_public_key_primary_domain || Setting.nostr_public_key } }
|
||||
else
|
||||
# pubkey for the akkounts domain without a username (e.g. accounts.kosmos.org)
|
||||
res = { names: { "_": Setting.nostr_public_key } }
|
||||
end
|
||||
|
||||
# pubkey for the primary domain without a username (e.g. kosmos.org)
|
||||
res = { names: { "_": Setting.nostr_public_key } }
|
||||
res[:relays] = { "_" => [ relay_url ] } if relay_url
|
||||
else
|
||||
@user = User.where(cn: params[:name], ou: domain).first
|
||||
|
||||
@ -12,9 +12,6 @@ module Settings
|
||||
field :nostr_public_key, type: :string,
|
||||
default: ENV["NOSTR_PUBLIC_KEY"].presence
|
||||
|
||||
field :nostr_public_key_primary_domain, type: :string,
|
||||
default: ENV["NOSTR_PUBLIC_KEY_PRIMARY_DOMAIN"].presence
|
||||
|
||||
field :nostr_relay_url, type: :string,
|
||||
default: ENV["NOSTR_RELAY_URL"].presence
|
||||
|
||||
|
||||
@ -19,11 +19,6 @@
|
||||
title: "Public key",
|
||||
description: "The corresponding public key of the accounts service"
|
||||
) %>
|
||||
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||
key: :nostr_public_key_primary_domain,
|
||||
title: "Public key for primary domain (NIP-05)",
|
||||
description: "(optional) A different pubkey to announce for the _@#{Setting.primary_domain} Nostr address"
|
||||
) %>
|
||||
<%= render FormElements::FieldsetResettableSettingComponent.new(
|
||||
key: :nostr_relay_url,
|
||||
title: "Relay URL",
|
||||
|
||||
@ -79,36 +79,10 @@ RSpec.describe "Well-known URLs", type: :request do
|
||||
end
|
||||
|
||||
describe "placeholder username for domain's own pubkey" do
|
||||
describe "for primary domain" do
|
||||
context "no different pubkey configured for primary domain" do
|
||||
it "returns the akkounts nostr pubkey" do
|
||||
get "/.well-known/nostr.json?name=_"
|
||||
res = JSON.parse(response.body)
|
||||
expect(res["names"]["_"]).to eq("bdd76ce2934b2f591f9fad2ebe9da18f20d2921de527494ba00eeaa0a0efadcf")
|
||||
end
|
||||
end
|
||||
|
||||
context "different pubkey configured for primary domain" do
|
||||
before do
|
||||
Setting.nostr_public_key_primary_domain = "b3e8f62fbe41217ffc0aa1e178d297339932d8ba4f46d9c7df3b61575e78fecc"
|
||||
end
|
||||
|
||||
it "returns the primary domain's nostr pubkey" do
|
||||
get "/.well-known/nostr.json?name=_"
|
||||
res = JSON.parse(response.body)
|
||||
expect(res["names"]["_"]).to eq("b3e8f62fbe41217ffc0aa1e178d297339932d8ba4f46d9c7df3b61575e78fecc")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "for akkounts domain" do
|
||||
it "returns the configured nostr pubkey" do
|
||||
headers = { "X-Forwarded-Host" => "accounts.kosmos.org" }
|
||||
get "/.well-known/nostr.json?name=_"
|
||||
|
||||
res = JSON.parse(response.body)
|
||||
expect(res["names"]["_"]).to eq("bdd76ce2934b2f591f9fad2ebe9da18f20d2921de527494ba00eeaa0a0efadcf")
|
||||
end
|
||||
it "returns the configured nostr pubkey" do
|
||||
get "/.well-known/nostr.json?name=_"
|
||||
res = JSON.parse(response.body)
|
||||
expect(res["names"]["_"]).to eq(Setting.nostr_public_key)
|
||||
end
|
||||
|
||||
context "with relay configured" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user