From 7fb83ea46ccda44b8f5efd039d925d7f214d1e0c Mon Sep 17 00:00:00 2001 From: StormRunner06106 Date: Tue, 13 Oct 2026 02:49:40 -0700 Subject: [PATCH] Take portfolio offline with blank pages and blocked API routes --- README.md | 14 ++++++++++++ backend/main.py | 17 ++++++++++++++- backend/test_offline.py | 47 +++++++++++++++++++++++++++++++++++++++++ frontend/index.html | 35 +++--------------------------- frontend/vite.config.js | 2 ++ vercel.json | 8 ++----- 6 files changed, 84 insertions(+), 39 deletions(-) create mode 100644 backend/test_offline.py diff --git a/README.md b/README.md index 15a898b..43d266c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,19 @@ # 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. ## Project structure diff --git a/backend/main.py b/backend/main.py index 06af34c..2d11108 100644 --- a/backend/main.py +++ b/backend/main.py @@ -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="", + 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 diff --git a/backend/test_offline.py b/backend/test_offline.py new file mode 100644 index 0000000..a495ee3 --- /dev/null +++ b/backend/test_offline.py @@ -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"" + 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() diff --git a/frontend/index.html b/frontend/index.html index 1a24e1c..e049c29 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,37 +3,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Alex Herlan — Software Engineer + + - -
- - + diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 26449cf..b8b278a 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -2,6 +2,8 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; export default defineConfig({ + // Do not publish photos, verification files, or other assets while offline. + publicDir: false, plugins: [react()], define: { "import.meta.env.VITE_MAX_UPLOAD_MB": JSON.stringify(process.env.VERCEL === "1" ? 4 : 20), diff --git a/vercel.json b/vercel.json index 90b612a..ea7cae8 100644 --- a/vercel.json +++ b/vercel.json @@ -12,11 +12,7 @@ } }, "routes": [ - { "src": "/api(?:/.*)?", "dest": "/api/index.py" }, - { "handle": "filesystem" }, - { "src": "/.*", "dest": "/index.html" } + { "src": "/.*", "dest": "/api/index.py" } ], - "crons": [ - { "path": "/api/cron/media-cleanup", "schedule": "0 10 * * *" } - ] + "crons": [] }