diff --git a/.idea/misc.xml b/.idea/misc.xml index cd18037..023f70c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -2,6 +2,9 @@ + + + diff --git a/LaunchServer/resources/launchserver/defaults/config.cfg b/LaunchServer/resources/launchserver/defaults/config.cfg index 42c1461..51f768a 100644 --- a/LaunchServer/resources/launchserver/defaults/config.cfg +++ b/LaunchServer/resources/launchserver/defaults/config.cfg @@ -10,7 +10,7 @@ authHandler: "textFile"; authHandlerConfig: { file: "authHandler.cfg"; - md5UUIDs: false; + md5UUIDs: true; }; # Auth provider diff --git a/LaunchServer/source/LaunchServer.java b/LaunchServer/source/LaunchServer.java index c82f419..768fd75 100644 --- a/LaunchServer/source/LaunchServer.java +++ b/LaunchServer/source/LaunchServer.java @@ -114,19 +114,19 @@ // Setup reloadKeyPair(); reloadConfig(); - hashLauncherBinaries(); + syncLauncherBinaries(); // Hash updates dir if (!IOHelper.isDir(UPDATES_DIR)) { Files.createDirectory(UPDATES_DIR); } - hashUpdatesDir(null); + syncUpdatesDir(null); // Hash profiles dir if (!IOHelper.isDir(PROFILES_DIR)) { Files.createDirectory(PROFILES_DIR); } - hashProfilesDir(); + syncProfilesDir(); // Set server socket thread serverSocketHandler = new ServerSocketHandler(this); @@ -193,25 +193,25 @@ } @LauncherAPI - public void hashLauncherBinaries() throws IOException { - LogHelper.info("Hashing launcher binaries"); + public void syncLauncherBinaries() throws IOException { + LogHelper.info("Syncing launcher binaries"); - // Hash launcher binary - LogHelper.subInfo("Hashing launcher binary file"); - if (!launcherBinary.hash()) { + // Syncing launcher binary + LogHelper.subInfo("Syncing launcher binary file"); + if (!launcherBinary.sync()) { LogHelper.subWarning("Missing launcher binary file"); } - // Hash launcher EXE binary - LogHelper.subInfo("Hashing launcher EXE binary file"); - if (!launcherEXEBinary.hash()) { + // Syncing launcher EXE binary + LogHelper.subInfo("Syncing launcher EXE binary file"); + if (!launcherEXEBinary.sync()) { LogHelper.subWarning("Missing launcher EXE binary file"); } } @LauncherAPI - public void hashProfilesDir() throws IOException { - LogHelper.info("Hashing profiles dir"); + public void syncProfilesDir() throws IOException { + LogHelper.info("Syncing profiles dir"); List> newProfies = new LinkedList<>(); IOHelper.walk(PROFILES_DIR, new ProfilesFileVisitor(newProfies), false); @@ -221,8 +221,8 @@ } @LauncherAPI - public void hashUpdatesDir(Collection dirs) throws IOException { - LogHelper.info("Hashing updates dir"); + public void syncUpdatesDir(Collection dirs) throws IOException { + LogHelper.info("Syncing updates dir"); Map> newUpdatesDirMap = new HashMap<>(16); try (DirectoryStream dirStream = Files.newDirectoryStream(UPDATES_DIR)) { for (Path updateDir : dirStream) { @@ -247,7 +247,7 @@ } // Hash and sign update dir - LogHelper.subInfo("Hashing '%s' update dir", name); + LogHelper.subInfo("Syncing '%s' update dir", name); HashedDir updateHDir = new HashedDir(updateDir, null); newUpdatesDirMap.put(name, new SignedObjectHolder<>(updateHDir, privateKey)); } @@ -322,7 +322,7 @@ // Create new launcher EXE binary LauncherBinary newExeBinary = newConfig.launch4J ? new EXEL4JLauncherBinary(this) : new EXELauncherBinary(this); - newExeBinary.hash(); + newExeBinary.sync(); // Apply changes config = newConfig; diff --git a/LaunchServer/source/binary/LauncherBinary.java b/LaunchServer/source/binary/LauncherBinary.java index 0235982..0fa4555 100644 --- a/LaunchServer/source/binary/LauncherBinary.java +++ b/LaunchServer/source/binary/LauncherBinary.java @@ -33,7 +33,7 @@ } @LauncherAPI - public final boolean hash() throws IOException { + public final boolean sync() throws IOException { boolean exists = exists(); binary = exists ? new SignedBytesHolder(IOHelper.read(binaryFile), server.getPrivateKey()) : null; return exists; diff --git a/LaunchServer/source/command/basic/BuildCommand.java b/LaunchServer/source/command/basic/BuildCommand.java index be15084..28f2e79 100644 --- a/LaunchServer/source/command/basic/BuildCommand.java +++ b/LaunchServer/source/command/basic/BuildCommand.java @@ -21,6 +21,6 @@ @Override public void invoke(String... args) throws Exception { server.buildLauncherBinaries(); - server.hashLauncherBinaries(); + server.syncLauncherBinaries(); } } diff --git a/LaunchServer/source/command/handler/CommandHandler.java b/LaunchServer/source/command/handler/CommandHandler.java index 0f31ebb..808fdc1 100644 --- a/LaunchServer/source/command/handler/CommandHandler.java +++ b/LaunchServer/source/command/handler/CommandHandler.java @@ -34,10 +34,10 @@ import launchserver.command.basic.VersionCommand; import launchserver.command.hash.DownloadAssetCommand; import launchserver.command.hash.DownloadClientCommand; -import launchserver.command.hash.HashBinariesCommand; -import launchserver.command.hash.HashProfilesCommand; -import launchserver.command.hash.HashUpdatesCommand; import launchserver.command.hash.IndexAssetCommand; +import launchserver.command.hash.SyncBinariesCommand; +import launchserver.command.hash.SyncProfilesCommand; +import launchserver.command.hash.SyncUpdatesCommand; import launchserver.command.hash.UnindexAssetCommand; public abstract class CommandHandler implements Runnable { @@ -57,14 +57,14 @@ register("clear", new ClearCommand(server)); register("gc", new GCCommand(server)); - // Register hash commands + // Register sync commands register("indexAsset", new IndexAssetCommand(server)); register("unindexAsset", new UnindexAssetCommand(server)); register("downloadAsset", new DownloadAssetCommand(server)); register("downloadClient", new DownloadClientCommand(server)); - register("hashBinaries", new HashBinariesCommand(server)); - register("hashUpdates", new HashUpdatesCommand(server)); - register("hashProfiles", new HashProfilesCommand(server)); + register("syncBinaries", new SyncBinariesCommand(server)); + register("syncUpdates", new SyncUpdatesCommand(server)); + register("syncProfiles", new SyncProfilesCommand(server)); // Register auth commands register("auth", new AuthCommand(server)); diff --git a/LaunchServer/source/command/hash/DownloadAssetCommand.java b/LaunchServer/source/command/hash/DownloadAssetCommand.java index 26ee5bb..1a463cc 100644 --- a/LaunchServer/source/command/hash/DownloadAssetCommand.java +++ b/LaunchServer/source/command/hash/DownloadAssetCommand.java @@ -47,7 +47,7 @@ unpack(new URL(String.format(ASSET_URL_MASK, version.name)), assetDir); // Finished - server.hashUpdatesDir(Collections.singleton(dirName)); + server.syncUpdatesDir(Collections.singleton(dirName)); LogHelper.subInfo("Asset successfully downloaded: '%s'", dirName); } diff --git a/LaunchServer/source/command/hash/DownloadClientCommand.java b/LaunchServer/source/command/hash/DownloadClientCommand.java index b322906..2240d0a 100644 --- a/LaunchServer/source/command/hash/DownloadClientCommand.java +++ b/LaunchServer/source/command/hash/DownloadClientCommand.java @@ -64,8 +64,8 @@ } // Finished - server.hashProfilesDir(); - server.hashUpdatesDir(Collections.singleton(dirName)); + server.syncProfilesDir(); + server.syncUpdatesDir(Collections.singleton(dirName)); LogHelper.subInfo("Client successfully downloaded: '%s'", dirName); } } diff --git a/LaunchServer/source/command/hash/HashBinariesCommand.java b/LaunchServer/source/command/hash/HashBinariesCommand.java deleted file mode 100644 index 186e7e0..0000000 --- a/LaunchServer/source/command/hash/HashBinariesCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package launchserver.command.hash; - -import java.io.IOException; - -import launcher.helper.LogHelper; -import launchserver.LaunchServer; -import launchserver.command.Command; - -public final class HashBinariesCommand extends Command { - public HashBinariesCommand(LaunchServer server) { - super(server); - } - - @Override - public String getArgsDescription() { - return null; - } - - @Override - public String getUsageDescription() { - return "Rehash launcher binaries"; - } - - @Override - public void invoke(String... args) throws IOException { - server.hashLauncherBinaries(); - LogHelper.subInfo("Binaries successfully rehashed"); - } -} diff --git a/LaunchServer/source/command/hash/HashProfilesCommand.java b/LaunchServer/source/command/hash/HashProfilesCommand.java deleted file mode 100644 index 011178c..0000000 --- a/LaunchServer/source/command/hash/HashProfilesCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package launchserver.command.hash; - -import java.io.IOException; - -import launcher.helper.LogHelper; -import launchserver.LaunchServer; -import launchserver.command.Command; - -public final class HashProfilesCommand extends Command { - public HashProfilesCommand(LaunchServer server) { - super(server); - } - - @Override - public String getArgsDescription() { - return null; - } - - @Override - public String getUsageDescription() { - return "Rehash profiles dir"; - } - - @Override - public void invoke(String... args) throws IOException { - server.hashProfilesDir(); - LogHelper.subInfo("Profiles successfully rehashed"); - } -} diff --git a/LaunchServer/source/command/hash/HashUpdatesCommand.java b/LaunchServer/source/command/hash/HashUpdatesCommand.java deleted file mode 100644 index 938cc77..0000000 --- a/LaunchServer/source/command/hash/HashUpdatesCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package launchserver.command.hash; - -import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import launcher.helper.LogHelper; -import launchserver.LaunchServer; -import launchserver.command.Command; - -public final class HashUpdatesCommand extends Command { - public HashUpdatesCommand(LaunchServer server) { - super(server); - } - - @Override - public String getArgsDescription() { - return "[subdirs...]"; - } - - @Override - public String getUsageDescription() { - return "Rehash updates dir"; - } - - @Override - public void invoke(String... args) throws IOException { - Set dirs = null; - if (args.length > 0) { // Hash all updates dirs - dirs = new HashSet<>(args.length); - Collections.addAll(dirs, args); - } - - // Hash updates dir - server.hashUpdatesDir(dirs); - LogHelper.subInfo("Updates dir successfully rehashed"); - } -} diff --git a/LaunchServer/source/command/hash/IndexAssetCommand.java b/LaunchServer/source/command/hash/IndexAssetCommand.java index b0bbced..79906e8 100644 --- a/LaunchServer/source/command/hash/IndexAssetCommand.java +++ b/LaunchServer/source/command/hash/IndexAssetCommand.java @@ -68,7 +68,7 @@ } // Finished - server.hashUpdatesDir(Collections.singleton(outputAssetDirName)); + server.syncUpdatesDir(Collections.singleton(outputAssetDirName)); LogHelper.subInfo("Asset successfully indexed: '%s'", inputAssetDirName); } diff --git a/LaunchServer/source/command/hash/SyncBinariesCommand.java b/LaunchServer/source/command/hash/SyncBinariesCommand.java new file mode 100644 index 0000000..62c3089 --- /dev/null +++ b/LaunchServer/source/command/hash/SyncBinariesCommand.java @@ -0,0 +1,29 @@ +package launchserver.command.hash; + +import java.io.IOException; + +import launcher.helper.LogHelper; +import launchserver.LaunchServer; +import launchserver.command.Command; + +public final class SyncBinariesCommand extends Command { + public SyncBinariesCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return null; + } + + @Override + public String getUsageDescription() { + return "Resync launcher binaries"; + } + + @Override + public void invoke(String... args) throws IOException { + server.syncLauncherBinaries(); + LogHelper.subInfo("Binaries successfully resynced"); + } +} diff --git a/LaunchServer/source/command/hash/SyncProfilesCommand.java b/LaunchServer/source/command/hash/SyncProfilesCommand.java new file mode 100644 index 0000000..25de620 --- /dev/null +++ b/LaunchServer/source/command/hash/SyncProfilesCommand.java @@ -0,0 +1,29 @@ +package launchserver.command.hash; + +import java.io.IOException; + +import launcher.helper.LogHelper; +import launchserver.LaunchServer; +import launchserver.command.Command; + +public final class SyncProfilesCommand extends Command { + public SyncProfilesCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return null; + } + + @Override + public String getUsageDescription() { + return "Resync profiles dir"; + } + + @Override + public void invoke(String... args) throws IOException { + server.syncProfilesDir(); + LogHelper.subInfo("Profiles successfully resynced"); + } +} diff --git a/LaunchServer/source/command/hash/SyncUpdatesCommand.java b/LaunchServer/source/command/hash/SyncUpdatesCommand.java new file mode 100644 index 0000000..ff2ebdc --- /dev/null +++ b/LaunchServer/source/command/hash/SyncUpdatesCommand.java @@ -0,0 +1,39 @@ +package launchserver.command.hash; + +import java.io.IOException; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import launcher.helper.LogHelper; +import launchserver.LaunchServer; +import launchserver.command.Command; + +public final class SyncUpdatesCommand extends Command { + public SyncUpdatesCommand(LaunchServer server) { + super(server); + } + + @Override + public String getArgsDescription() { + return "[subdirs...]"; + } + + @Override + public String getUsageDescription() { + return "Resync updates dir"; + } + + @Override + public void invoke(String... args) throws IOException { + Set dirs = null; + if (args.length > 0) { // Hash all updates dirs + dirs = new HashSet<>(args.length); + Collections.addAll(dirs, args); + } + + // Hash updates dir + server.syncUpdatesDir(dirs); + LogHelper.subInfo("Updates dir successfully resynced"); + } +} diff --git a/LaunchServer/source/command/hash/UnindexAssetCommand.java b/LaunchServer/source/command/hash/UnindexAssetCommand.java index d2ca90b..e49b74e 100644 --- a/LaunchServer/source/command/hash/UnindexAssetCommand.java +++ b/LaunchServer/source/command/hash/UnindexAssetCommand.java @@ -66,7 +66,7 @@ } // Finished - server.hashUpdatesDir(Collections.singleton(outputAssetDirName)); + server.syncUpdatesDir(Collections.singleton(outputAssetDirName)); LogHelper.subInfo("Asset successfully unindexed: '%s'", inputAssetDirName); } } diff --git a/LaunchServer/source/response/PingResponse.java b/LaunchServer/source/response/PingResponse.java index 6fa5fba..1a35844 100644 --- a/LaunchServer/source/response/PingResponse.java +++ b/LaunchServer/source/response/PingResponse.java @@ -2,6 +2,7 @@ import java.io.IOException; +import launcher.request.PingRequest; import launcher.serialize.HInput; import launcher.serialize.HOutput; import launchserver.LaunchServer; @@ -13,6 +14,6 @@ @Override public void reply() throws IOException { - output.writeUnsignedByte(123); + output.writeUnsignedByte(PingRequest.EXPECTED_BYTE); } -} \ No newline at end of file +} diff --git a/Launcher/runtime/dialog/overlay/debug/debug.fxml b/Launcher/runtime/dialog/overlay/debug/debug.fxml index f03c5b8..29a93a1 100755 --- a/Launcher/runtime/dialog/overlay/debug/debug.fxml +++ b/Launcher/runtime/dialog/overlay/debug/debug.fxml @@ -5,13 +5,13 @@ - + -