From fa345b493b114e3a109366435dbbb34f0d0b7937 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:47:20 +0000 Subject: [PATCH] Fix for proxying LBRY HLS. --- src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index f059522..1832e3a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -188,10 +188,8 @@ async fn index(req: HttpRequest) -> Result> { if url.starts_with("https://") { return line.replace(url, localize_url(url, host).as_str()); } - } else if line.starts_with("https://") { - return localize_url(line, host); } - line.to_string() + localize_url(line, host) }).collect::>().join("\n"); return Ok(response.body(modified)); @@ -212,7 +210,7 @@ fn localize_url(url: &str, host: &str) -> String { .append_pair("host", &host); return format!("{}?{}", url.path(), url.query().unwrap()); - } else if url.starts_with('/') { + } else if url.ends_with(".m3u8") || url.ends_with(".ts") { return if url.contains('?') { format!("{}&host={}", url, host) } else {