Add own relay to NIP-05 relay list if configured
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user