Skip to content

Commit 7c019ac

Browse files
committed
fix: some more bootatrapping
1 parent c8b00a3 commit 7c019ac

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/routes.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -343,26 +343,31 @@ async fn ntf_watchlist_force(
343343
let json_data = r#"{"enabled": true,"libraries": [],"identifier": "tv.plex.notification.library.new"}"#;
344344
let client = reqwest::Client::new();
345345

346-
println!("Bootstrao for request: {} platform: {} product: {} device name: {}",
346+
dbg!("Bootstrao for request: {} platform: {} product: {} device name: {}",
347347
params.clone().username.unwrap_or_default(),
348348
params.clone().platform,
349349
params.clone().product.unwrap_or_default(),
350350
params.clone().device_name.unwrap_or_default()
351351
);
352352

353353
let client_base = "https://clients.plex.tv";
354-
let user: PlexUser = client
354+
let res = client
355355
.get(format!("{}/api/v2/user", client_base))
356356
.header("Accept", "application/json")
357357
.header("X-Plex-Token", &token)
358358
.header("X-Plex-Client-Identifier", &client_id)
359359
.send()
360360
.await
361-
.unwrap()
362-
.json()
363-
.await
364361
.unwrap();
362+
363+
if !res.status().is_success() {
364+
dbg!("cannot get user");
365+
return;
366+
}
367+
368+
let user: PlexUser = res.json().await.unwrap();
365369
dbg!(&user);
370+
366371
let response = client
367372
.post(url)
368373
.header("Content-Type", "application/json")
@@ -395,7 +400,7 @@ async fn ntf_watchlist_force(
395400
.await
396401
.unwrap();
397402

398-
println!("Set opt out status: {}",
403+
dbg!("Set opt out status: {}",
399404
&response.status()
400405
);
401406

0 commit comments

Comments
 (0)