rework
Some checks failed
CI / check (push) Has been cancelled

This commit is contained in:
Bashy 2026-04-26 23:00:55 +03:00
parent c46f2f2fc3
commit 6c7facadce
1831 changed files with 477243 additions and 2607 deletions

View file

@ -1,72 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[BashyOverlay]${NC} $1"; }
warn() { echo -e "${YELLOW}[BashyOverlay]${NC} $1"; }
error() { echo -e "${RED}[BashyOverlay]${NC} $1"; exit 1; }
# ── Python version check ──────────────────────────────────────────────────────
PYTHON=$(command -v python3 || command -v python || error "Python not found")
PY_VER=$($PYTHON -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
PY_MAJOR=$($PYTHON -c 'import sys; print(sys.version_info.major)')
PY_MINOR=$($PYTHON -c 'import sys; print(sys.version_info.minor)')
if [ "$PY_MAJOR" -lt 3 ] || { [ "$PY_MAJOR" -eq 3 ] && [ "$PY_MINOR" -lt 10 ]; }; then
error "Python 3.10+ required (found $PY_VER)"
echo "==> Checking Node.js..."
node_version=$(node -v 2>/dev/null | cut -c2- | cut -d. -f1)
if [ -z "$node_version" ] || [ "$node_version" -lt 18 ]; then
echo "ERROR: Node.js 18+ required. Install via: https://nodejs.org"
exit 1
fi
info "Python $PY_VER OK"
echo " Node $(node -v) OK"
# ── Virtual environment ───────────────────────────────────────────────────────
if [ ! -d ".venv" ]; then
info "Creating virtual environment..."
$PYTHON -m venv .venv
echo "==> Installing dependencies..."
npm install --production
echo "==> Checking .env..."
if [ ! -f .env ]; then
echo "ERROR: .env not found. Copy .env.example and fill in your values."
exit 1
fi
source .venv/bin/activate
info "Virtual environment active"
for var in TWITCH_CLIENT_ID TWITCH_CLIENT_SECRET SECRET_KEY APP_BASE_URL; do
val=$(grep "^${var}=" .env | cut -d= -f2-)
if [ -z "$val" ] || echo "$val" | grep -q "your_\|change_this"; then
echo "ERROR: $var is not set in .env"
exit 1
fi
done
echo " .env OK"
# ── Dependencies ──────────────────────────────────────────────────────────────
info "Installing dependencies..."
pip install -q --upgrade pip
pip install -q -r requirements.txt
info "Dependencies installed"
# ── .env ──────────────────────────────────────────────────────────────────────
if [ ! -f ".env" ]; then
cp .env.example .env
warn ".env created from .env.example"
warn "Edit .env with your Twitch credentials before continuing."
warn ""
warn " TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET:"
warn " Register an app at https://dev.twitch.tv/console/apps"
warn " Set OAuth Redirect URL to: http://localhost:8000/auth/callback"
warn ""
echo -n "Have you filled in .env? [y/N] "
read -r answer
if [[ ! "$answer" =~ ^[Yy]$ ]]; then
warn "Edit .env and run deploy.sh again."
exit 0
fi
fi
# ── Media directory ───────────────────────────────────────────────────────────
mkdir -p static/media
info "Media directory ready"
# ── Launch ────────────────────────────────────────────────────────────────────
HOST="${HOST:-0.0.0.0}"
PORT="${PORT:-8000}"
info "Starting BashyOverlay at http://localhost:${PORT}"
info "Open that URL in your browser to log in with Twitch."
info "OBS browser source URL: http://localhost:${PORT}/overlay"
info ""
info "Press Ctrl+C to stop."
echo ""
exec uvicorn app.main:app --host "$HOST" --port "$PORT" --reload
echo "==> Starting BashyOverlay..."
node src/server.js