Skip to content

Commit c241418

Browse files
committed
fix: skip livtv
1 parent 52a76d1 commit c241418

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/models.rs

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ pub struct PlexContext {
120120
pub platform: Option<Platform>,
121121
#[salvo(extract(rename = "X-Plex-Username"))]
122122
pub username: Option<String>,
123+
#[salvo(extract(rename = "path"))]
124+
pub path: Option<String>,
123125
#[serde(default, deserialize_with = "deserialize_screen_resolution")]
124126
#[salvo(extract(rename = "X-Plex-Device-Screen-Resolution"))]
125127
pub screen_resolution: Vec<Resolution>,

src/routes.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,15 @@ async fn should_skip(
227227
depot: &mut Depot,
228228
ctrl: &mut FlowCtrl,
229229
) {
230-
231-
// We do this because of a bug in extract. Which taks the body which is needed for proy
232-
let queries: PlexContextProduct = req.parse_queries().unwrap();
233-
let headers: PlexContextProduct = req.parse_headers().unwrap();
234-
let product: Option<String> = if queries.product.is_some() {
235-
queries.product
236-
} else if headers.product.is_some() {
237-
headers.product
238-
} else {
239-
None
230+
let context: PlexContext = req.extract().await.unwrap();
231+
232+
let is_livetv = match context.path.clone() {
233+
Some(v) => v.contains("livetv"),
234+
None => false
240235
};
241236

242-
if product.is_some()
243-
&& product.clone().unwrap().to_lowercase() == "plexamp"
237+
if is_livetv || (context.product.is_some()
238+
&& context.product.clone().unwrap().to_lowercase() == "plexamp")
244239
{
245240

246241
let config: Config = Config::dynamic(req).extract().unwrap();

0 commit comments

Comments
 (0)