[FEATURE] Портирование ProfilesRequest

This commit is contained in:
Gravit 2019-02-10 17:00:05 +07:00
parent 98354345a0
commit be32df3e1e
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 18 additions and 5 deletions

View file

@ -99,9 +99,9 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
clientData.profile = p;
}
}
if (clientData.profile == null) {
throw new AuthException("You profile not found");
}
//if (clientData.profile == null) {
// throw new AuthException("You profile not found");
//}
UUID uuid = LaunchServer.server.config.authHandler.auth(aresult);
if(authType == ConnectTypes.CLIENT)
LaunchServer.server.config.hwidHandler.check(hwid, aresult.username);

View file

@ -18,7 +18,7 @@ public String getType() {
@Override
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"));
return;

View file

@ -7,6 +7,8 @@
import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.launcher.request.Request;
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.HOutput;
@ -14,7 +16,7 @@
import java.util.Collections;
import java.util.List;
public final class ProfilesRequest extends Request<ProfilesRequestEvent> {
public final class ProfilesRequest extends Request<ProfilesRequestEvent> implements RequestInterface {
@LauncherAPI
public ProfilesRequest() {
@ -31,6 +33,12 @@ public Integer getLegacyType() {
return RequestType.PROFILES.getNumber();
}
@Override
public ProfilesRequestEvent requestWebSockets() throws Exception
{
return (ProfilesRequestEvent) LegacyRequestBridge.sendRequest(this);
}
@Override
protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Exception {
output.writeBoolean(true);
@ -46,4 +54,9 @@ protected ProfilesRequestEvent requestDo(HInput input, HOutput output) throws Ex
// Return request result
return new ProfilesRequestEvent(profiles);
}
@Override
public String getType() {
return "profiles";
}
}