Update views_api.py

This commit is contained in:
Arc 2020-02-24 19:12:49 +00:00 committed by GitHub
parent 63ac385c59
commit 36ba680a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,9 +32,12 @@ 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.replace("http://", "https://"))}), 200
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"])
@ -52,11 +55,12 @@ def api_lnurlfetch(parstr, urlstr, rand):
k1str = uuid.uuid4().hex
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)
else:
precallback=precallback.replace("http://", "https://")
precallback = url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand)
if "onion" in precallback:
print(precallback)
else:
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.replace("http://", "https://"))}), 200
else:
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(TorUrl(url))}), 200
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url)}), 200
print(url)
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200