forked from Rockachopa/Timmy-time-dashboard
feat: code quality audit + autoresearch integration + infra hardening (#150)
This commit is contained in:
committed by
GitHub
parent
fd0ede0d51
commit
ae3bb1cc21
@@ -25,26 +25,42 @@ async def lightning_ledger(request: Request):
|
||||
"pending_incoming_sats": 0,
|
||||
"pending_outgoing_sats": 0,
|
||||
}
|
||||
|
||||
|
||||
# Mock transactions
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class TxType(Enum):
|
||||
incoming = "incoming"
|
||||
outgoing = "outgoing"
|
||||
|
||||
|
||||
class TxStatus(Enum):
|
||||
completed = "completed"
|
||||
pending = "pending"
|
||||
|
||||
Tx = namedtuple("Tx", ["tx_type", "status", "amount_sats", "payment_hash", "memo", "created_at"])
|
||||
|
||||
|
||||
Tx = namedtuple(
|
||||
"Tx", ["tx_type", "status", "amount_sats", "payment_hash", "memo", "created_at"]
|
||||
)
|
||||
|
||||
transactions = [
|
||||
Tx(TxType.outgoing, TxStatus.completed, 50, "hash1", "Model inference", "2026-03-04 10:00:00"),
|
||||
Tx(TxType.incoming, TxStatus.completed, 1000, "hash2", "Manual deposit", "2026-03-03 15:00:00"),
|
||||
Tx(
|
||||
TxType.outgoing,
|
||||
TxStatus.completed,
|
||||
50,
|
||||
"hash1",
|
||||
"Model inference",
|
||||
"2026-03-04 10:00:00",
|
||||
),
|
||||
Tx(
|
||||
TxType.incoming,
|
||||
TxStatus.completed,
|
||||
1000,
|
||||
"hash2",
|
||||
"Manual deposit",
|
||||
"2026-03-03 15:00:00",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
return templates.TemplateResponse(
|
||||
request,
|
||||
"ledger.html",
|
||||
@@ -84,9 +100,16 @@ async def mission_control(request: Request):
|
||||
|
||||
@router.get("/bugs", response_class=HTMLResponse)
|
||||
async def bugs_page(request: Request):
|
||||
return templates.TemplateResponse(request, "bugs.html", {
|
||||
"bugs": [], "total": 0, "stats": {}, "filter_status": None,
|
||||
})
|
||||
return templates.TemplateResponse(
|
||||
request,
|
||||
"bugs.html",
|
||||
{
|
||||
"bugs": [],
|
||||
"total": 0,
|
||||
"stats": {},
|
||||
"filter_status": None,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@router.get("/self-coding", response_class=HTMLResponse)
|
||||
@@ -109,14 +132,17 @@ async def api_notifications():
|
||||
"""Return recent system events for the notification dropdown."""
|
||||
try:
|
||||
from spark.engine import spark_engine
|
||||
|
||||
events = spark_engine.get_timeline(limit=20)
|
||||
return JSONResponse([
|
||||
{
|
||||
"event_type": e.event_type,
|
||||
"title": getattr(e, "description", e.event_type),
|
||||
"timestamp": str(getattr(e, "timestamp", "")),
|
||||
}
|
||||
for e in events
|
||||
])
|
||||
return JSONResponse(
|
||||
[
|
||||
{
|
||||
"event_type": e.event_type,
|
||||
"title": getattr(e, "description", e.event_type),
|
||||
"timestamp": str(getattr(e, "timestamp", "")),
|
||||
}
|
||||
for e in events
|
||||
]
|
||||
)
|
||||
except Exception:
|
||||
return JSONResponse([])
|
||||
|
||||
Reference in New Issue
Block a user