mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Возможность не указывать профиль при авторизации
This commit is contained in:
parent
7a7abd09bd
commit
d845b73c85
3 changed files with 19 additions and 12 deletions
|
@ -40,7 +40,10 @@ public AuthResponse(LaunchServer server, long session, HInput input, HOutput out
|
||||||
@Override
|
@Override
|
||||||
public void reply() throws Exception {
|
public void reply() throws Exception {
|
||||||
String login = input.readString(SerializeLimits.MAX_LOGIN);
|
String login = input.readString(SerializeLimits.MAX_LOGIN);
|
||||||
String client = input.readString(SerializeLimits.MAX_CLIENT);
|
boolean isClient = input.readBoolean();
|
||||||
|
String client = null;
|
||||||
|
if(isClient)
|
||||||
|
client = input.readString(SerializeLimits.MAX_CLIENT);
|
||||||
int auth_id = input.readInt();
|
int auth_id = input.readInt();
|
||||||
long hwid_hdd = input.readLong();
|
long hwid_hdd = input.readLong();
|
||||||
long hwid_cpu = input.readLong();
|
long hwid_cpu = input.readLong();
|
||||||
|
@ -73,17 +76,19 @@ public void reply() throws Exception {
|
||||||
AuthProvider.authError(String.format("Illegal result: '%s'", result.username));
|
AuthProvider.authError(String.format("Illegal result: '%s'", result.username));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Collection<SignedObjectHolder<ClientProfile>> profiles = server.getProfiles();
|
if(isClient) {
|
||||||
for (SignedObjectHolder<ClientProfile> p : profiles) {
|
Collection<SignedObjectHolder<ClientProfile>> profiles = server.getProfiles();
|
||||||
if (p.object.getTitle().equals(client)) {
|
for (SignedObjectHolder<ClientProfile> p : profiles) {
|
||||||
if (!p.object.isWhitelistContains(login)) {
|
if (p.object.getTitle().equals(client)) {
|
||||||
throw new AuthException(server.config.whitelistRejectString);
|
if (!p.object.isWhitelistContains(login)) {
|
||||||
|
throw new AuthException(server.config.whitelistRejectString);
|
||||||
|
}
|
||||||
|
clientData.profile = p.object;
|
||||||
}
|
}
|
||||||
clientData.profile = p.object;
|
|
||||||
}
|
}
|
||||||
}
|
if (clientData.profile == null) {
|
||||||
if(clientData.profile == null) {
|
throw new AuthException("You profile not found");
|
||||||
throw new AuthException("You profile not found");
|
}
|
||||||
}
|
}
|
||||||
server.config.hwidHandler.check(HWID.gen(hwid_hdd, hwid_bios, hwid_cpu), result.username);
|
server.config.hwidHandler.check(HWID.gen(hwid_hdd, hwid_bios, hwid_cpu), result.username);
|
||||||
} catch (AuthException | HWIDException e) {
|
} catch (AuthException | HWIDException e) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ private static Texture getTexture(String url, boolean cloak) throws IOException
|
||||||
private static String getTextureURL(String url, UUID uuid, String username, String client) {
|
private static String getTextureURL(String url, UUID uuid, String username, String client) {
|
||||||
return CommonHelper.replace(url, "username", IOHelper.urlEncode(username),
|
return CommonHelper.replace(url, "username", IOHelper.urlEncode(username),
|
||||||
"uuid", IOHelper.urlEncode(uuid.toString()), "hash", IOHelper.urlEncode(Launcher.toHash(uuid)),
|
"uuid", IOHelper.urlEncode(uuid.toString()), "hash", IOHelper.urlEncode(Launcher.toHash(uuid)),
|
||||||
"client", IOHelper.urlEncode(client));
|
"client", IOHelper.urlEncode(client == null ? "unknown" : client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
|
|
|
@ -67,7 +67,9 @@ public Integer getType() {
|
||||||
@Override
|
@Override
|
||||||
protected Result requestDo(HInput input, HOutput output) throws IOException {
|
protected Result requestDo(HInput input, HOutput output) throws IOException {
|
||||||
output.writeString(login, SerializeLimits.MAX_LOGIN);
|
output.writeString(login, SerializeLimits.MAX_LOGIN);
|
||||||
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
output.writeBoolean(Launcher.profile != null);
|
||||||
|
if(Launcher.profile != null)
|
||||||
|
output.writeString(Launcher.profile.getTitle(), SerializeLimits.MAX_CLIENT);
|
||||||
output.writeInt(auth_id);
|
output.writeInt(auth_id);
|
||||||
output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetHddId() : 0);
|
output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetHddId() : 0);
|
||||||
output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetCpuid() : 0);
|
output.writeLong(Launcher.isUsingAvanguard() ? GuardBind.avnGetCpuid() : 0);
|
||||||
|
|
Loading…
Reference in a new issue