mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-11 18:57:30 +03:00
sq179 пофикси эту хуйню
This commit is contained in:
parent
8e7aabc7f7
commit
fa801843e8
1 changed files with 62 additions and 11 deletions
|
@ -5,8 +5,10 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class RequestAuthHandler extends CachedAuthHandler {
|
public final class RequestAuthHandler extends CachedAuthHandler {
|
||||||
|
@ -19,30 +21,29 @@ public void init() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entry fetchEntry(UUID uuid) throws IOException {
|
protected Entry fetchEntry(UUID uuid) throws IOException {
|
||||||
// Входные данные - uuid ^, выходные - username
|
throw new UnsupportedOperationException("Произошол троллинг...");
|
||||||
String uuidTOstring = uuid.toString();
|
|
||||||
// вот запрос например этот выглядит так: localhost/auth.php?type = GetUsername & uuid = переменная uuidTOstring
|
|
||||||
return IOHelper.request(new URL(CommonHelper.replace(url, "type", "GetUsername", "uuid", IOHelper.urlEncode(uuidTOstring))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Entry fetchEntry(String username) throws IOException {
|
protected Entry fetchEntry(String username) throws IOException {
|
||||||
// тут надо с точностью наоборот как выше, вместо uuid входные данные username
|
throw new UnsupportedOperationException("Произошол троллинг...");
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException {
|
protected boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException {
|
||||||
return false;
|
return updUUID(uuid, username).equals("OK");
|
||||||
// тут и ниже пока не трогай
|
// а как объеденить?
|
||||||
|
return updAccessToken(accessToken, username).equals("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean updateServerID(UUID uuid, String serverID) throws IOException {
|
protected boolean updateServerID(UUID uuid, String serverID) throws IOException {
|
||||||
return false;
|
return updServerID(uuid, serverID).equals("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Override
|
@Override
|
||||||
public UUID usernameToUUID(String username) throws IOException {
|
public UUID usernameToUUID(String username) throws IOException {
|
||||||
|
@ -50,7 +51,6 @@ public UUID usernameToUUID(String username) throws IOException {
|
||||||
UUID stringTOuuid = UUID.fromString(currentResponse);
|
UUID stringTOuuid = UUID.fromString(currentResponse);
|
||||||
return stringTOuuid;
|
return stringTOuuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String uuidToUsername(UUID uuid) throws IOException {
|
public String uuidToUsername(UUID uuid) throws IOException {
|
||||||
String uuidTOstring = uuid.toString();
|
String uuidTOstring = uuid.toString();
|
||||||
|
@ -58,8 +58,59 @@ public String uuidToUsername(UUID uuid) throws IOException {
|
||||||
return currentResponse;
|
return currentResponse;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected String updAccessToken(final String accessToken, final String username) throws IOException {
|
||||||
|
final String type = "SetAccessToken";
|
||||||
|
final String encodedUsername = IOHelper.urlEncode(Objects.toString(username));
|
||||||
|
final String encodedAccessToken = IOHelper.urlEncode(Objects.toString(accessToken));
|
||||||
|
final URL formattedUrl = new URL(
|
||||||
|
CommonHelper.replace(url,
|
||||||
|
"type",
|
||||||
|
type,
|
||||||
|
"username",
|
||||||
|
encodedUsername,
|
||||||
|
"uuid",
|
||||||
|
encodedAccessToken));
|
||||||
|
|
||||||
|
return IOHelper.request(formattedUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String updServerID(final UUID uuid, final String serverID) throws IOException {
|
||||||
|
final String type = "SetServerID";
|
||||||
|
final String encodedUUID = IOHelper.urlEncode(Objects.toString(uuid));
|
||||||
|
final String encodedID = IOHelper.urlEncode(serverID);
|
||||||
|
final URL formattedUrl = new URL(
|
||||||
|
CommonHelper.replace(url,
|
||||||
|
"type",
|
||||||
|
type,
|
||||||
|
"uuid",
|
||||||
|
encodedUUID,
|
||||||
|
"ServerID",
|
||||||
|
encodedID));
|
||||||
|
|
||||||
|
return IOHelper.request(formattedUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String updUUID(final UUID uuid, final String username) throws IOException {
|
||||||
|
final String type = "SetUUID";
|
||||||
|
final String encodedUsername = IOHelper.urlEncode(Objects.toString(username));
|
||||||
|
final String encodedUUID = IOHelper.urlEncode(Objects.toString(uuid));
|
||||||
|
final URL formattedUrl = new URL(
|
||||||
|
CommonHelper.replace(url,
|
||||||
|
"type",
|
||||||
|
type,
|
||||||
|
"username",
|
||||||
|
encodedUsername,
|
||||||
|
"uuid",
|
||||||
|
encodedUUID));
|
||||||
|
|
||||||
|
return IOHelper.request(formattedUrl);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
// Ничего не делать
|
// Ничего не делать
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue