feat: Implement Xtream IPTV API service, including data fetching, caching, and proxy integration.

This commit is contained in:
Michael committed 2026-03-10 16:48:28 +01:00
1 parent f5b3457390
commit 8c65e48bbe
3 files changed
+11 -24

No files matched your search

+2 -15
View File
@@ -123,6 +123,7 @@ class ProxyHandler {
'User-Agent': 'VLC/3.0.18 LibVLC/3.0.18',
'Accept': '*/*',
'Accept-Encoding': 'identity',
'Connection': 'close', // Forced close for better IPTV server compatibility
};
// Forward Range header if present
@@ -158,21 +159,7 @@ class ProxyHandler {
}
}
// Special case for API requests (JSON list of channels etc.)
// If it's not a Range request and looks like JSON, read it fully
final isJson =
response.headers['content-type']?.contains('json') == true;
final isRange = request.headers.containsKey('range');
if (isJson && !isRange) {
final bytes = await response.stream.toBytes();
return Response(
response.statusCode,
body: bytes,
headers: responseHeaders,
);
}
// ALWAYS stream the response for maximum performance and to avoid memory issues with large JSONs
return Response(
response.statusCode,
body: response.stream,