diff --git a/README.md b/README.md index f5b0f2a..255098c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/server.py b/server.py index 4d75dbd..e902e75 100644 --- a/server.py +++ b/server.py @@ -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 = ''' +
+

404

+

Page not found

+ Go to home page +
+ ''' + 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):