СУКА ЛАСТ ФИКСЫ ДЛЯ ПРОХОДОК (логин работает)
This commit is contained in:
@@ -50,11 +50,11 @@ public class AuthManager {
|
||||
try {
|
||||
String body = GSON.toJson(new LoginRequest(username, password));
|
||||
|
||||
System.out.println(ZAnsi.cyan("[AUTH] Отправка запроса: " + endpoint));
|
||||
//System.out.println(ZAnsi.cyan("[AUTH] Отправка запроса: " + endpoint));
|
||||
|
||||
SimpleHttpResponse resp = post(endpoint, body);
|
||||
|
||||
System.out.println(ZAnsi.cyan("[AUTH] Ответ: HTTP " + resp.statusCode()));
|
||||
//System.out.println(ZAnsi.cyan("[AUTH] Ответ: HTTP " + resp.statusCode()));
|
||||
|
||||
if (resp.statusCode() == 200) {
|
||||
session = GSON.fromJson(resp.body(), AuthSession.class);
|
||||
@@ -67,7 +67,7 @@ public class AuthManager {
|
||||
return AuthResult.fail(extractError(resp.body()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println(ZAnsi.red("[AUTH] Исключение: " + e.getMessage()));
|
||||
//System.err.println(ZAnsi.red("[AUTH] Исключение: " + e.getMessage()));
|
||||
e.printStackTrace();
|
||||
return AuthResult.fail("Ошибка соединения: " + e.getMessage());
|
||||
}
|
||||
@@ -147,6 +147,12 @@ public class AuthManager {
|
||||
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
conn.setRequestProperty("User-Agent", "ZernMC-Launcher/1.0");
|
||||
|
||||
// Добавляем токен авторизации, если есть сессия
|
||||
if (session != null && session.accessToken != null) {
|
||||
conn.setRequestProperty("Authorization", "Bearer " + session.accessToken);
|
||||
}
|
||||
|
||||
conn.setDoOutput(true);
|
||||
conn.setConnectTimeout(15000);
|
||||
conn.setReadTimeout(15000);
|
||||
@@ -209,13 +215,18 @@ public class AuthManager {
|
||||
String json = "{\"pass_code\":\"" + passCode.toUpperCase() + "\"}";
|
||||
SimpleHttpResponse resp = post("/auth/pass/activate", json);
|
||||
|
||||
System.out.println(ZAnsi.cyan("[AUTH] Активация проходки: HTTP " + resp.statusCode()));
|
||||
|
||||
if (resp.statusCode() == 200) {
|
||||
return "Проходка успешно активирована!";
|
||||
} else if (resp.statusCode() == 401) {
|
||||
return "Ошибка: Требуется авторизация. Перезайдите в аккаунт.";
|
||||
} else {
|
||||
String error = extractError(resp.body());
|
||||
return "Ошибка: " + error;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "Ошибка соединения: " + e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user