Add Discord IP retrieval

This commit is contained in:
Joakim Hellsén 2026-08-09 03:25:03 +02:00
commit acf9f187f0
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
10 changed files with 821 additions and 4 deletions

29
src/e/main.py Normal file
View file

@ -0,0 +1,29 @@
import uvicorn
from litestar import Litestar
from litestar import get
@get("/")
async def twitter() -> dict[str, str]: # ruff: ignore[unused-async]
"""Handle Twitter requests.
https://twitter.com/DiscussingFilm/status/2086143411984208230
https://e.lovinator.space/DiscussingFilm/status/2086143411984208230
If IP is from Discord:
Download the image/video.
Return custom HTML with metadata tags with the image/video.
Otherwise:
Redirect to the original URL.
Returns:
Redirect to the original URL, or custom HTML with metadata tags.
"""
return {"message": "Hello, World!"}
app = Litestar(route_handlers=[twitter])
if __name__ == "__main__":
uvicorn.run(app)