Init photo gallery with auto-indexing, thumbs, UI, deploy script

This commit is contained in:
Alex Assistant
2026-02-19 16:37:51 +03:00
commit b5c49caeb2
9 changed files with 731 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -euo pipefail
# Timeweb shared hosting deploy script
# Usage:
# bash scripts/deploy.sh
# Optional env:
# APP_DIR=/home/USER/www/photo-gallery
# BRANCH=main
APP_DIR="${APP_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
BRANCH="${BRANCH:-main}"
cd "$APP_DIR"
echo "[deploy] dir: $APP_DIR"
echo "[deploy] branch: $BRANCH"
if [ ! -d .git ]; then
echo "[deploy] ERROR: .git not found in $APP_DIR"
exit 1
fi
# Keep runtime dirs
mkdir -p photos thumbs data
# Protect user-uploaded photos from direct HTTP access (Apache)
if [ -f photos/.htaccess ]; then
:
else
cat > photos/.htaccess <<'HTACCESS'
Require all denied
HTACCESS
fi
# Update code
current_branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$current_branch" != "$BRANCH" ]; then
git checkout "$BRANCH"
fi
git fetch --all --prune
git reset --hard "origin/$BRANCH"
# Make sure runtime files exist
[ -f data/last_indexed.txt ] || echo "0" > data/last_indexed.txt
echo "[deploy] done"