Add placeholder guide/bug-report pages, and an exclamation-mark bug icon
/guida now serves a static app/static/guida.html placeholder instead of docs/guida-utente.md, which sidesteps the known Docker gap (docs/ was never COPYed into the image). Added a matching /report-bug placeholder route and pointed the navbar's bug icon at it instead of the unset GitHub issues URL, with an outline circle + exclamation mark to match the help icon's style. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+6
-15
@@ -1,7 +1,6 @@
|
||||
import asyncio
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI, Request, status
|
||||
from fastapi.responses import FileResponse, JSONResponse
|
||||
@@ -21,7 +20,7 @@ from app.api.routes.rounds import router as rounds_router
|
||||
from app.api.routes.users import router as users_router
|
||||
from app.api.routes.withdrawals import router as withdrawals_router
|
||||
from app.auth.routes import router as auth_router
|
||||
from app.api.errors import ApiError, http_error
|
||||
from app.api.errors import ApiError
|
||||
from app.config import settings, validate_runtime_secrets
|
||||
from app.db.base import AsyncSessionLocal
|
||||
from app.electrum.client import ElectrumClient, ElectrumEndpoint, parse_endpoints
|
||||
@@ -119,22 +118,14 @@ async def admin_panel() -> FileResponse:
|
||||
return FileResponse("app/static/admin.html", headers=_NO_STORE_HEADERS)
|
||||
|
||||
|
||||
_USER_GUIDE_PATH = Path("docs/guida-utente.md")
|
||||
|
||||
|
||||
@app.get("/guida", include_in_schema=False)
|
||||
async def user_guide() -> FileResponse:
|
||||
"""Serves docs/guida-utente.md as plain text so it opens inline in the
|
||||
browser (no markdown rendering — keeps this simple), linked from the
|
||||
navbar's help button in app/static/index.html.
|
||||
return FileResponse("app/static/guida.html", headers=_NO_STORE_HEADERS)
|
||||
|
||||
The Dockerfile must COPY docs/ for this to exist inside the container (it
|
||||
didn't, which made this a guaranteed 500 in every real deployment — B-16).
|
||||
Answers a clean 404 if the file is missing rather than an unhandled error."""
|
||||
if not _USER_GUIDE_PATH.is_file():
|
||||
logger.error("user guide missing at %s (is docs/ shipped in the image?)", _USER_GUIDE_PATH)
|
||||
raise http_error(status.HTTP_404_NOT_FOUND, "guide_unavailable", "user guide not available")
|
||||
return FileResponse(_USER_GUIDE_PATH, media_type="text/plain; charset=utf-8")
|
||||
|
||||
@app.get("/report-bug", include_in_schema=False)
|
||||
async def report_bug_page() -> FileResponse:
|
||||
return FileResponse("app/static/report-bug.html", headers=_NO_STORE_HEADERS)
|
||||
|
||||
|
||||
app.mount("/", StaticFiles(directory="app/static", html=True), name="static")
|
||||
|
||||
Reference in New Issue
Block a user