mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FIX][EXPERIMENTAL] Фикс возможных проблем
This commit is contained in:
parent
08f811add2
commit
fcacd4fe12
1 changed files with 8 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
||||||
import ru.gravit.launcher.hasher.HashedEntry;
|
import ru.gravit.launcher.hasher.HashedEntry;
|
||||||
import ru.gravit.launcher.hasher.HashedEntryAdapter;
|
import ru.gravit.launcher.hasher.HashedEntryAdapter;
|
||||||
import ru.gravit.launcher.request.JsonResultSerializeAdapter;
|
import ru.gravit.launcher.request.JsonResultSerializeAdapter;
|
||||||
|
import ru.gravit.launcher.request.Request;
|
||||||
import ru.gravit.launcher.request.RequestException;
|
import ru.gravit.launcher.request.RequestException;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
import ru.gravit.launcher.request.admin.ProxyRequest;
|
import ru.gravit.launcher.request.admin.ProxyRequest;
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class WebSocketService {
|
public class WebSocketService {
|
||||||
|
@ -73,7 +75,8 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
|
||||||
simpleResponse.ctx = ctx;
|
simpleResponse.ctx = ctx;
|
||||||
}
|
}
|
||||||
LogHelper.debug("Proxy %s request", response.getType());
|
LogHelper.debug("Proxy %s request", response.getType());
|
||||||
ProxyRequest proxyRequest = new ProxyRequest(response, 0);
|
if(client.session == 0) client.session = new Random().nextLong();
|
||||||
|
ProxyRequest proxyRequest = new ProxyRequest(response, client.session);
|
||||||
proxyRequest.isCheckSign = client.checkSign;
|
proxyRequest.isCheckSign = client.checkSign;
|
||||||
try {
|
try {
|
||||||
ResultInterface result = proxyRequest.request();
|
ResultInterface result = proxyRequest.request();
|
||||||
|
@ -85,6 +88,10 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
|
||||||
client.session = authRequestEvent.session;
|
client.session = authRequestEvent.session;
|
||||||
if(authRequestEvent.playerProfile != null) client.username = authRequestEvent.playerProfile.username;
|
if(authRequestEvent.playerProfile != null) client.username = authRequestEvent.playerProfile.username;
|
||||||
}
|
}
|
||||||
|
if(result instanceof Request && response instanceof SimpleResponse)
|
||||||
|
{
|
||||||
|
((Request) result).requestUUID = ((SimpleResponse) response).requestUUID;
|
||||||
|
}
|
||||||
sendObject(ctx, result);
|
sendObject(ctx, result);
|
||||||
} catch (RequestException e)
|
} catch (RequestException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue