Browse Source

Update views_api.py

fee_issues
Arc 5 years ago
committed by GitHub
parent
commit
36ba680a5d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      lnbits/extensions/withdraw/views_api.py

18
lnbits/extensions/withdraw/views_api.py

@ -32,11 +32,14 @@ def api_lnurlencode(urlstr, parstr):
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=urlstr, parstr=parstr, rand=rand)
if "onion" in url:
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(TorUrl(url))}), 200
else:
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url)}), 200
print(url)
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
@withdraw_ext.route("/api/v1/lnurlfetch/<urlstr>/<parstr>/<rand>", methods=["GET"])
def api_lnurlfetch(parstr, urlstr, rand):
"""Returns LNURL json."""
@ -53,10 +56,11 @@ def api_lnurlfetch(parstr, urlstr, rand):
withdraw_ext_db.execute("UPDATE withdraws SET withdrawals = ? WHERE uni = ?", (k1str, parstr,))
precallback = url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand)
if "onion" in precallback:
precallback=TorUrl(precallback)
print(precallback)
else:
precallback=precallback.replace("http://", "https://")
precallback = url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand).replace("http://", "https://")
res = LnurlWithdrawResponse(
callback=precallback,
@ -188,8 +192,10 @@ def api_lnurlmaker():
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=request.host, parstr=uni, rand=rand)
if "onion" in url:
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url)}), 200
print(url)
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
else:
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(TorUrl(url))}), 200

Loading…
Cancel
Save