Take portfolio offline with blank pages and blocked API routes
This commit is contained in:
+16
-1
@@ -61,7 +61,10 @@ app = FastAPI(
|
||||
title="Alex Herlan Portfolio API",
|
||||
description="Supabase-ready content and contact delivery for Alex Herlan's portfolio.",
|
||||
version="1.1.0",
|
||||
lifespan=media_cleanup.lifespan,
|
||||
# The website is offline; do not start background storage cleanup.
|
||||
docs_url=None,
|
||||
redoc_url=None,
|
||||
openapi_url=None,
|
||||
)
|
||||
|
||||
origins = [
|
||||
@@ -78,6 +81,18 @@ app.add_middleware(
|
||||
)
|
||||
|
||||
|
||||
@app.middleware("http")
|
||||
async def site_offline(request: Request, call_next) -> Response:
|
||||
"""Keep every page, API, and file unavailable without deleting stored data."""
|
||||
return Response(
|
||||
# A minimal document avoids the browser's built-in error screen.
|
||||
content="<!doctype html><html><head><title></title></head><body></body></html>",
|
||||
status_code=410,
|
||||
media_type="text/html",
|
||||
headers={"Cache-Control": "no-store", "X-Robots-Tag": "noindex, nofollow"},
|
||||
)
|
||||
|
||||
|
||||
class ContactPayload(BaseModel):
|
||||
name: str = Field(min_length=2, max_length=100)
|
||||
email: EmailStr
|
||||
|
||||
Reference in New Issue
Block a user