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 asyncio
|
||||||
import logging
|
import logging
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from fastapi import FastAPI, Request, status
|
from fastapi import FastAPI, Request, status
|
||||||
from fastapi.responses import FileResponse, JSONResponse
|
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.users import router as users_router
|
||||||
from app.api.routes.withdrawals import router as withdrawals_router
|
from app.api.routes.withdrawals import router as withdrawals_router
|
||||||
from app.auth.routes import router as auth_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.config import settings, validate_runtime_secrets
|
||||||
from app.db.base import AsyncSessionLocal
|
from app.db.base import AsyncSessionLocal
|
||||||
from app.electrum.client import ElectrumClient, ElectrumEndpoint, parse_endpoints
|
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)
|
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)
|
@app.get("/guida", include_in_schema=False)
|
||||||
async def user_guide() -> FileResponse:
|
async def user_guide() -> FileResponse:
|
||||||
"""Serves docs/guida-utente.md as plain text so it opens inline in the
|
return FileResponse("app/static/guida.html", headers=_NO_STORE_HEADERS)
|
||||||
browser (no markdown rendering — keeps this simple), linked from the
|
|
||||||
navbar's help button in app/static/index.html.
|
|
||||||
|
|
||||||
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).
|
@app.get("/report-bug", include_in_schema=False)
|
||||||
Answers a clean 404 if the file is missing rather than an unhandled error."""
|
async def report_bug_page() -> FileResponse:
|
||||||
if not _USER_GUIDE_PATH.is_file():
|
return FileResponse("app/static/report-bug.html", headers=_NO_STORE_HEADERS)
|
||||||
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.mount("/", StaticFiles(directory="app/static", html=True), name="static")
|
app.mount("/", StaticFiles(directory="app/static", html=True), name="static")
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Guida — PLM Lottery</title>
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="app-shell">
|
||||||
|
<h1>Guida utente</h1>
|
||||||
|
<p>Questa pagina è un placeholder. La guida completa sarà pubblicata qui a breve.</p>
|
||||||
|
<p><a class="link" href="/">← Torna alla home</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
<a class="link icon-link" href="/guida" target="_blank" rel="noopener" data-i18n-title="nav.guideTitle" title="Guida" data-i18n-aria-label="nav.guideAria" aria-label="Apri la guida utente">
|
<a class="link icon-link" href="/guida" target="_blank" rel="noopener" data-i18n-title="nav.guideTitle" title="Guida" data-i18n-aria-label="nav.guideAria" aria-label="Apri la guida utente">
|
||||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 2-3 4"/><path d="M12 17h.01"/></svg>
|
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 2-3 4"/><path d="M12 17h.01"/></svg>
|
||||||
</a>
|
</a>
|
||||||
<a class="link icon-link" href="https://github.com/REPLACE_ME/plm-lottery/issues/new" target="_blank" rel="noopener" data-i18n-title="nav.bugReport" title="Segnala un bug" data-i18n-aria-label="nav.bugReport" aria-label="Segnala un bug su GitHub">
|
<a class="link icon-link" href="/report-bug" target="_blank" rel="noopener" data-i18n-title="nav.bugReport" title="Segnala un bug" data-i18n-aria-label="nav.bugReport" aria-label="Segnala un bug">
|
||||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2v3M16 2v3M12 12v-2a2 2 0 1 1 2 2h-2Z"/><rect x="6" y="10" width="12" height="10" rx="4"/><path d="M6 15H3M21 15h-3M9 20v-3M15 20v-3"/></svg>
|
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 8v5"/><path d="M12 16h.01"/></svg>
|
||||||
</a>
|
</a>
|
||||||
<button class="link icon-link" onclick="logout()" data-i18n-title="nav.logoutTitle" title="Esci" data-i18n-aria-label="nav.logoutAria" aria-label="Esci dall'account">
|
<button class="link icon-link" onclick="logout()" data-i18n-title="nav.logoutTitle" title="Esci" data-i18n-aria-label="nav.logoutAria" aria-label="Esci dall'account">
|
||||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="M16 17l5-5-5-5M21 12H9"/></svg>
|
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="M16 17l5-5-5-5M21 12H9"/></svg>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Segnala un bug — PLM Lottery</title>
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="app-shell">
|
||||||
|
<h1>Segnala un bug</h1>
|
||||||
|
<p>Questa pagina è un placeholder. Il modulo per la segnalazione dei bug sarà disponibile qui a breve.</p>
|
||||||
|
<p><a class="link" href="/">← Torna alla home</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user