mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Критические фиксы
This commit is contained in:
parent
c7468eba14
commit
fbfb074e0a
5 changed files with 14 additions and 14 deletions
|
@ -29,7 +29,7 @@ public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
for (ClientProfile p : profiles) {
|
for (ClientProfile p : profiles) {
|
||||||
if (p.getTitle().equals(this.client)) {
|
if (p.getTitle().equals(this.client)) {
|
||||||
if (server.config.protectHandler instanceof ProfilesProtectHandler &&
|
if (server.config.protectHandler instanceof ProfilesProtectHandler &&
|
||||||
((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) {
|
!((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) {
|
||||||
sendError("Access denied");
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public String getType() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ChannelHandlerContext ctx, Client client) {
|
public void execute(ChannelHandlerContext ctx, Client client) {
|
||||||
if (server.config.protectHandler instanceof ProfilesProtectHandler && ((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) {
|
if (server.config.protectHandler instanceof ProfilesProtectHandler && !((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) {
|
||||||
sendError("Access denied");
|
sendError("Access denied");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ClientLauncherEntryPoint {
|
public class ClientLauncherEntryPoint {
|
||||||
private ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException {
|
private static ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException {
|
||||||
try (Socket socket = IOHelper.newSocket())
|
try (Socket socket = IOHelper.newSocket())
|
||||||
{
|
{
|
||||||
socket.connect(address);
|
socket.connect(address);
|
||||||
|
@ -56,7 +56,7 @@ private ClientLauncherProcess.ClientParams readParams(SocketAddress address) thr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static ClientClassLoader classLoader;
|
private static ClientClassLoader classLoader;
|
||||||
public void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
LauncherEngine.IS_CLIENT.set(true);
|
LauncherEngine.IS_CLIENT.set(true);
|
||||||
LauncherEngine engine = LauncherEngine.clientInstance();
|
LauncherEngine engine = LauncherEngine.clientInstance();
|
||||||
LauncherEngine.checkClass(LauncherEngine.class);
|
LauncherEngine.checkClass(LauncherEngine.class);
|
||||||
|
@ -68,9 +68,9 @@ public void main(String[] args) throws Throwable {
|
||||||
initGson(LauncherEngine.modulesManager);
|
initGson(LauncherEngine.modulesManager);
|
||||||
LauncherEngine.verifyNoAgent();
|
LauncherEngine.verifyNoAgent();
|
||||||
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
|
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
|
||||||
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
JVMHelper.verifySystemProperties(ClientLauncherEntryPoint.class, true);
|
||||||
EnvHelper.checkDangerousParams();
|
EnvHelper.checkDangerousParams();
|
||||||
JVMHelper.checkStackTrace(ClientLauncher.class);
|
JVMHelper.checkStackTrace(ClientLauncherEntryPoint.class);
|
||||||
LogHelper.printVersion("Client Launcher");
|
LogHelper.printVersion("Client Launcher");
|
||||||
engine.readKeys();
|
engine.readKeys();
|
||||||
LauncherGuardManager.initGuard(true);
|
LauncherGuardManager.initGuard(true);
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
import pro.gravit.launcher.request.Request;
|
import pro.gravit.launcher.request.Request;
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
import pro.gravit.utils.Version;
|
import pro.gravit.utils.Version;
|
||||||
import pro.gravit.utils.helper.EnvHelper;
|
import pro.gravit.utils.helper.*;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.JVMHelper;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -26,7 +23,7 @@
|
||||||
|
|
||||||
public class ClientLauncherProcess {
|
public class ClientLauncherProcess {
|
||||||
private transient Process process;
|
private transient Process process;
|
||||||
private final transient Boolean[] waitWriteParams = new Boolean[1];
|
private final transient Boolean[] waitWriteParams = new Boolean[] {false};
|
||||||
public final Path executeFile;
|
public final Path executeFile;
|
||||||
public final Path workDir;
|
public final Path workDir;
|
||||||
public final Path javaDir;
|
public final Path javaDir;
|
||||||
|
@ -136,8 +133,8 @@ public void addClientLegacyArgs(Collection<String> args) {
|
||||||
|
|
||||||
// Add args for tweaker
|
// Add args for tweaker
|
||||||
Collections.addAll(args, "--version", profile.getVersion().name);
|
Collections.addAll(args, "--version", profile.getVersion().name);
|
||||||
Collections.addAll(args, "--gameDir", clientDir.toString());
|
Collections.addAll(args, "--gameDir", clientDir);
|
||||||
Collections.addAll(args, "--assetsDir", assetDir.toString());
|
Collections.addAll(args, "--assetsDir", assetDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addModernClientArgs(Collection<String> args) {
|
private void addModernClientArgs(Collection<String> args) {
|
||||||
|
@ -201,6 +198,7 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
||||||
processArgs.add("-cp");
|
processArgs.add("-cp");
|
||||||
//ADD CLASSPATH
|
//ADD CLASSPATH
|
||||||
processArgs.add(String.join(getPathSeparator(), systemClassPath));
|
processArgs.add(String.join(getPathSeparator(), systemClassPath));
|
||||||
|
processArgs.add(mainClass);
|
||||||
processArgs.addAll(systemClientArgs);
|
processArgs.addAll(systemClientArgs);
|
||||||
synchronized (waitWriteParams)
|
synchronized (waitWriteParams)
|
||||||
{
|
{
|
||||||
|
@ -209,6 +207,8 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
||||||
waitWriteParams.wait(1000);
|
waitWriteParams.wait(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(LogHelper.isDebugEnabled())
|
||||||
|
LogHelper.debug("Commandline: %s", Arrays.toString(processArgs.toArray()));
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(processArgs);
|
ProcessBuilder processBuilder = new ProcessBuilder(processArgs);
|
||||||
EnvHelper.addEnv(processBuilder);
|
EnvHelper.addEnv(processBuilder);
|
||||||
processBuilder.environment().putAll(systemEnv);
|
processBuilder.environment().putAll(systemEnv);
|
||||||
|
|
|
@ -157,7 +157,7 @@ public String[] getClassPath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getAlternativeClassPath() {
|
public String[] getAlternativeClassPath() {
|
||||||
return classPath.toArray(new String[0]);
|
return altClassPath.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue