Add IPTV playlist functionality and enhance streaming endpoints
ci / build-backend (push) Successful in 1m47s
ci / build-frontend (push) Successful in 52s
ci / tests (push) Successful in 1m36s
ci / sonar (push) Successful in 4m26s

Implemented a new endpoint for downloading the IPTV playlist, allowing users to access a comprehensive M3U file containing all channels and program guides. Updated the StreamingEndpoints to support token validation for both cookie and query parameters, ensuring secure access for external IPTV players. Enhanced the AirPage component to include a download button for the IPTV playlist, with appropriate user feedback on success or failure. Updated localization strings to reflect new features and instructions for users.
This commit is contained in:
Leonid Pershin
2026-07-29 18:14:01 +03:00
parent 775f287c29
commit c4a94443f7
14 changed files with 535 additions and 13 deletions
+18 -1
View File
@@ -1,4 +1,4 @@
import { apiRequest } from '@/shared/api/client'
import { apiDownload, apiRequest } from '@/shared/api/client'
import type { PublicChannelDto, PublicEpgEntryDto } from '@/shared/api/types'
/** Ссылка на изображение общего реестра (постеры/кадры) — по id из публичных DTO. */
@@ -20,6 +20,23 @@ export function watchChannel(slug: string) {
return apiRequest<void>(`/channels/${slug}/watch`, { method: 'POST' })
}
/**
* Скачивает M3U для внешнего плеера. Ссылка на файл не годится: эндпоинт закрыт Bearer'ом, а
* `<a href>` заголовок не отправит — поэтому тянем через fetch и сохраняем как blob.
*/
export async function downloadIptvPlaylist() {
const { blob, fileName } = await apiDownload('/iptv/playlist.m3u', 'telewave.m3u')
const url = URL.createObjectURL(blob)
try {
const link = document.createElement('a')
link.href = url
link.download = fileName
link.click()
} finally {
URL.revokeObjectURL(url)
}
}
export function getEpg(slug: string, from?: Date, to?: Date) {
const query = new URLSearchParams()
if (from) query.set('from', from.toISOString())