multi-provider hls stream fix

This commit is contained in:
euzu
2025-04-24 18:34:56 +02:00
parent 9f3c2bca69
commit 0661ea2026
4 changed files with 12 additions and 16 deletions
+3 -9
View File
@@ -472,7 +472,7 @@ fn is_throttled_stream(item_type: PlaylistItemType, throttle_kbps: usize) -> boo
const SESSION_COOKIE_NAME: &str = "m3uflt_session=";
fn create_delete_session_cookie() -> String {
format!("{SESSION_COOKIE_NAME}=; Max-Age=0; Path=/; HttpOnly")
format!("{SESSION_COOKIE_NAME}; Max-Age=0; Path=/; HttpOnly")
}
fn create_session_cookie(cookie: &str) -> String {
@@ -822,7 +822,7 @@ pub fn redirect(url: &str) -> impl IntoResponse {
pub fn is_seek_response(
cluster: XtreamCluster,
virtual_id: u32,
_virtual_id: u32,
req_headers: &HeaderMap,
) -> Option<String> {
// seek only for non-live streams
@@ -830,19 +830,13 @@ pub fn is_seek_response(
return None;
}
// cookie needs to have virtual_id to identify that we have the same item
let cookie = read_session_cookie(req_headers)?;
if !cookie.starts_with(&format!("{virtual_id}:")) {
return None;
}
// seek requests contain range header
let range = req_headers.get("range")?.to_str().ok()?;
if range.starts_with("bytes=0-") {
return None;
}
Some(cookie)
Some(read_session_cookie(req_headers)?)
}
pub async fn check_force_provider(app_state: &AppState, virtual_id: u32, req_headers: &HeaderMap, user: &ProxyUserCredentials) -> (Option<String>, UserConnectionPermission) {