epub2pdf: title-based export names, .pdf download headers, security hardening (68 tests green)

This commit is contained in:
BMad Master
2026-08-30 09:03:39 -04:00
commit 5580004aeb
22 changed files with 2351 additions and 0 deletions
Executable
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# One-command local test startup for the EPUB->PDF converter.
# Foreground gunicorn with an auto-restart loop (no systemd/supervisor needed).
#
# ./start.sh # http://0.0.0.0:8030
# PORT=9000 ./start.sh # custom port
#
# WORKERS is pinned to 1: the job registry (app.JOBS) is in-memory per
# process, so multiple workers would lose job state between requests.
# Extra concurrency comes from --threads instead. The gunicorn flags mirror
# the Dockerfile CMD (single source of truth for the launch contract).
set -u
cd "$(dirname "$0")"
HOST="${HOST:-0.0.0.0}"
PORT="${PORT:-8030}"
THREADS="${THREADS:-8}"
export DATA_DIR="${DATA_DIR:-$PWD/data}"
PY="${PY:-/opt/venv/bin/python}"
echo "[start] EPUB->PDF converter on http://${HOST}:${PORT}"
echo "[start] DATA_DIR=${DATA_DIR} workers=1 threads=${THREADS}"
while true; do
"$PY" -m gunicorn \
--bind "${HOST}:${PORT}" \
--workers 1 \
--threads "$THREADS" \
--timeout 1200 \
--graceful-timeout 30 \
--access-logfile - \
--error-logfile - \
app:app
code=$?
echo "[start] gunicorn exited (code ${code}); restarting in 2s..."
sleep 2
done