Use respond_to for request formats
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Râu Cao 2023-06-13 12:30:38 +02:00
parent 07fe8dba71
commit 332ad757a5
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -17,11 +17,12 @@ 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)
if params[:format] == "svg"
format.svg do
qr_svg = qr_code.as_svg(
color: "000",
shape_rendering: "crispEdges",
@ -37,7 +38,8 @@ class Services::LightningController < ApplicationController
filename: "bitcoin-lightning-#{current_user.address}.svg",
type: "image/svg+xml"
)
elsif params[:format] == "png"
end
format.png do
qr_png = qr_code.as_png(
fill: "white",
color: "black",
@ -48,8 +50,7 @@ class Services::LightningController < ApplicationController
filename: "bitcoin-lightning-#{current_user.address}.png",
type: "image/png"
)
else
http_status :not_found
end
end
end