Add in-app help page with user manual (Romanian)
Adds a /help page served from the dashboard navigation, containing the full
Romanian user manual for operators: dashboard, playlist management, adding
media, removing files from playlists, player management, and the advanced
edited-media view.
Implementation notes
- Manual is pre-rendered to HTML with pandoc and shipped as a static asset
(app/static/help/_manual_body.html) rather than parsed at runtime. This
keeps the container free of a Markdown dependency and makes the page render
identically regardless of what is installed.
- /help is login-protected; the sidebar table of contents is derived from the
level-2 headings at request time.
- Screenshots are served from app/static/help/screenshots/ (32 images).
- Regenerate after editing the manual:
documentatie/convert_help_page.sh
docker compose up -d --build
Also adds
- backup_players_playlists.sh / restore_database.sh for DB backup and restore.
- .gitignore rules so local database backups (real production data), generated
.docx files and duplicate screenshot copies are never committed.
This commit is contained in:
Executable
+93
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
# ============================================================================
|
||||
# convert_help_page.sh - Regenerates the in-app help page content
|
||||
# ----------------------------------------------------------------------------
|
||||
# Converts documentatie/Manual-Utilizare-DigiServer.md into the HTML fragment
|
||||
# that the Flask app serves at /help, and refreshes the screenshot copies.
|
||||
#
|
||||
# Run this whenever the manual is edited, then rebuild the image:
|
||||
# ./documentatie/convert_help_page.sh
|
||||
# cd .. && docker compose up -d --build
|
||||
# ============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC_MD="$PROJECT_DIR/documentatie/Manual-Utilizare-DigiServer.md"
|
||||
SRC_IMG_DIR="$PROJECT_DIR/documentatie/screenshots"
|
||||
DEST_DIR="$PROJECT_DIR/app/static/help"
|
||||
DEST_IMG_DIR="$DEST_DIR/screenshots"
|
||||
DEST_HTML="$DEST_DIR/_manual_body.html"
|
||||
|
||||
echo "============================================================"
|
||||
echo " Regenerare pagina Ajutor (/help)"
|
||||
echo "============================================================"
|
||||
echo
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Checks
|
||||
# ---------------------------------------------------------------------------
|
||||
if ! command -v pandoc &> /dev/null; then
|
||||
echo "✗ Pandoc nu este instalat."
|
||||
echo " Instalati cu: sudo apt-get install -y pandoc"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$SRC_MD" ]; then
|
||||
echo "✗ Nu am gasit manualul: $SRC_MD"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST_IMG_DIR"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. Convert Markdown -> HTML fragment
|
||||
# ---------------------------------------------------------------------------
|
||||
echo "[1/3] Conversie Markdown -> HTML..."
|
||||
pandoc "$SRC_MD" \
|
||||
-t html5 \
|
||||
--no-highlight \
|
||||
--wrap=none \
|
||||
-o "$DEST_HTML"
|
||||
echo " ✓ $(basename "$DEST_HTML")"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 2. Copy screenshots and rewrite their paths for Flask's static route
|
||||
# ---------------------------------------------------------------------------
|
||||
echo
|
||||
echo "[2/3] Copiere capturi de ecran si rescriere cai..."
|
||||
cp "$SRC_IMG_DIR"/*.png "$DEST_IMG_DIR"/ 2>/dev/null || {
|
||||
echo " ⚠ Nicio captura gasita in $SRC_IMG_DIR"
|
||||
}
|
||||
COUNT=$(ls -1 "$DEST_IMG_DIR"/*.png 2>/dev/null | wc -l)
|
||||
echo " ✓ $COUNT capturi copiate"
|
||||
|
||||
# Markdown references images as "screenshots/x.png"; the app serves them from
|
||||
# /static/help/screenshots/, so the prefix has to be made explicit.
|
||||
sed -i 's|src="screenshots/|src="/static/help/screenshots/|g' "$DEST_HTML"
|
||||
REFS=$(grep -c '/static/help/screenshots/' "$DEST_HTML" || true)
|
||||
echo " ✓ $REFS referinte de imagini rescrise"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3. Sanity check: every referenced image must exist
|
||||
# ---------------------------------------------------------------------------
|
||||
echo
|
||||
echo "[3/3] Verificare consistenta..."
|
||||
MISSING=0
|
||||
while IFS= read -r ref; do
|
||||
[ -z "$ref" ] && continue
|
||||
if [ ! -f "$DEST_IMG_DIR/$(basename "$ref")" ]; then
|
||||
echo " ✗ lipsa: $ref"
|
||||
MISSING=$((MISSING + 1))
|
||||
fi
|
||||
done < <(grep -oE '/static/help/screenshots/[^"]+' "$DEST_HTML" | sort -u || true)
|
||||
|
||||
if [ "$MISSING" -eq 0 ]; then
|
||||
echo " ✓ toate imaginile referite exista"
|
||||
else
|
||||
echo " ⚠ $MISSING imagini lipsa"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "============================================================"
|
||||
echo " Gata. Rebuild imaginea pentru a aplica modificarile:"
|
||||
echo " cd $PROJECT_DIR && docker compose up -d --build"
|
||||
echo "============================================================"
|
||||
Reference in New Issue
Block a user