Update views_api.py
This commit is contained in:
parent
63ac385c59
commit
36ba680a5d
|
@ -32,9 +32,12 @@ def api_lnurlencode(urlstr, parstr):
|
||||||
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=urlstr, parstr=parstr, rand=rand)
|
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=urlstr, parstr=parstr, rand=rand)
|
||||||
|
|
||||||
if "onion" in url:
|
if "onion" in url:
|
||||||
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(TorUrl(url))}), 200
|
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url)}), 200
|
||||||
else:
|
print(url)
|
||||||
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
|
|
||||||
|
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@withdraw_ext.route("/api/v1/lnurlfetch/<urlstr>/<parstr>/<rand>", methods=["GET"])
|
@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
|
k1str = uuid.uuid4().hex
|
||||||
withdraw_ext_db.execute("UPDATE withdraws SET withdrawals = ? WHERE uni = ?", (k1str, parstr,))
|
withdraw_ext_db.execute("UPDATE withdraws SET withdrawals = ? WHERE uni = ?", (k1str, parstr,))
|
||||||
|
|
||||||
precallback=url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand)
|
precallback = url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand)
|
||||||
if "onion" in precallback:
|
|
||||||
precallback=TorUrl(precallback)
|
if "onion" in precallback:
|
||||||
else:
|
print(precallback)
|
||||||
precallback=precallback.replace("http://", "https://")
|
else:
|
||||||
|
precallback = url_for("withdraw.api_lnurlwithdraw", _external=True, rand=rand).replace("http://", "https://")
|
||||||
|
|
||||||
res = LnurlWithdrawResponse(
|
res = LnurlWithdrawResponse(
|
||||||
callback=precallback,
|
callback=precallback,
|
||||||
|
@ -188,8 +192,10 @@ def api_lnurlmaker():
|
||||||
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=request.host, parstr=uni, rand=rand)
|
url = url_for("withdraw.api_lnurlfetch", _external=True, urlstr=request.host, parstr=uni, rand=rand)
|
||||||
|
|
||||||
if "onion" in url:
|
if "onion" in url:
|
||||||
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
|
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url)}), 200
|
||||||
else:
|
print(url)
|
||||||
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(TorUrl(url))}), 200
|
|
||||||
|
return jsonify({"status": "TRUE", "lnurl": lnurl_encode(url.replace("http://", "https://"))}), 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user