mirror of
https://github.com/lnbits/lnbits.git
synced 2025-08-09 01:32:14 +02:00
feat: display mint name
This commit is contained in:
11
lnbits/db.py
11
lnbits/db.py
@@ -125,6 +125,8 @@ class Database(Compat):
|
|||||||
import psycopg2 # type: ignore
|
import psycopg2 # type: ignore
|
||||||
|
|
||||||
def _parse_timestamp(value, _):
|
def _parse_timestamp(value, _):
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
f = "%Y-%m-%d %H:%M:%S.%f"
|
f = "%Y-%m-%d %H:%M:%S.%f"
|
||||||
if not "." in value:
|
if not "." in value:
|
||||||
f = "%Y-%m-%d %H:%M:%S"
|
f = "%Y-%m-%d %H:%M:%S"
|
||||||
@@ -149,14 +151,7 @@ class Database(Compat):
|
|||||||
|
|
||||||
psycopg2.extensions.register_type(
|
psycopg2.extensions.register_type(
|
||||||
psycopg2.extensions.new_type(
|
psycopg2.extensions.new_type(
|
||||||
(1184, 1114),
|
(1184, 1114), "TIMESTAMP2INT", _parse_timestamp
|
||||||
"TIMESTAMP2INT",
|
|
||||||
_parse_timestamp
|
|
||||||
# lambda value, curs: time.mktime(
|
|
||||||
# datetime.datetime.strptime(
|
|
||||||
# value, "%Y-%m-%d %H:%M:%S.%f"
|
|
||||||
# ).timetuple()
|
|
||||||
# ),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
{% extends "public.html" %} {% block toolbar_title %} {% raw %} {{name}} Cashu
|
{% extends "public.html" %} {% block toolbar_title %} {% raw %} Cashu {% endraw
|
||||||
{% endraw %} {% endblock %} {% block footer %}{% endblock %} {% block
|
%} - {{mint_name}} {% endblock %} {% block footer %}{% endblock %} {% block
|
||||||
page_container %}
|
page_container %}
|
||||||
<q-page-container>
|
<q-page-container>
|
||||||
<q-page>
|
<q-page>
|
||||||
|
@@ -27,11 +27,17 @@ async def index(
|
|||||||
|
|
||||||
@cashu_ext.get("/wallet")
|
@cashu_ext.get("/wallet")
|
||||||
async def wallet(request: Request, mint_id: str):
|
async def wallet(request: Request, mint_id: str):
|
||||||
|
cashu = await get_cashu(mint_id)
|
||||||
|
if not cashu:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTPStatus.NOT_FOUND, detail="Mint does not exist."
|
||||||
|
)
|
||||||
return cashu_renderer().TemplateResponse(
|
return cashu_renderer().TemplateResponse(
|
||||||
"cashu/wallet.html",
|
"cashu/wallet.html",
|
||||||
{
|
{
|
||||||
"request": request,
|
"request": request,
|
||||||
"web_manifest": f"/cashu/manifest/{mint_id}.webmanifest",
|
"web_manifest": f"/cashu/manifest/{mint_id}.webmanifest",
|
||||||
|
"mint_name": cashu.name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -41,7 +47,7 @@ async def cashu(request: Request, mintID):
|
|||||||
cashu = await get_cashu(mintID)
|
cashu = await get_cashu(mintID)
|
||||||
if not cashu:
|
if not cashu:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="Mint does not exist."
|
||||||
)
|
)
|
||||||
return cashu_renderer().TemplateResponse(
|
return cashu_renderer().TemplateResponse(
|
||||||
"cashu/mint.html",
|
"cashu/mint.html",
|
||||||
@@ -54,7 +60,7 @@ async def manifest(cashu_id: str):
|
|||||||
cashu = await get_cashu(cashu_id)
|
cashu = await get_cashu(cashu_id)
|
||||||
if not cashu:
|
if not cashu:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="Mint does not exist."
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user