summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2026-05-21 20:45:15 +0800
committeraltaf-creator <dev@altafcreator.com>2026-05-21 20:45:15 +0800
commit8fea6e4be4a61cd2bfcb310166fbe6b2541b9ff4 (patch)
tree3e144c0033200ef792b6e4284ac2789d77b18ccb /main.py
parent39c92cd0c75193465ddc7b96e9d8bbe23dff795c (diff)
video and blog
Diffstat (limited to 'main.py')
-rw-r--r--main.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/main.py b/main.py
index 9af3a54..f8e56df 100644
--- a/main.py
+++ b/main.py
@@ -17,6 +17,7 @@ TURNSTILE_SECRET = getenv("CLOUDFLARE_TURNSTILE_SECRET").encode("utf-8")
origins = [
"http://localhost",
+ "http://localhost:9091",
"https://altafcreator.com",
"https://backend.altafcreator.com"
]
@@ -97,4 +98,23 @@ def blogpost_redirect(blogpost: str):
status_code=301
)
+
+@app.get("/video/{video_name}/")
+def video_page(video_name: str):
+ status, html = pages.render_video(video_name)
+
+ if status == 200:
+ return fastapi.responses.Response(content=html, media_type="text/html", status_code=200)
+ else:
+ raise fastapi.HTTPException(status_code=status, detail="Blogpost doesn't exist.")
+
+
+@app.get("/video/{video_name}", include_in_schema=False)
+def video_page_redirect(video_name: str):
+ return fastapi.responses.RedirectResponse(
+ url=f"/video/{video_name}/",
+ status_code=301
+ )
+
+
app.mount("/", fastapi.staticfiles.StaticFiles(directory="./www/", html=True), name="static")