Files
hx-ki.com2/workspaces/homepage/repair_homepage_json.sh
2026-03-06 15:22:40 +00:00

53 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
FILE="/opt/hx-ki/workspaces/homepage/homepage.json"
echo "=== Repair homepage.json ==="
if [[ ! -f "$FILE" ]]; then
echo "✘ homepage.json fehlt wird neu erstellt."
cat > "$FILE" <<EOF2
{
"hero_title": "HX-KI Repair Mode",
"hero_sub": "homepage.json war weg und wurde automatisch neu erstellt.",
"sections": [
{
"title": "Hinweis",
"text": "Dies ist ein Fallback-Content aus repair_homepage_json.sh."
}
]
}
EOF2
echo "✔ homepage.json neu angelegt."
exit 0
fi
# JSON grob prüfen (ohne jq, über Python)
python3 - <<PYEOF
import json, sys
try:
json.load(open("$FILE", "r"))
except Exception as e:
sys.exit(1)
PYEOF
if [[ $? -eq 0 ]]; then
echo "✔ homepage.json ist gültiges JSON."
else
echo "✘ homepage.json ist defekt wird repariert."
cat > "$FILE" <<EOF3
{
"hero_title": "HX-KI Repair Mode",
"hero_sub": "homepage.json war defekt und wurde automatisch repariert.",
"sections": [
{
"title": "Hinweis",
"text": "Der vorherige Inhalt war ungültig. Dies ist ein Fallback."
}
]
}
EOF3
echo "✔ homepage.json repariert."
fi