AstraOS commited on
Commit
64931bf
Β·
verified Β·
1 Parent(s): f8fc43d

Update telegram_preview.py

Browse files
Files changed (1) hide show
  1. telegram_preview.py +13 -1
telegram_preview.py CHANGED
@@ -17,12 +17,24 @@ from typing import Optional
17
  from fastapi import APIRouter, Response, Request
18
  from fastapi.responses import HTMLResponse, StreamingResponse
19
  from fastapi.templating import Jinja2Templates
 
 
20
 
21
  # ─── Locate templates folder absolute path ────────────────────────────────────
22
  BASE_DIR = Path(__file__).resolve().parent
23
  templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
24
 
25
-
 
 
 
 
 
 
 
 
 
 
26
  # ─── Environment ───────────────────────────────────────────────────────────────
27
  TOKEN = os.getenv("BOT_TOKEN")
28
  FALLBACK_IMG = "https://telegram.org/img/t_logo.png"
 
17
  from fastapi import APIRouter, Response, Request
18
  from fastapi.responses import HTMLResponse, StreamingResponse
19
  from fastapi.templating import Jinja2Templates
20
+ from fastapi.staticfiles import StaticFiles # NEW
21
+
22
 
23
  # ─── Locate templates folder absolute path ────────────────────────────────────
24
  BASE_DIR = Path(__file__).resolve().parent
25
  templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
26
 
27
+ def include_in_app(app):
28
+ """
29
+ Helper so the main application can pull in both router *and* static mount.
30
+ """
31
+ app.include_router(router)
32
+ app.mount(
33
+ "/static",
34
+ StaticFiles(directory=str(BASE_DIR / "static")),
35
+ name="static",
36
+ )
37
+
38
  # ─── Environment ───────────────────────────────────────────────────────────────
39
  TOKEN = os.getenv("BOT_TOKEN")
40
  FALLBACK_IMG = "https://telegram.org/img/t_logo.png"