Skip to content

Commit

Permalink
fix: some more bootatrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Jul 12, 2024
1 parent c8b00a3 commit 7c019ac
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,26 +343,31 @@ async fn ntf_watchlist_force(
let json_data = r#"{"enabled": true,"libraries": [],"identifier": "tv.plex.notification.library.new"}"#;
let client = reqwest::Client::new();

println!("Bootstrao for request: {} platform: {} product: {} device name: {}",
dbg!("Bootstrao for request: {} platform: {} product: {} device name: {}",
params.clone().username.unwrap_or_default(),
params.clone().platform,
params.clone().product.unwrap_or_default(),
params.clone().device_name.unwrap_or_default()
);

let client_base = "https://clients.plex.tv";
let user: PlexUser = client
let res = client
.get(format!("{}/api/v2/user", client_base))
.header("Accept", "application/json")
.header("X-Plex-Token", &token)
.header("X-Plex-Client-Identifier", &client_id)
.send()
.await
.unwrap()
.json()
.await
.unwrap();

if !res.status().is_success() {
dbg!("cannot get user");
return;
}

let user: PlexUser = res.json().await.unwrap();
dbg!(&user);

let response = client
.post(url)
.header("Content-Type", "application/json")
Expand Down Expand Up @@ -395,7 +400,7 @@ async fn ntf_watchlist_force(
.await
.unwrap();

println!("Set opt out status: {}",
dbg!("Set opt out status: {}",
&response.status()
);

Expand Down

0 comments on commit 7c019ac

Please sign in to comment.