From f2507409a30aaad990ab3d0a3a6b04afe7c01b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 31 Mar 2024 12:11:06 +0300 Subject: [PATCH] Announce nostr pubkey on lnurlp endpoint --- app/controllers/lnurlpay_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/lnurlpay_controller.rb b/app/controllers/lnurlpay_controller.rb index 0ca11be..bc595bc 100644 --- a/app/controllers/lnurlpay_controller.rb +++ b/app/controllers/lnurlpay_controller.rb @@ -8,7 +8,7 @@ class LnurlpayController < ApplicationController # GET /.well-known/lnurlp/:username def index - render json: { + res = { status: "OK", callback: "https://#{Setting.accounts_domain}/lnurlpay/#{@user.cn}/invoice", tag: "payRequest", @@ -17,6 +17,13 @@ class LnurlpayController < ApplicationController metadata: metadata(@user.address), commentAllowed: MAX_COMMENT_CHARS } + + if Setting.nostr_enabled? && Setting.nostr_private_key.present? + res[:allows_nostr] = true + res[:nostrPubkey] = Setting.nostr_public_key + end + + render json: res end # GET /.well-known/keysend/:username