"use client"; import { useState } from "react"; import { Copy, Check } from "lucide-react"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { toast } from "sonner"; const API_BASE = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:3000/api/v1"; interface IptvExportDialogProps { open: boolean; onOpenChange: (open: boolean) => void; token: string; } export function IptvExportDialog({ open, onOpenChange, token, }: IptvExportDialogProps) { const m3uUrl = `${API_BASE}/iptv/playlist.m3u?token=${token}`; const xmltvUrl = `${API_BASE}/iptv/epg.xml?token=${token}`; const [copiedM3u, setCopiedM3u] = useState(false); const [copiedXmltv, setCopiedXmltv] = useState(false); const copy = async (text: string, which: "m3u" | "xmltv") => { try { await navigator.clipboard.writeText(text); if (which === "m3u") { setCopiedM3u(true); setTimeout(() => setCopiedM3u(false), 2000); } else { setCopiedXmltv(true); setTimeout(() => setCopiedXmltv(false), 2000); } toast.success("Copied to clipboard"); } catch { toast.error("Failed to copy"); } }; return ( IPTV Export Paste these URLs into your IPTV client (TiviMate, VLC, etc.).

Add Playlist → paste URL

EPG Source → paste URL

The token in these URLs is your session JWT. Anyone with these URLs can stream your channels.

); }