mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-29 18:10:46 +02:00
prettier/black
This commit is contained in:
@ -99,6 +99,7 @@ def chunks(lst, n):
|
|||||||
for i in range(0, len(lst), n):
|
for i in range(0, len(lst), n):
|
||||||
yield lst[i : i + n]
|
yield lst[i : i + n]
|
||||||
|
|
||||||
|
|
||||||
async def create_hash_check(
|
async def create_hash_check(
|
||||||
the_hash: str,
|
the_hash: str,
|
||||||
lnurl_id: str,
|
lnurl_id: str,
|
||||||
@ -120,6 +121,7 @@ async def create_hash_check(
|
|||||||
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
||||||
return HashCheck.from_row(row) if row else None
|
return HashCheck.from_row(row) if row else None
|
||||||
|
|
||||||
|
|
||||||
async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]:
|
async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]:
|
||||||
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
||||||
return HashCheck.from_row(row) if row else None
|
return HashCheck.from_row(row) if row else None
|
@ -95,6 +95,7 @@ async def m002_change_withdraw_table(db):
|
|||||||
)
|
)
|
||||||
await db.execute("DROP TABLE withdraw_links")
|
await db.execute("DROP TABLE withdraw_links")
|
||||||
|
|
||||||
|
|
||||||
async def m003_make_hash_check(db):
|
async def m003_make_hash_check(db):
|
||||||
"""
|
"""
|
||||||
Creates a hash check table.
|
Creates a hash check table.
|
||||||
|
@ -60,9 +60,11 @@ class WithdrawLink(NamedTuple):
|
|||||||
default_description=self.title,
|
default_description=self.title,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HashCheck(NamedTuple):
|
class HashCheck(NamedTuple):
|
||||||
id: str
|
id: str
|
||||||
lnurl_id: str
|
lnurl_id: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_row(cls, row: Row) -> "Hash":
|
def from_row(cls, row: Row) -> "Hash":
|
||||||
return cls(**dict(row))
|
return cls(**dict(row))
|
@ -129,7 +129,6 @@
|
|||||||
dense
|
dense
|
||||||
expand-separator
|
expand-separator
|
||||||
label="Delete a withdraw link"
|
label="Delete a withdraw link"
|
||||||
|
|
||||||
>
|
>
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
@ -149,13 +148,8 @@
|
|||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
<q-expansion-item
|
<q-expansion-item group="api" dense expand-separator label="Get Hash Check">
|
||||||
group="api"
|
<q-card>
|
||||||
dense
|
|
||||||
expand-separator
|
|
||||||
label="Get Hash Check"
|
|
||||||
>
|
|
||||||
<q-card>
|
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<code
|
<code
|
||||||
><span class="text-blue">GET</span>
|
><span class="text-blue">GET</span>
|
||||||
@ -170,20 +164,21 @@ label="Get Hash Check"
|
|||||||
<code>{"status": <bool>}</code>
|
<code>{"status": <bool>}</code>
|
||||||
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
||||||
<code
|
<code
|
||||||
>curl -X GET {{ request.url_root }}api/v1/links/<the_hash>/<lnurl_id> -H
|
>curl -X GET {{ request.url_root
|
||||||
"X-Api-Key: {{ g.user.wallets[0].inkey }}"
|
}}api/v1/links/<the_hash>/<lnurl_id> -H "X-Api-Key: {{
|
||||||
|
g.user.wallets[0].inkey }}"
|
||||||
</code>
|
</code>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
group="api"
|
group="api"
|
||||||
dense
|
dense
|
||||||
expand-separator
|
expand-separator
|
||||||
label="Get image to embed"
|
label="Get image to embed"
|
||||||
class="q-pb-md"
|
class="q-pb-md"
|
||||||
>
|
>
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<code
|
<code
|
||||||
><span class="text-blue">GET</span>
|
><span class="text-blue">GET</span>
|
||||||
@ -194,8 +189,6 @@ class="q-pb-md"
|
|||||||
>curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
|
>curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
|
||||||
</code>
|
</code>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
</q-expansion-item>
|
||||||
</q-expansion-item>
|
</q-expansion-item>
|
||||||
</q-expansion-item>
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ async def api_link_delete(link_id):
|
|||||||
|
|
||||||
return "", HTTPStatus.NO_CONTENT
|
return "", HTTPStatus.NO_CONTENT
|
||||||
|
|
||||||
|
|
||||||
@withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"])
|
@withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"])
|
||||||
@api_check_wallet_key("invoice")
|
@api_check_wallet_key("invoice")
|
||||||
async def api_hash_retrieve(the_hash, lnurl_id):
|
async def api_hash_retrieve(the_hash, lnurl_id):
|
||||||
|
Reference in New Issue
Block a user