From 3bf71f6df5b77db4358e0882515db0c587422e25 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 9 Aug 2023 14:26:20 +0800 Subject: [PATCH] feat: config --- main.py | 18 ++++- public/templates/config.html | 143 +++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 public/templates/config.html diff --git a/main.py b/main.py index 0755090..1e165c8 100644 --- a/main.py +++ b/main.py @@ -3,14 +3,17 @@ import traceback import uuid import PIL.Image from httpx import AsyncClient -from fastapi import FastAPI -from starlette.responses import RedirectResponse, StreamingResponse +from fastapi import FastAPI, Query +from fastapi.templating import Jinja2Templates +from starlette.requests import Request +from starlette.responses import RedirectResponse, StreamingResponse, HTMLResponse from utils import gen_url, get_auth app = FastAPI() with open("default.jpg", "rb") as f: default_jpg = io.BytesIO(f.read()) +templates = Jinja2Templates(directory="public/templates") @app.get('/gen') @@ -60,3 +63,14 @@ async def back_to_telegram( return RedirectResponse(f"https://t.me/{username}?start={data['token']}") else: return data + + +@app.get("/config", response_class=HTMLResponse) +async def debug_config_page( + request: Request, + bot_data: str = Query(..., title="bot_data"), +): + user = {"command": "config", "bot_data": bot_data} + return templates.TemplateResponse( + "config.html", {"request": request, "user": user} + ) diff --git a/public/templates/config.html b/public/templates/config.html new file mode 100644 index 0000000..39c9719 --- /dev/null +++ b/public/templates/config.html @@ -0,0 +1,143 @@ + + + + + + Config - Misskey Telegram Bridge + + + + + + + + + + + +
+

Config

+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+ +
+ +
+
+
+ + + + + + + +