import type { ChannelSortField, SortDirection } from "../types/index.js"; import type { Express, Request } from "express"; interface ProviderFilter { readonly exclude: boolean; readonly tags: string[]; } /** * Resolves the base URL from an incoming request by examining headers in priority order. This ensures that playlist URLs and other generated links use the same * host and protocol that the client used to connect, even when behind a reverse proxy. The resolution order is: * * 1. X-Forwarded-Host header (set by reverse proxies like nginx, Traefik) * 2. Host header (standard HTTP/1.1 header) * 3. Fallback to configured server host and port * * For protocol, Express's req.protocol already respects X-Forwarded-Proto when trust proxy is enabled. * * @param req - The Express request object. * @returns The base URL (e.g., "http://localhost:5589" or "https://myserver.example.com"). */ export declare function resolveBaseUrl(req: Request): string; /** * Generates the M3U playlist content for display on the landing page or the playlist endpoint. The playlist includes all configured video channels with their * stream URLs dynamically constructed from the provided base URL. * @param baseUrl - The base URL to use for stream URLs (e.g., "http://localhost:5589"). * @param filter - Optional provider filter based on the currently selected provider for each channel. In include mode, only channels whose selected provider matches * a filter tag are included. In exclude mode, channels whose selected provider matches any filter tag are excluded. When omitted, all channels are included. * @param sort - Optional sort field override. When provided, channels are sorted by this field instead of the user's saved preference. Validated against * VALID_SORT_FIELDS before calling. * @param direction - Optional sort direction override ("asc" or "desc"). When provided, overrides the user's saved sort direction. * @returns The M3U playlist content. */ export declare function generatePlaylistContent(baseUrl: string, filter?: ProviderFilter, sort?: ChannelSortField, direction?: SortDirection): string; /** * Creates the playlist endpoint that serves an M3U playlist in Channels DVR format. The playlist lists all configured channels with their stream URLs, allowing * Channels DVR to import them as custom channels. The endpoint dynamically constructs URLs using the request host header so the playlist works regardless of how * the server is accessed (localhost, IP address, or hostname). * @param app - The Express application. */ export declare function setupPlaylistEndpoint(app: Express): void; export {};