Fix iOS text color, viewport meta tag, and security improvements

- Add viewport meta tag to prevent iOS zoom/scaling issues
- Fix text color on iOS Safari (explicit text-gray-900 on buttons, inputs, TimePicker5)
- Add session checks to /api/beos, /api/objekte, /api/wetter
- Revert iframe embedding (X-Frame-Options: DENY, SameSite: lax)
- docker-compose.prod.yml: fix DB_PORT=3306 for production
- Add docker-compose.prod.yml, .env.prod.example, dump/import scripts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 17:38:08 +02:00
parent a0fb6d8089
commit 64acfdda6f
13 changed files with 424 additions and 6 deletions

103
migrate_db.sh Executable file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
# Erstellt einen neuen MySQL-Container "logbuch_mysql" und migriert
# die 5 App-relevanten Tabellen aus dem bestehenden "db"-Container.
set -e
# ── Konfiguration ────────────────────────────────────────────────────────────
SRC_CONTAINER="db"
SRC_DB="sternwarte"
SRC_ROOT_PASS="SFluorit"
NEW_CONTAINER="logbuch_mysql"
NEW_DB="sternwarte"
NEW_ROOT_PASS="SFluorit" # ggf. hier ändern
NEW_PORT="3307" # Host-Port (3306 ist schon belegt)
MYSQL_IMAGE="arm64v8/mysql:lts"
NETWORK="sternwarte_default"
TABLES="beos objekte logbuch logbuch_beos logbuch_objekte"
# ── Hilfsfunktion ────────────────────────────────────────────────────────────
wait_for_mysql() {
local container="$1"
local pass="$2"
echo -n "Warte auf MySQL in '$container' "
for i in $(seq 1 60); do
if docker exec "$container" mysqladmin ping -u root -p"$pass" --silent 2>/dev/null; then
echo " bereit."
return 0
fi
echo -n "."
sleep 2
done
echo ""
echo "FEHLER: MySQL in '$container' nicht erreichbar nach 120s." >&2
exit 1
}
# ── Prüfen ob Quell-Container läuft ─────────────────────────────────────────
if ! docker inspect "$SRC_CONTAINER" &>/dev/null; then
echo "FEHLER: Quell-Container '$SRC_CONTAINER' nicht gefunden." >&2
exit 1
fi
echo "Quell-Container '$SRC_CONTAINER' gefunden."
# ── Alten Ziel-Container entfernen falls vorhanden ──────────────────────────
if docker inspect "$NEW_CONTAINER" &>/dev/null; then
echo "Container '$NEW_CONTAINER' existiert bereits — wird gestoppt und entfernt..."
docker rm -f "$NEW_CONTAINER"
fi
# ── Neuen Container starten ──────────────────────────────────────────────────
echo "Starte neuen Container '$NEW_CONTAINER'..."
docker run -d \
--name "$NEW_CONTAINER" \
--network "$NETWORK" \
-p "${NEW_PORT}:3306" \
-e MYSQL_ROOT_PASSWORD="$NEW_ROOT_PASS" \
-e MYSQL_DATABASE="$NEW_DB" \
"$MYSQL_IMAGE"
wait_for_mysql "$NEW_CONTAINER" "$NEW_ROOT_PASS"
# ── Daten migrieren ──────────────────────────────────────────────────────────
echo "Migriere Tabellen: $TABLES"
echo "(Dump von '$SRC_CONTAINER' → Import in '$NEW_CONTAINER')"
docker exec "$SRC_CONTAINER" mysqldump \
-u root -p"$SRC_ROOT_PASS" \
--single-transaction \
--no-tablespaces \
"$SRC_DB" $TABLES \
| docker exec -i "$NEW_CONTAINER" mysql \
-u root -p"$NEW_ROOT_PASS" \
"$NEW_DB"
echo "Migration abgeschlossen."
# ── Zeilenzähler zur Verifikation ────────────────────────────────────────────
echo ""
echo "Zeilenzähler (Quelle → Ziel):"
for TABLE in $TABLES; do
SRC_COUNT=$(docker exec "$SRC_CONTAINER" mysql -u root -p"$SRC_ROOT_PASS" -sN \
-e "SELECT COUNT(*) FROM $TABLE;" "$SRC_DB" 2>/dev/null)
DST_COUNT=$(docker exec "$NEW_CONTAINER" mysql -u root -p"$NEW_ROOT_PASS" -sN \
-e "SELECT COUNT(*) FROM $TABLE;" "$NEW_DB" 2>/dev/null)
STATUS="✓"
[ "$SRC_COUNT" != "$DST_COUNT" ] && STATUS="✗ ABWEICHUNG"
printf " %-25s %5s → %5s %s\n" "$TABLE" "$SRC_COUNT" "$DST_COUNT" "$STATUS"
done
# ── Abschluss ─────────────────────────────────────────────────────────────────
echo ""
echo "══════════════════════════════════════════════════════"
echo "Neuer Container: $NEW_CONTAINER"
echo " Netzwerk: $NETWORK"
echo " Host-Port: $NEW_PORT"
echo " Datenbank: $NEW_DB"
echo ""
echo "Nächster Schritt — .env anpassen:"
echo " DB_HOST=$NEW_CONTAINER"
echo " DB_PASS=$NEW_ROOT_PASS"
echo "══════════════════════════════════════════════════════"