From 4bd84728f39ce7df73b93077ed9e8afa0e5c3e4b Mon Sep 17 00:00:00 2001 From: Gravita Date: Wed, 22 Sep 2021 13:06:45 +0700 Subject: [PATCH] [REFACTOR] Remove deprecated methods --- .../pro/gravit/launchserver/LaunchServer.java | 25 ---- .../launchserver/binary/BuildContext.java | 31 ----- .../command/hash/SaveProfilesCommand.java | 42 ------- .../command/service/SecurityCheckCommand.java | 6 - .../launchserver/components/Component.java | 10 -- .../config/LaunchServerConfig.java | 2 - .../launchserver/manangers/AuthManager.java | 9 -- .../manangers/CertificateManager.java | 107 +----------------- .../manangers/SessionManager.java | 27 ----- .../impl/LaunchServerModulesManager.java | 21 ---- .../gravit/launchserver/socket/Client.java | 6 - .../handlers/NettyServerSocketHandler.java | 2 - .../socket/response/auth/AuthResponse.java | 4 - .../profile/ProfileByUUIDResponse.java | 26 ----- .../gravit/launcher/ClientPermissions.java | 6 - .../pro/gravit/launcher/LauncherConfig.java | 28 ----- .../GetAvailabilityAuthRequestEvent.java | 31 ----- .../modules/impl/SimpleModuleManager.java | 20 ---- .../launcher/profiles/ClientProfile.java | 13 --- .../launcher/profiles/PlayerProfile.java | 30 +---- .../pro/gravit/launcher/profiles/Texture.java | 9 -- .../profiles/optional/OptionalDepend.java | 3 - .../profiles/optional/OptionalFile.java | 104 ----------------- .../profiles/optional/OptionalTrigger.java | 99 ---------------- .../profiles/optional/OptionalType.java | 15 --- .../profiles/optional/OptionalView.java | 52 +-------- .../launcher/request/auth/AuthRequest.java | 33 ------ .../request/auth/password/AuthECPassword.java | 19 ---- .../gravit/launcher/LauncherTrustManager.java | 33 ------ .../pro/gravit/launcher/hasher/HashedDir.java | 35 ------ .../pro/gravit/utils/helper/LogHelper.java | 11 -- .../gravit/utils/helper/SecurityHelper.java | 15 --- .../gravit/launcher/server/ServerWrapper.java | 2 - modules | 2 +- 34 files changed, 5 insertions(+), 873 deletions(-) delete mode 100644 LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalTrigger.java delete mode 100644 LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalType.java delete mode 100644 LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/password/AuthECPassword.java diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index 5213b609..58bbec6a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -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 updatesDirMap; // Updates and profiles private volatile Set 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 profilesList) { this.profilesList = Collections.unmodifiableSet(profilesList); } - @Deprecated - public HashedDir getUpdateDir(String name) { - return updatesDirMap.get(name); - } - - @Deprecated - public Set> getUpdateDirs() { - return updatesDirMap.entrySet(); - } - public void rebindNettyServerSocket() { nettyServerSocketHandler.close(); CommonHelper.newThread("Netty Server Socket Thread", false, nettyServerSocketHandler).start(); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java index cbe7228f..bab1cb87 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java @@ -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 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 filter, Predicate needTransform) throws IOException { pushJarFile(jarfile.toUri().toURL(), filter, needTransform); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java index b8ba4656..151011ba 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java @@ -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); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java index 108f64e9..486cc769 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/SecurityCheckCommand.java @@ -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 "[]"; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java b/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java index 01b07b99..e7720f4c 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/components/Component.java @@ -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) { - - } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java index 5f69cb41..a44831dd 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/config/LaunchServerConfig.java @@ -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; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java index 8ecf5deb..c5943f58 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java @@ -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 diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/CertificateManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/CertificateManager.java index 64aaa074..51f63436 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/CertificateManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/CertificateManager.java @@ -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); diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java index 6dd75418..3a4dd648 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/SessionManager.java @@ -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 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 getSessions() { - throw new UnsupportedOperationException(); - } - - @Deprecated - public void loadSessions(Set set) { - throw new UnsupportedOperationException(); - //clientSet.putAll(set.stream().collect(Collectors.toMap(c -> c.session, Function.identity()))); - } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerModulesManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerModulesManager.java index c770a883..daa4b592 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerModulesManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerModulesManager.java @@ -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 getModules() { return Collections.unmodifiableList(modules); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java index e99eb110..4ce6a1ad 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/Client.java @@ -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; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java index a5a97fa4..d01b2e84 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/NettyServerSocketHandler.java @@ -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; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java index e115624e..ffc9ab88 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/auth/AuthResponse.java @@ -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; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/profile/ProfileByUUIDResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/profile/ProfileByUUIDResponse.java index c80b62c5..50ec6978 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/profile/ProfileByUUIDResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/profile/ProfileByUUIDResponse.java @@ -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"; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/ClientPermissions.java b/LauncherAPI/src/main/java/pro/gravit/launcher/ClientPermissions.java index 9b063f55..cdf2d3a7 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/ClientPermissions.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/ClientPermissions.java @@ -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; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java index 5e5be0a6..f613b4eb 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/LauncherConfig.java @@ -32,8 +32,6 @@ public final class LauncherConfig extends StreamObject { public final ECPublicKey ecdsaPublicKey; public final RSAPublicKey rsaPublicKey; public final Map 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 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 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 runtime, String projec this.ecdsaPublicKey = null; environment = env; guardType = "no"; - isWarningMissArchJava = true; secureCheckSalt = null; secureCheckHash = null; passwordEncryptKey = null; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java index bfa10a20..930ec3f9 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/events/request/GetAvailabilityAuthRequestEvent.java @@ -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 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 - } } } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java index 529d73d5..773e2f72 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java @@ -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 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 clazz) { if (trustManager == null) return null; X509Certificate[] certificates = getCertificates(clazz); diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java index 36eee3c0..903eb757 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/ClientProfile.java @@ -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; } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/PlayerProfile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/PlayerProfile.java index dea6e001..115500b7 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/PlayerProfile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/PlayerProfile.java @@ -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); - } - } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/Texture.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/Texture.java index be27ffd5..83ae980f 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/Texture.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/Texture.java @@ -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 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); diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalDepend.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalDepend.java index b8e934f7..c5acde22 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalDepend.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalDepend.java @@ -5,7 +5,4 @@ public class OptionalDepend { @LauncherNetworkAPI public String name; - @Deprecated - @LauncherNetworkAPI - public OptionalType type; } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java index a5bca12e..d708a15e 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalFile.java @@ -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 actions; @LauncherNetworkAPI @@ -37,9 +20,6 @@ public class OptionalFile { @LauncherNetworkAPI public List 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 dependenciesCount; - @Deprecated - private volatile transient Collection> 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 watcher) { - if (watchList == null) watchList = ConcurrentHashMap.newKeySet(); - watchList.add(watcher); - } - - @Deprecated - public void removeWatcher(BiConsumer 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)); - } } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalTrigger.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalTrigger.java deleted file mode 100644 index bab150ba..00000000 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalTrigger.java +++ /dev/null @@ -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 - } -} diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalType.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalType.java deleted file mode 100644 index 5e1be92d..00000000 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalType.java +++ /dev/null @@ -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 -} diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java index 835b151b..11a6afae 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/profiles/optional/OptionalView.java @@ -11,21 +11,18 @@ public class OptionalView { public Set enabled = new HashSet<>(); - @Deprecated - public Map> dependenciesCountMap = new HashMap<>(); public Map installInfo = new HashMap<>(); public Set 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 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 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 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 callback) { if (enabled.contains(file)) return; enabled.add(file); @@ -128,7 +80,7 @@ public void enable(OptionalFile file, boolean manual, BiConsumer implements WebSocketRequest { public static final ProviderMap providers = new ProviderMap<>(); @@ -22,33 +21,6 @@ public final class AuthRequest extends Request 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 diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/password/AuthECPassword.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/password/AuthECPassword.java deleted file mode 100644 index d353f531..00000000 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/auth/password/AuthECPassword.java +++ /dev/null @@ -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; - } -} diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java index 5d47c913..421b6a75 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java @@ -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; } diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java b/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java index 22ab3401..71b28e17 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/hasher/HashedDir.java @@ -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 dirs = new LinkedList<>(); - StringTokenizer t = new StringTokenizer(name, "/"); - while (t.hasMoreTokens()) { - dirs.add(t.nextToken()); - } - Map 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); diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/LogHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/LogHelper.java index 065b138a..c5f2580a 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/LogHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/LogHelper.java @@ -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 { diff --git a/LauncherCore/src/main/java/pro/gravit/utils/helper/SecurityHelper.java b/LauncherCore/src/main/java/pro/gravit/utils/helper/SecurityHelper.java index cd568982..091c1862 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/helper/SecurityHelper.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/helper/SecurityHelper.java @@ -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)); } diff --git a/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java b/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java index eb604801..c287f42d 100644 --- a/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/ServerWrapper.java @@ -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; diff --git a/modules b/modules index 74a45c7a..66cfe184 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 74a45c7a697d33dbfc15efb0f5fac83055623ae9 +Subproject commit 66cfe1841a9562ec28e2ed8614a6cc495a261be7