feat: panele auth sistemi ekle (kullanıcı/şifre + oturum + middleware)

Panel şu ana kadar herkese açıktı — URL'yi bilen herkes kanal
ekleyip/silebilir, cookie güncelleyebilir, kayıt indirebilirdi.

- users tablosu (bcrypt şifre hash'i)
- /login: hiç kullanıcı yoksa "ilk admin hesabı oluştur" formu, varsa
  normal giriş formu
- jose ile imzalanmış, httpOnly çerezde tutulan 30 günlük oturum
- middleware.ts: /login hariç tüm rotaları korur (video stream route'u
  dahil — aynı origin istekleri çerezi otomatik taşır)
- layout: oturum yoksa nav hiç gösterilmiyor, varsa kullanıcı adı +
  çıkış butonu ekleniyor

SESSION_SECRET production'da zorunlu (docker-compose derleme zamanında
kontrol ediyor); Coolify'a rastgele bir değer eklendi.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-01 11:26:42 +03:00
co-authored by Claude Sonnet 5
parent ef1dc1b7ac
commit fb8485d638
12 changed files with 282 additions and 6 deletions
+6
View File
@@ -15,6 +15,12 @@ POLL_INTERVAL_MS=60000
SEGMENT_TIME_SEC=900
API_DAEMON_PORT=4001
# Signs the panel's login session cookies (frontend). Generate with:
# openssl rand -base64 32
# Required in production (docker-compose fails to start without it) — a
# fixed insecure default is only used for local dev when unset.
SESSION_SECRET=
# Set to a live YouTube URL to bypass the 60s polling loop and start
# capturing immediately — useful for testing the pipeline without waiting
# for a real scheduled stream.