Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- src/api.rs +6 -2
- src/main.rs +1 -1
src/api.rs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
use serde::{Serialize, Deserialize, de::DeserializeOwned};
|
| 2 |
use std::{env, marker::Sized, time::Instant, sync::Arc};
|
| 3 |
-
use std::time::{
|
| 4 |
use thiserror::Error;
|
| 5 |
use serde_json::{json, value::from_value};
|
| 6 |
use reqwest::{Client, Response, cookie::Jar, Url, header::ACCEPT};
|
|
@@ -11,7 +11,7 @@ struct DeezerResponse {
|
|
| 11 |
results: serde_json::Value,
|
| 12 |
}
|
| 13 |
|
| 14 |
-
#[derive(Deserialize, Serialize, Debug)]
|
| 15 |
#[allow(non_camel_case_types)]
|
| 16 |
pub enum Format {
|
| 17 |
AAC_64,
|
|
@@ -118,6 +118,10 @@ impl APIClient {
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
pub async fn user_data(&mut self) -> Result<serde_json::Value, APIError> {
|
| 122 |
self.no_renew_api_call("deezer.getUserData", &json!({})).await
|
| 123 |
}
|
|
|
|
| 1 |
use serde::{Serialize, Deserialize, de::DeserializeOwned};
|
| 2 |
use std::{env, marker::Sized, time::Instant, sync::Arc};
|
| 3 |
+
use std::time::{SystemTime, UNIX_EPOCH};
|
| 4 |
use thiserror::Error;
|
| 5 |
use serde_json::{json, value::from_value};
|
| 6 |
use reqwest::{Client, Response, cookie::Jar, Url, header::ACCEPT};
|
|
|
|
| 11 |
results: serde_json::Value,
|
| 12 |
}
|
| 13 |
|
| 14 |
+
#[derive(Clone, Deserialize, Serialize, Debug)]
|
| 15 |
#[allow(non_camel_case_types)]
|
| 16 |
pub enum Format {
|
| 17 |
AAC_64,
|
|
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
|
| 121 |
+
pub fn session_tokens(&self) -> (String, String) {
|
| 122 |
+
(self.check_form.clone(), self.license_token.clone())
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
pub async fn user_data(&mut self) -> Result<serde_json::Value, APIError> {
|
| 126 |
self.no_renew_api_call("deezer.getUserData", &json!({})).await
|
| 127 |
}
|
src/main.rs
CHANGED
|
@@ -2817,7 +2817,7 @@ async fn warm_arl(State(state): State<AppState>, Json(req): Json<WarmArlReq>) ->
|
|
| 2817 |
return json_error(StatusCode::SERVICE_UNAVAILABLE, format!("warm:renew:{e}"));
|
| 2818 |
}
|
| 2819 |
}
|
| 2820 |
-
(c.
|
| 2821 |
};
|
| 2822 |
|
| 2823 |
store_arl_session(&state, &arl, &session.0, &session.1).await;
|
|
|
|
| 2817 |
return json_error(StatusCode::SERVICE_UNAVAILABLE, format!("warm:renew:{e}"));
|
| 2818 |
}
|
| 2819 |
}
|
| 2820 |
+
(c.session_tokens())
|
| 2821 |
};
|
| 2822 |
|
| 2823 |
store_arl_session(&state, &arl, &session.0, &session.1).await;
|