Use respond_to for request formats
This commit is contained in:
parent
07fe8dba71
commit
332ad757a5
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user