mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[REFACTOR] Remove deprecated methods
This commit is contained in:
parent
9b55e243e7
commit
4bd84728f3
34 changed files with 5 additions and 873 deletions
|
@ -4,7 +4,6 @@
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.Launcher;
|
||||
import pro.gravit.launcher.NeedGarbageCollection;
|
||||
import pro.gravit.launcher.hasher.HashedDir;
|
||||
import pro.gravit.launcher.managers.ConfigManager;
|
||||
import pro.gravit.launcher.managers.GarbageManager;
|
||||
import pro.gravit.launcher.modules.events.ClosePhase;
|
||||
|
@ -40,10 +39,7 @@
|
|||
import java.lang.invoke.MethodType;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.security.interfaces.ECPrivateKey;
|
||||
import java.security.interfaces.ECPublicKey;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -89,10 +85,6 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
|||
* This object contains runtime configuration
|
||||
*/
|
||||
public final LaunchServerRuntimeConfig runtime;
|
||||
@Deprecated
|
||||
public final ECPublicKey publicKey;
|
||||
@Deprecated
|
||||
public final ECPrivateKey privateKey;
|
||||
/**
|
||||
* Pipeline for building JAR
|
||||
*/
|
||||
|
@ -121,15 +113,11 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
|||
// Server
|
||||
public final CommandHandler commandHandler;
|
||||
public final NettyServerSocketHandler nettyServerSocketHandler;
|
||||
@Deprecated
|
||||
public final Timer taskPool;
|
||||
public final ScheduledExecutorService service;
|
||||
public final AtomicBoolean started = new AtomicBoolean(false);
|
||||
public final LauncherModuleLoader launcherModuleLoader;
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
public LaunchServerConfig config;
|
||||
@Deprecated
|
||||
public volatile Map<String, HashedDir> updatesDirMap;
|
||||
// Updates and profiles
|
||||
private volatile Set<ClientProfile> profilesList;
|
||||
|
||||
|
@ -143,13 +131,10 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
|
|||
this.profilesDir = directories.profilesDir;
|
||||
this.updatesDir = directories.updatesDir;
|
||||
this.keyAgreementManager = keyAgreementManager;
|
||||
this.publicKey = keyAgreementManager.ecdsaPublicKey;
|
||||
this.privateKey = keyAgreementManager.ecdsaPrivateKey;
|
||||
this.commandHandler = commandHandler;
|
||||
this.runtime = runtimeConfig;
|
||||
this.certificateManager = certificateManager;
|
||||
this.service = Executors.newScheduledThreadPool(config.netty.performance.schedulerThread);
|
||||
taskPool = new Timer("Timered task worker thread", true);
|
||||
launcherLibraries = directories.launcherLibrariesDir;
|
||||
launcherLibrariesCompile = directories.launcherLibrariesCompileDir;
|
||||
|
||||
|
@ -326,16 +311,6 @@ public void setProfiles(Set<ClientProfile> profilesList) {
|
|||
this.profilesList = Collections.unmodifiableSet(profilesList);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public HashedDir getUpdateDir(String name) {
|
||||
return updatesDirMap.get(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Set<Entry<String, HashedDir>> getUpdateDirs() {
|
||||
return updatesDirMap.entrySet();
|
||||
}
|
||||
|
||||
public void rebindNettyServerSocket() {
|
||||
nettyServerSocketHandler.close();
|
||||
CommonHelper.newThread("Netty Server Socket Thread", false, nettyServerSocketHandler).start();
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
@ -98,36 +97,6 @@ public void pushBytes(String filename, byte[] bytes) throws IOException {
|
|||
fileList.add(filename);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void pushJarFile(ZipInputStream input) throws IOException {
|
||||
ZipEntry e = input.getNextEntry();
|
||||
while (e != null) {
|
||||
if (fileList.contains(e.getName())) {
|
||||
e = input.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
output.putNextEntry(IOHelper.newZipEntry(e));
|
||||
IOHelper.transfer(input, output);
|
||||
fileList.add(e.getName());
|
||||
e = input.getNextEntry();
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void pushJarFile(ZipInputStream input, Set<String> blacklist) throws IOException {
|
||||
ZipEntry e = input.getNextEntry();
|
||||
while (e != null) {
|
||||
if (fileList.contains(e.getName()) || blacklist.contains(e.getName())) {
|
||||
e = input.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
output.putNextEntry(IOHelper.newZipEntry(e));
|
||||
IOHelper.transfer(input, output);
|
||||
fileList.add(e.getName());
|
||||
e = input.getNextEntry();
|
||||
}
|
||||
}
|
||||
|
||||
public void pushJarFile(Path jarfile, Predicate<ZipEntry> filter, Predicate<String> needTransform) throws IOException {
|
||||
pushJarFile(jarfile.toUri().toURL(), filter, needTransform);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import pro.gravit.launcher.Launcher;
|
||||
import pro.gravit.launcher.profiles.ClientProfile;
|
||||
import pro.gravit.launcher.profiles.optional.OptionalFile;
|
||||
import pro.gravit.launcher.profiles.optional.OptionalTrigger;
|
||||
import pro.gravit.launcher.profiles.optional.actions.*;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.launchserver.command.Command;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
@ -16,9 +13,6 @@
|
|||
import java.io.Writer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SaveProfilesCommand extends Command {
|
||||
|
@ -28,7 +22,6 @@ public SaveProfilesCommand(LaunchServer server) {
|
|||
super(server);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void saveProfile(ClientProfile profile, Path path) throws IOException {
|
||||
if (profile.getUUID() == null) profile.setUUID(UUID.randomUUID());
|
||||
if (profile.getServers().size() == 0) {
|
||||
|
@ -39,41 +32,6 @@ public static void saveProfile(ClientProfile profile, Path path) throws IOExcept
|
|||
serverProfile.serverPort = profile.getServerPort();
|
||||
profile.getServers().add(serverProfile);
|
||||
}
|
||||
for (OptionalFile file : profile.getOptional()) {
|
||||
if (file.list != null) {
|
||||
String[] list = file.list;
|
||||
file.list = null;
|
||||
if (file.actions == null) file.actions = new ArrayList<>(2);
|
||||
OptionalAction action;
|
||||
switch (file.type) {
|
||||
case FILE:
|
||||
OptionalActionFile result = new OptionalActionFile(new HashMap<>());
|
||||
for (String s : list) result.files.put(s, "");
|
||||
action = result;
|
||||
break;
|
||||
case CLASSPATH:
|
||||
action = new OptionalActionClassPath(list);
|
||||
break;
|
||||
case JVMARGS:
|
||||
action = new OptionalActionJvmArgs(Arrays.asList(list));
|
||||
break;
|
||||
case CLIENTARGS:
|
||||
action = new OptionalActionClientArgs(Arrays.asList(list));
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
file.actions.add(action);
|
||||
}
|
||||
if (file.triggers != null) {
|
||||
file.triggersList = new ArrayList<>(file.triggers.length);
|
||||
for (OptionalTrigger trigger : file.triggers) {
|
||||
pro.gravit.launcher.profiles.optional.triggers.OptionalTrigger newTrigger = trigger.toTrigger();
|
||||
if (newTrigger != null) file.triggersList.add(newTrigger);
|
||||
}
|
||||
file.triggers = null;
|
||||
}
|
||||
}
|
||||
try (Writer w = IOHelper.newWriter(path)) {
|
||||
Launcher.gsonManager.configGson.toJson(profile, w);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
import pro.gravit.launchserver.helper.SignHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -47,11 +46,6 @@ public static void printCheckResult(String module, String comment, Boolean statu
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void printCheckResult(LogHelper.Level level, String module, String comment, Boolean status) {
|
||||
printCheckResult(module, comment, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgsDescription() {
|
||||
return "[]";
|
||||
|
|
|
@ -19,19 +19,9 @@ public static void registerComponents() {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void preInit(LaunchServer launchServer) {
|
||||
|
||||
}
|
||||
|
||||
public abstract void init(LaunchServer launchServer);
|
||||
|
||||
public final void setComponentName(String s) {
|
||||
this.componentName = s;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void postInit(LaunchServer launchServer) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,8 +279,6 @@ public static class NettyUpdatesBind {
|
|||
public static class LauncherConf {
|
||||
public String guardType;
|
||||
public boolean compress;
|
||||
@Deprecated
|
||||
public boolean warningMissArchJava;
|
||||
public boolean stripLineNumbers;
|
||||
public boolean deleteTempFiles;
|
||||
public boolean certificatePinning;
|
||||
|
|
|
@ -272,16 +272,7 @@ public AuthRequest.AuthPasswordInterface decryptPassword(AuthRequest.AuthPasswor
|
|||
return password;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private AuthRequest.AuthPasswordInterface tryDecryptPasswordPlain(AuthRequest.AuthPasswordInterface password) throws AuthException {
|
||||
if (password instanceof AuthECPassword) {
|
||||
try {
|
||||
return new AuthPlainPassword(IOHelper.decode(SecurityHelper.decrypt(server.runtime.passwordEncryptKey
|
||||
, ((AuthECPassword) password).password)));
|
||||
} catch (Exception ignored) {
|
||||
throw new AuthException("Password decryption error");
|
||||
}
|
||||
}
|
||||
if (password instanceof AuthAESPassword) {
|
||||
try {
|
||||
return new AuthPlainPassword(IOHelper.decode(SecurityHelper.decrypt(server.runtime.passwordEncryptKey
|
||||
|
|
|
@ -4,118 +4,31 @@
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.asn1.x500.X500NameBuilder;
|
||||
import org.bouncycastle.asn1.x500.style.BCStyle;
|
||||
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
|
||||
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
||||
import org.bouncycastle.cert.X509CertificateHolder;
|
||||
import org.bouncycastle.cert.X509v3CertificateBuilder;
|
||||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
|
||||
import org.bouncycastle.crypto.util.PrivateKeyFactory;
|
||||
import org.bouncycastle.crypto.util.PrivateKeyInfoFactory;
|
||||
import org.bouncycastle.operator.ContentSigner;
|
||||
import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
|
||||
import org.bouncycastle.operator.OperatorCreationException;
|
||||
import org.bouncycastle.operator.bc.BcECContentSignerBuilder;
|
||||
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
|
||||
import org.bouncycastle.util.io.pem.PemObject;
|
||||
import org.bouncycastle.util.io.pem.PemReader;
|
||||
import org.bouncycastle.util.io.pem.PemWriter;
|
||||
import pro.gravit.launcher.LauncherTrustManager;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
import pro.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.security.*;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.spec.ECGenParameterSpec;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class CertificateManager {
|
||||
@Deprecated
|
||||
public final int validDays = 60;
|
||||
@Deprecated
|
||||
public final int minusHours = 6;
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
@Deprecated
|
||||
public X509CertificateHolder ca;
|
||||
@Deprecated
|
||||
public AsymmetricKeyParameter caKey;
|
||||
@Deprecated
|
||||
public X509CertificateHolder server;
|
||||
@Deprecated
|
||||
public AsymmetricKeyParameter serverKey;
|
||||
public LauncherTrustManager trustManager;
|
||||
@Deprecated
|
||||
public String orgName;
|
||||
|
||||
@Deprecated
|
||||
public X509CertificateHolder generateCertificate(String subjectName, PublicKey subjectPublicKey) throws OperatorCreationException {
|
||||
SubjectPublicKeyInfo subjectPubKeyInfo = SubjectPublicKeyInfo.getInstance(subjectPublicKey.getEncoded());
|
||||
BigInteger serial = BigInteger.valueOf(SecurityHelper.newRandom().nextLong());
|
||||
Date startDate = Date.from(Instant.now().minus(minusHours, ChronoUnit.HOURS));
|
||||
Date endDate = Date.from(startDate.toInstant().plus(validDays, ChronoUnit.DAYS));
|
||||
|
||||
X500NameBuilder subject = new X500NameBuilder();
|
||||
subject.addRDN(BCStyle.CN, subjectName);
|
||||
subject.addRDN(BCStyle.O, orgName);
|
||||
X509v3CertificateBuilder v3CertGen = new X509v3CertificateBuilder(ca.getSubject(), serial,
|
||||
startDate, endDate, subject.build(), subjectPubKeyInfo);
|
||||
|
||||
AlgorithmIdentifier sigAlgId = ca.getSignatureAlgorithm();
|
||||
AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);
|
||||
ContentSigner sigGen = new BcECContentSignerBuilder(sigAlgId, digAlgId).build(caKey);
|
||||
|
||||
return v3CertGen.build(sigGen);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void generateCA() throws NoSuchAlgorithmException, IOException, OperatorCreationException, InvalidAlgorithmParameterException {
|
||||
ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("secp384k1");
|
||||
KeyPairGenerator generator = KeyPairGenerator.getInstance("EC");
|
||||
generator.initialize(ecGenSpec, SecurityHelper.newRandom());
|
||||
KeyPair pair = generator.generateKeyPair();
|
||||
LocalDateTime startDate = LocalDate.now().atStartOfDay();
|
||||
|
||||
X500NameBuilder subject = new X500NameBuilder();
|
||||
subject.addRDN(BCStyle.CN, orgName.concat(" CA"));
|
||||
subject.addRDN(BCStyle.O, orgName);
|
||||
|
||||
X509v3CertificateBuilder builder = new X509v3CertificateBuilder(
|
||||
subject.build(),
|
||||
new BigInteger("0"),
|
||||
Date.from(startDate.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(startDate.plusDays(3650).atZone(ZoneId.systemDefault()).toInstant()),
|
||||
new X500Name("CN=ca"),
|
||||
SubjectPublicKeyInfo.getInstance(pair.getPublic().getEncoded()));
|
||||
JcaContentSignerBuilder csBuilder = new JcaContentSignerBuilder("SHA256WITHECDSA");
|
||||
ContentSigner signer = csBuilder.build(pair.getPrivate());
|
||||
ca = builder.build(signer);
|
||||
caKey = PrivateKeyFactory.createKey(pair.getPrivate().getEncoded());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public KeyPair generateKeyPair() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
|
||||
ECGenParameterSpec ecGenSpec = new ECGenParameterSpec("secp384k1");
|
||||
KeyPairGenerator generator = KeyPairGenerator.getInstance("EC");
|
||||
generator.initialize(ecGenSpec, SecurityHelper.newRandom());
|
||||
return generator.generateKeyPair();
|
||||
}
|
||||
|
||||
public void writePrivateKey(Path file, PrivateKey privateKey) throws IOException {
|
||||
writePrivateKey(IOHelper.newWriter(file), privateKey);
|
||||
|
@ -214,24 +127,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
|
|||
trustManager = new LauncherTrustManager(certificates.toArray(new X509Certificate[0]));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void checkClass(Class<?> clazz, LauncherTrustManager.CheckMode mode) throws SecurityException {
|
||||
if (trustManager == null) return;
|
||||
X509Certificate[] certificates = JVMHelper.getCertificates(clazz);
|
||||
if (certificates == null) {
|
||||
if (mode == LauncherTrustManager.CheckMode.EXCEPTION_IN_NOT_SIGNED)
|
||||
throw new SecurityException(String.format("Class %s not signed", clazz.getName()));
|
||||
else if (mode == LauncherTrustManager.CheckMode.WARN_IN_NOT_SIGNED)
|
||||
logger.warn("Class {} not signed", clazz.getName());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
trustManager.checkCertificatesSuccess(certificates, trustManager::stdCertificateChecker);
|
||||
} catch (Exception e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public LauncherTrustManager.CheckClassResult checkClass(Class<?> clazz) {
|
||||
X509Certificate[] certificates = JVMHelper.getCertificates(clazz);
|
||||
return trustManager.checkCertificates(certificates, trustManager::stdCertificateChecker);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
import pro.gravit.utils.HookSet;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
|
@ -35,11 +34,6 @@ public boolean removeByUUID(UUID uuid) {
|
|||
return server.config.sessions.deleteSessionsByUserUUID(uuid);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Set<UUID> getSavedUUIDs() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
server.config.sessions.clear();
|
||||
}
|
||||
|
@ -84,25 +78,4 @@ public Client getOrNewClient(UUID session) {
|
|||
public boolean remove(UUID session) {
|
||||
return server.config.sessions.deleteSession(session);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void removeClient(UUID session) {
|
||||
remove(session);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void updateClient(UUID session) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Set<Client> getSessions() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void loadSessions(Set<Client> set) {
|
||||
throw new UnsupportedOperationException();
|
||||
//clientSet.putAll(set.stream().collect(Collectors.toMap(c -> c.session, Function.identity())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
|
||||
import pro.gravit.launcher.LauncherTrustManager;
|
||||
import pro.gravit.launcher.modules.LauncherModule;
|
||||
import pro.gravit.launcher.modules.LauncherModuleInfo;
|
||||
import pro.gravit.launcher.modules.impl.SimpleModuleManager;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -26,23 +22,6 @@ public void fullInitializedLaunchServer(LaunchServer server) {
|
|||
initContext = new LaunchServerInitContext(server);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void printModulesInfo() {
|
||||
for (LauncherModule module : modules) {
|
||||
LauncherModuleInfo info = module.getModuleInfo();
|
||||
LauncherTrustManager.CheckClassResult checkStatus = module.getCheckResult();
|
||||
LogHelper.info("[MODULE] %s v: %s p: %d deps: %s sig: %s", info.name, info.version.getVersionString(), info.priority, Arrays.toString(info.dependencies), checkStatus == null ? "null" : checkStatus.type);
|
||||
if (checkStatus != null && checkStatus.endCertificate != null) {
|
||||
X509Certificate cert = checkStatus.endCertificate;
|
||||
LogHelper.info("[MODULE CERT] Module signer: %s", cert.getSubjectDN().getName());
|
||||
}
|
||||
if (checkStatus != null && checkStatus.rootCertificate != null) {
|
||||
X509Certificate cert = checkStatus.rootCertificate;
|
||||
LogHelper.info("[MODULE CERT] Module signer CA: %s", cert.getSubjectDN().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<LauncherModule> getModules() {
|
||||
return Collections.unmodifiableList(modules);
|
||||
}
|
||||
|
|
|
@ -88,12 +88,6 @@ public pro.gravit.launchserver.auth.core.User getUser() {
|
|||
return coreObject;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public enum Type {
|
||||
SERVER,
|
||||
USER
|
||||
}
|
||||
|
||||
public static class TrustLevel {
|
||||
public byte[] verifySecureKey;
|
||||
public boolean keyChecked;
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
|
||||
private transient final LaunchServer server;
|
||||
private transient final Logger logger = LogManager.getLogger();
|
||||
@Deprecated
|
||||
public volatile boolean logConnections = Boolean.getBoolean("launcher.logConnections");
|
||||
public LauncherNettyServer nettyServer;
|
||||
private SSLServerSocketFactory ssf;
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
|
|||
}
|
||||
|
||||
public enum ConnectTypes {
|
||||
@Deprecated
|
||||
SERVER,
|
||||
CLIENT,
|
||||
API
|
||||
}
|
||||
|
@ -81,8 +79,6 @@ public static class AuthContext {
|
|||
public final Client client;
|
||||
public final AuthProviderPair pair;
|
||||
public AuthManager.AuthReport report;
|
||||
@Deprecated
|
||||
public int password_length; //Use AuthProvider for get password
|
||||
|
||||
public AuthContext(Client client, String login, String profileName, String ip, ConnectTypes authType, AuthProviderPair pair) {
|
||||
this.client = client;
|
||||
|
|
|
@ -2,43 +2,17 @@
|
|||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import pro.gravit.launcher.events.request.ProfileByUUIDRequestEvent;
|
||||
import pro.gravit.launcher.profiles.PlayerProfile;
|
||||
import pro.gravit.launcher.profiles.Texture;
|
||||
import pro.gravit.launchserver.auth.AuthProviderPair;
|
||||
import pro.gravit.launchserver.auth.core.User;
|
||||
import pro.gravit.launchserver.auth.texture.TextureProvider;
|
||||
import pro.gravit.launchserver.socket.Client;
|
||||
import pro.gravit.launchserver.socket.response.SimpleResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfileByUUIDResponse extends SimpleResponse {
|
||||
public UUID uuid;
|
||||
public String client;
|
||||
|
||||
@Deprecated
|
||||
public static PlayerProfile getProfile(UUID uuid, String username, String client, TextureProvider textureProvider) {
|
||||
// Get skin texture
|
||||
Texture skin;
|
||||
try {
|
||||
skin = textureProvider.getSkinTexture(uuid, username, client);
|
||||
} catch (IOException e) {
|
||||
skin = null;
|
||||
}
|
||||
|
||||
// Get cloak texture
|
||||
Texture cloak;
|
||||
try {
|
||||
cloak = textureProvider.getCloakTexture(uuid, username, client);
|
||||
} catch (IOException e) {
|
||||
cloak = null;
|
||||
}
|
||||
|
||||
// Return combined profile
|
||||
return new PlayerProfile(uuid, username, skin, cloak);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "profileByUUID";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package pro.gravit.launcher;
|
||||
|
||||
import pro.gravit.launcher.serialize.HInput;
|
||||
import pro.gravit.launcher.serialize.HOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -39,11 +38,6 @@ public long toLong() {
|
|||
return permissions;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void write(HOutput output) throws IOException {
|
||||
output.writeLong(toLong());
|
||||
}
|
||||
|
||||
//Read methods
|
||||
public final boolean isPermission(PermissionConsts con) {
|
||||
return (permissions & con.mask) != 0;
|
||||
|
|
|
@ -32,8 +32,6 @@ public final class LauncherConfig extends StreamObject {
|
|||
public final ECPublicKey ecdsaPublicKey;
|
||||
public final RSAPublicKey rsaPublicKey;
|
||||
public final Map<String, byte[]> runtime;
|
||||
@Deprecated
|
||||
public final boolean isWarningMissArchJava;
|
||||
@LauncherInject("launcher.guardType")
|
||||
public final String guardType;
|
||||
@LauncherInject("runtimeconfig.secureCheckHash")
|
||||
|
@ -46,8 +44,6 @@ public final class LauncherConfig extends StreamObject {
|
|||
public final String runtimeEncryptKey;
|
||||
@LauncherInject("launcher.address")
|
||||
public final String address;
|
||||
@Deprecated
|
||||
public ECPublicKey publicKey = null;
|
||||
@LauncherInject("runtimeconfig.secretKeyClient")
|
||||
public String secretKeyClient;
|
||||
@LauncherInject("runtimeconfig.oemUnlockKey")
|
||||
|
@ -60,7 +56,6 @@ public final class LauncherConfig extends StreamObject {
|
|||
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
|
||||
ecdsaPublicKey = SecurityHelper.toPublicECDSAKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
|
||||
rsaPublicKey = SecurityHelper.toPublicRSAKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
|
||||
publicKey = ecdsaPublicKey;
|
||||
secureCheckHash = null;
|
||||
secureCheckSalt = null;
|
||||
passwordEncryptKey = null;
|
||||
|
@ -74,8 +69,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
} catch (CertificateException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
|
||||
isWarningMissArchJava = false;
|
||||
guardType = null;
|
||||
address = null;
|
||||
environment = LauncherEnvironment.STD;
|
||||
|
@ -92,25 +85,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
|||
runtime = Collections.unmodifiableMap(localResources);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public LauncherConfig(String address, ECPublicKey publicKey, Map<String, byte[]> runtime, String projectName) {
|
||||
this.address = address;
|
||||
this.publicKey = publicKey;
|
||||
this.ecdsaPublicKey = this.publicKey;
|
||||
this.rsaPublicKey = null;
|
||||
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
|
||||
this.projectName = projectName;
|
||||
this.clientPort = 32148;
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
environment = LauncherEnvironment.STD;
|
||||
secureCheckSalt = null;
|
||||
secureCheckHash = null;
|
||||
passwordEncryptKey = null;
|
||||
runtimeEncryptKey = null;
|
||||
trustManager = null;
|
||||
}
|
||||
|
||||
public LauncherConfig(String address, ECPublicKey ecdsaPublicKey, RSAPublicKey rsaPublicKey, Map<String, byte[]> runtime, String projectName) {
|
||||
this.address = address;
|
||||
this.ecdsaPublicKey = ecdsaPublicKey;
|
||||
|
@ -119,7 +93,6 @@ public LauncherConfig(String address, ECPublicKey ecdsaPublicKey, RSAPublicKey r
|
|||
this.projectName = projectName;
|
||||
this.clientPort = 32148;
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
environment = LauncherEnvironment.STD;
|
||||
secureCheckSalt = null;
|
||||
secureCheckHash = null;
|
||||
|
@ -138,7 +111,6 @@ public LauncherConfig(String address, Map<String, byte[]> runtime, String projec
|
|||
this.ecdsaPublicKey = null;
|
||||
environment = env;
|
||||
guardType = "no";
|
||||
isWarningMissArchJava = true;
|
||||
secureCheckSalt = null;
|
||||
secureCheckHash = null;
|
||||
passwordEncryptKey = null;
|
||||
|
|
|
@ -45,42 +45,11 @@ public static class AuthAvailability {
|
|||
public String name;
|
||||
@LauncherNetworkAPI
|
||||
public String displayName;
|
||||
@Deprecated
|
||||
@LauncherNetworkAPI
|
||||
public AuthType firstType;
|
||||
@Deprecated
|
||||
@LauncherNetworkAPI
|
||||
public AuthType secondType;
|
||||
|
||||
@Deprecated
|
||||
public AuthAvailability(String name, String displayName, AuthType firstType, AuthType secondType) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.firstType = firstType;
|
||||
this.secondType = secondType;
|
||||
this.details = null;
|
||||
}
|
||||
|
||||
public AuthAvailability(String name, String displayName, List<AuthAvailabilityDetails> details) {
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public enum AuthType {
|
||||
@LauncherNetworkAPI
|
||||
PASSWORD,
|
||||
@LauncherNetworkAPI
|
||||
KEY,
|
||||
@LauncherNetworkAPI
|
||||
TOTP,
|
||||
@LauncherNetworkAPI
|
||||
OAUTH,
|
||||
@LauncherNetworkAPI
|
||||
NONE,
|
||||
@LauncherNetworkAPI
|
||||
OTHER
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ public class SimpleModuleManager implements LauncherModulesManager {
|
|||
protected final LauncherTrustManager trustManager;
|
||||
protected final PublicURLClassLoader classLoader = new PublicURLClassLoader(new URL[]{});
|
||||
protected LauncherInitContext initContext;
|
||||
@Deprecated
|
||||
protected LauncherTrustManager.CheckMode checkMode = LauncherTrustManager.CheckMode.WARN_IN_NOT_SIGNED;
|
||||
|
||||
public SimpleModuleManager(Path modulesDir, Path configDir) {
|
||||
modulesConfigManager = new SimpleModulesConfigManager(configDir);
|
||||
|
@ -172,24 +170,6 @@ public LauncherModule loadModule(Path file) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void checkModuleClass(Class<? extends LauncherModule> clazz, LauncherTrustManager.CheckMode mode) throws SecurityException {
|
||||
if (trustManager == null) return;
|
||||
X509Certificate[] certificates = getCertificates(clazz);
|
||||
if (certificates == null) {
|
||||
if (mode == LauncherTrustManager.CheckMode.EXCEPTION_IN_NOT_SIGNED)
|
||||
throw new SecurityException(String.format("Class %s not signed", clazz.getName()));
|
||||
else if (mode == LauncherTrustManager.CheckMode.WARN_IN_NOT_SIGNED)
|
||||
LogHelper.warning("Class %s not signed", clazz.getName());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
trustManager.checkCertificatesSuccess(certificates, trustManager::stdCertificateChecker);
|
||||
} catch (Exception e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public LauncherTrustManager.CheckClassResult checkModuleClass(Class<? extends LauncherModule> clazz) {
|
||||
if (trustManager == null) return null;
|
||||
X509Certificate[] certificates = getCertificates(clazz);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import pro.gravit.launcher.hasher.FileNameMatcher;
|
||||
import pro.gravit.launcher.profiles.optional.OptionalDepend;
|
||||
import pro.gravit.launcher.profiles.optional.OptionalFile;
|
||||
import pro.gravit.launcher.profiles.optional.OptionalType;
|
||||
import pro.gravit.launcher.profiles.optional.triggers.OptionalTrigger;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.VerifyHelper;
|
||||
|
@ -257,13 +256,6 @@ public void updateOptionalGraph() {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public OptionalFile getOptionalFile(String file, OptionalType type) {
|
||||
for (OptionalFile f : updateOptional)
|
||||
if (f.type.equals(type) && f.name.equals(file)) return f;
|
||||
return null;
|
||||
}
|
||||
|
||||
public OptionalFile getOptionalFile(String file) {
|
||||
for (OptionalFile f : updateOptional)
|
||||
if (f.name.equals(file)) return f;
|
||||
|
@ -279,11 +271,6 @@ public int getServerPort() {
|
|||
return profile == null ? 25565 : profile.serverPort;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public InetSocketAddress getServerSocketAddress() {
|
||||
return InetSocketAddress.createUnresolved(getServerAddress(), getServerPort());
|
||||
}
|
||||
|
||||
public int getSortIndex() {
|
||||
return sortIndex;
|
||||
}
|
||||
|
|
|
@ -1,31 +1,18 @@
|
|||
package pro.gravit.launcher.profiles;
|
||||
|
||||
import pro.gravit.launcher.serialize.HInput;
|
||||
import pro.gravit.launcher.serialize.HOutput;
|
||||
import pro.gravit.launcher.serialize.stream.StreamObject;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.VerifyHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class PlayerProfile extends StreamObject {
|
||||
public final class PlayerProfile {
|
||||
|
||||
public final UUID uuid;
|
||||
public final String username;
|
||||
public final Texture skin, cloak;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public PlayerProfile(HInput input) throws IOException {
|
||||
uuid = input.readUUID();
|
||||
username = VerifyHelper.verifyUsername(input.readString(64));
|
||||
skin = input.readBoolean() ? new Texture(input) : null;
|
||||
cloak = input.readBoolean() ? new Texture(input) : null;
|
||||
}
|
||||
|
||||
|
||||
public PlayerProfile(UUID uuid, String username, Texture skin, Texture cloak) {
|
||||
this.uuid = Objects.requireNonNull(uuid, "uuid");
|
||||
this.username = VerifyHelper.verifyUsername(username);
|
||||
|
@ -41,19 +28,4 @@ public static UUID offlineUUID(String username) {
|
|||
return UUID.nameUUIDFromBytes(IOHelper.encodeASCII("OfflinePlayer:" + username));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void write(HOutput output) throws IOException {
|
||||
output.writeUUID(uuid);
|
||||
output.writeString(username, 64);
|
||||
|
||||
// Write textures
|
||||
output.writeBoolean(skin != null);
|
||||
if (skin != null)
|
||||
skin.write(output);
|
||||
output.writeBoolean(cloak != null);
|
||||
if (cloak != null)
|
||||
cloak.write(output);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.gravit.launcher.profiles;
|
||||
|
||||
import pro.gravit.launcher.serialize.HInput;
|
||||
import pro.gravit.launcher.serialize.HOutput;
|
||||
import pro.gravit.launcher.serialize.stream.StreamObject;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
|
@ -25,14 +24,6 @@ public final class Texture extends StreamObject {
|
|||
|
||||
public final Map<String, String> metadata;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public Texture(HInput input) throws IOException {
|
||||
url = IOHelper.verifyURL(input.readASCII(2048));
|
||||
digest = input.readByteArray(-DIGEST_ALGO.bytes);
|
||||
metadata = null;
|
||||
}
|
||||
|
||||
public Texture(String url, boolean cloak) throws IOException {
|
||||
this.url = IOHelper.verifyURL(url);
|
||||
|
||||
|
|
|
@ -5,7 +5,4 @@
|
|||
public class OptionalDepend {
|
||||
@LauncherNetworkAPI
|
||||
public String name;
|
||||
@Deprecated
|
||||
@LauncherNetworkAPI
|
||||
public OptionalType type;
|
||||
}
|
||||
|
|
|
@ -2,28 +2,11 @@
|
|||
|
||||
import pro.gravit.launcher.LauncherNetworkAPI;
|
||||
import pro.gravit.launcher.profiles.optional.actions.OptionalAction;
|
||||
import pro.gravit.launcher.serialize.HInput;
|
||||
import pro.gravit.launcher.serialize.HOutput;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class OptionalFile {
|
||||
@LauncherNetworkAPI
|
||||
@Deprecated
|
||||
public long permissions = 0L;
|
||||
@LauncherNetworkAPI
|
||||
@Deprecated
|
||||
public String[] list;
|
||||
@LauncherNetworkAPI
|
||||
@Deprecated
|
||||
public OptionalType type;
|
||||
@LauncherNetworkAPI
|
||||
public List<OptionalAction> actions;
|
||||
@LauncherNetworkAPI
|
||||
|
@ -37,9 +20,6 @@ public class OptionalFile {
|
|||
@LauncherNetworkAPI
|
||||
public List<pro.gravit.launcher.profiles.optional.triggers.OptionalTrigger> triggersList;
|
||||
@LauncherNetworkAPI
|
||||
@Deprecated
|
||||
public OptionalTrigger[] triggers;
|
||||
@LauncherNetworkAPI
|
||||
public OptionalDepend[] dependenciesFile;
|
||||
@LauncherNetworkAPI
|
||||
public OptionalDepend[] conflictFile;
|
||||
|
@ -51,35 +31,6 @@ public class OptionalFile {
|
|||
public int subTreeLevel = 1;
|
||||
@LauncherNetworkAPI
|
||||
public boolean isPreset;
|
||||
@Deprecated
|
||||
public transient Set<OptionalFile> dependenciesCount;
|
||||
@Deprecated
|
||||
private volatile transient Collection<BiConsumer<OptionalFile, Boolean>> watchList = null;
|
||||
|
||||
@Deprecated
|
||||
public static OptionalType readType(HInput input) throws IOException {
|
||||
int t = input.readInt();
|
||||
OptionalType type;
|
||||
switch (t) {
|
||||
case 1:
|
||||
type = OptionalType.FILE;
|
||||
break;
|
||||
case 2:
|
||||
type = OptionalType.CLASSPATH;
|
||||
break;
|
||||
case 3:
|
||||
type = OptionalType.JVMARGS;
|
||||
break;
|
||||
case 4:
|
||||
type = OptionalType.CLIENTARGS;
|
||||
break;
|
||||
default:
|
||||
LogHelper.error("readType failed. Read int %d", t);
|
||||
type = OptionalType.FILE;
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
@ -93,11 +44,6 @@ public int hashCode() {
|
|||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public OptionalType getType() {
|
||||
return OptionalType.FILE;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -109,54 +55,4 @@ public boolean isVisible() {
|
|||
public boolean isMark() {
|
||||
return mark;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public long getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void writeType(HOutput output) throws IOException {
|
||||
switch (type) {
|
||||
|
||||
case FILE:
|
||||
output.writeInt(1);
|
||||
break;
|
||||
case CLASSPATH:
|
||||
output.writeInt(2);
|
||||
break;
|
||||
case JVMARGS:
|
||||
output.writeInt(3);
|
||||
break;
|
||||
case CLIENTARGS:
|
||||
output.writeInt(4);
|
||||
break;
|
||||
default:
|
||||
output.writeInt(5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void registerWatcher(BiConsumer<OptionalFile, Boolean> watcher) {
|
||||
if (watchList == null) watchList = ConcurrentHashMap.newKeySet();
|
||||
watchList.add(watcher);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void removeWatcher(BiConsumer<OptionalFile, Boolean> watcher) {
|
||||
if (watchList == null) return;
|
||||
watchList.remove(watcher);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void clearAllWatchers() {
|
||||
if (watchList == null) return;
|
||||
watchList.clear();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void watchEvent(boolean isMark) {
|
||||
if (watchList == null) return;
|
||||
watchList.forEach((e) -> e.accept(this, isMark));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
package pro.gravit.launcher.profiles.optional;
|
||||
|
||||
import pro.gravit.launcher.profiles.optional.triggers.JavaTrigger;
|
||||
import pro.gravit.launcher.profiles.optional.triggers.OSTrigger;
|
||||
import pro.gravit.utils.helper.JVMHelper;
|
||||
|
||||
@Deprecated
|
||||
public class OptionalTrigger {
|
||||
public TriggerType type;
|
||||
public boolean need = true;
|
||||
public long value;
|
||||
public long compareMode = 0;
|
||||
|
||||
public OptionalTrigger() {
|
||||
}
|
||||
|
||||
public OptionalTrigger(TriggerType type, long value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public OptionalTrigger(TriggerType type, boolean need, long value, long compareMode) {
|
||||
this.type = type;
|
||||
this.need = need;
|
||||
this.value = value;
|
||||
this.compareMode = compareMode;
|
||||
}
|
||||
|
||||
public boolean isTriggered() {
|
||||
long test;
|
||||
switch (type) {
|
||||
|
||||
case JAVA_VERSION:
|
||||
test = JVMHelper.JVM_VERSION;
|
||||
break;
|
||||
case JAVA_BITS:
|
||||
test = JVMHelper.JVM_BITS;
|
||||
break;
|
||||
case OS_BITS:
|
||||
test = JVMHelper.OS_BITS;
|
||||
break;
|
||||
case OS_TYPE:
|
||||
switch (JVMHelper.OS_TYPE) {
|
||||
|
||||
case MUSTDIE:
|
||||
test = 0;
|
||||
break;
|
||||
case LINUX:
|
||||
test = 1;
|
||||
break;
|
||||
case MACOSX:
|
||||
test = 2;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (compareMode == 0) return test == value;
|
||||
else if (compareMode < 0) return test < value;
|
||||
else return test > value;
|
||||
}
|
||||
|
||||
public pro.gravit.launcher.profiles.optional.triggers.OptionalTrigger toTrigger() {
|
||||
switch (type) {
|
||||
case JAVA_VERSION: {
|
||||
JavaTrigger trigger = new JavaTrigger((int) value, (int) value);
|
||||
trigger.required = need;
|
||||
if (compareMode > 0) {
|
||||
trigger.maxVersion = 999;
|
||||
} else if (compareMode < 0) {
|
||||
trigger.minVersion = 0;
|
||||
}
|
||||
return trigger;
|
||||
}
|
||||
case JAVA_BITS:
|
||||
case OS_BITS:
|
||||
return null;
|
||||
case OS_TYPE: {
|
||||
JVMHelper.OS os;
|
||||
if (value == 0) os = JVMHelper.OS.MUSTDIE;
|
||||
else if (value == 1) os = JVMHelper.OS.LINUX;
|
||||
else if (value == 2) os = JVMHelper.OS.MUSTDIE;
|
||||
else throw new IllegalArgumentException(String.format("Os version %d unknown", value));
|
||||
OSTrigger trigger = new OSTrigger(os);
|
||||
trigger.required = need;
|
||||
if (compareMode != 0) trigger.inverted = true;
|
||||
return trigger;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum TriggerType {
|
||||
JAVA_VERSION, JAVA_BITS, OS_BITS, OS_TYPE
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package pro.gravit.launcher.profiles.optional;
|
||||
|
||||
import pro.gravit.launcher.LauncherNetworkAPI;
|
||||
|
||||
@Deprecated
|
||||
public enum OptionalType {
|
||||
@LauncherNetworkAPI
|
||||
FILE,
|
||||
@LauncherNetworkAPI
|
||||
CLASSPATH,
|
||||
@LauncherNetworkAPI
|
||||
JVMARGS,
|
||||
@LauncherNetworkAPI
|
||||
CLIENTARGS
|
||||
}
|
|
@ -11,21 +11,18 @@
|
|||
|
||||
public class OptionalView {
|
||||
public Set<OptionalFile> enabled = new HashSet<>();
|
||||
@Deprecated
|
||||
public Map<OptionalFile, Set<OptionalFile>> dependenciesCountMap = new HashMap<>();
|
||||
public Map<OptionalFile, OptionalFileInstallInfo> installInfo = new HashMap<>();
|
||||
public Set<OptionalFile> all;
|
||||
|
||||
public OptionalView(ClientProfile profile) {
|
||||
this.all = profile.getOptional();
|
||||
for (OptionalFile f : this.all) {
|
||||
if (f.mark) enable(f);
|
||||
if (f.mark) enable(f, true, null);
|
||||
}
|
||||
}
|
||||
|
||||
public OptionalView(OptionalView view) {
|
||||
this.enabled = new HashSet<>(view.enabled);
|
||||
this.dependenciesCountMap = new HashMap<>(view.dependenciesCountMap);
|
||||
this.installInfo = new HashMap<>(view.installInfo);
|
||||
this.all = view.all;
|
||||
}
|
||||
|
@ -66,51 +63,6 @@ public Set<OptionalAction> getDisabledActions() {
|
|||
return results;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void enable(OptionalFile file) {
|
||||
if (enabled.contains(file)) return;
|
||||
enabled.add(file);
|
||||
file.watchEvent(true);
|
||||
if (file.dependencies != null) {
|
||||
for (OptionalFile dep : file.dependencies) {
|
||||
Set<OptionalFile> dependenciesCount = dependenciesCountMap.computeIfAbsent(dep, k -> new HashSet<>());
|
||||
dependenciesCount.add(file);
|
||||
enable(dep);
|
||||
}
|
||||
}
|
||||
if (file.conflict != null) {
|
||||
for (OptionalFile conflict : file.conflict) {
|
||||
disable(conflict);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void disable(OptionalFile file) {
|
||||
if (!enabled.remove(file)) return;
|
||||
file.watchEvent(false);
|
||||
Set<OptionalFile> dependenciesCount = dependenciesCountMap.get(file);
|
||||
if (dependenciesCount != null) {
|
||||
for (OptionalFile f : dependenciesCount) {
|
||||
if (f.isPreset) continue;
|
||||
disable(f);
|
||||
}
|
||||
dependenciesCount.clear();
|
||||
}
|
||||
if (file.dependencies != null) {
|
||||
for (OptionalFile f : file.dependencies) {
|
||||
if (!enabled.contains(f)) continue;
|
||||
dependenciesCount = dependenciesCountMap.get(f);
|
||||
if (dependenciesCount == null) {
|
||||
disable(f);
|
||||
} else if (dependenciesCount.size() <= 1) {
|
||||
dependenciesCount.clear();
|
||||
disable(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void enable(OptionalFile file, boolean manual, BiConsumer<OptionalFile, Boolean> callback) {
|
||||
if (enabled.contains(file)) return;
|
||||
enabled.add(file);
|
||||
|
@ -128,7 +80,7 @@ public void enable(OptionalFile file, boolean manual, BiConsumer<OptionalFile, B
|
|||
}
|
||||
if (file.conflict != null) {
|
||||
for (OptionalFile conflict : file.conflict) {
|
||||
disable(conflict);
|
||||
disable(conflict, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
import pro.gravit.launcher.request.auth.password.*;
|
||||
import pro.gravit.launcher.request.websockets.WebSocketRequest;
|
||||
import pro.gravit.utils.ProviderMap;
|
||||
import pro.gravit.utils.helper.VerifyHelper;
|
||||
|
||||
public final class AuthRequest extends Request<AuthRequestEvent> implements WebSocketRequest {
|
||||
public static final ProviderMap<AuthPasswordInterface> providers = new ProviderMap<>();
|
||||
|
@ -22,33 +21,6 @@ public final class AuthRequest extends Request<AuthRequestEvent> implements WebS
|
|||
@LauncherNetworkAPI
|
||||
private final ConnectTypes authType;
|
||||
|
||||
@Deprecated
|
||||
public AuthRequest(String login, byte[] password) {
|
||||
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
||||
this.password = new AuthECPassword(password.clone());
|
||||
auth_id = "";
|
||||
getSession = true;
|
||||
authType = ConnectTypes.CLIENT;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AuthRequest(String login, byte[] password, String auth_id) {
|
||||
this.login = VerifyHelper.verify(login, VerifyHelper.NOT_EMPTY, "Login can't be empty");
|
||||
this.password = new AuthECPassword(password.clone());
|
||||
this.auth_id = auth_id;
|
||||
getSession = true;
|
||||
authType = ConnectTypes.CLIENT;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AuthRequest(String login, byte[] encryptedPassword, String auth_id, ConnectTypes authType) {
|
||||
this.login = login;
|
||||
this.password = new AuthECPassword(encryptedPassword.clone());
|
||||
this.auth_id = auth_id;
|
||||
this.authType = authType;
|
||||
this.getSession = false;
|
||||
}
|
||||
|
||||
public AuthRequest(String login, String password, String auth_id, ConnectTypes authType) {
|
||||
this.login = login;
|
||||
this.password = new AuthPlainPassword(password);
|
||||
|
@ -65,12 +37,10 @@ public AuthRequest(String login, AuthPasswordInterface password, String auth_id,
|
|||
this.authType = authType;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void registerProviders() {
|
||||
if (!registerProviders) {
|
||||
providers.register("plain", AuthPlainPassword.class);
|
||||
providers.register("rsa2", AuthRSAPassword.class);
|
||||
providers.register("rsa", AuthECPassword.class);
|
||||
providers.register("aes", AuthAESPassword.class);
|
||||
providers.register("2fa", Auth2FAPassword.class);
|
||||
providers.register("multi", AuthMultiPassword.class);
|
||||
|
@ -88,9 +58,6 @@ public String getType() {
|
|||
}
|
||||
|
||||
public enum ConnectTypes {
|
||||
@Deprecated
|
||||
@LauncherNetworkAPI
|
||||
SERVER,
|
||||
@LauncherNetworkAPI
|
||||
CLIENT,
|
||||
@LauncherNetworkAPI
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package pro.gravit.launcher.request.auth.password;
|
||||
|
||||
import pro.gravit.launcher.LauncherNetworkAPI;
|
||||
import pro.gravit.launcher.request.auth.AuthRequest;
|
||||
|
||||
@Deprecated
|
||||
public class AuthECPassword implements AuthRequest.AuthPasswordInterface {
|
||||
@LauncherNetworkAPI
|
||||
public final byte[] password;
|
||||
|
||||
public AuthECPassword(byte[] password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -5,10 +5,6 @@
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SignatureException;
|
||||
import java.security.cert.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -87,30 +83,6 @@ public void checkCertificatesSuccess(X509Certificate[] certs, CertificateChecker
|
|||
throw new SecurityException(result.type.name());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void checkCertificate(X509Certificate[] certs, CertificateChecker checker) throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
|
||||
if (certs == null) throw new SecurityException("Object not signed");
|
||||
for (int i = 0; i < certs.length; ++i) {
|
||||
X509Certificate cert = certs[i];
|
||||
if (trustCache.contains(cert)) {
|
||||
//Добавляем в кеш все проверенные сертификаты
|
||||
trustCache.addAll(Arrays.asList(certs).subList(0, i));
|
||||
return;
|
||||
}
|
||||
X509Certificate signer = (i + 1 < certs.length) ? certs[i + 1] : null;
|
||||
cert.checkValidity();
|
||||
if (signer != null) {
|
||||
cert.verify(signer.getPublicKey());
|
||||
} else {
|
||||
if (!isTrusted(cert)) {
|
||||
throw new CertificateException(String.format("Certificate %s is not signed by a trusted signer", cert.getSubjectDN().getName()));
|
||||
}
|
||||
}
|
||||
checker.check(cert, signer, i);
|
||||
}
|
||||
Collections.addAll(trustCache, certs);
|
||||
}
|
||||
|
||||
public boolean isTrusted(X509Certificate certificate) throws CertificateEncodingException {
|
||||
//Java API не дает возможности вызвать getFingerprint
|
||||
//Oracle использует хак с кастом к sun.security.x509.X509CertImpl для проверки равенства сертификатов
|
||||
|
@ -167,11 +139,6 @@ public enum CheckClassResultType {
|
|||
UNCOMPAT
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public enum CheckMode {
|
||||
EXCEPTION_IN_NOT_SIGNED, WARN_IN_NOT_SIGNED, NONE_IN_NOT_SIGNED
|
||||
}
|
||||
|
||||
public interface CertificateChecker {
|
||||
void check(X509Certificate cert, X509Certificate signer, int number) throws SecurityException;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import pro.gravit.launcher.serialize.HOutput;
|
||||
import pro.gravit.launcher.serialize.stream.EnumSerializer;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
import pro.gravit.utils.helper.VerifyHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -68,40 +67,6 @@ public void remove(String name) {
|
|||
map.remove(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void removeR(String name) {
|
||||
LinkedList<String> dirs = new LinkedList<>();
|
||||
StringTokenizer t = new StringTokenizer(name, "/");
|
||||
while (t.hasMoreTokens()) {
|
||||
dirs.add(t.nextToken());
|
||||
}
|
||||
Map<String, HashedEntry> current = map;
|
||||
for (String s : dirs) {
|
||||
HashedEntry e = current.get(s);
|
||||
if (e == null) {
|
||||
if (LogHelper.isDebugEnabled()) {
|
||||
LogHelper.debug("Null %s", s);
|
||||
}
|
||||
if (LogHelper.isDebugEnabled()) {
|
||||
for (String x : current.keySet()) LogHelper.debug("Contains %s", x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (e.getType() == Type.DIR) {
|
||||
current = ((HashedDir) e).map;
|
||||
if (LogHelper.isDebugEnabled()) {
|
||||
LogHelper.debug("Found dir %s", s);
|
||||
}
|
||||
} else {
|
||||
current.remove(s);
|
||||
if (LogHelper.isDebugEnabled()) {
|
||||
LogHelper.debug("Found filename %s", s);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void moveTo(String elementName, HashedDir target, String targetElementName) {
|
||||
HashedEntry entry = map.remove(elementName);
|
||||
target.map.put(targetElementName, entry);
|
||||
|
|
|
@ -10,10 +10,7 @@
|
|||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -135,11 +132,6 @@ public static void setDevEnabled(boolean stacktraceEnabled) {
|
|||
impl.setDevEnabled(stacktraceEnabled);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getDataTime() {
|
||||
return DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss", Locale.US).format(LocalDateTime.now());
|
||||
}
|
||||
|
||||
public static void log(Level level, String message, boolean sub) {
|
||||
impl.log(level, message, sub);
|
||||
}
|
||||
|
@ -205,9 +197,6 @@ public enum OutputTypes {
|
|||
PLAIN,
|
||||
@LauncherNetworkAPI
|
||||
JANSI,
|
||||
@LauncherNetworkAPI
|
||||
@Deprecated
|
||||
HTML
|
||||
}
|
||||
|
||||
public enum Level {
|
||||
|
|
|
@ -83,11 +83,6 @@ public static byte[] digest(DigestAlgorithm algo, URL url) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static KeyPair genECKeyPair(SecureRandom random) {
|
||||
return genECDSAKeyPair(random);
|
||||
}
|
||||
|
||||
public static KeyPair genECDSAKeyPair(SecureRandom random) {
|
||||
try {
|
||||
KeyPairGenerator generator = KeyPairGenerator.getInstance(EC_ALGO);
|
||||
|
@ -409,16 +404,6 @@ public static String toHex(byte[] bytes) {
|
|||
return new String(hex);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ECPublicKey toPublicECKey(byte[] bytes) throws InvalidKeySpecException {
|
||||
return toPublicECDSAKey(bytes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static ECPrivateKey toPrivateECKey(byte[] bytes) throws InvalidKeySpecException {
|
||||
return toPrivateECDSAKey(bytes);
|
||||
}
|
||||
|
||||
public static ECPublicKey toPublicECDSAKey(byte[] bytes) throws InvalidKeySpecException {
|
||||
return (ECPublicKey) newECDSAKeyFactory().generatePublic(new X509EncodedKeySpec(bytes));
|
||||
}
|
||||
|
|
|
@ -267,8 +267,6 @@ public Config getDefaultConfig() {
|
|||
}
|
||||
|
||||
public static final class Config {
|
||||
@Deprecated
|
||||
public String title;
|
||||
public String projectname;
|
||||
public String address;
|
||||
public String serverName;
|
||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit 74a45c7a697d33dbfc15efb0f5fac83055623ae9
|
||||
Subproject commit 66cfe1841a9562ec28e2ed8614a6cc495a261be7
|
Loading…
Reference in a new issue