mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
Merge pull request #282 from GravitLauncher/nonInstance
[FEATURE] Удалено поле с статической инстанцией LaunchServer`а
This commit is contained in:
commit
1f10bab874
269 changed files with 2187 additions and 1210 deletions
|
@ -53,6 +53,7 @@ bundle project(':Radon')
|
||||||
bundle 'commons-codec:commons-codec:1.12'
|
bundle 'commons-codec:commons-codec:1.12'
|
||||||
bundle 'org.javassist:javassist:3.25.0-GA'
|
bundle 'org.javassist:javassist:3.25.0-GA'
|
||||||
bundle 'io.netty:netty-all:4.1.36.Final'
|
bundle 'io.netty:netty-all:4.1.36.Final'
|
||||||
|
bundle 'org.hibernate:hibernate-core:5.4.3.Final'
|
||||||
|
|
||||||
bundle 'org.slf4j:slf4j-simple:1.7.25'
|
bundle 'org.slf4j:slf4j-simple:1.7.25'
|
||||||
bundle 'org.slf4j:slf4j-api:1.7.25'
|
bundle 'org.slf4j:slf4j-api:1.7.25'
|
||||||
|
|
|
@ -1,6 +1,49 @@
|
||||||
package pro.gravit.launchserver;
|
package pro.gravit.launchserver;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.lang.ProcessBuilder.Redirect;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
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.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
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.Timer;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
import io.netty.handler.logging.LogLevel;
|
import io.netty.handler.logging.LogLevel;
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launcher.LauncherConfig;
|
||||||
|
import pro.gravit.launcher.NeedGarbageCollection;
|
||||||
|
import pro.gravit.launcher.config.JsonConfigurable;
|
||||||
|
import pro.gravit.launcher.hasher.HashedDir;
|
||||||
|
import pro.gravit.launcher.managers.ConfigManager;
|
||||||
|
import pro.gravit.launcher.managers.GarbageManager;
|
||||||
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
|
import pro.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.handler.MemoryAuthHandler;
|
import pro.gravit.launchserver.auth.handler.MemoryAuthHandler;
|
||||||
|
@ -15,49 +58,37 @@
|
||||||
import pro.gravit.launchserver.auth.provider.RejectAuthProvider;
|
import pro.gravit.launchserver.auth.provider.RejectAuthProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.RequestTextureProvider;
|
import pro.gravit.launchserver.auth.texture.RequestTextureProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
import pro.gravit.launchserver.binary.*;
|
import pro.gravit.launchserver.binary.EXEL4JLauncherBinary;
|
||||||
|
import pro.gravit.launchserver.binary.EXELauncherBinary;
|
||||||
|
import pro.gravit.launchserver.binary.JARLauncherBinary;
|
||||||
|
import pro.gravit.launchserver.binary.LauncherBinary;
|
||||||
|
import pro.gravit.launchserver.binary.ProguardConf;
|
||||||
import pro.gravit.launchserver.components.AuthLimiterComponent;
|
import pro.gravit.launchserver.components.AuthLimiterComponent;
|
||||||
import pro.gravit.launchserver.components.Component;
|
import pro.gravit.launchserver.components.Component;
|
||||||
import pro.gravit.launchserver.config.LaunchServerRuntimeConfig;
|
import pro.gravit.launchserver.config.LaunchServerRuntimeConfig;
|
||||||
|
import pro.gravit.launchserver.dao.UserService;
|
||||||
import pro.gravit.launchserver.legacy.Response;
|
import pro.gravit.launchserver.legacy.Response;
|
||||||
import pro.gravit.launchserver.manangers.*;
|
import pro.gravit.launchserver.manangers.LaunchServerGsonManager;
|
||||||
|
import pro.gravit.launchserver.manangers.MirrorManager;
|
||||||
|
import pro.gravit.launchserver.manangers.ModulesManager;
|
||||||
|
import pro.gravit.launchserver.manangers.ReconfigurableManager;
|
||||||
|
import pro.gravit.launchserver.manangers.ReloadManager;
|
||||||
|
import pro.gravit.launchserver.manangers.SessionManager;
|
||||||
import pro.gravit.launchserver.manangers.hook.AuthHookManager;
|
import pro.gravit.launchserver.manangers.hook.AuthHookManager;
|
||||||
import pro.gravit.launchserver.manangers.hook.BuildHookManager;
|
import pro.gravit.launchserver.manangers.hook.BuildHookManager;
|
||||||
import pro.gravit.launchserver.manangers.hook.SocketHookManager;
|
import pro.gravit.launchserver.manangers.hook.SocketHookManager;
|
||||||
import pro.gravit.launchserver.socket.ServerSocketHandler;
|
import pro.gravit.launchserver.socket.ServerSocketHandler;
|
||||||
import pro.gravit.launchserver.websocket.NettyServerSocketHandler;
|
import pro.gravit.launchserver.websocket.NettyServerSocketHandler;
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launcher.LauncherConfig;
|
|
||||||
import pro.gravit.launcher.NeedGarbageCollection;
|
|
||||||
import pro.gravit.launcher.config.JsonConfigurable;
|
|
||||||
import pro.gravit.launcher.hasher.HashedDir;
|
|
||||||
import pro.gravit.launcher.managers.ConfigManager;
|
|
||||||
import pro.gravit.launcher.managers.GarbageManager;
|
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
|
||||||
import pro.gravit.launcher.serialize.signed.SignedObjectHolder;
|
|
||||||
import pro.gravit.utils.helper.*;
|
|
||||||
import pro.gravit.launchserver.binary.*;
|
|
||||||
import pro.gravit.launchserver.manangers.*;
|
|
||||||
import pro.gravit.utils.Version;
|
import pro.gravit.utils.Version;
|
||||||
import pro.gravit.utils.command.CommandHandler;
|
import pro.gravit.utils.command.CommandHandler;
|
||||||
import pro.gravit.utils.command.JLineCommandHandler;
|
import pro.gravit.utils.command.JLineCommandHandler;
|
||||||
import pro.gravit.utils.command.StdCommandHandler;
|
import pro.gravit.utils.command.StdCommandHandler;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
import java.io.*;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import java.lang.ProcessBuilder.Redirect;
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import java.net.InetSocketAddress;
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
import java.net.SocketAddress;
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
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.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.zip.CRC32;
|
|
||||||
|
|
||||||
public final class LaunchServer implements Runnable, AutoCloseable, Reloadable {
|
public final class LaunchServer implements Runnable, AutoCloseable, Reloadable {
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,11 +98,13 @@ public void reload() throws Exception {
|
||||||
try (BufferedReader reader = IOHelper.newReader(configFile)) {
|
try (BufferedReader reader = IOHelper.newReader(configFile)) {
|
||||||
config = Launcher.gsonManager.gson.fromJson(reader, Config.class);
|
config = Launcher.gsonManager.gson.fromJson(reader, Config.class);
|
||||||
}
|
}
|
||||||
|
config.server = this;
|
||||||
config.verify();
|
config.verify();
|
||||||
config.init();
|
config.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Config {
|
public static final class Config {
|
||||||
|
private transient LaunchServer server = null;
|
||||||
public int legacyPort;
|
public int legacyPort;
|
||||||
|
|
||||||
private String legacyAddress;
|
private String legacyAddress;
|
||||||
|
@ -206,30 +239,30 @@ public void verify() {
|
||||||
public void init() {
|
public void init() {
|
||||||
Launcher.applyLauncherEnv(env);
|
Launcher.applyLauncherEnv(env);
|
||||||
for (AuthProviderPair provider : auth) {
|
for (AuthProviderPair provider : auth) {
|
||||||
provider.init();
|
provider.init(server);
|
||||||
}
|
}
|
||||||
permissionsHandler.init();
|
permissionsHandler.init();
|
||||||
hwidHandler.init();
|
hwidHandler.init();
|
||||||
if (protectHandler != null) {
|
if (protectHandler != null) {
|
||||||
protectHandler.checkLaunchServerLicense();
|
protectHandler.checkLaunchServerLicense();
|
||||||
}
|
}
|
||||||
LaunchServer.server.registerObject("permissionsHandler", permissionsHandler);
|
server.registerObject("permissionsHandler", permissionsHandler);
|
||||||
for (AuthProviderPair pair : auth) {
|
for (AuthProviderPair pair : auth) {
|
||||||
LaunchServer.server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
||||||
LaunchServer.server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
||||||
LaunchServer.server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
Arrays.stream(mirrors).forEach(LaunchServer.server.mirrorManager::addMirror);
|
Arrays.stream(mirrors).forEach(server.mirrorManager::addMirror);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
LaunchServer.server.unregisterObject("permissionsHandler", permissionsHandler);
|
server.unregisterObject("permissionsHandler", permissionsHandler);
|
||||||
for (AuthProviderPair pair : auth) {
|
for (AuthProviderPair pair : auth) {
|
||||||
LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
server.unregisterObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
|
||||||
LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
server.unregisterObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
|
||||||
LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
server.unregisterObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
|
@ -396,7 +429,7 @@ public static void main(String... args) throws Throwable {
|
||||||
|
|
||||||
public final Path updatesDir;
|
public final Path updatesDir;
|
||||||
|
|
||||||
public static LaunchServer server = null;
|
//public static LaunchServer server = null;
|
||||||
|
|
||||||
public final Path profilesDir;
|
public final Path profilesDir;
|
||||||
// Server config
|
// Server config
|
||||||
|
@ -426,6 +459,8 @@ public static void main(String... args) throws Throwable {
|
||||||
|
|
||||||
public final ModulesManager modulesManager;
|
public final ModulesManager modulesManager;
|
||||||
|
|
||||||
|
public final UserService userService;
|
||||||
|
|
||||||
public final MirrorManager mirrorManager;
|
public final MirrorManager mirrorManager;
|
||||||
|
|
||||||
public final ReloadManager reloadManager;
|
public final ReloadManager reloadManager;
|
||||||
|
@ -479,7 +514,7 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException
|
||||||
Response.registerResponses();
|
Response.registerResponses();
|
||||||
Component.registerComponents();
|
Component.registerComponents();
|
||||||
ProtectHandler.registerHandlers();
|
ProtectHandler.registerHandlers();
|
||||||
LaunchServer.server = this;
|
//LaunchServer.server = this;
|
||||||
|
|
||||||
// Set command handler
|
// Set command handler
|
||||||
CommandHandler localCommandHandler;
|
CommandHandler localCommandHandler;
|
||||||
|
@ -496,7 +531,7 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException
|
||||||
localCommandHandler = new StdCommandHandler(true);
|
localCommandHandler = new StdCommandHandler(true);
|
||||||
LogHelper.warning("JLine2 isn't in classpath, using std");
|
LogHelper.warning("JLine2 isn't in classpath, using std");
|
||||||
}
|
}
|
||||||
pro.gravit.launchserver.command.handler.CommandHandler.registerCommands(localCommandHandler);
|
pro.gravit.launchserver.command.handler.CommandHandler.registerCommands(localCommandHandler, this);
|
||||||
commandHandler = localCommandHandler;
|
commandHandler = localCommandHandler;
|
||||||
|
|
||||||
// Set key pair
|
// Set key pair
|
||||||
|
@ -538,6 +573,7 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException
|
||||||
try (BufferedReader reader = IOHelper.newReader(configFile)) {
|
try (BufferedReader reader = IOHelper.newReader(configFile)) {
|
||||||
config = Launcher.gsonManager.gson.fromJson(reader, Config.class);
|
config = Launcher.gsonManager.gson.fromJson(reader, Config.class);
|
||||||
}
|
}
|
||||||
|
config.server = this;
|
||||||
if (!Files.exists(runtimeConfigFile)) {
|
if (!Files.exists(runtimeConfigFile)) {
|
||||||
LogHelper.info("Reset LaunchServer runtime config file");
|
LogHelper.info("Reset LaunchServer runtime config file");
|
||||||
runtime = new LaunchServerRuntimeConfig();
|
runtime = new LaunchServerRuntimeConfig();
|
||||||
|
@ -552,7 +588,7 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException
|
||||||
config.verify();
|
config.verify();
|
||||||
Launcher.applyLauncherEnv(config.env);
|
Launcher.applyLauncherEnv(config.env);
|
||||||
for (AuthProviderPair provider : config.auth) {
|
for (AuthProviderPair provider : config.auth) {
|
||||||
provider.init();
|
provider.init(this);
|
||||||
}
|
}
|
||||||
config.permissionsHandler.init();
|
config.permissionsHandler.init();
|
||||||
config.hwidHandler.init();
|
config.hwidHandler.init();
|
||||||
|
@ -578,6 +614,7 @@ public LaunchServer(Path dir, boolean testEnv, String[] args) throws IOException
|
||||||
socketHookManager = new SocketHookManager();
|
socketHookManager = new SocketHookManager();
|
||||||
authHookManager = new AuthHookManager();
|
authHookManager = new AuthHookManager();
|
||||||
configManager = new ConfigManager();
|
configManager = new ConfigManager();
|
||||||
|
userService = new UserService(this);
|
||||||
GarbageManager.registerNeedGC(sessionManager);
|
GarbageManager.registerNeedGC(sessionManager);
|
||||||
reloadManager.registerReloadable("launchServer", this);
|
reloadManager.registerReloadable("launchServer", this);
|
||||||
registerObject("permissionsHandler", config.permissionsHandler);
|
registerObject("permissionsHandler", config.permissionsHandler);
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.instrument.Instrumentation;
|
import java.lang.instrument.Instrumentation;
|
||||||
import java.nio.file.*;
|
import java.nio.file.FileVisitOption;
|
||||||
|
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.nio.file.attribute.PosixFileAttributeView;
|
import java.nio.file.attribute.PosixFileAttributeView;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package pro.gravit.launchserver.asm;
|
package pro.gravit.launchserver.asm;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassVisitor;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -13,6 +8,12 @@
|
||||||
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 pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Позволяет искать методы внутри незагруженных классов и общие суперклассы для
|
* Позволяет искать методы внутри незагруженных классов и общие суперклассы для
|
||||||
* чего угодно. Работает через поиск class-файлов в classpath.
|
* чего угодно. Работает через поиск class-файлов в classpath.
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package pro.gravit.launchserver.asm;
|
package pro.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,11 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth;
|
package pro.gravit.launchserver.auth;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class AuthProviderPair {
|
public class AuthProviderPair {
|
||||||
public AuthProvider provider;
|
public AuthProvider provider;
|
||||||
public AuthHandler handler;
|
public AuthHandler handler;
|
||||||
|
@ -21,9 +22,9 @@ public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvi
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
provider.init();
|
provider.init(srv);
|
||||||
handler.init();
|
handler.init(srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package pro.gravit.launchserver.auth;
|
package pro.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 pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public final class MySQLSourceConfig implements AutoCloseable {
|
public final class MySQLSourceConfig implements AutoCloseable {
|
||||||
|
|
||||||
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
public static final int TIMEOUT = VerifyHelper.verifyInt(
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
|
||||||
import pro.gravit.launchserver.auth.AuthException;
|
|
||||||
import pro.gravit.utils.ProviderMap;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
|
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
|
import pro.gravit.utils.ProviderMap;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AuthHandler implements AutoCloseable {
|
public abstract class AuthHandler implements AutoCloseable {
|
||||||
public static ProviderMap<AuthHandler> providers = new ProviderMap<>("AuthHandler");
|
public static ProviderMap<AuthHandler> providers = new ProviderMap<>("AuthHandler");
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
@ -23,10 +25,13 @@ public static void registerHandlers() {
|
||||||
providers.register("memory", MemoryAuthHandler.class);
|
providers.register("memory", MemoryAuthHandler.class);
|
||||||
providers.register("mysql", MySQLAuthHandler.class);
|
providers.register("mysql", MySQLAuthHandler.class);
|
||||||
providers.register("request", RequestAuthHandler.class);
|
providers.register("request", RequestAuthHandler.class);
|
||||||
|
providers.register("hibernate", HibernateAuthHandler.class);
|
||||||
registredHandl = true;
|
registredHandl = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected transient LaunchServer srv;
|
||||||
|
|
||||||
public abstract UUID auth(AuthProviderResult authResult) throws IOException;
|
public abstract UUID auth(AuthProviderResult authResult) throws IOException;
|
||||||
|
|
||||||
public abstract UUID checkServer(String username, String serverID) throws IOException;
|
public abstract UUID checkServer(String username, String serverID) throws IOException;
|
||||||
|
@ -43,7 +48,7 @@ public static void registerHandlers() {
|
||||||
|
|
||||||
public abstract String uuidToUsername(UUID uuid) throws IOException;
|
public abstract String uuidToUsername(UUID uuid) throws IOException;
|
||||||
|
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
this.srv = srv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
|
||||||
import pro.gravit.launcher.NeedGarbageCollection;
|
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
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 pro.gravit.launcher.NeedGarbageCollection;
|
||||||
|
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
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 {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
|
||||||
|
public class HibernateAuthHandler extends CachedAuthHandler {
|
||||||
|
@Override
|
||||||
|
protected Entry fetchEntry(String username) throws IOException {
|
||||||
|
User user = srv.userService.findUserByUsername(username);
|
||||||
|
if(user == null) return null;
|
||||||
|
return new Entry(user.uuid, username, user.getAccessToken(), user.serverID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Entry fetchEntry(UUID uuid) throws IOException {
|
||||||
|
User user = srv.userService.findUserByUUID(uuid);
|
||||||
|
if(user == null) return null;
|
||||||
|
return new Entry(user.uuid, user.username, user.getAccessToken(), user.serverID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException {
|
||||||
|
User user = srv.userService.findUserByUUID(uuid);
|
||||||
|
user.setAccessToken(accessToken);
|
||||||
|
srv.userService.updateUser(user);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean updateServerID(UUID uuid, String serverID) throws IOException {
|
||||||
|
User user = srv.userService.findUserByUUID(uuid);
|
||||||
|
user.serverID = serverID;
|
||||||
|
srv.userService.updateUser(user);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.utils.HTTPRequest;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.utils.HTTPRequest;
|
||||||
|
|
||||||
public class JsonAuthHandler extends CachedAuthHandler {
|
public class JsonAuthHandler extends CachedAuthHandler {
|
||||||
public URL getUrl;
|
public URL getUrl;
|
||||||
public URL updateAuthUrl;
|
public URL updateAuthUrl;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
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,8 +1,5 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -10,6 +7,10 @@
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public final class MySQLAuthHandler extends CachedAuthHandler {
|
public final class MySQLAuthHandler extends CachedAuthHandler {
|
||||||
private MySQLSourceConfig mySQLHolder;
|
private MySQLSourceConfig mySQLHolder;
|
||||||
private String uuidColumn;
|
private String uuidColumn;
|
||||||
|
@ -25,7 +26,8 @@ public final class MySQLAuthHandler extends CachedAuthHandler {
|
||||||
private transient String updateServerIDSQL;
|
private transient String updateServerIDSQL;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
super.init(srv);
|
||||||
//Verify
|
//Verify
|
||||||
if (mySQLHolder == null) LogHelper.error("[Verify][AuthHandler] mySQLHolder cannot be null");
|
if (mySQLHolder == null) LogHelper.error("[Verify][AuthHandler] mySQLHolder cannot be null");
|
||||||
if (uuidColumn == null) LogHelper.error("[Verify][AuthHandler] uuidColumn cannot be null");
|
if (uuidColumn == null) LogHelper.error("[Verify][AuthHandler] uuidColumn cannot be null");
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.auth.provider.AuthProviderResult;
|
||||||
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
public final class NullAuthHandler extends AuthHandler {
|
public final class NullAuthHandler extends AuthHandler {
|
||||||
private volatile AuthHandler handler;
|
private volatile AuthHandler handler;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package pro.gravit.launchserver.auth.handler;
|
package pro.gravit.launchserver.auth.handler;
|
||||||
|
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public final class RequestAuthHandler extends CachedAuthHandler {
|
public final class RequestAuthHandler extends CachedAuthHandler {
|
||||||
private String usernameFetch;
|
private String usernameFetch;
|
||||||
private String uuidFetch;
|
private String uuidFetch;
|
||||||
|
@ -19,7 +20,8 @@ public final class RequestAuthHandler extends CachedAuthHandler {
|
||||||
private String goodResponse = "OK";
|
private String goodResponse = "OK";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
super.init(srv);
|
||||||
if (usernameFetch == null)
|
if (usernameFetch == null)
|
||||||
LogHelper.error("[Verify][AuthHandler] usernameFetch cannot be null");
|
LogHelper.error("[Verify][AuthHandler] usernameFetch cannot be null");
|
||||||
if (uuidFetch == null)
|
if (uuidFetch == null)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.HWID;
|
||||||
|
|
||||||
public class AcceptHWIDHandler extends HWIDHandler {
|
public class AcceptHWIDHandler extends HWIDHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
import pro.gravit.launcher.HWID;
|
||||||
import pro.gravit.utils.ProviderMap;
|
import pro.gravit.utils.ProviderMap;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class HWIDHandler implements AutoCloseable {
|
public abstract class HWIDHandler implements AutoCloseable {
|
||||||
public static ProviderMap<HWIDHandler> providers = new ProviderMap<>("HWIDHandler");
|
public static ProviderMap<HWIDHandler> providers = new ProviderMap<>("HWIDHandler");
|
||||||
private static boolean registredHandl = false;
|
private static boolean registredHandl = false;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import pro.gravit.launcher.HWID;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
@ -16,6 +10,13 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.HWID;
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class JsonFileHWIDHandler extends HWIDHandler {
|
public class JsonFileHWIDHandler extends HWIDHandler {
|
||||||
public class Entry {
|
public class Entry {
|
||||||
public HWID hwid;
|
public HWID hwid;
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import pro.gravit.launcher.HWID;
|
|
||||||
import pro.gravit.launcher.OshiHWID;
|
|
||||||
import pro.gravit.utils.HTTPRequest;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.HWID;
|
||||||
|
import pro.gravit.launcher.OshiHWID;
|
||||||
|
import pro.gravit.utils.HTTPRequest;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.HWID;
|
||||||
|
|
||||||
public class MemoryHWIDHandler extends HWIDHandler {
|
public class MemoryHWIDHandler extends HWIDHandler {
|
||||||
public class Entry {
|
public class Entry {
|
||||||
public HWID hwid;
|
public HWID hwid;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package pro.gravit.launchserver.auth.hwid;
|
package pro.gravit.launchserver.auth.hwid;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
|
||||||
import pro.gravit.launcher.OshiHWID;
|
|
||||||
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
@ -13,6 +7,12 @@
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.HWID;
|
||||||
|
import pro.gravit.launcher.OshiHWID;
|
||||||
|
import pro.gravit.launchserver.auth.MySQLSourceConfig;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class MysqlHWIDHandler extends HWIDHandler {
|
public class MysqlHWIDHandler extends HWIDHandler {
|
||||||
private MySQLSourceConfig mySQLHolder;
|
private MySQLSourceConfig mySQLHolder;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package pro.gravit.launchserver.auth.permissions;
|
package pro.gravit.launchserver.auth.permissions;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launchserver.Reloadable;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
@ -16,6 +9,14 @@
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launchserver.Reloadable;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class JsonFilePermissionsHandler extends PermissionsHandler implements Reloadable {
|
public class JsonFilePermissionsHandler extends PermissionsHandler implements Reloadable {
|
||||||
public String filename = "permissions.json";
|
public String filename = "permissions.json";
|
||||||
public static Map<String, ClientPermissions> map;
|
public static Map<String, ClientPermissions> map;
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package pro.gravit.launchserver.auth.permissions;
|
package pro.gravit.launchserver.auth.permissions;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launchserver.Reloadable;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
@ -16,6 +9,14 @@
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launchserver.Reloadable;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class JsonLongFilePermissionsHandler extends PermissionsHandler implements Reloadable {
|
public class JsonLongFilePermissionsHandler extends PermissionsHandler implements Reloadable {
|
||||||
public String filename = "permissions.json";
|
public String filename = "permissions.json";
|
||||||
public long defaultPerms = 0L;
|
public long defaultPerms = 0L;
|
||||||
|
|
|
@ -6,7 +6,7 @@ public final class AcceptAuthProvider extends AuthProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthProviderResult auth(String login, String password, String ip) {
|
public AuthProviderResult auth(String login, String password, String ip) {
|
||||||
return new AuthProviderResult(login, SecurityHelper.randomStringToken()); // Same as login
|
return new AuthProviderResult(login, SecurityHelper.randomStringToken(), srv); // Same as login
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthException;
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
import pro.gravit.utils.ProviderMap;
|
import pro.gravit.utils.ProviderMap;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public abstract class AuthProvider implements AutoCloseable {
|
public abstract class AuthProvider implements AutoCloseable {
|
||||||
public static ProviderMap<AuthProvider> providers = new ProviderMap<>("AuthProvider");
|
public static ProviderMap<AuthProvider> providers = new ProviderMap<>("AuthProvider");
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
|
protected transient LaunchServer srv = null;
|
||||||
public static AuthProviderResult authError(String message) throws AuthException {
|
public static AuthProviderResult authError(String message) throws AuthException {
|
||||||
throw new AuthException(message);
|
throw new AuthException(message);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +22,7 @@ public static void registerProviders() {
|
||||||
providers.register("mysql", MySQLAuthProvider.class);
|
providers.register("mysql", MySQLAuthProvider.class);
|
||||||
providers.register("request", RequestAuthProvider.class);
|
providers.register("request", RequestAuthProvider.class);
|
||||||
providers.register("json", JsonAuthProvider.class);
|
providers.register("json", JsonAuthProvider.class);
|
||||||
|
providers.register("hibernate", HibernateAuthProvider.class);
|
||||||
registredProv = true;
|
registredProv = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +36,7 @@ public void preAuth(String login, String password, String customText, String ip)
|
||||||
@Override
|
@Override
|
||||||
public abstract void close() throws IOException;
|
public abstract void close() throws IOException;
|
||||||
|
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
this.srv = srv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,10 @@ public class AuthProviderResult {
|
||||||
public final String accessToken;
|
public final String accessToken;
|
||||||
public final ClientPermissions permissions;
|
public final ClientPermissions permissions;
|
||||||
|
|
||||||
public AuthProviderResult(String username, String accessToken) {
|
public AuthProviderResult(String username, String accessToken, LaunchServer server) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.accessToken = accessToken;
|
this.accessToken = accessToken;
|
||||||
permissions = LaunchServer.server.config.permissionsHandler.getPermissions(username);
|
permissions = server.config.permissionsHandler.getPermissions(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthProviderResult(String username, String accessToken, ClientPermissions permissions) {
|
public AuthProviderResult(String username, String accessToken, ClientPermissions permissions) {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
public class HibernateAuthProvider extends AuthProvider {
|
||||||
|
@Override
|
||||||
|
public AuthProviderResult auth(String login, String password, String ip) throws Exception {
|
||||||
|
User user = srv.userService.findUserByUsername(login);
|
||||||
|
if(user == null || !user.verifyPassword(password))
|
||||||
|
{
|
||||||
|
if(user ==null) throw new AuthException("Username incorrect");
|
||||||
|
else throw new AuthException("Username or password incorrect");
|
||||||
|
}
|
||||||
|
return new AuthProviderResult(login, SecurityHelper.randomStringToken(), srv);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
|
||||||
import pro.gravit.utils.HTTPRequest;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
|
import pro.gravit.utils.HTTPRequest;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
public final class JsonAuthProvider extends AuthProvider {
|
public final class JsonAuthProvider extends AuthProvider {
|
||||||
private static Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
private URL url;
|
private URL url;
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthException;
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
|
@ -8,11 +13,6 @@
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
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 MySQLSourceConfig mySQLHolder;
|
private MySQLSourceConfig mySQLHolder;
|
||||||
private String query;
|
private String query;
|
||||||
|
@ -21,7 +21,8 @@ public final class MySQLAuthProvider extends AuthProvider {
|
||||||
private boolean usePermission;
|
private boolean usePermission;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
super.init(srv);
|
||||||
if (query == null) LogHelper.error("[Verify][AuthProvider] query cannot be null");
|
if (query == null) LogHelper.error("[Verify][AuthProvider] query cannot be null");
|
||||||
if (message == null) LogHelper.error("[Verify][AuthProvider] message cannot be null");
|
if (message == null) LogHelper.error("[Verify][AuthProvider] message cannot be null");
|
||||||
if (mySQLHolder == null) LogHelper.error("[Verify][AuthProvider] mySQLHolder cannot be null");
|
if (mySQLHolder == null) LogHelper.error("[Verify][AuthProvider] mySQLHolder cannot be null");
|
||||||
|
@ -38,7 +39,7 @@ public AuthProviderResult auth(String login, String password, String ip) throws
|
||||||
// Execute SQL query
|
// Execute SQL query
|
||||||
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
s.setQueryTimeout(MySQLSourceConfig.TIMEOUT);
|
||||||
try (ResultSet set = s.executeQuery()) {
|
try (ResultSet set = s.executeQuery()) {
|
||||||
return set.next() ? new AuthProviderResult(set.getString(1), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(set.getLong(2)) : LaunchServer.server.config.permissionsHandler.getPermissions(set.getString(1))) : authError(message);
|
return set.next() ? new AuthProviderResult(set.getString(1), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(set.getLong(2)) : srv.config.permissionsHandler.getPermissions(set.getString(1))) : authError(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
public final class NullAuthProvider extends AuthProvider {
|
public final class NullAuthProvider extends AuthProvider {
|
||||||
private volatile AuthProvider provider;
|
private volatile AuthProvider provider;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import pro.gravit.launchserver.Reconfigurable;
|
import pro.gravit.launchserver.Reconfigurable;
|
||||||
import pro.gravit.launchserver.auth.AuthException;
|
import pro.gravit.launchserver.auth.AuthException;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public final class RejectAuthProvider extends AuthProvider implements Reconfigurable {
|
public final class RejectAuthProvider extends AuthProvider implements Reconfigurable {
|
||||||
public RejectAuthProvider() {
|
public RejectAuthProvider() {
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public AuthProviderResult auth(String login, String password, String ip) throws
|
||||||
if (whitelist != null) {
|
if (whitelist != null) {
|
||||||
for (String username : whitelist) {
|
for (String username : whitelist) {
|
||||||
if (login.equals(username)) {
|
if (login.equals(username)) {
|
||||||
return new AuthProviderResult(login, SecurityHelper.randomStringToken());
|
return new AuthProviderResult(login, SecurityHelper.randomStringToken(), srv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package pro.gravit.launchserver.auth.provider;
|
package pro.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import pro.gravit.launcher.ClientPermissions;
|
import pro.gravit.launcher.ClientPermissions;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
@ -7,11 +12,6 @@
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.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 String url;
|
private String url;
|
||||||
private transient Pattern pattern;
|
private transient Pattern pattern;
|
||||||
|
@ -19,7 +19,8 @@ public final class RequestAuthProvider extends AuthProvider {
|
||||||
private boolean usePermission;
|
private boolean usePermission;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init(LaunchServer srv) {
|
||||||
|
super.init(srv);
|
||||||
if (url == null) LogHelper.error("[Verify][AuthProvider] url cannot be null");
|
if (url == null) LogHelper.error("[Verify][AuthProvider] url cannot be null");
|
||||||
if (response == null) LogHelper.error("[Verify][AuthProvider] response cannot be null");
|
if (response == null) LogHelper.error("[Verify][AuthProvider] response cannot be null");
|
||||||
pattern = Pattern.compile(response);
|
pattern = Pattern.compile(response);
|
||||||
|
@ -32,7 +33,7 @@ public AuthProviderResult auth(String login, String password, String ip) throws
|
||||||
// Match username
|
// Match username
|
||||||
Matcher matcher = pattern.matcher(currentResponse);
|
Matcher matcher = pattern.matcher(currentResponse);
|
||||||
return matcher.matches() && matcher.groupCount() >= 1 ?
|
return matcher.matches() && matcher.groupCount() >= 1 ?
|
||||||
new AuthProviderResult(matcher.group("username"), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(Long.getLong(matcher.group("permission"))) : LaunchServer.server.config.permissionsHandler.getPermissions(login)) :
|
new AuthProviderResult(matcher.group("username"), SecurityHelper.randomStringToken(), usePermission ? new ClientPermissions(Long.getLong(matcher.group("permission"))) : srv.config.permissionsHandler.getPermissions(login)) :
|
||||||
authError(currentResponse);
|
authError(currentResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.auth.texture;
|
package pro.gravit.launchserver.auth.texture;
|
||||||
|
|
||||||
import pro.gravit.launcher.profiles.Texture;
|
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.profiles.Texture;
|
||||||
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
public final class NullTextureProvider extends TextureProvider {
|
public final class NullTextureProvider extends TextureProvider {
|
||||||
private volatile TextureProvider provider;
|
private volatile TextureProvider provider;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package pro.gravit.launchserver.auth.texture;
|
package pro.gravit.launchserver.auth.texture;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.profiles.Texture;
|
import pro.gravit.launcher.profiles.Texture;
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 {
|
||||||
public RequestTextureProvider() {
|
public RequestTextureProvider() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.auth.texture;
|
package pro.gravit.launchserver.auth.texture;
|
||||||
|
|
||||||
import pro.gravit.launcher.profiles.Texture;
|
|
||||||
import pro.gravit.utils.ProviderMap;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.profiles.Texture;
|
||||||
|
import pro.gravit.utils.ProviderMap;
|
||||||
|
|
||||||
public abstract class TextureProvider implements AutoCloseable {
|
public abstract class TextureProvider implements AutoCloseable {
|
||||||
public static ProviderMap<TextureProvider> providers = new ProviderMap<>("TextureProvider");
|
public static ProviderMap<TextureProvider> providers = new ProviderMap<>("TextureProvider");
|
||||||
private static boolean registredProv = false;
|
private static boolean registredProv = false;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package pro.gravit.launchserver.auth.texture;
|
package pro.gravit.launchserver.auth.texture;
|
||||||
|
|
||||||
import pro.gravit.launcher.profiles.Texture;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.profiles.Texture;
|
||||||
|
|
||||||
public final class VoidTextureProvider extends TextureProvider {
|
public final class VoidTextureProvider extends TextureProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -11,6 +8,9 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||||
|
import pro.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,16 +1,20 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.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.*;
|
import net.sf.launch4j.config.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 pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.utils.Version;
|
import pro.gravit.utils.Version;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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,11 +1,16 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
import javassist.*;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javassist.CannotCompileException;
|
||||||
|
import javassist.ClassPool;
|
||||||
|
import javassist.CtClass;
|
||||||
|
import javassist.CtConstructor;
|
||||||
|
import javassist.CtMethod;
|
||||||
|
import javassist.NotFoundException;
|
||||||
import pro.gravit.launcher.LauncherConfig;
|
import pro.gravit.launcher.LauncherConfig;
|
||||||
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class JAConfigurator implements AutoCloseable {
|
public class JAConfigurator implements AutoCloseable {
|
||||||
public ClassPool pool;
|
public ClassPool pool;
|
||||||
public CtClass ctClass;
|
public CtClass ctClass;
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
import pro.gravit.launchserver.binary.tasks.*;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.binary.tasks.*;
|
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -15,6 +7,19 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.AdditionalFixesApplyTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.AttachJarsTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.LauncherBuildTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.PrepareBuildTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.ProGuardBuildTask;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.RadonBuildTask;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public final class JARLauncherBinary extends LauncherBinary {
|
public final class JARLauncherBinary extends LauncherBinary {
|
||||||
public final AtomicLong count;
|
public final AtomicLong count;
|
||||||
public final Path runtimeDir;
|
public final Path runtimeDir;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import pro.gravit.launcher.serialize.signed.DigestBytesHolder;
|
import pro.gravit.launcher.serialize.signed.DigestBytesHolder;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.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;
|
||||||
public final Path syncBinaryFile;
|
public final Path syncBinaryFile;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary;
|
package pro.gravit.launchserver.binary;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
import pro.gravit.utils.helper.UnpackHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
@ -15,6 +9,12 @@
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
import pro.gravit.utils.helper.UnpackHelper;
|
||||||
|
|
||||||
public class ProguardConf {
|
public class ProguardConf {
|
||||||
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public void genWords(boolean force) throws IOException {
|
||||||
SecureRandom rand = SecurityHelper.newRandom();
|
SecureRandom rand = SecurityHelper.newRandom();
|
||||||
rand.setSeed(SecureRandom.getSeed(32));
|
rand.setSeed(SecureRandom.getSeed(32));
|
||||||
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(IOHelper.newOutput(words), IOHelper.UNICODE_CHARSET))) {
|
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(IOHelper.newOutput(words), IOHelper.UNICODE_CHARSET))) {
|
||||||
String projectName = LaunchServer.server.config.projectName.replaceAll("\\W", "");
|
String projectName = srv.config.projectName.replaceAll("\\W", "");
|
||||||
String lowName = projectName.toLowerCase();
|
String lowName = projectName.toLowerCase();
|
||||||
String upName = projectName.toUpperCase();
|
String upName = projectName.toUpperCase();
|
||||||
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 3));
|
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 3));
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
|
||||||
import pro.gravit.launchserver.asm.SafeClassWriter;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
@ -19,6 +11,15 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
||||||
|
import pro.gravit.launchserver.asm.SafeClassWriter;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
public class AdditionalFixesApplyTask implements LauncherBuildTask {
|
public class AdditionalFixesApplyTask implements LauncherBuildTask {
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -12,6 +8,10 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class AttachJarsTask implements LauncherBuildTask {
|
public class AttachJarsTask implements LauncherBuildTask {
|
||||||
private final LaunchServer srv;
|
private final LaunchServer srv;
|
||||||
private final List<Path> jars;
|
private final List<Path> jars;
|
||||||
|
|
|
@ -1,18 +1,6 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
import javassist.CannotCompileException;
|
import static pro.gravit.utils.helper.IOHelper.newZipEntry;
|
||||||
import javassist.NotFoundException;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
|
||||||
import pro.gravit.launchserver.binary.BuildContext;
|
|
||||||
import pro.gravit.launchserver.binary.JAConfigurator;
|
|
||||||
import pro.gravit.launcher.AutogenConfig;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launcher.LauncherConfig;
|
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -28,7 +16,19 @@
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import static pro.gravit.utils.helper.IOHelper.newZipEntry;
|
import javassist.CannotCompileException;
|
||||||
|
import javassist.NotFoundException;
|
||||||
|
import pro.gravit.launcher.AutogenConfig;
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launcher.LauncherConfig;
|
||||||
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
||||||
|
import pro.gravit.launchserver.binary.BuildContext;
|
||||||
|
import pro.gravit.launchserver.binary.JAConfigurator;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
public class MainBuildTask implements LauncherBuildTask {
|
public class MainBuildTask implements LauncherBuildTask {
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
import pro.gravit.utils.helper.UnpackHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.FileVisitResult;
|
import java.nio.file.FileVisitResult;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -13,6 +8,11 @@
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
import pro.gravit.utils.helper.UnpackHelper;
|
||||||
|
|
||||||
public class PrepareBuildTask implements LauncherBuildTask {
|
public class PrepareBuildTask implements LauncherBuildTask {
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
private final Path result;
|
private final Path result;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import proguard.Configuration;
|
import proguard.Configuration;
|
||||||
import proguard.ConfigurationParser;
|
import proguard.ConfigurationParser;
|
||||||
import proguard.ParseException;
|
import proguard.ParseException;
|
||||||
import proguard.ProGuard;
|
import proguard.ProGuard;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class ProGuardBuildTask implements LauncherBuildTask {
|
public class ProGuardBuildTask implements LauncherBuildTask {
|
||||||
private final LaunchServer server;
|
private final LaunchServer server;
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
package pro.gravit.launchserver.binary.tasks;
|
package pro.gravit.launchserver.binary.tasks;
|
||||||
|
|
||||||
import me.itzsomebody.radon.Radon;
|
|
||||||
import me.itzsomebody.radon.SessionInfo;
|
|
||||||
import me.itzsomebody.radon.config.ConfigurationParser;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.UnpackHelper;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
@ -14,6 +7,13 @@
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import me.itzsomebody.radon.Radon;
|
||||||
|
import me.itzsomebody.radon.SessionInfo;
|
||||||
|
import me.itzsomebody.radon.config.ConfigurationParser;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.UnpackHelper;
|
||||||
|
|
||||||
public class RadonBuildTask implements LauncherBuildTask {
|
public class RadonBuildTask implements LauncherBuildTask {
|
||||||
private final LaunchServer srv;
|
private final LaunchServer srv;
|
||||||
public final Path config;
|
public final Path config;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
import pro.gravit.launchserver.auth.provider.AuthProvider;
|
||||||
|
@ -7,8 +9,6 @@
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
import pro.gravit.launcher.HWID;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.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,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
import pro.gravit.launcher.HWID;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GetHWIDCommand extends Command {
|
public class GetHWIDCommand extends Command {
|
||||||
public GetHWIDCommand(LaunchServer server) {
|
public GetHWIDCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.command.CommandException;
|
import pro.gravit.utils.command.CommandException;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pro.gravit.launcher.HWID;
|
import pro.gravit.launcher.HWID;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.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,14 +1,14 @@
|
||||||
package pro.gravit.launchserver.command.auth;
|
package pro.gravit.launchserver.command.auth;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.command.CommandException;
|
import pro.gravit.utils.command.CommandException;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.command.basic;
|
package pro.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
public class ProguardCleanCommand extends Command {
|
public class ProguardCleanCommand extends Command {
|
||||||
public ProguardCleanCommand(LaunchServer server) {
|
public ProguardCleanCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package pro.gravit.launchserver.command.basic;
|
package pro.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.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 pro.gravit.launchserver.command.basic;
|
package pro.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
public class RemoveMappingsProguardCommand extends Command {
|
public class RemoveMappingsProguardCommand extends Command {
|
||||||
|
|
||||||
public RemoveMappingsProguardCommand(LaunchServer server) {
|
public RemoveMappingsProguardCommand(LaunchServer server) {
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package pro.gravit.launchserver.command.basic;
|
package pro.gravit.launchserver.command.basic;
|
||||||
|
|
||||||
import pro.gravit.launchserver.websocket.NettyServerSocketHandler;
|
|
||||||
import pro.gravit.launchserver.websocket.WebSocketFrameHandler;
|
|
||||||
import pro.gravit.launcher.events.PingEvent;
|
import pro.gravit.launcher.events.PingEvent;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.websocket.NettyServerSocketHandler;
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
|
||||||
public class TestCommand extends Command {
|
public class TestCommand extends Command {
|
||||||
|
@ -36,7 +35,7 @@ public void invoke(String... args) throws Exception {
|
||||||
handler.close();
|
handler.close();
|
||||||
}
|
}
|
||||||
if (args[0].equals("eventAll")) {
|
if (args[0].equals("eventAll")) {
|
||||||
WebSocketFrameHandler.service.sendObjectAll(new PingEvent());
|
handler.nettyServer.frameHandler.service.sendObjectAll(new PingEvent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package pro.gravit.launchserver.command.dao;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
public class GetAllUsersCommand extends Command {
|
||||||
|
public GetAllUsersCommand(LaunchServer server) {
|
||||||
|
super(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArgsDescription() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsageDescription() {
|
||||||
|
return "get all users information";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String... args) throws Exception {
|
||||||
|
int count = 0;
|
||||||
|
for(User user : server.userService.findAllUsers())
|
||||||
|
{
|
||||||
|
LogHelper.subInfo("[%s] UUID: %s", user.username, user.uuid.toString());
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
LogHelper.info("Print %d users", count);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package pro.gravit.launchserver.command.dao;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
public class GetUserCommand extends Command {
|
||||||
|
public GetUserCommand(LaunchServer server) {
|
||||||
|
super(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArgsDescription() {
|
||||||
|
return "[username]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsageDescription() {
|
||||||
|
return "get user information";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String... args) throws Exception {
|
||||||
|
verifyArgs(args, 1);
|
||||||
|
User user = server.userService.findUserByUsername(args[0]);
|
||||||
|
if(user == null)
|
||||||
|
{
|
||||||
|
LogHelper.error("User %s not found", args[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LogHelper.info("[%s] UUID: %s", user.username, user.uuid.toString());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package pro.gravit.launchserver.command.dao;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
public class RegisterCommand extends Command {
|
||||||
|
public RegisterCommand(LaunchServer server) {
|
||||||
|
super(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArgsDescription() {
|
||||||
|
return "[login] [password]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsageDescription() {
|
||||||
|
return "Register new user";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String... args) throws Exception {
|
||||||
|
verifyArgs(args, 2);
|
||||||
|
User user = new User();
|
||||||
|
user.username = args[0];
|
||||||
|
user.setPassword(args[1]);
|
||||||
|
user.uuid = UUID.randomUUID();
|
||||||
|
server.userService.saveUser(user);
|
||||||
|
LogHelper.info("User %s registered. UUID: %s", user.username, user.uuid.toString());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package pro.gravit.launchserver.command.dao;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
|
public class SetUserPasswordCommand extends Command {
|
||||||
|
|
||||||
|
public SetUserPasswordCommand(LaunchServer server) {
|
||||||
|
super(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArgsDescription() {
|
||||||
|
return "[username] [new password]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsageDescription() {
|
||||||
|
return "Set user password";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String... args) throws Exception {
|
||||||
|
verifyArgs(args, 2);
|
||||||
|
User user = server.userService.findUserByUsername(args[0]);
|
||||||
|
if(user == null)
|
||||||
|
{
|
||||||
|
LogHelper.error("User %s not found", args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
user.setPassword(args[1]);
|
||||||
|
server.userService.updateUser(user);
|
||||||
|
LogHelper.info("[%s] UUID: %s | New Password: %s", user.username, user.uuid.toString(), args[1]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,11 @@
|
||||||
package pro.gravit.launchserver.command.dump;
|
package pro.gravit.launchserver.command.dump;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||||
|
@ -8,12 +14,6 @@
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.Writer;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class DumpEntryCacheCommand extends Command {
|
public class DumpEntryCacheCommand extends Command {
|
||||||
public DumpEntryCacheCommand(LaunchServer server) {
|
public DumpEntryCacheCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package pro.gravit.launchserver.command.dump;
|
package pro.gravit.launchserver.command.dump;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import pro.gravit.launcher.Launcher;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
@ -15,6 +7,15 @@
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.Launcher;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
public class DumpSessionsCommand extends Command {
|
public class DumpSessionsCommand extends Command {
|
||||||
public DumpSessionsCommand(LaunchServer server) {
|
public DumpSessionsCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,20 +1,50 @@
|
||||||
package pro.gravit.launchserver.command.handler;
|
package pro.gravit.launchserver.command.handler;
|
||||||
|
|
||||||
import pro.gravit.launchserver.command.auth.*;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.basic.*;
|
import pro.gravit.launchserver.command.auth.AuthCommand;
|
||||||
import pro.gravit.launchserver.command.hash.*;
|
import pro.gravit.launchserver.command.auth.BanCommand;
|
||||||
|
import pro.gravit.launchserver.command.auth.GetHWIDCommand;
|
||||||
|
import pro.gravit.launchserver.command.auth.UUIDToUsernameCommand;
|
||||||
|
import pro.gravit.launchserver.command.auth.UnbanCommand;
|
||||||
|
import pro.gravit.launchserver.command.auth.UsernameToUUIDCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.BuildCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.LogConnectionsCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.ProguardCleanCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.RebindCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.RegenProguardDictCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.RemoveMappingsProguardCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.RestartCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.StopCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.TestCommand;
|
||||||
|
import pro.gravit.launchserver.command.basic.VersionCommand;
|
||||||
|
import pro.gravit.launchserver.command.dao.GetAllUsersCommand;
|
||||||
|
import pro.gravit.launchserver.command.dao.GetUserCommand;
|
||||||
|
import pro.gravit.launchserver.command.dao.RegisterCommand;
|
||||||
|
import pro.gravit.launchserver.command.dao.SetUserPasswordCommand;
|
||||||
|
import pro.gravit.launchserver.command.dump.DumpEntryCacheCommand;
|
||||||
|
import pro.gravit.launchserver.command.dump.DumpSessionsCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.DownloadAssetCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.DownloadClientCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.IndexAssetCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.SyncBinariesCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.SyncProfilesCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.SyncUpdatesCommand;
|
||||||
|
import pro.gravit.launchserver.command.hash.UnindexAssetCommand;
|
||||||
import pro.gravit.launchserver.command.install.CheckInstallCommand;
|
import pro.gravit.launchserver.command.install.CheckInstallCommand;
|
||||||
import pro.gravit.launchserver.command.install.MultiCommand;
|
import pro.gravit.launchserver.command.install.MultiCommand;
|
||||||
import pro.gravit.launchserver.command.modules.LoadModuleCommand;
|
import pro.gravit.launchserver.command.modules.LoadModuleCommand;
|
||||||
import pro.gravit.launchserver.command.modules.ModulesCommand;
|
import pro.gravit.launchserver.command.modules.ModulesCommand;
|
||||||
import pro.gravit.launchserver.command.service.*;
|
import pro.gravit.launchserver.command.service.ComponentCommand;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.command.service.ConfigCommand;
|
||||||
import pro.gravit.launchserver.command.auth.*;
|
import pro.gravit.launchserver.command.service.ConfigHelpCommand;
|
||||||
import pro.gravit.launchserver.command.basic.*;
|
import pro.gravit.launchserver.command.service.ConfigListCommand;
|
||||||
import pro.gravit.launchserver.command.dump.DumpEntryCacheCommand;
|
import pro.gravit.launchserver.command.service.GetModulusCommand;
|
||||||
import pro.gravit.launchserver.command.dump.DumpSessionsCommand;
|
import pro.gravit.launchserver.command.service.GetPermissionsCommand;
|
||||||
import pro.gravit.launchserver.command.hash.*;
|
import pro.gravit.launchserver.command.service.GivePermissionsCommand;
|
||||||
import pro.gravit.launchserver.command.service.*;
|
import pro.gravit.launchserver.command.service.ReloadAllCommand;
|
||||||
|
import pro.gravit.launchserver.command.service.ReloadCommand;
|
||||||
|
import pro.gravit.launchserver.command.service.ReloadListCommand;
|
||||||
|
import pro.gravit.launchserver.command.service.ServerStatusCommand;
|
||||||
import pro.gravit.utils.command.BaseCommandCategory;
|
import pro.gravit.utils.command.BaseCommandCategory;
|
||||||
import pro.gravit.utils.command.basic.ClearCommand;
|
import pro.gravit.utils.command.basic.ClearCommand;
|
||||||
import pro.gravit.utils.command.basic.DebugCommand;
|
import pro.gravit.utils.command.basic.DebugCommand;
|
||||||
|
@ -22,8 +52,7 @@
|
||||||
import pro.gravit.utils.command.basic.HelpCommand;
|
import pro.gravit.utils.command.basic.HelpCommand;
|
||||||
|
|
||||||
public abstract class CommandHandler extends pro.gravit.utils.command.CommandHandler {
|
public abstract class CommandHandler extends pro.gravit.utils.command.CommandHandler {
|
||||||
public static void registerCommands(pro.gravit.utils.command.CommandHandler handler) {
|
public static void registerCommands(pro.gravit.utils.command.CommandHandler handler, LaunchServer server) {
|
||||||
LaunchServer server = LaunchServer.server;
|
|
||||||
BaseCommandCategory basic = new BaseCommandCategory();
|
BaseCommandCategory basic = new BaseCommandCategory();
|
||||||
// Register basic commands
|
// Register basic commands
|
||||||
basic.registerCommand("help", new HelpCommand(handler));
|
basic.registerCommand("help", new HelpCommand(handler));
|
||||||
|
@ -57,6 +86,15 @@ public static void registerCommands(pro.gravit.utils.command.CommandHandler hand
|
||||||
Category updatesCategory = new Category(updates, "updates", "Update and Sync Management");
|
Category updatesCategory = new Category(updates, "updates", "Update and Sync Management");
|
||||||
handler.registerCategory(updatesCategory);
|
handler.registerCategory(updatesCategory);
|
||||||
|
|
||||||
|
//Register dao commands
|
||||||
|
BaseCommandCategory dao = new BaseCommandCategory();
|
||||||
|
dao.registerCommand("register", new RegisterCommand(server));
|
||||||
|
dao.registerCommand("setUserPassword", new SetUserPasswordCommand(server));
|
||||||
|
dao.registerCommand("getUser", new GetUserCommand(server));
|
||||||
|
dao.registerCommand("getAllUsers", new GetAllUsersCommand(server));
|
||||||
|
Category daoCategory = new Category(dao, "DAO", "Data Management");
|
||||||
|
handler.registerCategory(daoCategory);
|
||||||
|
|
||||||
// Register auth commands
|
// Register auth commands
|
||||||
BaseCommandCategory auth = new BaseCommandCategory();
|
BaseCommandCategory auth = new BaseCommandCategory();
|
||||||
auth.registerCommand("auth", new AuthCommand(server));
|
auth.registerCommand("auth", new AuthCommand(server));
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import pro.gravit.launcher.profiles.ClientProfile.Version;
|
import pro.gravit.launcher.profiles.ClientProfile.Version;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
@ -7,10 +11,6 @@
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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,5 +1,12 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.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 pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
import pro.gravit.launcher.profiles.ClientProfile.Version;
|
import pro.gravit.launcher.profiles.ClientProfile.Version;
|
||||||
|
@ -10,13 +17,6 @@
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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,15 +1,5 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
import pro.gravit.utils.command.CommandException;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
|
||||||
import pro.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;
|
||||||
|
@ -19,6 +9,17 @@
|
||||||
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.JsonObject;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.utils.command.CommandException;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
import pro.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();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.command.Command;
|
import pro.gravit.launchserver.command.Command;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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 pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
import pro.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 pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.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,20 +1,21 @@
|
||||||
package pro.gravit.launchserver.command.hash;
|
package pro.gravit.launchserver.command.hash;
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
import pro.gravit.utils.command.CommandException;
|
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
|
||||||
import pro.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 pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
import pro.gravit.utils.command.CommandException;
|
||||||
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
import pro.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();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.command.modules;
|
package pro.gravit.launchserver.command.modules;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.command.Command;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
public class LoadModuleCommand extends Command {
|
public class LoadModuleCommand extends Command {
|
||||||
public LoadModuleCommand(LaunchServer server) {
|
public LoadModuleCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package pro.gravit.launchserver.command.service;
|
package pro.gravit.launchserver.command.service;
|
||||||
|
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.NeedGarbageCollection;
|
import pro.gravit.launcher.NeedGarbageCollection;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
@ -8,9 +11,6 @@
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
public class ComponentCommand extends Command {
|
public class ComponentCommand extends Command {
|
||||||
public ComponentCommand(LaunchServer server) {
|
public ComponentCommand(LaunchServer server) {
|
||||||
super(server);
|
super(server);
|
||||||
|
|
|
@ -21,6 +21,6 @@ public String getUsageDescription() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invoke(String... args) throws Exception {
|
public void invoke(String... args) throws Exception {
|
||||||
LogHelper.info("You publickey modulus: %s", LaunchServer.server.publicKey.getModulus().toString(16));
|
LogHelper.info("You publickey modulus: %s", server.publicKey.getModulus().toString(16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
package pro.gravit.launchserver.components;
|
package pro.gravit.launchserver.components;
|
||||||
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
|
||||||
import pro.gravit.launcher.NeedGarbageCollection;
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.launchserver.websocket.json.auth.AuthResponse;
|
|
||||||
import pro.gravit.utils.HookException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AuthLimiterComponent extends Component implements NeedGarbageCollection {
|
import pro.gravit.launcher.NeedGarbageCollection;
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
|
import pro.gravit.launchserver.websocket.json.auth.AuthResponse;
|
||||||
|
import pro.gravit.utils.BiHookSet.Hook;
|
||||||
|
import pro.gravit.utils.HookException;
|
||||||
|
|
||||||
|
public class AuthLimiterComponent extends Component implements NeedGarbageCollection, AutoCloseable {
|
||||||
|
private transient final Hook<AuthResponse.AuthContext, Client> prA = this::preAuthHook;
|
||||||
|
private transient LaunchServer srv;
|
||||||
@Override
|
@Override
|
||||||
public void preInit(LaunchServer launchServer) {
|
public void preInit(LaunchServer launchServer) {
|
||||||
|
srv = launchServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(LaunchServer launchServer) {
|
public void init(LaunchServer launchServer) {
|
||||||
launchServer.authHookManager.preHook.registerHook(this::preAuthHook);
|
launchServer.authHookManager.preHook.registerHook(prA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,4 +109,9 @@ public boolean isLimit(String ip) {
|
||||||
map.put(ip, new AuthEntry(1, System.currentTimeMillis()));
|
map.put(ip, new AuthEntry(1, System.currentTimeMillis()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws Exception {
|
||||||
|
srv.authHookManager.preHook.unregisterHook(prA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
package pro.gravit.launchserver.components;
|
package pro.gravit.launchserver.components;
|
||||||
|
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
|
||||||
import pro.gravit.utils.command.Command;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.utils.command.Command;
|
||||||
|
|
||||||
public class CommandRemoverComponent extends Component implements AutoCloseable {
|
public class CommandRemoverComponent extends Component implements AutoCloseable {
|
||||||
public String[] removeList = new String[]{};
|
public String[] removeList = new String[]{};
|
||||||
public transient Map<String, Command> commandsList = new HashMap<>();
|
public transient Map<String, Command> commandsList = new HashMap<>();
|
||||||
|
private transient LaunchServer server = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(LaunchServer launchServer) {
|
public void preInit(LaunchServer launchServer) {
|
||||||
|
server = launchServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +33,7 @@ public void postInit(LaunchServer launchServer) {
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
for (Map.Entry<String, Command> e : commandsList.entrySet()) {
|
for (Map.Entry<String, Command> e : commandsList.entrySet()) {
|
||||||
LaunchServer.server.commandHandler.registerCommand(e.getKey(), e.getValue());
|
server.commandHandler.registerCommand(e.getKey(), e.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ public static void registerComponents() {
|
||||||
if (!registredComp) {
|
if (!registredComp) {
|
||||||
providers.register("authLimiter", AuthLimiterComponent.class);
|
providers.register("authLimiter", AuthLimiterComponent.class);
|
||||||
providers.register("commandRemover", CommandRemoverComponent.class);
|
providers.register("commandRemover", CommandRemoverComponent.class);
|
||||||
|
providers.register("hibernate", HibernateConfiguratorComponent.class);
|
||||||
registredComp = true;
|
registredComp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package pro.gravit.launchserver.components;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.dao.LaunchServerDaoFactory;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.launchserver.dao.impl.HibernateUserDAOImpl;
|
||||||
|
import pro.gravit.launchserver.hibernate.SessionFactoryManager;
|
||||||
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
|
|
||||||
|
public class HibernateConfiguratorComponent extends Component {
|
||||||
|
public String driver;
|
||||||
|
public String url;
|
||||||
|
public String username;
|
||||||
|
public String password;
|
||||||
|
public String pool_size;
|
||||||
|
public String hibernateConfig;
|
||||||
|
public boolean parallelHibernateInit;
|
||||||
|
@Override
|
||||||
|
public void preInit(LaunchServer launchServer) {
|
||||||
|
LaunchServerDaoFactory.setUserDaoProvider(launchServer, HibernateUserDAOImpl::new);
|
||||||
|
Runnable init = () -> {
|
||||||
|
Configuration cfg = new Configuration()
|
||||||
|
.addAnnotatedClass(User.class)
|
||||||
|
.setProperty("hibernate.connection.driver_class", driver)
|
||||||
|
.setProperty("hibernate.connection.url", url)
|
||||||
|
.setProperty("hibernate.connection.username", username)
|
||||||
|
.setProperty("hibernate.connection.password", password)
|
||||||
|
.setProperty("hibernate.connection.pool_size", pool_size);
|
||||||
|
if(hibernateConfig != null)
|
||||||
|
cfg.configure(Paths.get(hibernateConfig).toFile());
|
||||||
|
SessionFactoryManager.forLaunchServer(launchServer).fact = cfg.buildSessionFactory();
|
||||||
|
};
|
||||||
|
if(parallelHibernateInit)
|
||||||
|
CommonHelper.newThread("Hibernate Thread", true, init);
|
||||||
|
else
|
||||||
|
init.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(LaunchServer launchServer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postInit(LaunchServer launchServer) {
|
||||||
|
//UserService service = new UserService();
|
||||||
|
//List<User> users = service.findAllUsers();
|
||||||
|
//User newUser = new User();
|
||||||
|
//newUser.username = "VeryTestUser";
|
||||||
|
//newUser.setPassword("12345");
|
||||||
|
//service.saveUser(newUser);
|
||||||
|
//for(User u : users)
|
||||||
|
//{
|
||||||
|
// LogHelper.info("Found User %s", u.username);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package pro.gravit.launchserver.dao;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.dao.impl.DefaultUserDAOImpl;
|
||||||
|
|
||||||
|
public class LaunchServerDaoFactory {
|
||||||
|
private static final Function<LaunchServer, UserDAO> defDao = DefaultUserDAOImpl::new;
|
||||||
|
private static final Map<LaunchServer, Function<LaunchServer, UserDAO>> daos = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static void setUserDaoProvider(LaunchServer srv, Function<LaunchServer, UserDAO> getDao) {
|
||||||
|
daos.put(srv, getDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserDAO createUserDao(LaunchServer srv)
|
||||||
|
{
|
||||||
|
return daos.getOrDefault(srv, defDao).apply(srv);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package pro.gravit.launchserver.dao;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "users")
|
||||||
|
public class User {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private long id;
|
||||||
|
@Column(unique = true)
|
||||||
|
public String username;
|
||||||
|
@Column(unique = true)
|
||||||
|
public UUID uuid;
|
||||||
|
@Column(name = "password")
|
||||||
|
private byte[] password;
|
||||||
|
private String accessToken;
|
||||||
|
public String serverID;
|
||||||
|
private String password_salt;
|
||||||
|
public void setPassword(String password)
|
||||||
|
{
|
||||||
|
password_salt = SecurityHelper.randomStringAESKey();
|
||||||
|
MessageDigest digest;
|
||||||
|
try {
|
||||||
|
digest = MessageDigest.getInstance("SHA-256");
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
LogHelper.error(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.password = digest.digest(password.concat(password_salt).getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
public boolean verifyPassword(String password)
|
||||||
|
{
|
||||||
|
MessageDigest digest;
|
||||||
|
try {
|
||||||
|
digest = MessageDigest.getInstance("SHA-256");
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
LogHelper.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
byte[] enpassword = digest.digest(password.concat(password_salt).getBytes(StandardCharsets.UTF_8));
|
||||||
|
LogHelper.info(Arrays.toString(enpassword));
|
||||||
|
LogHelper.info(Arrays.toString(this.password));
|
||||||
|
return Arrays.equals(enpassword, this.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package pro.gravit.launchserver.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public interface UserDAO {
|
||||||
|
User findById(int id);
|
||||||
|
User findByUsername(String username);
|
||||||
|
User findByUUID(UUID uuid);
|
||||||
|
void save(User user);
|
||||||
|
void update(User user);
|
||||||
|
void delete(User user);
|
||||||
|
List<User> findAll();
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package pro.gravit.launchserver.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
|
||||||
|
public class UserService {
|
||||||
|
|
||||||
|
private final UserDAO usersDao;
|
||||||
|
|
||||||
|
public UserService(LaunchServer server) {
|
||||||
|
usersDao = LaunchServerDaoFactory.createUserDao(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User findUser(int id) {
|
||||||
|
return usersDao.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User findUserByUsername(String username) {
|
||||||
|
return usersDao.findByUsername(username);
|
||||||
|
}
|
||||||
|
public User findUserByUUID(UUID uuid) {
|
||||||
|
return usersDao.findByUUID(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveUser(User user) {
|
||||||
|
usersDao.save(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteUser(User user) {
|
||||||
|
usersDao.delete(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUser(User user) {
|
||||||
|
usersDao.update(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<User> findAllUsers() {
|
||||||
|
return usersDao.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package pro.gravit.launchserver.dao.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.launchserver.dao.UserDAO;
|
||||||
|
|
||||||
|
public class DefaultUserDAOImpl implements UserDAO {
|
||||||
|
public DefaultUserDAOImpl(LaunchServer srv) { }
|
||||||
|
@Override
|
||||||
|
public User findById(int id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User findByUsername(String username) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User findByUUID(UUID uuid) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(User user) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(User user) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(User user) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<User> findAll() {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package pro.gravit.launchserver.dao.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
import javax.persistence.criteria.Root;
|
||||||
|
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.Transaction;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.dao.User;
|
||||||
|
import pro.gravit.launchserver.dao.UserDAO;
|
||||||
|
import pro.gravit.launchserver.hibernate.SessionFactoryManager;
|
||||||
|
|
||||||
|
public class HibernateUserDAOImpl implements UserDAO {
|
||||||
|
private final SessionFactoryManager manager;
|
||||||
|
|
||||||
|
public HibernateUserDAOImpl(LaunchServer srv) {
|
||||||
|
manager = SessionFactoryManager.forLaunchServer(srv);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User findById(int id) {
|
||||||
|
try (Session s = manager.fact.openSession()) {
|
||||||
|
return s.get(User.class, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public User findByUsername(String username) {
|
||||||
|
EntityManager em = manager.fact.createEntityManager();
|
||||||
|
em.getTransaction().begin();
|
||||||
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
||||||
|
CriteriaQuery<User> personCriteria = cb.createQuery(User.class);
|
||||||
|
Root<User> rootUser = personCriteria.from(User.class);
|
||||||
|
personCriteria.select(rootUser).where(cb.equal(rootUser.get("username"), username));
|
||||||
|
List<User> ret = em.createQuery(personCriteria).getResultList();
|
||||||
|
em.close();
|
||||||
|
return ret.size() == 0 ? null : ret.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User findByUUID(UUID uuid) {
|
||||||
|
EntityManager em = manager.fact.createEntityManager();
|
||||||
|
em.getTransaction().begin();
|
||||||
|
CriteriaBuilder cb = em.getCriteriaBuilder();
|
||||||
|
CriteriaQuery<User> personCriteria = cb.createQuery(User.class);
|
||||||
|
Root<User> rootUser = personCriteria.from(User.class);
|
||||||
|
personCriteria.select(rootUser).where(cb.equal(rootUser.get("uuid"), uuid));
|
||||||
|
List<User> ret = em.createQuery(personCriteria).getResultList();
|
||||||
|
em.close();
|
||||||
|
return ret.size() == 0 ? null : ret.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(User user) {
|
||||||
|
try (Session session = manager.fact.openSession()) {
|
||||||
|
Transaction tx1 = session.beginTransaction();
|
||||||
|
session.save(user);
|
||||||
|
tx1.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(User user) {
|
||||||
|
try (Session session = manager.fact.openSession()) {
|
||||||
|
Transaction tx1 = session.beginTransaction();
|
||||||
|
session.update(user);
|
||||||
|
tx1.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(User user) {
|
||||||
|
try (Session session = manager.fact.openSession()) {
|
||||||
|
Transaction tx1 = session.beginTransaction();
|
||||||
|
session.delete(user);
|
||||||
|
tx1.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<User> findAll() {
|
||||||
|
try (Session s = manager.fact.openSession()) {
|
||||||
|
return (List<User>) s.createQuery("From User").list();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package pro.gravit.launchserver.hibernate;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
|
||||||
|
public class SessionFactoryManager {
|
||||||
|
public SessionFactory fact;
|
||||||
|
private static final Map<LaunchServer, SessionFactoryManager> sessionFactories = new ConcurrentHashMap<>();
|
||||||
|
private static final Function<LaunchServer, SessionFactoryManager> cr = e -> new SessionFactoryManager();
|
||||||
|
public static SessionFactoryManager forLaunchServer(LaunchServer srv) {
|
||||||
|
return sessionFactories.computeIfAbsent(srv, cr);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.legacy;
|
package pro.gravit.launchserver.legacy;
|
||||||
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import java.io.IOException;
|
||||||
|
|
||||||
import pro.gravit.launcher.serialize.HInput;
|
import pro.gravit.launcher.serialize.HInput;
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
import pro.gravit.launcher.serialize.SerializeLimits;
|
import pro.gravit.launcher.serialize.SerializeLimits;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
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, Client clientData) {
|
public PingResponse(LaunchServer server, long id, HInput input, HOutput output, String ip, Client clientData) {
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package pro.gravit.launchserver.legacy;
|
package pro.gravit.launchserver.legacy;
|
||||||
|
|
||||||
import pro.gravit.launchserver.legacy.update.LauncherResponse;
|
import java.io.IOException;
|
||||||
import pro.gravit.launchserver.legacy.update.LegacyLauncherResponse;
|
import java.util.Map;
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import pro.gravit.launcher.request.RequestException;
|
import pro.gravit.launcher.request.RequestException;
|
||||||
import pro.gravit.launcher.request.RequestType;
|
import pro.gravit.launcher.request.RequestType;
|
||||||
import pro.gravit.launcher.serialize.HInput;
|
import pro.gravit.launcher.serialize.HInput;
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.legacy.update.LauncherResponse;
|
||||||
|
import pro.gravit.launchserver.legacy.update.LegacyLauncherResponse;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.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,15 +1,15 @@
|
||||||
package pro.gravit.launchserver.legacy.update;
|
package pro.gravit.launchserver.legacy.update;
|
||||||
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import pro.gravit.launcher.serialize.HInput;
|
import pro.gravit.launcher.serialize.HInput;
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
import pro.gravit.launcher.serialize.SerializeLimits;
|
import pro.gravit.launcher.serialize.SerializeLimits;
|
||||||
import pro.gravit.launcher.serialize.signed.DigestBytesHolder;
|
import pro.gravit.launcher.serialize.signed.DigestBytesHolder;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.legacy.Response;
|
import pro.gravit.launchserver.legacy.Response;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public final class LauncherResponse extends Response {
|
public final class LauncherResponse extends Response {
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package pro.gravit.launchserver.legacy.update;
|
package pro.gravit.launchserver.legacy.update;
|
||||||
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
import java.io.IOException;
|
||||||
|
|
||||||
import pro.gravit.launcher.serialize.HInput;
|
import pro.gravit.launcher.serialize.HInput;
|
||||||
import pro.gravit.launcher.serialize.HOutput;
|
import pro.gravit.launcher.serialize.HOutput;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
import pro.gravit.launchserver.binary.LauncherBinary;
|
import pro.gravit.launchserver.binary.LauncherBinary;
|
||||||
import pro.gravit.launchserver.legacy.Response;
|
import pro.gravit.launchserver.legacy.Response;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
import pro.gravit.utils.helper.SecurityHelper;
|
import pro.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, Client clientData) {
|
public LegacyLauncherResponse(LaunchServer server, long session, HInput input, HOutput output, String ip, Client clientData) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
import pro.gravit.launcher.managers.GsonManager;
|
import pro.gravit.launcher.managers.GsonManager;
|
||||||
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
import pro.gravit.launchserver.auth.handler.AuthHandler;
|
||||||
import pro.gravit.launchserver.auth.hwid.HWIDHandler;
|
import pro.gravit.launchserver.auth.hwid.HWIDHandler;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import pro.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 pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
public class MirrorManager {
|
public class MirrorManager {
|
||||||
public class Mirror {
|
public class Mirror {
|
||||||
URL url;
|
URL url;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import pro.gravit.launcher.managers.SimpleModuleManager;
|
import pro.gravit.launcher.managers.SimpleModuleManager;
|
||||||
import pro.gravit.launcher.managers.SimpleModulesConfigManager;
|
import pro.gravit.launcher.managers.SimpleModulesConfigManager;
|
||||||
import pro.gravit.launchserver.LaunchServer;
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
@ -7,9 +10,6 @@
|
||||||
import pro.gravit.launchserver.modules.LaunchServerModuleContext;
|
import pro.gravit.launchserver.modules.LaunchServerModuleContext;
|
||||||
import pro.gravit.utils.PublicURLClassLoader;
|
import pro.gravit.utils.PublicURLClassLoader;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ModulesManager extends SimpleModuleManager {
|
public class ModulesManager extends SimpleModuleManager {
|
||||||
public SimpleModulesConfigManager configManager;
|
public SimpleModulesConfigManager configManager;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import pro.gravit.launchserver.Reconfigurable;
|
import pro.gravit.launchserver.Reconfigurable;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ReconfigurableManager {
|
public class ReconfigurableManager {
|
||||||
private final HashMap<String, Reconfigurable> RECONFIGURABLE = new HashMap<>();
|
private final HashMap<String, Reconfigurable> RECONFIGURABLE = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import pro.gravit.launchserver.Reloadable;
|
import pro.gravit.launchserver.Reloadable;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
import pro.gravit.utils.helper.VerifyHelper;
|
import pro.gravit.utils.helper.VerifyHelper;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ReloadManager {
|
public class ReloadManager {
|
||||||
private final HashMap<String, Reloadable> RELOADABLES = new HashMap<>();
|
private final HashMap<String, Reloadable> RELOADABLES = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.gravit.launchserver.manangers;
|
package pro.gravit.launchserver.manangers;
|
||||||
|
|
||||||
import pro.gravit.launcher.NeedGarbageCollection;
|
|
||||||
import pro.gravit.launchserver.socket.Client;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.NeedGarbageCollection;
|
||||||
|
import pro.gravit.launchserver.socket.Client;
|
||||||
|
|
||||||
public class SessionManager implements NeedGarbageCollection {
|
public class SessionManager implements NeedGarbageCollection {
|
||||||
|
|
||||||
public static final long SESSION_TIMEOUT = 3 * 60 * 60 * 1000; // 3 часа
|
public static final long SESSION_TIMEOUT = 3 * 60 * 60 * 1000; // 3 часа
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package pro.gravit.launchserver.manangers.hook;
|
package pro.gravit.launchserver.manangers.hook;
|
||||||
|
|
||||||
import pro.gravit.launcher.AutogenConfig;
|
|
||||||
import pro.gravit.launchserver.binary.BuildContext;
|
|
||||||
import pro.gravit.launchserver.binary.JAConfigurator;
|
|
||||||
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.AutogenConfig;
|
||||||
|
import pro.gravit.launchserver.binary.BuildContext;
|
||||||
|
import pro.gravit.launchserver.binary.JAConfigurator;
|
||||||
|
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||||
|
|
||||||
public class BuildHookManager {
|
public class BuildHookManager {
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package pro.gravit.launchserver.manangers.hook;
|
package pro.gravit.launchserver.manangers.hook;
|
||||||
|
|
||||||
import pro.gravit.launcher.request.RequestException;
|
|
||||||
import pro.gravit.launchserver.socket.SocketContext;
|
|
||||||
|
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.request.RequestException;
|
||||||
|
import pro.gravit.launchserver.socket.SocketContext;
|
||||||
|
|
||||||
public class SocketHookManager {
|
public class SocketHookManager {
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface SocketPreHook {
|
public interface SocketPreHook {
|
||||||
|
|
|
@ -38,10 +38,10 @@ public void up() {
|
||||||
timestamp = System.currentTimeMillis();
|
timestamp = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateAuth() {
|
public void updateAuth(LaunchServer server) {
|
||||||
if (!isAuth) return;
|
if (!isAuth) return;
|
||||||
if (auth_id.isEmpty()) auth = LaunchServer.server.config.getAuthProviderPair();
|
if (auth_id.isEmpty()) auth = server.config.getAuthProviderPair();
|
||||||
else auth = LaunchServer.server.config.getAuthProviderPair(auth_id);
|
else auth = server.config.getAuthProviderPair(auth_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue