krustyplanet.org/scripts/sync-eepsite.sh
BarnacleBoy 8a10eaaeb8 Fix audit form backend, update blog page, add I2P links, robots.txt, sitemap, audit form JS
- Add /api/audit endpoint to contact-api (deployed to server)
- Replace blog ghost links with 'coming soon' placeholder
- Add I2P mirror link to all page footers
- Wire up audit form frontend handler in main.js
- Update contact form handler to use fetch API
- Add robots.txt and sitemap.xml
- Add scripts/sync-eepsite.sh for I2P/clearnet sync
2026-04-23 22:51:21 +00:00

71 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
# sync-eepsite.sh — Copy clearnet site to eepsite with appropriate modifications
# Usage: ./sync-eepsite.sh [--dry-run]
#
# The eepsite is a simplified version of the clearnet site:
# - No blog page (no blog content yet)
# - No free-audit page (audit form uses /api which isn't available on I2P)
# - Cross-reference links point to clearnet (not eepsite) and vice versa
# - Same JS/CSS
# - Same footer with I2P/clearnet cross-link
set -euo pipefail
CLEARNET="/var/www/krustyplanet"
EEPSITE="/var/www/eepsite"
DRY_RUN=false
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=true
echo "DRY RUN — no files will be modified"
fi
# Pages that exist on both sites
SHARED_PAGES=("index.html" "services.html" "pricing.html" "contact.html")
# Pages only on clearnet (these have backend API dependencies)
CLEARNET_ONLY=("blog.html" "free-audit.html")
# Copy shared static assets
for dir in css js; do
echo "Syncing $dir/"
if $DRY_RUN; then
diff -rq "$CLEARNET/$dir/" "$EEPSITE/$dir/" || true
else
rsync -av --delete "$CLEARNET/$dir/" "$EEPSITE/$dir/"
fi
done
# Copy favicon
echo "Syncing favicon.svg"
if ! $DRY_RUN; then
cp "$CLEARNET/favicon.svg" "$EEPSITE/favicon.svg"
fi
# Sync shared pages with I2P-specific modifications
for page in "${SHARED_PAGES[@]}"; do
echo "Syncing $page"
if $DRY_RUN; then
echo " Would transform and copy $CLEARNET/$page -> $EEPSITE/$page"
else
# Start with clearnet version
cp "$CLEARNET/$page" "$EEPSITE/$page"
# Replace clearnet I2P mirror link with clearnet reference link
sed -i 's|🔒 I2P Mirror:.*b32\.i2p</a></p>|🌐 Clearnet: <a href="https://krustyplanet.org" style="color:#b5b5b5;">https://krustyplanet.org</a></p>|' "$EEPSITE/$page"
# Remove nav links to clearnet-only pages (free-audit, blog)
sed -i '/href="\/free-audit\.html"/d' "$EEPSITE/$page"
sed -i '/href="\/blog\.html"/d' "$EEPSITE/$page"
fi
done
echo "Done. Eepsite is in sync with clearnet."
echo ""
echo "NOTE: The following pages are clearnet-only (require /api backend):"
for page in "${CLEARNET_ONLY[@]}"; do
echo " - $page"
done
echo ""
echo "NOTE: The eepsite contact form JS still posts to /api/contact"
echo " which won't work over I2P. Consider adding a mailto: fallback."