import { prisma } from "@streamclipper/db"; import { updateYtdlpCookies, updateSystemSettings, updateNotificationPrefs, updateSttEnabled, updateAutoRenderEnabled, updateDeleteAfterTelegramSend, } from "../actions"; import { formatTr } from "../../lib/formatDate"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { SettingSwitch } from "../components/SettingSwitch"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"; export const dynamic = "force-dynamic"; const STALE_COOKIE_HOURS = 4; export default async function SettingsPage() { const [setting, pollSetting, ttlSetting, notifyStart, notifyRender, notifyError, sttSetting, autoRenderSetting, deleteAfterSendSetting] = await Promise.all([ prisma.appSetting.findUnique({ where: { key: "ytdlp_cookies" } }), prisma.appSetting.findUnique({ where: { key: "poll_interval_ms" } }), prisma.appSetting.findUnique({ where: { key: "raw_segment_ttl_hours" } }), prisma.appSetting.findUnique({ where: { key: "notify_stream_start" } }), prisma.appSetting.findUnique({ where: { key: "notify_render_done" } }), prisma.appSetting.findUnique({ where: { key: "notify_poll_error" } }), prisma.appSetting.findUnique({ where: { key: "stt_enabled" } }), prisma.appSetting.findUnique({ where: { key: "auto_render_enabled" } }), prisma.appSetting.findUnique({ where: { key: "delete_after_telegram_send" } }), ]); const cookieAgeHours = setting ? (Date.now() - setting.updatedAt.getTime()) / 3_600_000 : null; const cookieStale = cookieAgeHours !== null && cookieAgeHours > STALE_COOKIE_HOURS; const pollIntervalSec = pollSetting ? Math.round(Number(pollSetting.value) / 1000) : 60; const ttlHours = ttlSetting ? Number(ttlSetting.value) : 24; const notifyStreamStart = notifyStart?.value !== "false"; const notifyRenderDone = notifyRender?.value !== "false"; const notifyPollError = notifyError?.value !== "false"; const sttEnabled = sttSetting?.value !== "false"; const autoRenderEnabled = autoRenderSetting?.value !== "false"; const deleteAfterTelegramSend = deleteAfterSendSetting?.value === "true"; return (

Ayarlar

YouTube Cookie'leri {setting ? `son güncelleme: ${formatTr(setting.updatedAt)}` : "hiç ayarlanmadı"} {cookieStale && ( ⚠️ {Math.round(cookieAgeHours!)} saattir güncellenmedi — büyük/popüler kanallarda bot-check hatası görülebilir )} YouTube canlı yayın kontrolü ve kayıt için kullanılıyor. Google, oturum çerezlerinin bir kısmını birkaç saatte bir yeniliyor — burada eskidiğini fark edersen (kanal detay sayfasında "son poll hatası" olarak görürsün) taze bir cookies.txt ile güncelle. Ana hesabın yerine ayrı, önemsiz bir Google hesabı kullanman önerilir.