mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-25 01:02:29 +02:00
multi-provider hls stream fix
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user