Fix console errors: React Router v7 flags, form a11y, bans 500
- Add v7_startTransition and v7_relativeSplatPath future flags to BrowserRouter to silence React Router deprecation warnings - Add hidden autocomplete='username' inputs to LoginPage and SetupPage so password managers and browsers stop warning about missing username fields in password forms - Mount fail2ban-dev-config volume into backend container at /config:ro so ban_service can open the fail2ban SQLite database returned by 'get dbfile'; this fixes the 500 on GET /api/dashboard/bans - Track compose.debug.yml in git (was previously untracked)
This commit is contained in:
123
Docker/compose.debug.yml
Normal file
123
Docker/compose.debug.yml
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
# ──────────────────────────────────────────────────────────────
|
||||||
|
# BanGUI — Debug / Development Compose
|
||||||
|
#
|
||||||
|
# Compatible with:
|
||||||
|
# docker compose -f Docker/compose.debug.yml up
|
||||||
|
# podman compose -f Docker/compose.debug.yml up
|
||||||
|
# podman-compose -f Docker/compose.debug.yml up
|
||||||
|
#
|
||||||
|
# Features:
|
||||||
|
# - Source code mounted as volumes (hot-reload)
|
||||||
|
# - Uvicorn --reload for backend auto-restart
|
||||||
|
# - Vite dev server for frontend with HMR
|
||||||
|
# - Ports exposed on host for direct access
|
||||||
|
# - Debug log level enabled
|
||||||
|
# ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
name: bangui-dev
|
||||||
|
|
||||||
|
services:
|
||||||
|
# ── fail2ban ─────────────────────────────────────────────────
|
||||||
|
fail2ban:
|
||||||
|
image: lscr.io/linuxserver/fail2ban:latest
|
||||||
|
container_name: bangui-fail2ban-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_RAW
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
TZ: "${BANGUI_TIMEZONE:-UTC}"
|
||||||
|
PUID: 0
|
||||||
|
PGID: 0
|
||||||
|
volumes:
|
||||||
|
- fail2ban-dev-config:/config
|
||||||
|
- fail2ban-dev-run:/var/run/fail2ban
|
||||||
|
- /var/log:/var/log:ro
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "fail2ban-client", "ping"]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 15s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
# ── Backend (FastAPI + uvicorn with --reload) ───────────────
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Docker/Dockerfile.backend
|
||||||
|
target: runtime
|
||||||
|
container_name: bangui-backend-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
user: "0"
|
||||||
|
depends_on:
|
||||||
|
fail2ban:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
BANGUI_DATABASE_PATH: "/data/bangui.db"
|
||||||
|
BANGUI_FAIL2BAN_SOCKET: "/var/run/fail2ban/fail2ban.sock"
|
||||||
|
BANGUI_LOG_LEVEL: "debug"
|
||||||
|
BANGUI_SESSION_SECRET: "${BANGUI_SESSION_SECRET:-dev-secret-do-not-use-in-production}"
|
||||||
|
BANGUI_TIMEZONE: "${BANGUI_TIMEZONE:-UTC}"
|
||||||
|
volumes:
|
||||||
|
- ../backend/app:/app/app:z
|
||||||
|
- ../fail2ban-master:/app/fail2ban-master:ro,z
|
||||||
|
- bangui-dev-data:/data
|
||||||
|
- fail2ban-dev-run:/var/run/fail2ban:ro
|
||||||
|
- fail2ban-dev-config:/config:ro
|
||||||
|
ports:
|
||||||
|
- "${BANGUI_BACKEND_PORT:-8000}:8000"
|
||||||
|
command:
|
||||||
|
[
|
||||||
|
"uvicorn", "app.main:create_app", "--factory",
|
||||||
|
"--host", "0.0.0.0", "--port", "8000",
|
||||||
|
"--reload", "--reload-dir", "/app/app"
|
||||||
|
]
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "python -c 'import urllib.request; urllib.request.urlopen(\"http://127.0.0.1:8000/api/health\", timeout=4)'"]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 45s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- bangui-dev-net
|
||||||
|
|
||||||
|
# ── Frontend (Vite dev server with HMR) ─────────────────────
|
||||||
|
frontend:
|
||||||
|
image: node:22-alpine
|
||||||
|
container_name: bangui-frontend-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
working_dir: /app
|
||||||
|
environment:
|
||||||
|
NODE_ENV: development
|
||||||
|
volumes:
|
||||||
|
- ../frontend:/app:z
|
||||||
|
- frontend-node-modules:/app/node_modules
|
||||||
|
ports:
|
||||||
|
- "${BANGUI_FRONTEND_PORT:-5173}:5173"
|
||||||
|
command: ["sh", "-c", "npm install && npm run dev -- --host 0.0.0.0"]
|
||||||
|
depends_on:
|
||||||
|
backend:
|
||||||
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5173/"]
|
||||||
|
interval: 15s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 30s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- bangui-dev-net
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
bangui-dev-data:
|
||||||
|
driver: local
|
||||||
|
frontend-node-modules:
|
||||||
|
driver: local
|
||||||
|
fail2ban-dev-config:
|
||||||
|
driver: local
|
||||||
|
fail2ban-dev-run:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
bangui-dev-net:
|
||||||
|
driver: bridge
|
||||||
@@ -43,7 +43,7 @@ import { BlocklistsPage } from "./pages/BlocklistsPage";
|
|||||||
function App(): React.JSX.Element {
|
function App(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<FluentProvider theme={lightTheme}>
|
<FluentProvider theme={lightTheme}>
|
||||||
<BrowserRouter>
|
<BrowserRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<Routes>
|
<Routes>
|
||||||
{/* Setup wizard — always accessible; redirects to /login if already done */}
|
{/* Setup wizard — always accessible; redirects to /login if already done */}
|
||||||
|
|||||||
@@ -129,6 +129,17 @@ export function LoginPage(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<form onSubmit={(ev) => void handleSubmit(ev)}>
|
<form onSubmit={(ev) => void handleSubmit(ev)}>
|
||||||
|
{/* Hidden username field — required by accessibility guidelines for
|
||||||
|
password managers to correctly identify the credential form. */}
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
autoComplete="username"
|
||||||
|
aria-hidden="true"
|
||||||
|
tabIndex={-1}
|
||||||
|
value="bangui"
|
||||||
|
readOnly
|
||||||
|
style={{ display: "none" }}
|
||||||
|
/>
|
||||||
<div className={styles.field}>
|
<div className={styles.field}>
|
||||||
<Field label="Password" required>
|
<Field label="Password" required>
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -205,6 +205,17 @@ export function SetupPage(): React.JSX.Element {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<form onSubmit={(ev) => void handleSubmit(ev)}>
|
<form onSubmit={(ev) => void handleSubmit(ev)}>
|
||||||
|
{/* Hidden username field — required by accessibility guidelines for
|
||||||
|
password managers to correctly identify the credential form. */}
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
autoComplete="username"
|
||||||
|
aria-hidden="true"
|
||||||
|
tabIndex={-1}
|
||||||
|
value="bangui"
|
||||||
|
readOnly
|
||||||
|
style={{ display: "none" }}
|
||||||
|
/>
|
||||||
<div className={styles.fields}>
|
<div className={styles.fields}>
|
||||||
<Field
|
<Field
|
||||||
label="Master Password"
|
label="Master Password"
|
||||||
|
|||||||
Reference in New Issue
Block a user