Add own relay to NIP-05 relay list if configured

This commit is contained in:
2024-06-19 20:06:07 +02:00
parent 926dc06294
commit 87d900b627
2 changed files with 32 additions and 3 deletions

View File

@@ -5,11 +5,19 @@ class WellKnownController < ApplicationController
@user = User.where(cn: params[:name], ou: domain).first
http_status :not_found and return if @user.nil? || @user.nostr_pubkey.blank?
res = {
names: { "#{@user.cn}": @user.nostr_pubkey }
}
if Setting.nostr_relay_url
res[:relays] = {
@user.nostr_pubkey => [ Setting.nostr_relay_url ]
}
end
respond_to do |format|
format.json do
render json: {
names: { "#{@user.cn}": @user.nostr_pubkey }
}.to_json
render json: res.to_json
end
end
end