mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Дублирование функций Client.Type и ConnectTypes
This commit is contained in:
parent
b93848055b
commit
8c62cfff11
4 changed files with 8 additions and 4 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import pro.gravit.launcher.NeedGarbageCollection;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -27,7 +28,7 @@ public void garbageCollection() {
|
|||
long time = System.currentTimeMillis();
|
||||
clientSet.entrySet().removeIf(entry -> {
|
||||
Client c = entry.getValue();
|
||||
return (c.timestamp + SESSION_TIMEOUT < time) && ((c.type == Client.Type.USER) || ((c.type == Client.Type.SERVER) && GARBAGE_SERVER));
|
||||
return (c.timestamp + SESSION_TIMEOUT < time) && ((c.type == AuthResponse.ConnectTypes.CLIENT) || ((c.type == AuthResponse.ConnectTypes.SERVER) && GARBAGE_SERVER));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
import pro.gravit.launcher.profiles.ClientProfile;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class Client {
|
||||
public long session;
|
||||
public String auth_id;
|
||||
public long timestamp;
|
||||
public final Type type;
|
||||
public AuthResponse.ConnectTypes type;
|
||||
public ClientProfile profile;
|
||||
public boolean isAuth;
|
||||
public boolean checkSign;
|
||||
|
@ -25,7 +26,7 @@ public class Client {
|
|||
public Client(long session) {
|
||||
this.session = session;
|
||||
timestamp = System.currentTimeMillis();
|
||||
type = Type.USER;
|
||||
type = null;
|
||||
isAuth = false;
|
||||
permissions = ClientPermissions.DEFAULT;
|
||||
username = "";
|
||||
|
|
|
@ -127,6 +127,7 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
|||
LogHelper.debug("Auth: %s accessToken %s uuid: %s", login, result.accessToken, uuid.toString());
|
||||
}
|
||||
}
|
||||
clientData.type = authType;
|
||||
sendResult(result);
|
||||
} catch (AuthException | HWIDException | HookException e) {
|
||||
sendError(e.getMessage());
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import pro.gravit.launchserver.config.LaunchServerConfig;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
public class UpdateResponse extends SimpleResponse {
|
||||
|
@ -19,7 +20,7 @@ public String getType() {
|
|||
|
||||
@Override
|
||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||
if (!client.isAuth || client.type != Client.Type.USER || client.profile == null) {
|
||||
if (!client.isAuth || client.type != AuthResponse.ConnectTypes.CLIENT || client.profile == null) {
|
||||
sendError("Access denied");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue