mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: Implement Xtream proxy handler with SSRF protection and M3U8 URL rewriting, resolving 502 proxy errors.
This commit is contained in:
1 parent
c9a212ec4f
commit
d0a2a1ee6a
2 files changed
+17
-2
No files matched your search
@@ -13,9 +13,7 @@ class ProxyHandler {
|
|||||||
|
|
||||||
static const _allowedHeaders = [
|
static const _allowedHeaders = [
|
||||||
'content-type',
|
'content-type',
|
||||||
'content-length',
|
|
||||||
'content-range',
|
'content-range',
|
||||||
'transfer-encoding',
|
|
||||||
'accept-ranges',
|
'accept-ranges',
|
||||||
'cache-control',
|
'cache-control',
|
||||||
];
|
];
|
||||||
@@ -134,6 +132,7 @@ class ProxyHandler {
|
|||||||
|
|
||||||
final client = http.Client();
|
final client = http.Client();
|
||||||
try {
|
try {
|
||||||
|
print('[Proxy] Forwarding to: $targetUrl');
|
||||||
final proxyRequest = http.Request(request.method, targetUrl);
|
final proxyRequest = http.Request(request.method, targetUrl);
|
||||||
proxyRequest.headers.addAll(proxyHeaders);
|
proxyRequest.headers.addAll(proxyHeaders);
|
||||||
proxyRequest.followRedirects = true;
|
proxyRequest.followRedirects = true;
|
||||||
@@ -157,6 +156,21 @@ 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
response.statusCode,
|
response.statusCode,
|
||||||
body: response.stream,
|
body: response.stream,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Refonte du Guide TV pour inclure les catégories et corriger l'EPG.
|
|||||||
- [x] Correction Connectivité Mobile (Auto-origin + Manuel Override)
|
- [x] Correction Connectivité Mobile (Auto-origin + Manuel Override)
|
||||||
- [x] Compatibilité Streaming iOS (HLS Live + Proxy Streaming)
|
- [x] Compatibilité Streaming iOS (HLS Live + Proxy Streaming)
|
||||||
- [x] Correction Chemins HLS Relatifs (Bug chemins absolus FFmpeg)
|
- [x] Correction Chemins HLS Relatifs (Bug chemins absolus FFmpeg)
|
||||||
|
- [x] Résolution Erreur 502 Proxy (Nettoyage Headers + API Buffer)
|
||||||
|
|
||||||
## Progress Log
|
## Progress Log
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user