2026-09-17 21:11:48 +00:00
|
|
|
|
# =====================================================================
|
|
|
|
|
|
# MyYouTube — образец .env
|
|
|
|
|
|
# Скопируй в `.env` и заполни своими значениями.
|
|
|
|
|
|
# Сам `.env` в git НЕ попадает (в .gitignore) — не коммить его!
|
|
|
|
|
|
# =====================================================================
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- Приложение ----------
|
|
|
|
|
|
|
|
|
|
|
|
# Окружение: production | development
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
APP_ENV=production
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Внешний адрес сервиса. Используется в OAuth-редиректе и для cookie.
|
|
|
|
|
|
# Локально — http://localhost:8080, в проде — https://твой-домен
|
|
|
|
|
|
APP_BASE_URL=http://localhost:8080
|
|
|
|
|
|
|
|
|
|
|
|
# Порт uvicorn внутри контейнера (наружу проброшен в compose.yml как 8080)
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
APP_PORT=8080
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Секрет для сессионных cookie. Любая длинная случайная строка, например:
|
|
|
|
|
|
# python3 -c "import secrets; print(secrets.token_urlsafe(48))"
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
APP_SECRET_KEY=CHANGE_ME
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Ключ шифрования refresh-токена Google (хранится в БД). Fernet-ключ:
|
|
|
|
|
|
# python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
|
|
|
|
|
|
# Генерируй один раз и не меняй (иначе старый токен не расшифруется).
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
TOKEN_ENCRYPTION_KEY=CHANGE_ME
|
|
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# ---------- База данных ----------
|
|
|
|
|
|
|
|
|
|
|
|
# Пароль Postgres. Должен совпадать с POSTGRES_PASSWORD у сервиса postgres в compose.yml
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
POSTGRES_PASSWORD=CHANGE_ME
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# URL базы. `postgres` — имя сервиса внутри docker-сети; при запуске без docker замени на localhost
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
DATABASE_URL=postgresql+psycopg://youtube_app:CHANGE_ME@postgres:5432/youtube_app
|
|
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# ---------- Google OAuth (YouTube) ----------
|
|
|
|
|
|
|
|
|
|
|
|
# Google Cloud Console → APIs & Services → Credentials → Create credentials →
|
|
|
|
|
|
# OAuth client ID → Application type: Web application
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
GOOGLE_CLIENT_ID=
|
|
|
|
|
|
GOOGLE_CLIENT_SECRET=
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Тот же URI добавь в "Authorized redirect URIs" клиента в консоли.
|
|
|
|
|
|
# Всегда: {APP_BASE_URL}/api/auth/google/callback
|
|
|
|
|
|
GOOGLE_REDIRECT_URI=http://localhost:8080/api/auth/google/callback
|
|
|
|
|
|
|
|
|
|
|
|
# Gmail единственного пользователя, которому разрешён вход (single-user)
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
ALLOWED_GOOGLE_EMAIL=
|
|
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# Endpoint'ы Google/YouTube — НЕОБЯЗАТЕЛЬНО (в коде есть дефолты).
|
|
|
|
|
|
# Раскомментируй, только если нужно их переопределить:
|
|
|
|
|
|
# GOOGLE_AUTH_URI=https://accounts.google.com/o/oauth2/auth
|
|
|
|
|
|
# GOOGLE_TOKEN_URI=https://oauth2.googleapis.com/token
|
|
|
|
|
|
# GOOGLE_USERINFO_URI=https://www.googleapis.com/oauth2/v3/userinfo
|
|
|
|
|
|
# GOOGLE_REVOKE_URI=https://oauth2.googleapis.com/revoke
|
|
|
|
|
|
# YOUTUBE_API_BASE_URL=https://www.googleapis.com/youtube/v3
|
|
|
|
|
|
# YOUTUBE_WATCH_URL_TEMPLATE=https://www.youtube.com/watch?v={video_id}
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- MeTube (скачивание) ----------
|
2026-09-17 17:22:22 +00:00
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# API-адрес MeTube, куда backend ходит управлять загрузками
|
|
|
|
|
|
# (POST /add, /delete, GET /history, Socket.IO-события)
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
METUBE_API_BASE_URL=http://192.168.8.177:8081
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Публичный адрес MeTube, с которого БРАУЗЕР стримит скачанные файлы
|
|
|
|
|
|
# (/download/...). Если MeTube за reverse-proxy — укажи его внешний URL.
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
METUBE_PUBLIC_BASE_URL=http://192.168.8.177:8081
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Каталог загрузок внутри контейнера MeTube (как в его настройках)
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
METUBE_CONTAINER_DOWNLOAD_DIR=/downloads
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Таймаут HTTP-запросов к MeTube/Google, секунды
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
METUBE_REQUEST_TIMEOUT_SECONDS=30
|
|
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# ---------- Синхронизация ----------
|
|
|
|
|
|
|
|
|
|
|
|
# Интервал планового синка подписок, часов
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
SUBSCRIPTIONS_SYNC_INTERVAL_HOURS=6
|
2026-09-17 21:07:33 +00:00
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# Авто-синк видео запускается по активности: когда ты делаешь запрос к сервису,
|
|
|
|
|
|
# а с последнего завершённого синка прошло больше этого числа часов
|
2026-09-17 21:07:33 +00:00
|
|
|
|
VIDEOS_SYNC_IDLE_HOURS=2
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Глубина истории канала: максимум последних N видео на канал.
|
|
|
|
|
|
# Всё, что старше, намеренно не подтягивается.
|
2026-09-17 21:07:33 +00:00
|
|
|
|
VIDEOS_BACKFILL_CAP=200
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Остановить перелистывание плейлиста канала, когда подряд встретилось
|
|
|
|
|
|
# N уже известных видео (дальше — уже синхронизированная история)
|
2026-09-17 21:07:33 +00:00
|
|
|
|
VIDEOS_KNOWN_STOP_THRESHOLD=50
|
2026-09-17 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
# Окно «новых видео», дней. От него зависят бейджи «N новых» у каналов
|
|
|
|
|
|
# и в сайдбаре категорий, а также фильтр «только новые» по клику на число
|
2026-09-17 21:07:33 +00:00
|
|
|
|
NEW_VIDEOS_WINDOW_DAYS=2
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
|
2026-09-17 21:11:48 +00:00
|
|
|
|
# ---------- Логи ----------
|
|
|
|
|
|
|
Implement Phases 1-5: skeleton, OAuth, categories, video sync/feed, playback
- FastAPI + PostgreSQL + Alembic + React/Vite skeleton, Docker Compose, healthcheck
- Google OAuth (single allowed account), encrypted refresh token storage
- Subscriptions sync with pagination, uploads playlist batch fetch
- Categories CRUD, many-to-many channel assignment, category filtering
- Video sync (playlistItems + videos.list batching), cached feed with cursor
pagination, background scheduler (APScheduler)
- Video detail page with YouTube embed player
- SPA fallback routing, optimistic UI updates, client-side query caching
40 backend tests covering OAuth allow-list, sync idempotency, cascade deletes,
cursor pagination, and category filtering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 18:44:30 +00:00
|
|
|
|
LOG_LEVEL=INFO
|