Take portfolio offline with blank pages and blocked API routes
This commit is contained in:
@@ -1,5 +1,19 @@
|
|||||||
# Alex Herlan Portfolio
|
# Alex Herlan Portfolio
|
||||||
|
|
||||||
|
## Website offline
|
||||||
|
|
||||||
|
The website is intentionally blank. The backend returns blank HTML with HTTP 410
|
||||||
|
for every route, including APIs, resume downloads, and static files,
|
||||||
|
with caching disabled and a `noindex` header. Background cleanup and scheduled
|
||||||
|
jobs are disabled. The frontend builds only a blank HTML page without assets.
|
||||||
|
Vercel routes all requests through the same offline backend.
|
||||||
|
|
||||||
|
Deploy the updated `main` branch and restart the production backend to apply
|
||||||
|
this shutdown. Pushing to Git alone does not stop an already-running server.
|
||||||
|
Source history and stored content are retained; reverting the shutdown commit
|
||||||
|
and redeploying restores the application. The documentation below describes
|
||||||
|
the original application when it is online.
|
||||||
|
|
||||||
A custom React and FastAPI portfolio built from Alex Herlan's résumé. The interface uses hand-written CSS—no Tailwind or component library. Profile, career, and skill content comes from JSON; journal articles use Supabase through FastAPI with a local JSON fallback.
|
A custom React and FastAPI portfolio built from Alex Herlan's résumé. The interface uses hand-written CSS—no Tailwind or component library. Profile, career, and skill content comes from JSON; journal articles use Supabase through FastAPI with a local JSON fallback.
|
||||||
|
|
||||||
## Project structure
|
## Project structure
|
||||||
|
|||||||
+16
-1
@@ -61,7 +61,10 @@ app = FastAPI(
|
|||||||
title="Alex Herlan Portfolio API",
|
title="Alex Herlan Portfolio API",
|
||||||
description="Supabase-ready content and contact delivery for Alex Herlan's portfolio.",
|
description="Supabase-ready content and contact delivery for Alex Herlan's portfolio.",
|
||||||
version="1.1.0",
|
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 = [
|
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):
|
class ContactPayload(BaseModel):
|
||||||
name: str = Field(min_length=2, max_length=100)
|
name: str = Field(min_length=2, max_length=100)
|
||||||
email: EmailStr
|
email: EmailStr
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
"""Verify the intentional shutdown blocks content and storage side effects."""
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
from backend import main
|
||||||
|
|
||||||
|
|
||||||
|
class OfflineTests(unittest.TestCase):
|
||||||
|
def test_all_routes_and_methods_return_blank_gone(self):
|
||||||
|
paths = [
|
||||||
|
"/", "/experience", "/blog/example", "/api/profile",
|
||||||
|
"/api/experience", "/api/posts", "/api/health", "/api/resume",
|
||||||
|
"/api/auth/login", "/api/contact", "/api/cron/media-cleanup",
|
||||||
|
"/api/resume?v=resume-v25", "/resumes/resume-v25.pdf",
|
||||||
|
"/api/uploads/" + "a" * 32, "/alexander-herlan.png",
|
||||||
|
"/assets/old.js", "/docs", "/openapi.json", "/missing",
|
||||||
|
]
|
||||||
|
with patch.object(main, "get_supabase") as storage, \
|
||||||
|
patch.object(main, "read_data") as data, \
|
||||||
|
patch.object(main, "deliver_contact_email") as email, \
|
||||||
|
patch.object(main.media_cleanup, "cleanup_pending") as cleanup, \
|
||||||
|
TestClient(main.app) as client:
|
||||||
|
for method in ("GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"):
|
||||||
|
for path in paths:
|
||||||
|
with self.subTest(method=method, path=path):
|
||||||
|
response = client.request(method, path)
|
||||||
|
self.assertEqual(response.status_code, 410)
|
||||||
|
expected = b"<!doctype html><html><head><title></title></head><body></body></html>"
|
||||||
|
self.assertEqual(response.content, b"" if method == "HEAD" else expected)
|
||||||
|
self.assertEqual(response.headers["cache-control"], "no-store")
|
||||||
|
self.assertEqual(response.headers["x-robots-tag"], "noindex, nofollow")
|
||||||
|
storage.assert_not_called()
|
||||||
|
data.assert_not_called()
|
||||||
|
email.assert_not_called()
|
||||||
|
cleanup.assert_not_called()
|
||||||
|
|
||||||
|
def test_vercel_has_no_static_bypass_or_scheduled_jobs(self):
|
||||||
|
config = json.loads((main.PROJECT_DIR / "vercel.json").read_text(encoding="utf-8"))
|
||||||
|
self.assertEqual(config["routes"], [{"src": "/.*", "dest": "/api/index.py"}])
|
||||||
|
self.assertEqual(config["crons"], [])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
+3
-32
@@ -3,37 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="google-site-verification" content="ebCvzTpckwFmDSYoFlfRB-z4aqOKKDP5ngtG1iNs4J0" />
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
<meta
|
<title></title>
|
||||||
name="description"
|
|
||||||
content="Alex Herlan is a senior software engineer building full-stack products, applied AI, and dependable cloud systems."
|
|
||||||
/>
|
|
||||||
<meta name="theme-color" content="#f7f8f4" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:site_name" content="Alex Herlan Portfolio" />
|
|
||||||
<meta property="og:title" content="Alex Herlan — Software Engineer" />
|
|
||||||
<meta property="og:description" content="Alex Herlan is a senior software engineer building full-stack products, applied AI, and dependable cloud systems." />
|
|
||||||
<meta property="og:image" content="https://alex-herlan-portfolio.vercel.app/alexander-herlan.png" />
|
|
||||||
<meta property="og:image:type" content="image/png" />
|
|
||||||
<meta property="og:image:width" content="512" />
|
|
||||||
<meta property="og:image:height" content="512" />
|
|
||||||
<meta property="og:image:alt" content="Portrait of Alex Herlan" />
|
|
||||||
<meta name="twitter:card" content="summary" />
|
|
||||||
<meta name="twitter:title" content="Alex Herlan — Software Engineer" />
|
|
||||||
<meta name="twitter:description" content="Alex Herlan is a senior software engineer building full-stack products, applied AI, and dependable cloud systems." />
|
|
||||||
<meta name="twitter:image" content="https://alex-herlan-portfolio.vercel.app/alexander-herlan.png" />
|
|
||||||
<meta name="twitter:image:alt" content="Portrait of Alex Herlan" />
|
|
||||||
<script src="/theme-init.js"></script>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet" />
|
|
||||||
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 48x48" />
|
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
|
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
||||||
<title>Alex Herlan — Software Engineer</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body></body>
|
||||||
<div id="root"></div>
|
|
||||||
<script type="module" src="/src/main.jsx"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { defineConfig } from "vite";
|
|||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
// Do not publish photos, verification files, or other assets while offline.
|
||||||
|
publicDir: false,
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
define: {
|
define: {
|
||||||
"import.meta.env.VITE_MAX_UPLOAD_MB": JSON.stringify(process.env.VERCEL === "1" ? 4 : 20),
|
"import.meta.env.VITE_MAX_UPLOAD_MB": JSON.stringify(process.env.VERCEL === "1" ? 4 : 20),
|
||||||
|
|||||||
+2
-6
@@ -12,11 +12,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"routes": [
|
"routes": [
|
||||||
{ "src": "/api(?:/.*)?", "dest": "/api/index.py" },
|
{ "src": "/.*", "dest": "/api/index.py" }
|
||||||
{ "handle": "filesystem" },
|
|
||||||
{ "src": "/.*", "dest": "/index.html" }
|
|
||||||
],
|
],
|
||||||
"crons": [
|
"crons": []
|
||||||
{ "path": "/api/cron/media-cleanup", "schedule": "0 10 * * *" }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user