Add 404 page and Web UI section to README

- Add styled 404 page for HTML requests (returns JSON for API calls)
- Add Web UI section to README documenting available routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-09 10:42:44 +00:00
parent 0a0dd278fe
commit 0f01d8e12c
2 changed files with 31 additions and 0 deletions

View File

@@ -96,6 +96,20 @@ Keys are stored in `$ARTDAG_DATA/keys/`:
**Important**: Private keys are gitignored. Back them up securely. Losing them invalidates all your signatures.
## Web UI
The server provides a web interface:
| Path | Description |
|------|-------------|
| `/` | Home page with stats and README |
| `/assets` | Browse registered assets |
| `/activities` | View published activities |
| `/users` | List registered users |
| `/asset/{name}` | Asset detail page |
| `/login` | Login page |
| `/register` | Registration page |
## Client Commands
### Upload Media

View File

@@ -89,6 +89,23 @@ app = FastAPI(
)
@app.exception_handler(404)
async def not_found_handler(request: Request, exc):
"""Custom 404 page."""
accept = request.headers.get("accept", "")
if "text/html" in accept and "application/json" not in accept:
content = '''
<div class="text-center py-16">
<h2 class="text-6xl font-bold text-gray-600 mb-4">404</h2>
<p class="text-xl text-gray-400 mb-8">Page not found</p>
<a href="/" class="text-blue-400 hover:text-blue-300">Go to home page</a>
</div>
'''
username = get_user_from_cookie(request)
return HTMLResponse(base_html("Not Found", content, username), status_code=404)
return JSONResponse({"detail": "Not found"}, status_code=404)
# ============ Data Models ============
class Asset(BaseModel):