swanky admin console

This commit is contained in:
UnitedAirforce
2025-09-22 07:54:57 +08:00
parent e154c8f5e0
commit b46832b4dd
7 changed files with 1109 additions and 6 deletions
+10 -1
View File
@@ -1,5 +1,5 @@
import sqlalchemy
from sqlalchemy import Table, Column, Integer, String, DateTime
from sqlalchemy import Table, Column, Integer, String, DateTime, Boolean
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy import select, update
@@ -96,6 +96,15 @@ batch_token = Table(
Column("expire_at", Integer, default=int(time.time()) + 1800),
)
admins = Table(
"admins",
metadata,
Column("id", Integer, primary_key=True, autoincrement=True),
Column("username", String(32), unique=True, nullable=False),
Column("password", String(64), nullable=False),
Column("token", String(256), unique=True, nullable=True)
)
async def init_db():
global redis
if not os.path.exists(DB_PATH):