mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
IDEA Code Reformat
This commit is contained in:
parent
e15e4c1e35
commit
87669d1d46
184 changed files with 1389 additions and 1733 deletions
|
@ -1,36 +1,5 @@
|
||||||
package ru.gravit.launchserver;
|
package ru.gravit.launchserver;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.SocketAddress;
|
|
||||||
import java.nio.file.DirectoryStream;
|
|
||||||
import java.nio.file.FileVisitResult;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.SimpleFileVisitor;
|
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
|
||||||
import java.security.KeyPair;
|
|
||||||
import java.security.interfaces.RSAPrivateKey;
|
|
||||||
import java.security.interfaces.RSAPublicKey;
|
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.zip.CRC32;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
|
@ -39,17 +8,16 @@
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.*;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.IntegerConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.ListConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import ru.gravit.launchserver.auth.AuthLimiter;
|
import ru.gravit.launchserver.auth.AuthLimiter;
|
||||||
import ru.gravit.launchserver.auth.handler.AuthHandler;
|
import ru.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import ru.gravit.launchserver.auth.hwid.HWIDHandler;
|
import ru.gravit.launchserver.auth.hwid.HWIDHandler;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import ru.gravit.launchserver.binary.*;
|
import ru.gravit.launchserver.binary.EXEL4JLauncherBinary;
|
||||||
|
import ru.gravit.launchserver.binary.EXELauncherBinary;
|
||||||
|
import ru.gravit.launchserver.binary.JARLauncherBinary;
|
||||||
|
import ru.gravit.launchserver.binary.LauncherBinary;
|
||||||
import ru.gravit.launchserver.command.handler.CommandHandler;
|
import ru.gravit.launchserver.command.handler.CommandHandler;
|
||||||
import ru.gravit.launchserver.command.handler.JLineCommandHandler;
|
import ru.gravit.launchserver.command.handler.JLineCommandHandler;
|
||||||
import ru.gravit.launchserver.command.handler.StdCommandHandler;
|
import ru.gravit.launchserver.command.handler.StdCommandHandler;
|
||||||
|
@ -60,12 +28,26 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.launchserver.socket.ServerSocketHandler;
|
import ru.gravit.launchserver.socket.ServerSocketHandler;
|
||||||
import ru.gravit.launchserver.texture.TextureProvider;
|
import ru.gravit.launchserver.texture.TextureProvider;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
import java.io.BufferedReader;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import java.io.BufferedWriter;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import java.io.IOException;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.SocketAddress;
|
||||||
|
import java.nio.file.*;
|
||||||
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
public final class LaunchServer implements Runnable, AutoCloseable {
|
public final class LaunchServer implements Runnable, AutoCloseable {
|
||||||
public static final class Config extends ConfigObject {
|
public static final class Config extends ConfigObject {
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
package ru.gravit.launchserver;
|
package ru.gravit.launchserver;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ProguardConf {
|
public class ProguardConf {
|
||||||
private static final String charsFirst = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
|
private static final String charsFirst = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
|
||||||
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
||||||
|
|
|
@ -2,12 +2,7 @@
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.instrument.Instrumentation;
|
import java.lang.instrument.Instrumentation;
|
||||||
import java.nio.file.FileVisitOption;
|
import java.nio.file.*;
|
||||||
import java.nio.file.FileVisitResult;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.nio.file.SimpleFileVisitor;
|
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
@ -28,10 +23,11 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
return super.visitFile(file, attrs);
|
return super.visitFile(file, attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Instrumentation inst;
|
public static Instrumentation inst;
|
||||||
private static boolean isStarted = false;
|
private static boolean isStarted = false;
|
||||||
public static boolean isAgentStarted()
|
|
||||||
{
|
public static boolean isAgentStarted() {
|
||||||
return isStarted;
|
return isStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package ru.gravit.launchserver.asm;
|
package ru.gravit.launchserver.asm;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -7,12 +12,6 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassVisitor;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Позволяет искать методы внутри незагруженных классов и общие суперклассы для
|
* Позволяет искать методы внутри незагруженных классов и общие суперклассы для
|
||||||
* чего угодно. Работает через поиск class-файлов в classpath.
|
* чего угодно. Работает через поиск class-файлов в classpath.
|
||||||
|
@ -57,7 +56,10 @@ public void acceptVisitor(String className, ClassVisitor visitor) throws IOExcep
|
||||||
|
|
||||||
public byte[] getClassData(String className) throws IOException {
|
public byte[] getClassData(String className) throws IOException {
|
||||||
for (JarFile f : cp) {
|
for (JarFile f : cp) {
|
||||||
if (f.getEntry(className + ".class") != null) try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) { return IOHelper.read(in); }
|
if (f.getEntry(className + ".class") != null)
|
||||||
|
try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) {
|
||||||
|
return IOHelper.read(in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
|
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package ru.gravit.launchserver.asm;
|
package ru.gravit.launchserver.asm;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassWriter с другой реализацией метода getCommonSuperClass: при его
|
* ClassWriter с другой реализацией метода getCommonSuperClass: при его
|
||||||
* использовании не происходит загрузки классов.
|
* использовании не происходит загрузки классов.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.auth;
|
package ru.gravit.launchserver.auth;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.NeedGarbageCollection;
|
import ru.gravit.launcher.NeedGarbageCollection;
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AuthLimiter implements NeedGarbageCollection {
|
public class AuthLimiter implements NeedGarbageCollection {
|
||||||
static class AuthEntry {
|
static class AuthEntry {
|
||||||
public int value;
|
public int value;
|
||||||
|
@ -59,7 +59,8 @@ public String toString() {
|
||||||
public AuthLimiter(LaunchServer srv) {
|
public AuthLimiter(LaunchServer srv) {
|
||||||
map = new HashMap<>();
|
map = new HashMap<>();
|
||||||
excludeIps = new ArrayList<>();
|
excludeIps = new ArrayList<>();
|
||||||
if (srv.config.authLimitExclusions != null) srv.config.authLimitExclusions.stream(StringConfigEntry.class).forEach(excludeIps::add);
|
if (srv.config.authLimitExclusions != null)
|
||||||
|
srv.config.authLimitExclusions.stream(StringConfigEntry.class).forEach(excludeIps::add);
|
||||||
rateLimit = srv.config.authRateLimit;
|
rateLimit = srv.config.authRateLimit;
|
||||||
rateLimitMilis = srv.config.authRateLimitMilis;
|
rateLimitMilis = srv.config.authRateLimitMilis;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
package ru.gravit.launchserver.auth;
|
package ru.gravit.launchserver.auth;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import com.mysql.cj.jdbc.MysqlDataSource;
|
import com.mysql.cj.jdbc.MysqlDataSource;
|
||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
||||||
|
@ -17,6 +11,10 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public final class MySQLSourceConfig extends ConfigObject implements AutoCloseable {
|
public final class MySQLSourceConfig extends ConfigObject implements AutoCloseable {
|
||||||
|
|
||||||
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launchserver.auth.AuthException;
|
import ru.gravit.launchserver.auth.AuthException;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class AuthHandler extends ConfigObject implements AutoCloseable {
|
public abstract class AuthHandler extends ConfigObject implements AutoCloseable {
|
||||||
private static final Map<String, Adapter<AuthHandler>> AUTH_HANDLERS = new ConcurrentHashMap<>(4);
|
private static final Map<String, Adapter<AuthHandler>> AUTH_HANDLERS = new ConcurrentHashMap<>(4);
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class BinaryFileAuthHandler extends FileAuthHandler {
|
public final class BinaryFileAuthHandler extends FileAuthHandler {
|
||||||
public BinaryFileAuthHandler(BlockConfigEntry block) {
|
public BinaryFileAuthHandler(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.NeedGarbageCollection;
|
import ru.gravit.launcher.NeedGarbageCollection;
|
||||||
import ru.gravit.launcher.managers.GarbageManager;
|
import ru.gravit.launcher.managers.GarbageManager;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -15,6 +9,12 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class CachedAuthHandler extends AuthHandler implements NeedGarbageCollection {
|
public abstract class CachedAuthHandler extends AuthHandler implements NeedGarbageCollection {
|
||||||
public static final class Entry {
|
public static final class Entry {
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
@ -18,11 +8,13 @@
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import java.io.IOException;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import java.nio.file.Path;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import java.security.SecureRandom;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
public abstract class FileAuthHandler extends AuthHandler {
|
public abstract class FileAuthHandler extends AuthHandler {
|
||||||
public static final class Entry extends StreamObject {
|
public static final class Entry extends StreamObject {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class MemoryAuthHandler extends CachedAuthHandler {
|
public final class MemoryAuthHandler extends CachedAuthHandler {
|
||||||
private static String toUsername(UUID uuid) {
|
private static String toUsername(UUID uuid) {
|
||||||
byte[] bytes = ByteBuffer.allocate(16).
|
byte[] bytes = ByteBuffer.allocate(16).
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
|
import ru.gravit.launchserver.auth.MySQLSourceConfig;
|
||||||
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -7,11 +12,6 @@
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
|
||||||
import ru.gravit.launchserver.auth.MySQLSourceConfig;
|
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
public final class MySQLAuthHandler extends CachedAuthHandler {
|
public final class MySQLAuthHandler extends CachedAuthHandler {
|
||||||
private final MySQLSourceConfig mySQLHolder;
|
private final MySQLSourceConfig mySQLHolder;
|
||||||
private final String uuidColumn;
|
private final String uuidColumn;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class NullAuthHandler extends AuthHandler {
|
public final class NullAuthHandler extends AuthHandler {
|
||||||
private volatile AuthHandler handler;
|
private volatile AuthHandler handler;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.handler;
|
package ru.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -17,6 +9,14 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class TextFileAuthHandler extends FileAuthHandler {
|
public final class TextFileAuthHandler extends FileAuthHandler {
|
||||||
private static StringConfigEntry cc(String value) {
|
private static StringConfigEntry cc(String value) {
|
||||||
StringConfigEntry entry = new StringConfigEntry(value, true, 4);
|
StringConfigEntry entry = new StringConfigEntry(value, true, 4);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.auth.hwid;
|
package ru.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AcceptHWIDHandler extends HWIDHandler {
|
public class AcceptHWIDHandler extends HWIDHandler {
|
||||||
|
|
||||||
public AcceptHWIDHandler(BlockConfigEntry block) {
|
public AcceptHWIDHandler(BlockConfigEntry block) {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package ru.gravit.launchserver.auth.hwid;
|
package ru.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class HWIDHandler extends ConfigObject implements AutoCloseable {
|
public abstract class HWIDHandler extends ConfigObject implements AutoCloseable {
|
||||||
private static final Map<String, Adapter<HWIDHandler>> HW_HANDLERS = new ConcurrentHashMap<>(4);
|
private static final Map<String, Adapter<HWIDHandler>> HW_HANDLERS = new ConcurrentHashMap<>(4);
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
package ru.gravit.launchserver.auth.hwid;
|
package ru.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.OshiHWID;
|
import ru.gravit.launcher.OshiHWID;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -16,6 +10,11 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class JsonHWIDHandler extends HWIDHandler {
|
public final class JsonHWIDHandler extends HWIDHandler {
|
||||||
private static final Gson gson = new Gson();
|
private static final Gson gson = new Gson();
|
||||||
|
|
||||||
|
@ -26,15 +25,15 @@ public final class JsonHWIDHandler extends HWIDHandler {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final URL urlGet;
|
private final URL urlGet;
|
||||||
|
|
||||||
public class banRequest
|
public class banRequest {
|
||||||
{
|
|
||||||
public banRequest(String hwid) {
|
public banRequest(String hwid) {
|
||||||
this.hwid = hwid;
|
this.hwid = hwid;
|
||||||
}
|
}
|
||||||
|
|
||||||
String hwid;
|
String hwid;
|
||||||
}
|
}
|
||||||
public class checkRequest
|
|
||||||
{
|
public class checkRequest {
|
||||||
public checkRequest(String username, String hwid) {
|
public checkRequest(String username, String hwid) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.hwid = hwid;
|
this.hwid = hwid;
|
||||||
|
@ -44,21 +43,21 @@ public checkRequest(String username, String hwid) {
|
||||||
String hwid;
|
String hwid;
|
||||||
|
|
||||||
}
|
}
|
||||||
public class Result
|
|
||||||
{
|
public class Result {
|
||||||
String error;
|
String error;
|
||||||
}
|
}
|
||||||
public class BannedResult
|
|
||||||
{
|
public class BannedResult {
|
||||||
boolean isBanned;
|
boolean isBanned;
|
||||||
String error;
|
String error;
|
||||||
}
|
}
|
||||||
public class HWIDResult
|
|
||||||
{
|
public class HWIDResult {
|
||||||
String string;
|
String string;
|
||||||
}
|
}
|
||||||
public class HWIDRequest
|
|
||||||
{
|
public class HWIDRequest {
|
||||||
public HWIDRequest(String username) {
|
public HWIDRequest(String username) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
@ -84,8 +83,8 @@ public void ban(List<HWID> l_hwid) throws HWIDException {
|
||||||
banRequest request = new banRequest(hwid.getSerializeString());
|
banRequest request = new banRequest(hwid.getSerializeString());
|
||||||
try {
|
try {
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
||||||
Result r = gson.fromJson(result,Result.class);
|
Result r = gson.fromJson(result, Result.class);
|
||||||
if(r.error != null) throw new HWIDException(r.error);
|
if (r.error != null) throw new HWIDException(r.error);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
throw new HWIDException("HWID service error");
|
throw new HWIDException("HWID service error");
|
||||||
|
@ -95,11 +94,11 @@ public void ban(List<HWID> l_hwid) throws HWIDException {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void check0(HWID hwid, String username) throws HWIDException {
|
public void check0(HWID hwid, String username) throws HWIDException {
|
||||||
checkRequest request = new checkRequest(username,hwid.getSerializeString());
|
checkRequest request = new checkRequest(username, hwid.getSerializeString());
|
||||||
try {
|
try {
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
||||||
BannedResult r = gson.fromJson(result,BannedResult.class);
|
BannedResult r = gson.fromJson(result, BannedResult.class);
|
||||||
if(r.error != null) throw new HWIDException(r.error);
|
if (r.error != null) throw new HWIDException(r.error);
|
||||||
boolean isBanned = r.isBanned;
|
boolean isBanned = r.isBanned;
|
||||||
if (isBanned) throw new HWIDException("You will BANNED!");
|
if (isBanned) throw new HWIDException("You will BANNED!");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -119,10 +118,9 @@ public List<HWID> getHwid(String username) throws HWIDException {
|
||||||
HWIDRequest request = new HWIDRequest(username);
|
HWIDRequest request = new HWIDRequest(username);
|
||||||
try {
|
try {
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlBan);
|
||||||
HWIDResult[] r = gson.fromJson(result,HWIDResult[].class);
|
HWIDResult[] r = gson.fromJson(result, HWIDResult[].class);
|
||||||
for( HWIDResult hw : r)
|
for (HWIDResult hw : r) {
|
||||||
{
|
hwids.add(OshiHWID.gson.fromJson(hw.string, OshiHWID.class));
|
||||||
hwids.add(OshiHWID.gson.fromJson(hw.string,OshiHWID.class));
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
|
@ -137,8 +135,8 @@ public void unban(List<HWID> l_hwid) throws HWIDException {
|
||||||
banRequest request = new banRequest(hwid.getSerializeString());
|
banRequest request = new banRequest(hwid.getSerializeString());
|
||||||
try {
|
try {
|
||||||
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlUnBan);
|
JsonElement result = HTTPRequest.jsonRequest(gson.toJsonTree(request), urlUnBan);
|
||||||
Result r = gson.fromJson(result,Result.class);
|
Result r = gson.fromJson(result, Result.class);
|
||||||
if(r.error != null) throw new HWIDException(r.error);
|
if (r.error != null) throw new HWIDException(r.error);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
throw new HWIDException("HWID service error");
|
throw new HWIDException("HWID service error");
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.hwid;
|
package ru.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.OshiHWID;
|
import ru.gravit.launcher.OshiHWID;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -17,6 +10,13 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class MysqlHWIDHandler extends HWIDHandler {
|
public class MysqlHWIDHandler extends HWIDHandler {
|
||||||
private final MySQLSourceConfig mySQLHolder;
|
private final MySQLSourceConfig mySQLHolder;
|
||||||
private final String query;
|
private final String query;
|
||||||
|
@ -172,7 +172,7 @@ public List<HWID> getHwid(String username) {
|
||||||
hwid_str = set.getString(hwidName);
|
hwid_str = set.getString(hwidName);
|
||||||
}
|
}
|
||||||
ArrayList<HWID> list = new ArrayList<>();
|
ArrayList<HWID> list = new ArrayList<>();
|
||||||
HWID hwid = OshiHWID.gson.fromJson(hwid_str,OshiHWID.class);
|
HWID hwid = OshiHWID.gson.fromJson(hwid_str, OshiHWID.class);
|
||||||
if (hwid.isNull()) {
|
if (hwid.isNull()) {
|
||||||
LogHelper.warning("Null HWID");
|
LogHelper.warning("Null HWID");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
@ -12,6 +7,11 @@
|
||||||
import ru.gravit.launchserver.auth.handler.AuthHandler;
|
import ru.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class AuthProvider extends ConfigObject implements AutoCloseable {
|
public abstract class AuthProvider extends ConfigObject implements AutoCloseable {
|
||||||
private static final Map<String, ServerAdapter<AuthProvider>> AUTH_PROVIDERS = new ConcurrentHashMap<>(8);
|
private static final Map<String, ServerAdapter<AuthProvider>> AUTH_PROVIDERS = new ConcurrentHashMap<>(8);
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.attribute.FileTime;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -15,11 +7,15 @@
|
||||||
import ru.gravit.launcher.serialize.config.entry.ConfigEntry.Type;
|
import ru.gravit.launcher.serialize.config.entry.ConfigEntry.Type;
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import java.io.BufferedReader;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import java.io.IOException;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.attribute.FileTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public final class FileAuthProvider extends DigestAuthProvider {
|
public final class FileAuthProvider extends DigestAuthProvider {
|
||||||
private static final class Entry extends ConfigObject {
|
private static final class Entry extends ConfigObject {
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
@ -14,17 +10,20 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
public final class JsonAuthProvider extends AuthProvider {
|
public final class JsonAuthProvider extends AuthProvider {
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
private final URL url;
|
private final URL url;
|
||||||
public class authResult
|
|
||||||
{
|
public class authResult {
|
||||||
String username;
|
String username;
|
||||||
String error;
|
String error;
|
||||||
long permissions;
|
long permissions;
|
||||||
}
|
}
|
||||||
public class authRequest
|
|
||||||
{
|
public class authRequest {
|
||||||
public authRequest(String username, String password, String ip) {
|
public authRequest(String username, String password, String ip) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
@ -44,7 +43,7 @@ public authRequest(String username, String password, String ip) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthProviderResult auth(String login, String password, String ip) throws IOException {
|
public AuthProviderResult auth(String login, String password, String ip) throws IOException {
|
||||||
authRequest authRequest = new authRequest(login,password,ip);
|
authRequest authRequest = new authRequest(login, password, ip);
|
||||||
JsonElement request = gson.toJsonTree(authRequest);
|
JsonElement request = gson.toJsonTree(authRequest);
|
||||||
JsonElement content = HTTPRequest.jsonRequest(request, url);
|
JsonElement content = HTTPRequest.jsonRequest(request, url);
|
||||||
if (!content.isJsonObject())
|
if (!content.isJsonObject())
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.utils.HTTPRequest;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
|
||||||
import ru.gravit.utils.HTTPRequest;
|
|
||||||
|
|
||||||
public final class MojangAuthProvider extends AuthProvider {
|
public final class MojangAuthProvider extends AuthProvider {
|
||||||
private static final Pattern UUID_REGEX = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
|
private static final Pattern UUID_REGEX = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
|
||||||
private static final URL URL;
|
private static final URL URL;
|
||||||
|
@ -29,8 +28,8 @@ public final class MojangAuthProvider extends AuthProvider {
|
||||||
public MojangAuthProvider(BlockConfigEntry block, LaunchServer server) {
|
public MojangAuthProvider(BlockConfigEntry block, LaunchServer server) {
|
||||||
super(block, server);
|
super(block, server);
|
||||||
}
|
}
|
||||||
public class mojangAuth
|
|
||||||
{
|
public class mojangAuth {
|
||||||
public mojangAuth(String username, String password) {
|
public mojangAuth(String username, String password) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
@ -44,13 +43,14 @@ public mojangAuth(String username, String password) {
|
||||||
String password;
|
String password;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthProviderResult auth(String login, String password, String ip) throws Exception {
|
public AuthProviderResult auth(String login, String password, String ip) throws Exception {
|
||||||
mojangAuth mojangAuth = new mojangAuth(login,password);
|
mojangAuth mojangAuth = new mojangAuth(login, password);
|
||||||
JsonElement request = gson.toJsonTree(mojangAuth);
|
JsonElement request = gson.toJsonTree(mojangAuth);
|
||||||
|
|
||||||
// Verify there's no error
|
// Verify there's no error
|
||||||
JsonObject response = HTTPRequest.jsonRequest(request,URL).getAsJsonObject();
|
JsonObject response = HTTPRequest.jsonRequest(request, URL).getAsJsonObject();
|
||||||
if (response == null)
|
if (response == null)
|
||||||
authError("Empty com.mojang response");
|
authError("Empty com.mojang response");
|
||||||
JsonElement errorMessage = response.get("errorMessage");
|
JsonElement errorMessage = response.get("errorMessage");
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.ListConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.ListConfigEntry;
|
||||||
|
@ -17,6 +12,11 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public final class MySQLAuthProvider extends AuthProvider {
|
public final class MySQLAuthProvider extends AuthProvider {
|
||||||
private final MySQLSourceConfig mySQLHolder;
|
private final MySQLSourceConfig mySQLHolder;
|
||||||
private final String query;
|
private final String query;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class NullAuthProvider extends AuthProvider {
|
public final class NullAuthProvider extends AuthProvider {
|
||||||
private volatile AuthProvider provider;
|
private volatile AuthProvider provider;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package ru.gravit.launchserver.auth.provider;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
||||||
|
@ -14,6 +9,11 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public final class RequestAuthProvider extends AuthProvider {
|
public final class RequestAuthProvider extends AuthProvider {
|
||||||
private final String url;
|
private final String url;
|
||||||
private final Pattern response;
|
private final Pattern response;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -7,8 +9,6 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
public class BuildContext {
|
public class BuildContext {
|
||||||
public final ZipOutputStream output;
|
public final ZipOutputStream output;
|
||||||
public final JAConfigurator config;
|
public final JAConfigurator config;
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
import net.sf.launch4j.Builder;
|
import net.sf.launch4j.Builder;
|
||||||
import net.sf.launch4j.Log;
|
import net.sf.launch4j.Log;
|
||||||
import net.sf.launch4j.config.Config;
|
import net.sf.launch4j.config.*;
|
||||||
import net.sf.launch4j.config.ConfigPersister;
|
|
||||||
import net.sf.launch4j.config.Jre;
|
|
||||||
import net.sf.launch4j.config.LanguageID;
|
|
||||||
import net.sf.launch4j.config.VersionInfo;
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public final class EXEL4JLauncherBinary extends LauncherBinary {
|
public final class EXEL4JLauncherBinary extends LauncherBinary {
|
||||||
private final static class Launch4JLog extends Log {
|
private final static class Launch4JLog extends Log {
|
||||||
private static final Launch4JLog INSTANCE = new Launch4JLog();
|
private static final Launch4JLog INSTANCE = new Launch4JLog();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
public class EXELauncherBinary extends LauncherBinary {
|
public class EXELauncherBinary extends LauncherBinary {
|
||||||
|
|
||||||
public EXELauncherBinary(LaunchServer server) {
|
public EXELauncherBinary(LaunchServer server) {
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
|
import javassist.*;
|
||||||
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javassist.CannotCompileException;
|
public class JAConfigurator implements AutoCloseable {
|
||||||
import javassist.ClassPool;
|
|
||||||
import javassist.CtClass;
|
|
||||||
import javassist.CtConstructor;
|
|
||||||
import javassist.CtMethod;
|
|
||||||
import javassist.NotFoundException;
|
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
|
||||||
|
|
||||||
public class JAConfigurator implements AutoCloseable {
|
|
||||||
public ClassPool pool;
|
public ClassPool pool;
|
||||||
public CtClass ctClass;
|
public CtClass ctClass;
|
||||||
public CtConstructor ctConstructor;
|
public CtConstructor ctConstructor;
|
||||||
|
@ -93,10 +88,10 @@ public void setPort(int port) {
|
||||||
body.append(port);
|
body.append(port);
|
||||||
body.append(";");
|
body.append(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||||
int i = 2;
|
int i = 2;
|
||||||
switch(env)
|
switch (env) {
|
||||||
{
|
|
||||||
|
|
||||||
case DEV:
|
case DEV:
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -133,6 +128,7 @@ public void setDownloadJava(boolean b) {
|
||||||
body.append(b ? "true" : "false");
|
body.append(b ? "true" : "false");
|
||||||
body.append(";");
|
body.append(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarningMissArchJava(boolean b) {
|
public void setWarningMissArchJava(boolean b) {
|
||||||
body.append("this.isWarningMissArchJava = ");
|
body.append("this.isWarningMissArchJava = ");
|
||||||
body.append(b ? "true" : "false");
|
body.append(b ? "true" : "false");
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
import static ru.gravit.utils.helper.IOHelper.newZipEntry;
|
import javassist.CannotCompileException;
|
||||||
|
import javassist.NotFoundException;
|
||||||
|
import proguard.Configuration;
|
||||||
|
import proguard.ConfigurationParser;
|
||||||
|
import proguard.ParseException;
|
||||||
|
import proguard.ProGuard;
|
||||||
|
import ru.gravit.launcher.AutogenConfig;
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
|
import ru.gravit.launcher.LauncherConfig;
|
||||||
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.launchserver.asm.ClassMetadataReader;
|
||||||
|
import ru.gravit.launchserver.manangers.BuildHookManager.ZipBuildHook;
|
||||||
|
import ru.gravit.utils.helper.*;
|
||||||
|
import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -20,25 +34,7 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import javassist.CannotCompileException;
|
import static ru.gravit.utils.helper.IOHelper.newZipEntry;
|
||||||
import javassist.NotFoundException;
|
|
||||||
import proguard.Configuration;
|
|
||||||
import proguard.ConfigurationParser;
|
|
||||||
import proguard.ParseException;
|
|
||||||
import proguard.ProGuard;
|
|
||||||
import ru.gravit.launcher.AutogenConfig;
|
|
||||||
import ru.gravit.launcher.Launcher;
|
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
|
||||||
import ru.gravit.launchserver.asm.ClassMetadataReader;
|
|
||||||
import ru.gravit.launchserver.manangers.BuildHookManager.ZipBuildHook;
|
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
|
||||||
import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm;
|
|
||||||
import ru.gravit.utils.helper.UnpackHelper;
|
|
||||||
|
|
||||||
public final class JARLauncherBinary extends LauncherBinary {
|
public final class JARLauncherBinary extends LauncherBinary {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.binary;
|
package ru.gravit.launchserver.binary;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.signed.DigestBytesHolder;
|
import ru.gravit.launcher.serialize.signed.DigestBytesHolder;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
public abstract class LauncherBinary {
|
public abstract class LauncherBinary {
|
||||||
|
|
||||||
public final LaunchServer server;
|
public final LaunchServer server;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package ru.gravit.launchserver.command;
|
package ru.gravit.launchserver.command;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
|
|
||||||
protected static String parseUsername(String username) throws CommandException {
|
protected static String parseUsername(String username) throws CommandException {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.command.auth;
|
package ru.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
import ru.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class AuthCommand extends Command {
|
public final class AuthCommand extends Command {
|
||||||
public AuthCommand(LaunchServer server) {
|
public AuthCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.auth;
|
package ru.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BanCommand extends Command {
|
public class BanCommand extends Command {
|
||||||
public BanCommand(LaunchServer server) {
|
public BanCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.command.auth;
|
package ru.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class UUIDToUsernameCommand extends Command {
|
public final class UUIDToUsernameCommand extends Command {
|
||||||
public UUIDToUsernameCommand(LaunchServer server) {
|
public UUIDToUsernameCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.auth;
|
package ru.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class UnbanCommand extends Command {
|
public class UnbanCommand extends Command {
|
||||||
public UnbanCommand(LaunchServer server) {
|
public UnbanCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.command.auth;
|
package ru.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class UsernameToUUIDCommand extends Command {
|
public final class UsernameToUUIDCommand extends Command {
|
||||||
public UsernameToUUIDCommand(LaunchServer server) {
|
public UsernameToUUIDCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ru.gravit.launchserver.command.basic;
|
package ru.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public final class HelpCommand extends Command {
|
public final class HelpCommand extends Command {
|
||||||
private static void printCommand(String name, Command command) {
|
private static void printCommand(String name, Command command) {
|
||||||
String args = command.getArgsDescription();
|
String args = command.getArgsDescription();
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package ru.gravit.launchserver.command.basic;
|
package ru.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class RegenProguardDictCommand extends Command {
|
public class RegenProguardDictCommand extends Command {
|
||||||
|
|
||||||
public RegenProguardDictCommand(LaunchServer server) {
|
public RegenProguardDictCommand(LaunchServer server) {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.basic;
|
package ru.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
public class RemoveMappingsProguardCommand extends Command {
|
public class RemoveMappingsProguardCommand extends Command {
|
||||||
|
|
||||||
public RemoveMappingsProguardCommand(LaunchServer server) {
|
public RemoveMappingsProguardCommand(LaunchServer server) {
|
||||||
|
|
|
@ -1,49 +1,22 @@
|
||||||
package ru.gravit.launchserver.command.handler;
|
package ru.gravit.launchserver.command.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
import ru.gravit.launchserver.command.auth.AuthCommand;
|
import ru.gravit.launchserver.command.auth.*;
|
||||||
import ru.gravit.launchserver.command.auth.BanCommand;
|
import ru.gravit.launchserver.command.basic.*;
|
||||||
import ru.gravit.launchserver.command.auth.UUIDToUsernameCommand;
|
import ru.gravit.launchserver.command.hash.*;
|
||||||
import ru.gravit.launchserver.command.auth.UnbanCommand;
|
|
||||||
import ru.gravit.launchserver.command.auth.UsernameToUUIDCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.BuildCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.ClearCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.DebugCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.GCCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.HelpCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.LogConnectionsCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.ProguardCleanCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.RebindCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.RegenProguardDictCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.RemoveMappingsProguardCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.StopCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.TestCommand;
|
|
||||||
import ru.gravit.launchserver.command.basic.VersionCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.DownloadAssetCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.DownloadClientCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.IndexAssetCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.SyncBinariesCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.SyncProfilesCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.SyncUpdatesCommand;
|
|
||||||
import ru.gravit.launchserver.command.hash.UnindexAssetCommand;
|
|
||||||
import ru.gravit.launchserver.command.modules.LoadModuleCommand;
|
import ru.gravit.launchserver.command.modules.LoadModuleCommand;
|
||||||
import ru.gravit.launchserver.command.modules.ModulesCommand;
|
import ru.gravit.launchserver.command.modules.ModulesCommand;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class CommandHandler implements Runnable {
|
public abstract class CommandHandler implements Runnable {
|
||||||
private static String[] parse(CharSequence line) throws CommandException {
|
private static String[] parse(CharSequence line) throws CommandException {
|
||||||
boolean quoted = false;
|
boolean quoted = false;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ru.gravit.launchserver.command.handler;
|
package ru.gravit.launchserver.command.handler;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import jline.console.ConsoleReader;
|
import jline.console.ConsoleReader;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper.Output;
|
import ru.gravit.utils.helper.LogHelper.Output;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class JLineCommandHandler extends CommandHandler {
|
public final class JLineCommandHandler extends CommandHandler {
|
||||||
private final class JLineOutput implements Output {
|
private final class JLineOutput implements Output {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.handler;
|
package ru.gravit.launchserver.command.handler;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class StdCommandHandler extends CommandHandler {
|
public final class StdCommandHandler extends CommandHandler {
|
||||||
private final BufferedReader reader;
|
private final BufferedReader reader;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
@ -11,6 +7,10 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public final class DownloadAssetCommand extends Command {
|
public final class DownloadAssetCommand extends Command {
|
||||||
|
|
||||||
public DownloadAssetCommand(LaunchServer server) {
|
public DownloadAssetCommand(LaunchServer server) {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||||
|
@ -19,6 +12,13 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public final class DownloadClientCommand extends Command {
|
public final class DownloadClientCommand extends Command {
|
||||||
|
|
||||||
public DownloadClientCommand(LaunchServer server) {
|
public DownloadClientCommand(LaunchServer server) {
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileVisitResult;
|
import java.nio.file.FileVisitResult;
|
||||||
|
@ -9,21 +19,10 @@
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
|
||||||
import ru.gravit.launchserver.command.Command;
|
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
|
||||||
import ru.gravit.utils.helper.SecurityHelper.DigestAlgorithm;
|
|
||||||
|
|
||||||
public final class IndexAssetCommand extends Command {
|
public final class IndexAssetCommand extends Command {
|
||||||
private static Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
public static class IndexObject
|
|
||||||
{
|
public static class IndexObject {
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
public IndexObject(long size, String hash) {
|
public IndexObject(long size, String hash) {
|
||||||
|
@ -33,6 +32,7 @@ public IndexObject(long size, String hash) {
|
||||||
|
|
||||||
String hash;
|
String hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class IndexAssetVisitor extends SimpleFileVisitor<Path> {
|
private static final class IndexAssetVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final JsonArray objects;
|
private final JsonArray objects;
|
||||||
private final Path inputAssetDir;
|
private final Path inputAssetDir;
|
||||||
|
@ -51,7 +51,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
||||||
|
|
||||||
// Add to index and copy file
|
// Add to index and copy file
|
||||||
String digest = SecurityHelper.toHex(SecurityHelper.digest(DigestAlgorithm.SHA1, file));
|
String digest = SecurityHelper.toHex(SecurityHelper.digest(DigestAlgorithm.SHA1, file));
|
||||||
IndexObject obj = new IndexObject(attrs.size(),digest);
|
IndexObject obj = new IndexObject(attrs.size(), digest);
|
||||||
objects.add(gson.toJsonTree(obj));
|
objects.add(gson.toJsonTree(obj));
|
||||||
IOHelper.copy(file, resolveObjectFile(outputAssetDir, digest));
|
IOHelper.copy(file, resolveObjectFile(outputAssetDir, digest));
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class SyncBinariesCommand extends Command {
|
public final class SyncBinariesCommand extends Command {
|
||||||
public SyncBinariesCommand(LaunchServer server) {
|
public SyncBinariesCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class SyncProfilesCommand extends Command {
|
public final class SyncProfilesCommand extends Command {
|
||||||
public SyncProfilesCommand(LaunchServer server) {
|
public SyncProfilesCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
|
||||||
import ru.gravit.launchserver.command.Command;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
public final class SyncUpdatesCommand extends Command {
|
public final class SyncUpdatesCommand extends Command {
|
||||||
public SyncUpdatesCommand(LaunchServer server) {
|
public SyncUpdatesCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
package ru.gravit.launchserver.command.hash;
|
package ru.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
import ru.gravit.launchserver.command.CommandException;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
|
||||||
import ru.gravit.launchserver.command.Command;
|
|
||||||
import ru.gravit.launchserver.command.CommandException;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
public final class UnindexAssetCommand extends Command {
|
public final class UnindexAssetCommand extends Command {
|
||||||
private static JsonParser parser = new JsonParser();
|
private static JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
public UnindexAssetCommand(LaunchServer server) {
|
public UnindexAssetCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.command.modules;
|
package ru.gravit.launchserver.command.modules;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.command.Command;
|
import ru.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class LoadModuleCommand extends Command {
|
public class LoadModuleCommand extends Command {
|
||||||
public LoadModuleCommand(LaunchServer server) {
|
public LoadModuleCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.fileserver;
|
package ru.gravit.launchserver.fileserver;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
|
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
|
|
||||||
public class ClosingChannelFutureListener implements ChannelFutureListener {
|
public class ClosingChannelFutureListener implements ChannelFutureListener {
|
||||||
public final Closeable[] close;
|
public final Closeable[] close;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package ru.gravit.launchserver.fileserver;
|
package ru.gravit.launchserver.fileserver;
|
||||||
|
|
||||||
import static io.netty.handler.codec.http.HttpMethod.GET;
|
import io.netty.buffer.ByteBuf;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST;
|
import io.netty.buffer.Unpooled;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN;
|
import io.netty.channel.*;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.FOUND;
|
import io.netty.handler.codec.http.*;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR;
|
import io.netty.handler.ssl.SslHandler;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.METHOD_NOT_ALLOWED;
|
import io.netty.handler.stream.ChunkedFile;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
|
import io.netty.util.CharsetUtil;
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.NOT_MODIFIED;
|
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
|
|
||||||
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
|
||||||
|
|
||||||
|
import javax.activation.MimetypesFileTypeMap;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
|
@ -18,38 +16,12 @@
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.activation.MimetypesFileTypeMap;
|
import static io.netty.handler.codec.http.HttpMethod.GET;
|
||||||
|
import static io.netty.handler.codec.http.HttpResponseStatus.*;
|
||||||
import io.netty.buffer.ByteBuf;
|
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
import io.netty.channel.ChannelFuture;
|
|
||||||
import io.netty.channel.ChannelFutureListener;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.channel.ChannelProgressiveFuture;
|
|
||||||
import io.netty.channel.ChannelProgressiveFutureListener;
|
|
||||||
import io.netty.channel.DefaultFileRegion;
|
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
|
||||||
import io.netty.handler.codec.http.DefaultHttpResponse;
|
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
|
||||||
import io.netty.handler.codec.http.FullHttpResponse;
|
|
||||||
import io.netty.handler.codec.http.HttpChunkedInput;
|
|
||||||
import io.netty.handler.codec.http.HttpHeaderNames;
|
|
||||||
import io.netty.handler.codec.http.HttpHeaderValues;
|
|
||||||
import io.netty.handler.codec.http.HttpResponse;
|
|
||||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
|
||||||
import io.netty.handler.codec.http.HttpUtil;
|
|
||||||
import io.netty.handler.codec.http.LastHttpContent;
|
|
||||||
import io.netty.handler.ssl.SslHandler;
|
|
||||||
import io.netty.handler.stream.ChunkedFile;
|
|
||||||
import io.netty.util.CharsetUtil;
|
|
||||||
|
|
||||||
public class FileServerHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
|
public class FileServerHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package ru.gravit.launchserver.manangers;
|
package ru.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.AutogenConfig;
|
import ru.gravit.launcher.AutogenConfig;
|
||||||
import ru.gravit.launcher.modules.TestClientModule;
|
import ru.gravit.launcher.modules.TestClientModule;
|
||||||
import ru.gravit.launchserver.binary.BuildContext;
|
import ru.gravit.launchserver.binary.BuildContext;
|
||||||
import ru.gravit.launchserver.binary.JAConfigurator;
|
import ru.gravit.launchserver.binary.JAConfigurator;
|
||||||
import ru.gravit.launchserver.binary.JARLauncherBinary;
|
import ru.gravit.launchserver.binary.JARLauncherBinary;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
public class BuildHookManager {
|
public class BuildHookManager {
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public static interface ZipBuildHook {
|
public static interface ZipBuildHook {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.manangers;
|
package ru.gravit.launchserver.manangers;
|
||||||
|
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
public class MirrorManager {
|
public class MirrorManager {
|
||||||
public class Mirror {
|
public class Mirror {
|
||||||
URL url;
|
URL url;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package ru.gravit.launchserver.manangers;
|
package ru.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.modules.SimpleModuleManager;
|
import ru.gravit.launcher.modules.SimpleModuleManager;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.modules.CoreModule;
|
import ru.gravit.launchserver.modules.CoreModule;
|
||||||
import ru.gravit.launchserver.modules.LaunchServerModuleContext;
|
import ru.gravit.launchserver.modules.LaunchServerModuleContext;
|
||||||
import ru.gravit.utils.PublicURLClassLoader;
|
import ru.gravit.utils.PublicURLClassLoader;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ModulesManager extends SimpleModuleManager {
|
public class ModulesManager extends SimpleModuleManager {
|
||||||
public ModulesManager(LaunchServer lsrv) {
|
public ModulesManager(LaunchServer lsrv) {
|
||||||
modules = new ArrayList<>(1);
|
modules = new ArrayList<>(1);
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package ru.gravit.launchserver.manangers;
|
package ru.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
import ru.gravit.launchserver.asm.SafeClassWriter;
|
import ru.gravit.launchserver.asm.SafeClassWriter;
|
||||||
import ru.gravit.launchserver.binary.JARLauncherBinary;
|
import ru.gravit.launchserver.binary.JARLauncherBinary;
|
||||||
import ru.gravit.launchserver.manangers.BuildHookManager.Transformer;
|
import ru.gravit.launchserver.manangers.BuildHookManager.Transformer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class NodeTransformer implements Transformer {
|
public class NodeTransformer implements Transformer {
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public static interface ClassNodeTransformer {
|
public static interface ClassNodeTransformer {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launchserver.manangers;
|
package ru.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.NeedGarbageCollection;
|
import ru.gravit.launcher.NeedGarbageCollection;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class SessionManager implements NeedGarbageCollection {
|
public class SessionManager implements NeedGarbageCollection {
|
||||||
|
|
||||||
public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут
|
public static final long SESSION_TIMEOUT = 10 * 60 * 1000; // 10 минут
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package ru.gravit.launchserver.response;
|
package ru.gravit.launchserver.response;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class PingResponse extends Response {
|
public final class PingResponse extends Response {
|
||||||
public PingResponse(LaunchServer server, long id, HInput input, HOutput output, String ip) {
|
public PingResponse(LaunchServer server, long id, HInput input, HOutput output, String ip) {
|
||||||
super(server, id, input, output, ip);
|
super(server, id, input, output, ip);
|
||||||
|
|
|
@ -1,30 +1,21 @@
|
||||||
package ru.gravit.launchserver.response;
|
package ru.gravit.launchserver.response;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.request.RequestException;
|
import ru.gravit.launcher.request.RequestException;
|
||||||
import ru.gravit.launcher.request.RequestType;
|
import ru.gravit.launcher.request.RequestType;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.response.auth.AuthResponse;
|
import ru.gravit.launchserver.response.auth.*;
|
||||||
import ru.gravit.launchserver.response.auth.AuthServerResponse;
|
|
||||||
import ru.gravit.launchserver.response.auth.ChangeServerResponse;
|
|
||||||
import ru.gravit.launchserver.response.auth.CheckServerResponse;
|
|
||||||
import ru.gravit.launchserver.response.auth.JoinServerResponse;
|
|
||||||
import ru.gravit.launchserver.response.auth.SetProfileResponse;
|
|
||||||
import ru.gravit.launchserver.response.profile.BatchProfileByUsernameResponse;
|
import ru.gravit.launchserver.response.profile.BatchProfileByUsernameResponse;
|
||||||
import ru.gravit.launchserver.response.profile.ProfileByUUIDResponse;
|
import ru.gravit.launchserver.response.profile.ProfileByUUIDResponse;
|
||||||
import ru.gravit.launchserver.response.profile.ProfileByUsernameResponse;
|
import ru.gravit.launchserver.response.profile.ProfileByUsernameResponse;
|
||||||
import ru.gravit.launchserver.response.update.LauncherResponse;
|
import ru.gravit.launchserver.response.update.*;
|
||||||
import ru.gravit.launchserver.response.update.LegacyLauncherResponse;
|
|
||||||
import ru.gravit.launchserver.response.update.ProfilesResponse;
|
|
||||||
import ru.gravit.launchserver.response.update.UpdateListResponse;
|
|
||||||
import ru.gravit.launchserver.response.update.UpdateResponse;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public abstract class Response {
|
public abstract class Response {
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface Factory<R> {
|
public interface Factory<R> {
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.auth;
|
package ru.gravit.launchserver.response.auth;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.OshiHWID;
|
import ru.gravit.launcher.OshiHWID;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
|
@ -26,6 +19,12 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class AuthResponse extends Response {
|
public final class AuthResponse extends Response {
|
||||||
private static String echo(int length) {
|
private static String echo(int length) {
|
||||||
char[] chars = new char[length];
|
char[] chars = new char[length];
|
||||||
|
@ -91,7 +90,7 @@ public void reply() throws Exception {
|
||||||
throw new AuthException("You profile not found");
|
throw new AuthException("You profile not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.config.hwidHandler.check(OshiHWID.gson.fromJson(hwid_str,OshiHWID.class), result.username);
|
server.config.hwidHandler.check(OshiHWID.gson.fromJson(hwid_str, OshiHWID.class), result.username);
|
||||||
} catch (AuthException | HWIDException e) {
|
} catch (AuthException | HWIDException e) {
|
||||||
requestError(e.getMessage());
|
requestError(e.getMessage());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.auth;
|
package ru.gravit.launchserver.response.auth;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
@ -23,6 +17,11 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import javax.crypto.BadPaddingException;
|
||||||
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public final class AuthServerResponse extends Response {
|
public final class AuthServerResponse extends Response {
|
||||||
private static String echo(int length) {
|
private static String echo(int length) {
|
||||||
char[] chars = new char[length];
|
char[] chars = new char[length];
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.auth;
|
package ru.gravit.launchserver.response.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||||
|
@ -13,6 +10,9 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class CheckServerResponse extends Response {
|
public final class CheckServerResponse extends Response {
|
||||||
|
|
||||||
public CheckServerResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public CheckServerResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.auth;
|
package ru.gravit.launchserver.response.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||||
|
@ -12,6 +10,8 @@
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class JoinServerResponse extends Response {
|
public final class JoinServerResponse extends Response {
|
||||||
|
|
||||||
public JoinServerResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public JoinServerResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.auth;
|
package ru.gravit.launchserver.response.auth;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
@ -11,6 +9,8 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class SetProfileResponse extends Response {
|
public class SetProfileResponse extends Response {
|
||||||
public SetProfileResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public SetProfileResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
super(server, session, input, output, ip);
|
super(server, session, input, output, ip);
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.profile;
|
package ru.gravit.launchserver.response.profile;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||||
|
@ -10,6 +7,9 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public final class BatchProfileByUsernameResponse extends Response {
|
public final class BatchProfileByUsernameResponse extends Response {
|
||||||
|
|
||||||
public BatchProfileByUsernameResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public BatchProfileByUsernameResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.profile;
|
package ru.gravit.launchserver.response.profile;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
|
@ -12,6 +9,9 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class ProfileByUUIDResponse extends Response {
|
public final class ProfileByUUIDResponse extends Response {
|
||||||
|
|
||||||
public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client) {
|
public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.profile;
|
package ru.gravit.launchserver.response.profile;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.SerializeLimits;
|
import ru.gravit.launcher.serialize.SerializeLimits;
|
||||||
|
@ -10,6 +7,9 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class ProfileByUsernameResponse extends Response {
|
public final class ProfileByUsernameResponse extends Response {
|
||||||
|
|
||||||
public static void writeProfile(LaunchServer server, HOutput output, String username, String client) throws IOException {
|
public static void writeProfile(LaunchServer server, HOutput output, String username, String client) throws IOException {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.update;
|
package ru.gravit.launchserver.response.update;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.signed.DigestBytesHolder;
|
import ru.gravit.launcher.serialize.signed.DigestBytesHolder;
|
||||||
|
@ -10,6 +7,9 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public final class LauncherResponse extends Response {
|
public final class LauncherResponse extends Response {
|
||||||
|
|
||||||
public LauncherResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public LauncherResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.update;
|
package ru.gravit.launchserver.response.update;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
|
@ -9,6 +7,8 @@
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public final class LegacyLauncherResponse extends Response {
|
public final class LegacyLauncherResponse extends Response {
|
||||||
|
|
||||||
public LegacyLauncherResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public LegacyLauncherResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.update;
|
package ru.gravit.launchserver.response.update;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
@ -12,6 +9,9 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public final class ProfilesResponse extends Response {
|
public final class ProfilesResponse extends Response {
|
||||||
|
|
||||||
public ProfilesResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public ProfilesResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.update;
|
package ru.gravit.launchserver.response.update;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
@ -10,6 +7,9 @@
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.response.Response;
|
import ru.gravit.launchserver.response.Response;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public final class UpdateListResponse extends Response {
|
public final class UpdateListResponse extends Response {
|
||||||
|
|
||||||
public UpdateListResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public UpdateListResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package ru.gravit.launchserver.response.update;
|
package ru.gravit.launchserver.response.update;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.zip.DeflaterOutputStream;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.hasher.HashedEntry;
|
import ru.gravit.launcher.hasher.HashedEntry;
|
||||||
import ru.gravit.launcher.hasher.HashedEntry.Type;
|
import ru.gravit.launcher.hasher.HashedEntry.Type;
|
||||||
|
@ -22,6 +14,14 @@
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.zip.DeflaterOutputStream;
|
||||||
|
|
||||||
public final class UpdateResponse extends Response {
|
public final class UpdateResponse extends Response {
|
||||||
|
|
||||||
public UpdateResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
public UpdateResponse(LaunchServer server, long session, HInput input, HOutput output, String ip) {
|
||||||
|
|
|
@ -1,34 +1,5 @@
|
||||||
package ru.gravit.launchserver.socket;
|
package ru.gravit.launchserver.socket;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.nio.channels.Selector;
|
|
||||||
import java.nio.channels.ServerSocketChannel;
|
|
||||||
import java.security.KeyManagementException;
|
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.KeyStoreException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.security.UnrecoverableKeyException;
|
|
||||||
import java.security.cert.CertificateException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLServerSocketFactory;
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
|
|
||||||
import io.netty.bootstrap.ServerBootstrap;
|
import io.netty.bootstrap.ServerBootstrap;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelInitializer;
|
import io.netty.channel.ChannelInitializer;
|
||||||
|
@ -53,6 +24,29 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLServerSocketFactory;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.nio.channels.Selector;
|
||||||
|
import java.nio.channels.ServerSocketChannel;
|
||||||
|
import java.security.*;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "rawtypes"})
|
@SuppressWarnings({"unused", "rawtypes"})
|
||||||
public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
|
public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
|
||||||
private static final String WEBSOCKET_PATH = "/api";
|
private static final String WEBSOCKET_PATH = "/api";
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package ru.gravit.launchserver.socket;
|
package ru.gravit.launchserver.socket;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.SocketException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.request.RequestException;
|
import ru.gravit.launcher.request.RequestException;
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
|
@ -16,6 +11,11 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.SocketException;
|
||||||
|
|
||||||
public final class ResponseThread implements Runnable {
|
public final class ResponseThread implements Runnable {
|
||||||
class Handshake {
|
class Handshake {
|
||||||
int type;
|
int type;
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
package ru.gravit.launchserver.socket;
|
package ru.gravit.launchserver.socket;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.SynchronousQueue;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.managers.GarbageManager;
|
import ru.gravit.launcher.managers.GarbageManager;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.manangers.SessionManager;
|
import ru.gravit.launchserver.manangers.SessionManager;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.CommonHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.util.concurrent.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public final class ServerSocketHandler implements Runnable, AutoCloseable {
|
public final class ServerSocketHandler implements Runnable, AutoCloseable {
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ru.gravit.launchserver.socket.websocket;
|
package ru.gravit.launchserver.socket.websocket;
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import io.netty.channel.group.DefaultChannelGroup;
|
import io.netty.channel.group.DefaultChannelGroup;
|
||||||
|
|
|
@ -1,28 +1,17 @@
|
||||||
package ru.gravit.launchserver.socket.websocket;
|
package ru.gravit.launchserver.socket.websocket;
|
||||||
|
|
||||||
import static io.netty.handler.codec.http.HttpMethod.GET;
|
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST;
|
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN;
|
|
||||||
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
|
|
||||||
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
|
||||||
import static io.netty.handler.codec.rtsp.RtspResponseStatuses.NOT_FOUND;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.*;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.handler.codec.http.*;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.channel.ChannelPipeline;
|
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
|
||||||
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
|
||||||
import io.netty.handler.codec.http.FullHttpRequest;
|
|
||||||
import io.netty.handler.codec.http.FullHttpResponse;
|
|
||||||
import io.netty.handler.codec.http.HttpHeaderNames;
|
|
||||||
import io.netty.handler.codec.http.HttpRequest;
|
|
||||||
import io.netty.handler.codec.http.HttpUtil;
|
|
||||||
import io.netty.handler.ssl.SslHandler;
|
import io.netty.handler.ssl.SslHandler;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
|
|
||||||
|
import static io.netty.handler.codec.http.HttpMethod.GET;
|
||||||
|
import static io.netty.handler.codec.http.HttpResponseStatus.*;
|
||||||
|
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||||
|
import static io.netty.handler.codec.rtsp.RtspResponseStatuses.NOT_FOUND;
|
||||||
|
|
||||||
public class WebSocketIndexPageHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
|
public class WebSocketIndexPageHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
|
||||||
|
|
||||||
private final String websocketPath;
|
private final String websocketPath;
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package ru.gravit.launchserver.socket.websocket;
|
package ru.gravit.launchserver.socket.websocket;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
@ -24,6 +21,8 @@
|
||||||
import ru.gravit.launchserver.socket.websocket.json.update.UpdateListResponse;
|
import ru.gravit.launchserver.socket.websocket.json.update.UpdateListResponse;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@SuppressWarnings({"unused", "rawtypes"})
|
@SuppressWarnings({"unused", "rawtypes"})
|
||||||
public class WebSocketService {
|
public class WebSocketService {
|
||||||
public final ChannelGroup channels;
|
public final ChannelGroup channels;
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
package ru.gravit.launchserver.socket.websocket.json;
|
package ru.gravit.launchserver.socket.websocket.json;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import com.google.gson.*;
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonDeserializer;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParseException;
|
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
import com.google.gson.JsonSerializationContext;
|
|
||||||
import com.google.gson.JsonSerializer;
|
|
||||||
|
|
||||||
import ru.gravit.launchserver.socket.websocket.WebSocketService;
|
import ru.gravit.launchserver.socket.websocket.WebSocketService;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
public class JsonResponseAdapter implements JsonSerializer<JsonResponseInterface>, JsonDeserializer<JsonResponseInterface> {
|
public class JsonResponseAdapter implements JsonSerializer<JsonResponseInterface>, JsonDeserializer<JsonResponseInterface> {
|
||||||
private final WebSocketService service;
|
private final WebSocketService service;
|
||||||
private static final String PROP_NAME = "type";
|
private static final String PROP_NAME = "type";
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.gravit.launchserver.socket.websocket.json.auth;
|
package ru.gravit.launchserver.socket.websocket.json.auth;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
|
@ -17,6 +15,8 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class AuthResponse implements JsonResponseInterface {
|
public class AuthResponse implements JsonResponseInterface {
|
||||||
public String login;
|
public String login;
|
||||||
public String client;
|
public String client;
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package ru.gravit.launchserver.socket.websocket.json.update;
|
package ru.gravit.launchserver.socket.websocket.json.update;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import ru.gravit.launchserver.LaunchServer;
|
import ru.gravit.launchserver.LaunchServer;
|
||||||
import ru.gravit.launchserver.socket.Client;
|
import ru.gravit.launchserver.socket.Client;
|
||||||
|
@ -10,6 +7,9 @@
|
||||||
import ru.gravit.launchserver.socket.websocket.json.JsonResponseInterface;
|
import ru.gravit.launchserver.socket.websocket.json.JsonResponseInterface;
|
||||||
import ru.gravit.utils.Version;
|
import ru.gravit.utils.Version;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
public class LauncherResponse implements JsonResponseInterface {
|
public class LauncherResponse implements JsonResponseInterface {
|
||||||
public Version version;
|
public Version version;
|
||||||
public String hash;
|
public String hash;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package ru.gravit.launchserver.texture;
|
package ru.gravit.launchserver.texture;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class NullTextureProvider extends TextureProvider {
|
public final class NullTextureProvider extends TextureProvider {
|
||||||
private volatile TextureProvider provider;
|
private volatile TextureProvider provider;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package ru.gravit.launchserver.texture;
|
package ru.gravit.launchserver.texture;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
@ -12,6 +8,10 @@
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class RequestTextureProvider extends TextureProvider {
|
public final class RequestTextureProvider extends TextureProvider {
|
||||||
private static final UUID ZERO_UUID = new UUID(0, 0);
|
private static final UUID ZERO_UUID = new UUID(0, 0);
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package ru.gravit.launchserver.texture;
|
package ru.gravit.launchserver.texture;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
public abstract class TextureProvider extends ConfigObject implements AutoCloseable {
|
public abstract class TextureProvider extends ConfigObject implements AutoCloseable {
|
||||||
private static final Map<String, Adapter<TextureProvider>> TEXTURE_PROVIDERS = new ConcurrentHashMap<>(2);
|
private static final Map<String, Adapter<TextureProvider>> TEXTURE_PROVIDERS = new ConcurrentHashMap<>(2);
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package ru.gravit.launchserver.texture;
|
package ru.gravit.launchserver.texture;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class VoidTextureProvider extends TextureProvider {
|
public final class VoidTextureProvider extends TextureProvider {
|
||||||
public VoidTextureProvider(BlockConfigEntry block) {
|
public VoidTextureProvider(BlockConfigEntry block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package ru.gravit.launcher;
|
package ru.gravit.launcher;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.client.ClientLauncher;
|
||||||
|
import ru.gravit.utils.helper.EnvHelper;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
import ru.gravit.utils.helper.JVMHelper;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -7,12 +13,6 @@
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import ru.gravit.launcher.client.ClientLauncher;
|
|
||||||
import ru.gravit.utils.helper.EnvHelper;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
public class ClientLauncherWrapper {
|
public class ClientLauncherWrapper {
|
||||||
public static void main(String[] arguments) throws IOException, InterruptedException {
|
public static void main(String[] arguments) throws IOException, InterruptedException {
|
||||||
LogHelper.printVersion("Launcher");
|
LogHelper.printVersion("Launcher");
|
||||||
|
@ -42,7 +42,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
if (!process.isAlive()) {
|
if (!process.isAlive()) {
|
||||||
int errorcode = process.exitValue();
|
int errorcode = process.exitValue();
|
||||||
if(errorcode != 0)
|
if (errorcode != 0)
|
||||||
LogHelper.error("Process exit witch error code: %d", errorcode);
|
LogHelper.error("Process exit witch error code: %d", errorcode);
|
||||||
else
|
else
|
||||||
LogHelper.info("Process exit witch code 0");
|
LogHelper.info("Process exit witch code 0");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package ru.gravit.launcher;
|
package ru.gravit.launcher;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
@SuppressWarnings("AbstractClassNeverImplemented")
|
@SuppressWarnings("AbstractClassNeverImplemented")
|
||||||
public abstract class JSApplication extends Application {
|
public abstract class JSApplication extends Application {
|
||||||
private static final AtomicReference<JSApplication> INSTANCE = new AtomicReference<>();
|
private static final AtomicReference<JSApplication> INSTANCE = new AtomicReference<>();
|
||||||
|
|
|
@ -1,26 +1,6 @@
|
||||||
package ru.gravit.launcher;
|
package ru.gravit.launcher;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import ru.gravit.launcher.client.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import javax.script.Bindings;
|
|
||||||
import javax.script.Invocable;
|
|
||||||
import javax.script.ScriptContext;
|
|
||||||
import javax.script.ScriptEngine;
|
|
||||||
import javax.script.ScriptException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.client.ClientLauncher;
|
|
||||||
import ru.gravit.launcher.client.ClientModuleManager;
|
|
||||||
import ru.gravit.launcher.client.DirBridge;
|
|
||||||
import ru.gravit.launcher.client.FunctionalBridge;
|
|
||||||
import ru.gravit.launcher.client.LauncherSettings;
|
|
||||||
import ru.gravit.launcher.client.ServerPinger;
|
|
||||||
import ru.gravit.launcher.gui.choosebox.CheckComboBox;
|
import ru.gravit.launcher.gui.choosebox.CheckComboBox;
|
||||||
import ru.gravit.launcher.gui.choosebox.CheckComboBoxSkin;
|
import ru.gravit.launcher.gui.choosebox.CheckComboBoxSkin;
|
||||||
import ru.gravit.launcher.gui.choosebox.CheckModel;
|
import ru.gravit.launcher.gui.choosebox.CheckModel;
|
||||||
|
@ -34,11 +14,7 @@
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
import ru.gravit.launcher.profiles.Texture;
|
import ru.gravit.launcher.profiles.Texture;
|
||||||
import ru.gravit.launcher.request.CustomRequest;
|
import ru.gravit.launcher.request.*;
|
||||||
import ru.gravit.launcher.request.PingRequest;
|
|
||||||
import ru.gravit.launcher.request.Request;
|
|
||||||
import ru.gravit.launcher.request.RequestException;
|
|
||||||
import ru.gravit.launcher.request.RequestType;
|
|
||||||
import ru.gravit.launcher.request.auth.AuthRequest;
|
import ru.gravit.launcher.request.auth.AuthRequest;
|
||||||
import ru.gravit.launcher.request.auth.CheckServerRequest;
|
import ru.gravit.launcher.request.auth.CheckServerRequest;
|
||||||
import ru.gravit.launcher.request.auth.JoinServerRequest;
|
import ru.gravit.launcher.request.auth.JoinServerRequest;
|
||||||
|
@ -54,24 +30,23 @@
|
||||||
import ru.gravit.launcher.serialize.config.ConfigObject;
|
import ru.gravit.launcher.serialize.config.ConfigObject;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
import ru.gravit.launcher.serialize.config.TextConfigReader;
|
||||||
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
import ru.gravit.launcher.serialize.config.TextConfigWriter;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BlockConfigEntry;
|
import ru.gravit.launcher.serialize.config.entry.*;
|
||||||
import ru.gravit.launcher.serialize.config.entry.BooleanConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.ConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.IntegerConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.ListConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.config.entry.StringConfigEntry;
|
|
||||||
import ru.gravit.launcher.serialize.signed.SignedBytesHolder;
|
import ru.gravit.launcher.serialize.signed.SignedBytesHolder;
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import ru.gravit.launcher.serialize.stream.EnumSerializer;
|
import ru.gravit.launcher.serialize.stream.EnumSerializer;
|
||||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||||
import ru.gravit.utils.HTTPRequest;
|
import ru.gravit.utils.HTTPRequest;
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.EnvHelper;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import javax.script.*;
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
import java.io.BufferedReader;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import java.io.IOException;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import java.net.URL;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public class LauncherEngine {
|
public class LauncherEngine {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package ru.gravit.launcher;
|
package ru.gravit.launcher;
|
||||||
|
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
public class RequestWorker implements Runnable {
|
public class RequestWorker implements Runnable {
|
||||||
public RequestWorker()
|
public RequestWorker() {
|
||||||
{
|
|
||||||
queue = new LinkedBlockingQueue<>(64);
|
queue = new LinkedBlockingQueue<>(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockingQueue<Runnable> queue;
|
public BlockingQueue<Runnable> queue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LogHelper.debug("FX Task Thread start");
|
LogHelper.debug("FX Task Thread start");
|
||||||
while (!Thread.interrupted())
|
while (!Thread.interrupted()) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
Runnable task;
|
Runnable task;
|
||||||
task = queue.take();
|
task = queue.take();
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import ru.gravit.launcher.*;
|
||||||
|
import ru.gravit.launcher.hasher.DirWatcher;
|
||||||
|
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||||
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
|
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
|
||||||
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
|
import ru.gravit.launcher.serialize.stream.StreamObject;
|
||||||
|
import ru.gravit.utils.PublicURLClassLoader;
|
||||||
|
import ru.gravit.utils.helper.*;
|
||||||
|
import ru.gravit.utils.helper.JVMHelper.OS;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ProcessBuilder.Redirect;
|
import java.lang.ProcessBuilder.Redirect;
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
|
@ -16,45 +34,11 @@
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
import java.security.interfaces.RSAPublicKey;
|
import java.security.interfaces.RSAPublicKey;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
|
||||||
import ru.gravit.launcher.LauncherAgent;
|
|
||||||
import ru.gravit.launcher.LauncherConfig;
|
|
||||||
import ru.gravit.launcher.LauncherEngine;
|
|
||||||
import ru.gravit.launcher.hasher.DirWatcher;
|
|
||||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
|
||||||
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
|
||||||
import ru.gravit.launcher.serialize.stream.StreamObject;
|
|
||||||
import ru.gravit.utils.PublicURLClassLoader;
|
|
||||||
import ru.gravit.utils.helper.CommonHelper;
|
|
||||||
import ru.gravit.utils.helper.EnvHelper;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
|
||||||
import ru.gravit.utils.helper.JVMHelper.OS;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
|
||||||
|
|
||||||
public final class ClientLauncher {
|
public final class ClientLauncher {
|
||||||
private static Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
|
|
||||||
private static final class ClassPathFileVisitor extends SimpleFileVisitor<Path> {
|
private static final class ClassPathFileVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final Collection<Path> result;
|
private final Collection<Path> result;
|
||||||
|
|
||||||
|
@ -183,6 +167,7 @@ public void write(HOutput output) throws IOException {
|
||||||
private static final Path NATIVES_DIR = IOHelper.toPath("natives");
|
private static final Path NATIVES_DIR = IOHelper.toPath("natives");
|
||||||
private static final Path RESOURCEPACKS_DIR = IOHelper.toPath("resourcepacks");
|
private static final Path RESOURCEPACKS_DIR = IOHelper.toPath("resourcepacks");
|
||||||
private static PublicURLClassLoader classLoader;
|
private static PublicURLClassLoader classLoader;
|
||||||
|
|
||||||
private static void addClientArgs(Collection<String> args, ClientProfile profile, Params params) {
|
private static void addClientArgs(Collection<String> args, ClientProfile profile, Params params) {
|
||||||
PlayerProfile pp = params.pp;
|
PlayerProfile pp = params.pp;
|
||||||
|
|
||||||
|
@ -257,7 +242,7 @@ public static void checkJVMBitsAndVersion() {
|
||||||
if (JVMHelper.JVM_BITS != JVMHelper.OS_BITS) {
|
if (JVMHelper.JVM_BITS != JVMHelper.OS_BITS) {
|
||||||
String error = String.format("У Вас установлена Java %d, но Ваша система определена как %d. Установите Java правильной разрядности", JVMHelper.JVM_BITS, JVMHelper.OS_BITS);
|
String error = String.format("У Вас установлена Java %d, но Ваша система определена как %d. Установите Java правильной разрядности", JVMHelper.JVM_BITS, JVMHelper.OS_BITS);
|
||||||
LogHelper.error(error);
|
LogHelper.error(error);
|
||||||
if(Launcher.getConfig().isWarningMissArchJava)
|
if (Launcher.getConfig().isWarningMissArchJava)
|
||||||
JOptionPane.showMessageDialog(null, error);
|
JOptionPane.showMessageDialog(null, error);
|
||||||
}
|
}
|
||||||
String jvmVersion = JVMHelper.RUNTIME_MXBEAN.getVmVersion();
|
String jvmVersion = JVMHelper.RUNTIME_MXBEAN.getVmVersion();
|
||||||
|
@ -265,7 +250,7 @@ public static void checkJVMBitsAndVersion() {
|
||||||
if (jvmVersion.startsWith("10.") || jvmVersion.startsWith("9.") || jvmVersion.startsWith("11.")) {
|
if (jvmVersion.startsWith("10.") || jvmVersion.startsWith("9.") || jvmVersion.startsWith("11.")) {
|
||||||
String error = String.format("У Вас установлена Java %s. Для правильной работы необходима Java 8", JVMHelper.RUNTIME_MXBEAN.getVmVersion());
|
String error = String.format("У Вас установлена Java %s. Для правильной работы необходима Java 8", JVMHelper.RUNTIME_MXBEAN.getVmVersion());
|
||||||
LogHelper.error(error);
|
LogHelper.error(error);
|
||||||
if(Launcher.getConfig().isWarningMissArchJava)
|
if (Launcher.getConfig().isWarningMissArchJava)
|
||||||
JOptionPane.showMessageDialog(null, error);
|
JOptionPane.showMessageDialog(null, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +334,8 @@ public static Process launch(
|
||||||
boolean wrapper = isUsingWrapper();
|
boolean wrapper = isUsingWrapper();
|
||||||
Path javaBin;
|
Path javaBin;
|
||||||
/*if (wrapper) javaBin = AvanguardStarter.wrapper;
|
/*if (wrapper) javaBin = AvanguardStarter.wrapper;
|
||||||
else*/ if (isDownloadJava) {
|
else*/
|
||||||
|
if (isDownloadJava) {
|
||||||
//Linux и Mac не должны скачивать свою JVM
|
//Linux и Mac не должны скачивать свою JVM
|
||||||
if (JVMHelper.OS_TYPE == OS.MUSTDIE)
|
if (JVMHelper.OS_TYPE == OS.MUSTDIE)
|
||||||
javaBin = IOHelper.resolveJavaBin(JavaBinPath);
|
javaBin = IOHelper.resolveJavaBin(JavaBinPath);
|
||||||
|
@ -380,10 +366,9 @@ public static Process launch(
|
||||||
Collections.addAll(args, profile.object.getJvmArgs());
|
Collections.addAll(args, profile.object.getJvmArgs());
|
||||||
Collections.addAll(args, "-Djava.library.path=".concat(params.clientDir.resolve(NATIVES_DIR).toString())); // Add Native Path
|
Collections.addAll(args, "-Djava.library.path=".concat(params.clientDir.resolve(NATIVES_DIR).toString())); // Add Native Path
|
||||||
Collections.addAll(args, "-javaagent:".concat(pathLauncher));
|
Collections.addAll(args, "-javaagent:".concat(pathLauncher));
|
||||||
if(wrapper)
|
if (wrapper)
|
||||||
Collections.addAll(args, "-Djava.class.path=".concat(pathLauncher)); // Add Class Path
|
Collections.addAll(args, "-Djava.class.path=".concat(pathLauncher)); // Add Class Path
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
Collections.addAll(args, "-cp");
|
Collections.addAll(args, "-cp");
|
||||||
Collections.addAll(args, pathLauncher);
|
Collections.addAll(args, pathLauncher);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherEngine;
|
import ru.gravit.launcher.LauncherEngine;
|
||||||
import ru.gravit.launcher.modules.SimpleModuleManager;
|
import ru.gravit.launcher.modules.SimpleModuleManager;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class ClientModuleManager extends SimpleModuleManager {
|
public class ClientModuleManager extends SimpleModuleManager {
|
||||||
public ClientModuleManager(LauncherEngine engine) {
|
public ClientModuleManager(LauncherEngine engine) {
|
||||||
context = new ClientModuleContext(engine);
|
context = new ClientModuleContext(engine);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
import ru.gravit.utils.helper.JVMHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
|
||||||
|
|
||||||
public class DirBridge {
|
public class DirBridge {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static Path dir;
|
public static Path dir;
|
||||||
|
@ -18,63 +18,55 @@ public class DirBridge {
|
||||||
public static Path defaultUpdatesDir;
|
public static Path defaultUpdatesDir;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static boolean useLegacyDir;
|
public static boolean useLegacyDir;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static void move(Path newDir) throws IOException
|
public static void move(Path newDir) throws IOException {
|
||||||
{
|
IOHelper.move(dirUpdates, newDir);
|
||||||
IOHelper.move(dirUpdates,newDir);
|
|
||||||
dirUpdates = newDir;
|
dirUpdates = newDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static Path getAppDataDir() throws IOException {
|
public static Path getAppDataDir() throws IOException {
|
||||||
Boolean isCustomDir = Boolean.getBoolean(System.getProperty("launcher.usecustomdir","false"));
|
Boolean isCustomDir = Boolean.getBoolean(System.getProperty("launcher.usecustomdir", "false"));
|
||||||
if(isCustomDir)
|
if (isCustomDir) {
|
||||||
{
|
|
||||||
return Paths.get(System.getProperty("launcher.customdir"));
|
return Paths.get(System.getProperty("launcher.customdir"));
|
||||||
}
|
}
|
||||||
if(JVMHelper.OS_TYPE == JVMHelper.OS.LINUX)
|
if (JVMHelper.OS_TYPE == JVMHelper.OS.LINUX) {
|
||||||
{
|
Boolean isOpt = Boolean.getBoolean(System.getProperty("launcher.useoptdir", "false"));
|
||||||
Boolean isOpt = Boolean.getBoolean(System.getProperty("launcher.useoptdir","false"));
|
if (isOpt) {
|
||||||
if(isOpt)
|
|
||||||
{
|
|
||||||
Path opt = Paths.get("/").resolve("opt");
|
Path opt = Paths.get("/").resolve("opt");
|
||||||
if(!IOHelper.isDir(opt)) Files.createDirectories(opt);
|
if (!IOHelper.isDir(opt)) Files.createDirectories(opt);
|
||||||
return opt;
|
return opt;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Path local = IOHelper.HOME_DIR.resolve(".minecraftlauncher");
|
Path local = IOHelper.HOME_DIR.resolve(".minecraftlauncher");
|
||||||
if(!IOHelper.isDir(local)) Files.createDirectories(local);
|
if (!IOHelper.isDir(local)) Files.createDirectories(local);
|
||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
}
|
} else if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||||
else if(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
|
||||||
{
|
|
||||||
Path appdata = IOHelper.HOME_DIR.resolve("AppData").resolve("Roaming");
|
Path appdata = IOHelper.HOME_DIR.resolve("AppData").resolve("Roaming");
|
||||||
if(!IOHelper.isDir(appdata)) Files.createDirectories(appdata);
|
if (!IOHelper.isDir(appdata)) Files.createDirectories(appdata);
|
||||||
return appdata;
|
return appdata;
|
||||||
}
|
} else if (JVMHelper.OS_TYPE == JVMHelper.OS.MACOSX) {
|
||||||
else if(JVMHelper.OS_TYPE == JVMHelper.OS.MACOSX)
|
|
||||||
{
|
|
||||||
Path minecraft = IOHelper.HOME_DIR.resolve("minecraft");
|
Path minecraft = IOHelper.HOME_DIR.resolve("minecraft");
|
||||||
if(!IOHelper.isDir(minecraft)) Files.createDirectories(minecraft);
|
if (!IOHelper.isDir(minecraft)) Files.createDirectories(minecraft);
|
||||||
return minecraft;
|
return minecraft;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return IOHelper.HOME_DIR;
|
return IOHelper.HOME_DIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static Path getLauncherDir(String projectname) throws IOException {
|
public static Path getLauncherDir(String projectname) throws IOException {
|
||||||
return getAppDataDir().resolve(projectname);
|
return getAppDataDir().resolve(projectname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static Path getLegacyLauncherDir(String projectname) throws IOException {
|
public static Path getLegacyLauncherDir(String projectname) throws IOException {
|
||||||
return IOHelper.HOME_DIR.resolve(projectname);
|
return IOHelper.HOME_DIR.resolve(projectname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static void setUseLegacyDir(boolean b)
|
public static void setUseLegacyDir(boolean b) {
|
||||||
{
|
|
||||||
useLegacyDir = b;
|
useLegacyDir = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.security.SignatureException;
|
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import ru.gravit.launcher.HWID;
|
import ru.gravit.launcher.HWID;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
import ru.gravit.launcher.RequestWorker;
|
import ru.gravit.launcher.RequestWorker;
|
||||||
import ru.gravit.launcher.managers.HasherManager;
|
|
||||||
import ru.gravit.launcher.managers.HasherStore;
|
|
||||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
import ru.gravit.launcher.hwid.OshiHWIDProvider;
|
import ru.gravit.launcher.hwid.OshiHWIDProvider;
|
||||||
|
import ru.gravit.launcher.managers.HasherManager;
|
||||||
|
import ru.gravit.launcher.managers.HasherStore;
|
||||||
import ru.gravit.launcher.request.Request;
|
import ru.gravit.launcher.request.Request;
|
||||||
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
|
import ru.gravit.launcher.request.update.LegacyLauncherRequest;
|
||||||
import ru.gravit.launcher.request.websockets.RequestInterface;
|
import ru.gravit.launcher.request.websockets.RequestInterface;
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.security.SignatureException;
|
||||||
|
|
||||||
public class FunctionalBridge {
|
public class FunctionalBridge {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static LauncherSettings settings;
|
public static LauncherSettings settings;
|
||||||
|
@ -52,34 +52,33 @@ public static LegacyLauncherRequest.Result offlineLauncherRequest() throws IOExc
|
||||||
// Return last sign and profiles
|
// Return last sign and profiles
|
||||||
return new LegacyLauncherRequest.Result(null, settings.lastDigest, settings.lastProfiles);
|
return new LegacyLauncherRequest.Result(null, settings.lastDigest, settings.lastProfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static void makeJsonRequest(RequestInterface request, Runnable callback)
|
public static void makeJsonRequest(RequestInterface request, Runnable callback) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static void startTask(@SuppressWarnings("rawtypes") Task task)
|
public static void startTask(@SuppressWarnings("rawtypes") Task task) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
worker.queue.put(task);
|
worker.queue.put(task);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static HWID getHWID()
|
public static HWID getHWID() {
|
||||||
{
|
|
||||||
return hwidProvider.getHWID();
|
return hwidProvider.getHWID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static long getTotalMemory()
|
public static long getTotalMemory() {
|
||||||
{
|
|
||||||
return hwidProvider.getTotalMemory() >> 20;
|
return hwidProvider.getTotalMemory() >> 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static HasherStore getDefaultHasherStore()
|
public static HasherStore getDefaultHasherStore() {
|
||||||
{
|
|
||||||
return HasherManager.getDefaultStore();
|
return HasherManager.getDefaultStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.security.SignatureException;
|
|
||||||
import java.security.interfaces.RSAPublicKey;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.crypto.BadPaddingException;
|
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.Launcher;
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
|
@ -19,11 +7,18 @@
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
import ru.gravit.utils.helper.*;
|
||||||
import ru.gravit.utils.helper.JVMHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import javax.crypto.BadPaddingException;
|
||||||
import ru.gravit.utils.helper.SecurityHelper;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.security.SignatureException;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class LauncherSettings {
|
public class LauncherSettings {
|
||||||
public static int settingsMagic = 0xc0de7;
|
public static int settingsMagic = 0xc0de7;
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package ru.gravit.launcher.client;
|
package ru.gravit.launcher.client;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
|
import ru.gravit.launcher.serialize.HInput;
|
||||||
|
import ru.gravit.launcher.serialize.HOutput;
|
||||||
|
import ru.gravit.utils.helper.IOHelper;
|
||||||
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
import ru.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
@ -10,19 +20,9 @@
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
|
||||||
import ru.gravit.launcher.serialize.HInput;
|
|
||||||
import ru.gravit.launcher.serialize.HOutput;
|
|
||||||
import ru.gravit.utils.helper.IOHelper;
|
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
|
||||||
import ru.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
public final class ServerPinger {
|
public final class ServerPinger {
|
||||||
private JsonParser parser = new JsonParser();
|
private JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
public static final class Result {
|
public static final class Result {
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final int onlinePlayers;
|
public final int onlinePlayers;
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package ru.gravit.launcher.gui.choosebox;
|
package ru.gravit.launcher.gui.choosebox;
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.sun.javafx.collections.MappingChange;
|
import com.sun.javafx.collections.MappingChange;
|
||||||
import com.sun.javafx.collections.NonIterableChange;
|
import com.sun.javafx.collections.NonIterableChange;
|
||||||
import com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList;
|
import com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList;
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
abstract class CheckBitSetModelBase<T> implements IndexedCheckModel<T> {
|
abstract class CheckBitSetModelBase<T> implements IndexedCheckModel<T> {
|
||||||
private final Map<T, BooleanProperty> itemBooleanMap;
|
private final Map<T, BooleanProperty> itemBooleanMap;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
package ru.gravit.launcher.gui.choosebox;
|
package ru.gravit.launcher.gui.choosebox;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import javafx.beans.property.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
|
||||||
import javafx.beans.property.ObjectProperty;
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.beans.property.StringProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
@ -15,6 +8,9 @@
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class CheckComboBox<T> extends ControlsFXControl {
|
public class CheckComboBox<T> extends ControlsFXControl {
|
||||||
private static class CheckComboBoxBitSetCheckModel<T> extends CheckBitSetModelBase<T> {
|
private static class CheckComboBoxBitSetCheckModel<T> extends CheckBitSetModelBase<T> {
|
||||||
private final ObservableList<T> items;
|
private final ObservableList<T> items;
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package ru.gravit.launcher.gui.choosebox;
|
package ru.gravit.launcher.gui.choosebox;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList;
|
import com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList;
|
||||||
import com.sun.javafx.scene.control.behavior.BehaviorBase;
|
import com.sun.javafx.scene.control.behavior.BehaviorBase;
|
||||||
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
|
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;
|
||||||
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
|
import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
|
||||||
|
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
|
@ -17,6 +14,8 @@
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import ru.gravit.launcher.LauncherAPI;
|
import ru.gravit.launcher.LauncherAPI;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
public class CheckComboBoxSkin<T> extends BehaviorSkinBase<CheckComboBox<T>, BehaviorBase<CheckComboBox<T>>> {
|
public class CheckComboBoxSkin<T> extends BehaviorSkinBase<CheckComboBox<T>, BehaviorBase<CheckComboBox<T>>> {
|
||||||
|
|
||||||
private final ComboBox<T> comboBox;
|
private final ComboBox<T> comboBox;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue