mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Портирование ProfilesRequest
This commit is contained in:
parent
98354345a0
commit
be32df3e1e
3 changed files with 18 additions and 5 deletions
|
@ -99,9 +99,9 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
||||||
clientData.profile = p;
|
clientData.profile = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clientData.profile == null) {
|
//if (clientData.profile == null) {
|
||||||
throw new AuthException("You profile not found");
|
// throw new AuthException("You profile not found");
|
||||||
}
|
//}
|
||||||
UUID uuid = LaunchServer.server.config.authHandler.auth(aresult);
|
UUID uuid = LaunchServer.server.config.authHandler.auth(aresult);
|
||||||
if(authType == ConnectTypes.CLIENT)
|
if(authType == ConnectTypes.CLIENT)
|
||||||
LaunchServer.server.config.hwidHandler.check(hwid, aresult.username);
|
LaunchServer.server.config.hwidHandler.check(hwid, aresult.username);
|
||||||
|
|
|
@ -18,7 +18,7 @@ public String getType() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||||
if(!client.isAuth)
|
if(!client.checkSign)
|
||||||
{
|
{
|
||||||
service.sendObject(ctx, new WebSocketService.ErrorResult("Access denied"));
|
service.sendObject(ctx, new WebSocketService.ErrorResult("Access denied"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.request.Request;
|
import ru.gravit.launcher.request.Request;
|
||||||
import ru.gravit.launcher.request.RequestType;
|
import ru.gravit.launcher.request.RequestType;
|
||||||
|
import ru.gravit.launcher.request.websockets.LegacyRequestBridge;
|
||||||
|
import ru.gravit.launcher.request.websockets.RequestInterface;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
|
||||||
|
@ -14,7 +16,7 @@
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class ProfilesRequest extends Request<ProfilesRequestEvent> {
|
public final class ProfilesRequest extends Request<ProfilesRequestEvent> implements RequestInterface {
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public ProfilesRequest() {
|
public ProfilesRequest() {
|
||||||
|
@ -31,6 +33,12 @@ public Integer getLegacyType() {
|
||||||
return RequestType.PROFILES.getNumber();
|
return RequestType.PROFILES.getNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProfilesRequestEvent requestWebSockets() throws Exception
|
||||||
|
{
|
||||||
|
return (ProfilesRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Exception {
|
protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Exception {
|
||||||
output.writeBoolean(true);
|
output.writeBoolean(true);
|
||||||
|
@ -46,4 +54,9 @@ protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Ex
|
||||||
// Return request result
|
// Return request result
|
||||||
return new ProfilesRequestEvent(profiles);
|
return new ProfilesRequestEvent(profiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "profiles";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue