diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/IndexAssetCommand.java b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/IndexAssetCommand.java index 5878a49a..d7a24294 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/IndexAssetCommand.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/command/hash/IndexAssetCommand.java @@ -12,6 +12,7 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.CommandException; @@ -35,11 +36,11 @@ public IndexObject(long size, String hash) { } private static final class IndexAssetVisitor extends SimpleFileVisitor { - private final JsonArray objects; + private final JsonObject objects; private final Path inputAssetDir; private final Path outputAssetDir; - private IndexAssetVisitor(JsonArray objects, Path inputAssetDir, Path outputAssetDir) { + private IndexAssetVisitor(JsonObject objects, Path inputAssetDir, Path outputAssetDir) { this.objects = objects; this.inputAssetDir = inputAssetDir; this.outputAssetDir = outputAssetDir; @@ -53,7 +54,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO // Add to index and copy file String digest = SecurityHelper.toHex(SecurityHelper.digest(DigestAlgorithm.SHA1, file)); IndexObject obj = new IndexObject(attrs.size(), digest); - objects.add(gson.toJsonTree(obj)); + objects.add(name, gson.toJsonTree(obj)); IOHelper.copy(file, resolveObjectFile(outputAssetDir, digest)); // Continue visiting @@ -106,7 +107,7 @@ public void invoke(String... args) throws Exception { Files.createDirectory(outputAssetDir); // Index objects - JsonArray objects = new JsonArray(); + JsonObject objects = new JsonObject(); LogHelper.subInfo("Indexing objects"); IOHelper.walk(inputAssetDir, new IndexAssetVisitor(objects, inputAssetDir, outputAssetDir), false); @@ -114,7 +115,9 @@ public void invoke(String... args) throws Exception { LogHelper.subInfo("Writing asset index file: '%s'", indexFileName); try (BufferedWriter writer = IOHelper.newWriter(resolveIndexFile(outputAssetDir, indexFileName))) { - writer.write(gson.toJson(objects)); + JsonObject result = new JsonObject(); + result.add("objects",objects); + writer.write(gson.toJson(result)); } // Finished diff --git a/Launcher/runtime/config.js b/Launcher/runtime/config.js index 9d8062d0..d31c1aa1 100644 --- a/Launcher/runtime/config.js +++ b/Launcher/runtime/config.js @@ -28,17 +28,3 @@ DirBridge.defaultUpdatesDir = DirBridge.dir.resolve("updates"); if (!IOHelper.isDir(DirBridge.defaultUpdatesDir)) { java.nio.file.Files.createDirectory(DirBridge.defaultUpdatesDir); } - -//====== SERVERS CONFIG ====== // -var serversConfig = { - defaults: { - // Лозунг сервера - description: "Мир в котором возможно все" - }, - getServerProperty: function(profile, property){ - if(serversConfig[profile]==null || serversConfig[profile][property]==null){ - return serversConfig.defaults[property]; - } - return serversConfig[profile][property]; - } -};