Spaces:
Paused
Paused
Upload main.rs
Browse files- src/main.rs +13 -16
src/main.rs
CHANGED
|
@@ -1008,8 +1008,6 @@ async fn gw_light_call(
|
|
| 1008 |
("cid", cid.as_str()),
|
| 1009 |
])
|
| 1010 |
.header(ACCEPT, "*/*")
|
| 1011 |
-
.header("Cache-Control", "max-age=0")
|
| 1012 |
-
.header("Connection", "keep-alive")
|
| 1013 |
.header("Origin", "https://www.deezer.com")
|
| 1014 |
.header("Referer", "https://www.deezer.com/")
|
| 1015 |
.header("Sec-Fetch-Site", "same-origin")
|
|
@@ -1017,9 +1015,6 @@ async fn gw_light_call(
|
|
| 1017 |
.header("Sec-Fetch-Dest", "empty")
|
| 1018 |
.header("X-Requested-With", "XMLHttpRequest")
|
| 1019 |
.header("Accept-Language", "en-US,en;q=0.9")
|
| 1020 |
-
.header("Content-Language", "en-US")
|
| 1021 |
-
.header("X-User-IP", "1.1.1.1")
|
| 1022 |
-
.header("x-deezer-client-ip", "1.1.1.1")
|
| 1023 |
.header(
|
| 1024 |
"User-Agent",
|
| 1025 |
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
|
|
@@ -1393,10 +1388,12 @@ async fn pair_complete(State(state): State<AppState>, Form(f): Form<PairComplete
|
|
| 1393 |
Err(e) => oauth_err = Some(e),
|
| 1394 |
}
|
| 1395 |
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
if
|
|
|
|
|
|
|
| 1400 |
&client,
|
| 1401 |
&jar,
|
| 1402 |
"user.checkCredentials",
|
|
@@ -1409,18 +1406,15 @@ async fn pair_complete(State(state): State<AppState>, Form(f): Form<PairComplete
|
|
| 1409 |
)
|
| 1410 |
.await
|
| 1411 |
{
|
|
|
|
| 1412 |
if access_token_out.is_none() {
|
|
|
|
| 1413 |
let mut map = state.pair.write().await;
|
| 1414 |
if let Some(s) = map.get_mut(&code) {
|
| 1415 |
-
s.error = Some(
|
| 1416 |
}
|
| 1417 |
-
return Html(format!(
|
| 1418 |
-
"<h3>Ошибка входа</h3><pre>{}</pre>",
|
| 1419 |
-
htmlesc(&format!("gw:checkCredentials:{e}"))
|
| 1420 |
-
))
|
| 1421 |
-
.into_response();
|
| 1422 |
}
|
| 1423 |
-
gw_err = Some(format!("gw:checkCredentials:{e}"));
|
| 1424 |
} else {
|
| 1425 |
gw_token = Some(token.clone());
|
| 1426 |
gw_uid = ud["USER"]["USER_ID"]
|
|
@@ -1437,6 +1431,9 @@ async fn pair_complete(State(state): State<AppState>, Form(f): Form<PairComplete
|
|
| 1437 |
}
|
| 1438 |
}
|
| 1439 |
}
|
|
|
|
|
|
|
|
|
|
| 1440 |
}
|
| 1441 |
|
| 1442 |
if gw_token.is_none() && access_token_out.is_none() {
|
|
|
|
| 1008 |
("cid", cid.as_str()),
|
| 1009 |
])
|
| 1010 |
.header(ACCEPT, "*/*")
|
|
|
|
|
|
|
| 1011 |
.header("Origin", "https://www.deezer.com")
|
| 1012 |
.header("Referer", "https://www.deezer.com/")
|
| 1013 |
.header("Sec-Fetch-Site", "same-origin")
|
|
|
|
| 1015 |
.header("Sec-Fetch-Dest", "empty")
|
| 1016 |
.header("X-Requested-With", "XMLHttpRequest")
|
| 1017 |
.header("Accept-Language", "en-US,en;q=0.9")
|
|
|
|
|
|
|
|
|
|
| 1018 |
.header(
|
| 1019 |
"User-Agent",
|
| 1020 |
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
|
|
|
|
| 1388 |
Err(e) => oauth_err = Some(e),
|
| 1389 |
}
|
| 1390 |
|
| 1391 |
+
match gw_light_call(&client, &jar, "deezer.getUserData", "null", json!({})).await {
|
| 1392 |
+
Ok(ud) => {
|
| 1393 |
+
let token = ud["checkForm"].as_str().unwrap_or("").to_string();
|
| 1394 |
+
if token.is_empty() {
|
| 1395 |
+
gw_err = Some("gw:no_checkForm".to_string());
|
| 1396 |
+
} else if let Err(e) = gw_light_call(
|
| 1397 |
&client,
|
| 1398 |
&jar,
|
| 1399 |
"user.checkCredentials",
|
|
|
|
| 1406 |
)
|
| 1407 |
.await
|
| 1408 |
{
|
| 1409 |
+
gw_err = Some(format!("gw:checkCredentials:{e}"));
|
| 1410 |
if access_token_out.is_none() {
|
| 1411 |
+
let msg = gw_err.clone().unwrap_or_else(|| "gw:checkCredentials".to_string());
|
| 1412 |
let mut map = state.pair.write().await;
|
| 1413 |
if let Some(s) = map.get_mut(&code) {
|
| 1414 |
+
s.error = Some(msg.clone());
|
| 1415 |
}
|
| 1416 |
+
return Html(format!("<h3>Ошибка входа</h3><pre>{}</pre>", htmlesc(&msg))).into_response();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1417 |
}
|
|
|
|
| 1418 |
} else {
|
| 1419 |
gw_token = Some(token.clone());
|
| 1420 |
gw_uid = ud["USER"]["USER_ID"]
|
|
|
|
| 1431 |
}
|
| 1432 |
}
|
| 1433 |
}
|
| 1434 |
+
Err(e) => {
|
| 1435 |
+
gw_err = Some(format!("gw:getUserData:{e}"));
|
| 1436 |
+
}
|
| 1437 |
}
|
| 1438 |
|
| 1439 |
if gw_token.is_none() && access_token_out.is_none() {
|