mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-27 20:36:16 +02:00
lndhub: fix "token" -> "refresh_token".
This commit is contained in:
@@ -17,7 +17,13 @@ from ..tasks import sse_listeners
|
|||||||
@api_check_wallet_key("invoice")
|
@api_check_wallet_key("invoice")
|
||||||
async def api_wallet():
|
async def api_wallet():
|
||||||
return (
|
return (
|
||||||
jsonify({"id": g.wallet.id, "name": g.wallet.name, "balance": g.wallet.balance_msat,}),
|
jsonify(
|
||||||
|
{
|
||||||
|
"id": g.wallet.id,
|
||||||
|
"name": g.wallet.name,
|
||||||
|
"balance": g.wallet.balance_msat,
|
||||||
|
}
|
||||||
|
),
|
||||||
HTTPStatus.OK,
|
HTTPStatus.OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -28,8 +28,8 @@ async def lndhub_getinfo():
|
|||||||
)
|
)
|
||||||
async def lndhub_auth():
|
async def lndhub_auth():
|
||||||
token = (
|
token = (
|
||||||
g.data["token"]
|
g.data["refresh_token"]
|
||||||
if "token" in g.data and g.data["token"]
|
if "refresh_token" in g.data and g.data["refresh_token"]
|
||||||
else urlsafe_b64encode((g.data["login"] + ":" + g.data["password"]).encode("utf-8")).decode("ascii")
|
else urlsafe_b64encode((g.data["login"] + ":" + g.data["password"]).encode("utf-8")).decode("ascii")
|
||||||
)
|
)
|
||||||
return jsonify({"refresh_token": token, "access_token": token})
|
return jsonify({"refresh_token": token, "access_token": token})
|
||||||
|
@@ -37,7 +37,12 @@ class LndRestWallet(Wallet):
|
|||||||
else:
|
else:
|
||||||
data["memo"] = memo or ""
|
data["memo"] = memo or ""
|
||||||
|
|
||||||
r = httpx.post(url=f"{self.endpoint}/v1/invoices", headers=self.auth_invoice, verify=self.auth_cert, json=data,)
|
r = httpx.post(
|
||||||
|
url=f"{self.endpoint}/v1/invoices",
|
||||||
|
headers=self.auth_invoice,
|
||||||
|
verify=self.auth_cert,
|
||||||
|
json=data,
|
||||||
|
)
|
||||||
|
|
||||||
if r.is_error:
|
if r.is_error:
|
||||||
error_message = r.text
|
error_message = r.text
|
||||||
@@ -78,7 +83,9 @@ class LndRestWallet(Wallet):
|
|||||||
def get_invoice_status(self, checking_id: str) -> PaymentStatus:
|
def get_invoice_status(self, checking_id: str) -> PaymentStatus:
|
||||||
checking_id = checking_id.replace("_", "/")
|
checking_id = checking_id.replace("_", "/")
|
||||||
r = httpx.get(
|
r = httpx.get(
|
||||||
url=f"{self.endpoint}/v1/invoice/{checking_id}", headers=self.auth_invoice, verify=self.auth_cert,
|
url=f"{self.endpoint}/v1/invoice/{checking_id}",
|
||||||
|
headers=self.auth_invoice,
|
||||||
|
verify=self.auth_cert,
|
||||||
)
|
)
|
||||||
|
|
||||||
if r.is_error or not r.json().get("settled"):
|
if r.is_error or not r.json().get("settled"):
|
||||||
|
Reference in New Issue
Block a user