Offer LNURL QR code for download on Lightning info page #135

Merged
raucao merged 5 commits from feature/lightning_donation_qr_codes into master 2023-06-20 16:44:59 +00:00
Showing only changes of commit d922e7f869 - Show all commits

View File

@@ -17,11 +17,11 @@ class Services::LightningController < ApplicationController
end
def qr_lnurlp
respond_to do |format|
lnurlp_url = "https://kosmos.org/.well-known/lnurlp/#{current_user.cn}"
lnurlp_bech32 = Lnurl.new(lnurlp_url).to_bech32
qr_code = RQRCode::QRCode.new("lightning:" + lnurlp_bech32)
lnurlp_url = "https://kosmos.org/.well-known/lnurlp/#{current_user.cn}"
lnurlp_bech32 = Lnurl.new(lnurlp_url).to_bech32
qr_code = RQRCode::QRCode.new("lightning:" + lnurlp_bech32)
respond_to do |format|
raucao marked this conversation as resolved Outdated
Outdated
Review

why don't you use respond_to here?

why don't you use `respond_to` here?

Good question. Should've done so to begin with. Refactored and pushed.

Good question. Should've done so to begin with. Refactored and pushed.
Outdated
Review

I'd move the logic out of this block and only have

lnurlp_url = "https://kosmos.org/.well-known/lnurlp/#{current_user.cn}"
lnurlp_bech32 = Lnurl.new(lnurlp_url).to_bech32
qr_code = RQRCode::QRCode.new("lightning:" + lnurlp_bech32)
      
respond_to do |format|
  format.svg ...
  format.png ...
end
I'd move the logic out of this block and only have ``` lnurlp_url = "https://kosmos.org/.well-known/lnurlp/#{current_user.cn}" lnurlp_bech32 = Lnurl.new(lnurlp_url).to_bech32 qr_code = RQRCode::QRCode.new("lightning:" + lnurlp_bech32) respond_to do |format| format.svg ... format.png ... end ```
format.svg do
qr_svg = qr_code.as_svg(
color: "000",