Skip to content

Commit

Permalink
fix: hero images for web
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Sep 7, 2024
1 parent 9ffb41a commit 9c8ee86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ run:
RUST_BACKTRACE=0 \
RUST_LOG="info,replex=debug" \
REPLEX_NTF_WATCHLIST_FORCE=0 \
RUSTFLAGS=-Awarnings \
cargo watch -w src -x run

fix:
Expand Down
12 changes: 9 additions & 3 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,20 @@ async fn resolve_local_media_path(
req: &mut Request,
res: &mut Response,
) {
let context: PlexContext = req.extract().await.unwrap();
let mut context: PlexContext = req.extract().await.unwrap();
let url = req.query::<String>("url");
if url.is_some() && url.clone().unwrap().contains("/replex/image/hero")
{
let uri: url::Url = url::Url::parse(url.unwrap().as_str()).unwrap();
let uuid = uri.path_segments().unwrap().last();
let segments = uri.path_segments().unwrap().collect::<Vec<&str>>();

let uuid = segments[segments.len() - 2];
if context.token.is_none() {
context.token = Some(segments.last().unwrap().to_string());
}

let plex_client = PlexClient::from_context(&context);
let rurl = plex_client.get_hero_art(uuid.unwrap().to_string()).await;
let rurl = plex_client.get_hero_art(uuid.to_string()).await;
if rurl.is_some() {
add_query_param_salvo(req, "url".to_string(), rurl.unwrap());
}
Expand Down
2 changes: 1 addition & 1 deletion src/transform/media_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Transform for MediaStyleTransform {
}
guid = guid.replace("plex://", "");

let cover_art = Some(format!("/replex/image/hero/{}?X-Plex-Token={}",
let cover_art = Some(format!("/replex/image/hero/{}/{}",
// let cover_art = Some(format!("{}://{}/replex/image/hero/{}?X-Plex-Token={}",
// match options.forwarded_proto {
// Some(v) => v,
Expand Down

0 comments on commit 9c8ee86

Please sign in to comment.