This commit is contained in:
parent
aae97feeca
commit
787833f732
@ -9,16 +9,6 @@ allprojects {
|
|||||||
group = "io.gitlab.jfronny.inceptum"
|
group = "io.gitlab.jfronny.inceptum"
|
||||||
}
|
}
|
||||||
|
|
||||||
// common
|
|
||||||
val jfCommonsVersion by extra(libs.versions.jf.commons.get())
|
|
||||||
val gsonCompileVersion by extra(libs.versions.gson.compile.get())
|
|
||||||
val jbAnnotationsVersion by extra(libs.versions.annotations.get())
|
|
||||||
// launcher-imgui
|
|
||||||
val lwjglVersion by extra(libs.versions.lwjgl.get())
|
|
||||||
val imguiVersion by extra(libs.versions.imgui.get())
|
|
||||||
// launcher-gtk
|
|
||||||
val javagiVersion by extra(libs.versions.javagi.get())
|
|
||||||
|
|
||||||
val flavorProp: String by extra(prop("flavor", "custom"))
|
val flavorProp: String by extra(prop("flavor", "custom"))
|
||||||
if (!setOf("custom", "maven", "fat", "windows", "linux", "macos").contains(flavorProp)) throw IllegalStateException("Unsupported flavor: $flavorProp")
|
if (!setOf("custom", "maven", "fat", "windows", "linux", "macos").contains(flavorProp)) throw IllegalStateException("Unsupported flavor: $flavorProp")
|
||||||
val flavor: String by extra(if (flavorProp != "custom") flavorProp else OS.TYPE.codename)
|
val flavor: String by extra(if (flavorProp != "custom") flavorProp else OS.TYPE.codename)
|
||||||
@ -28,6 +18,8 @@ val isRelease by extra(project.hasProperty("release"))
|
|||||||
val buildTime by extra(System.currentTimeMillis())
|
val buildTime by extra(System.currentTimeMillis())
|
||||||
val wrapperVersion by extra(1)
|
val wrapperVersion by extra(1)
|
||||||
|
|
||||||
|
val lwjglVersion = libs.versions.lwjgl.get()
|
||||||
|
val imguiVersion = libs.versions.imgui.get()
|
||||||
tasks.register("exportMetadata") {
|
tasks.register("exportMetadata") {
|
||||||
doLast {
|
doLast {
|
||||||
projectDir.resolve("version.json").writeText(
|
projectDir.resolve("version.json").writeText(
|
||||||
|
@ -4,11 +4,10 @@ plugins {
|
|||||||
|
|
||||||
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.findLibrary("gson-compile-core").orElseThrow())
|
compileOnly(libs.findLibrary("commons-serialize-generator-annotations").orElseThrow())
|
||||||
compileOnly(libs.findLibrary("gson-compile-annotations").orElseThrow())
|
annotationProcessor(libs.findLibrary("commons-serialize-generator").orElseThrow())
|
||||||
annotationProcessor(libs.findLibrary("gson-compile-processor").orElseThrow())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile> {
|
||||||
options.compilerArgs.add("-AgsonCompileNoReflect")
|
options.compilerArgs.addAll(listOf("-AserializeProcessorNoReflect"))
|
||||||
}
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package io.gitlab.jfronny.inceptum.common;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.Token;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonWriter;
|
||||||
|
import io.gitlab.jfronny.commons.throwable.ThrowingBiConsumer;
|
||||||
|
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GList {
|
||||||
|
public static <T, TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> List<T> read(Reader reader, ThrowingFunction<Reader, T, TEx> read) throws TEx {
|
||||||
|
if (reader.isLenient() && reader.peek() != Token.BEGIN_ARRAY) return List.of(read.apply(reader));
|
||||||
|
reader.beginArray();
|
||||||
|
List<T> res = new LinkedList<>();
|
||||||
|
while (reader.hasNext()) {
|
||||||
|
if (reader.peek() == Token.NULL) {
|
||||||
|
reader.nextNull();
|
||||||
|
res.add(null);
|
||||||
|
} else res.add(read.apply(reader));
|
||||||
|
}
|
||||||
|
reader.endArray();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> void write(JsonWriter writer, List<T> list, ThrowingBiConsumer<T, JsonWriter, IOException> write) throws IOException {
|
||||||
|
writer.beginArray();
|
||||||
|
for (T t : list) write.accept(t, writer);
|
||||||
|
writer.endArray();
|
||||||
|
}
|
||||||
|
}
|
@ -1,34 +1,76 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common;
|
package io.gitlab.jfronny.inceptum.common;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonTransport;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonWriter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
public class GsonPreset {
|
public class GsonPreset {
|
||||||
public static class Config {
|
public static Config CONFIG = new Config();
|
||||||
public static void configure(JsonReader reader) {
|
public static Api API = new Api();
|
||||||
|
|
||||||
|
public static class Config extends JsonTransport {
|
||||||
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> void configure(Reader reader) {
|
||||||
reader.setSerializeSpecialFloatingPointValues(true);
|
reader.setSerializeSpecialFloatingPointValues(true);
|
||||||
reader.setLenient(true);
|
reader.setLenient(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void configure(JsonWriter writer) {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void configure(Writer writer) {
|
||||||
writer.setSerializeNulls(true);
|
writer.setSerializeNulls(true);
|
||||||
writer.setSerializeSpecialFloatingPointValues(true);
|
writer.setSerializeSpecialFloatingPointValues(true);
|
||||||
writer.setLenient(true);
|
writer.setLenient(true);
|
||||||
writer.setIndent(" ");
|
if (writer instanceof JsonWriter jw) {
|
||||||
writer.setOmitQuotes(true);
|
jw.setIndent(" ");
|
||||||
|
jw.setOmitQuotes(true);
|
||||||
|
jw.setNewline("\n");
|
||||||
|
jw.setCommentUnexpectedNames(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Api {
|
@Override
|
||||||
public static void configure(JsonReader reader) {
|
public JsonWriter createWriter(Writer target) throws IOException {
|
||||||
|
JsonWriter jw = super.createWriter(target);
|
||||||
|
configure(jw);
|
||||||
|
return jw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonReader createReader(Reader source) {
|
||||||
|
JsonReader jr = super.createReader(source);
|
||||||
|
configure(jr);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Api extends JsonTransport {
|
||||||
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> void configure(Reader reader) {
|
||||||
reader.setSerializeSpecialFloatingPointValues(true);
|
reader.setSerializeSpecialFloatingPointValues(true);
|
||||||
reader.setLenient(true);
|
reader.setLenient(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void configure(JsonWriter writer) {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void configure(Writer writer) {
|
||||||
writer.setSerializeNulls(false);
|
writer.setSerializeNulls(false);
|
||||||
writer.setSerializeSpecialFloatingPointValues(true);
|
writer.setSerializeSpecialFloatingPointValues(true);
|
||||||
writer.setLenient(false);
|
writer.setLenient(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonWriter createWriter(Writer target) throws IOException {
|
||||||
|
JsonWriter jw = super.createWriter(target);
|
||||||
|
configure(jw);
|
||||||
|
return jw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonReader createReader(Reader source) {
|
||||||
|
JsonReader jr = super.createReader(source);
|
||||||
|
configure(jr);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common;
|
package io.gitlab.jfronny.inceptum.common;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GComment;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GComment;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.model.inceptum.UpdateChannel;
|
import io.gitlab.jfronny.inceptum.common.model.inceptum.UpdateChannel;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Config.class, isStatic = true)
|
@GSerializable(isStatic = true)
|
||||||
public class InceptumConfig {
|
public class InceptumConfig {
|
||||||
@GComment("Whether to show snapshots in the version selector for new instances")
|
@GComment("Whether to show snapshots in the version selector for new instances")
|
||||||
public static boolean snapshots = false;
|
public static boolean snapshots = false;
|
||||||
@ -41,12 +41,12 @@ public class InceptumConfig {
|
|||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GC_InceptumConfig.read(MetaHolder.CONFIG_PATH);
|
GC_InceptumConfig.deserialize(MetaHolder.CONFIG_PATH, GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveConfig() {
|
public static void saveConfig() {
|
||||||
try {
|
try {
|
||||||
GC_InceptumConfig.write(MetaHolder.CONFIG_PATH);
|
GC_InceptumConfig.serialize(MetaHolder.CONFIG_PATH, GsonPreset.CONFIG);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Utils.LOGGER.error("Could not save config", e);
|
Utils.LOGGER.error("Could not save config", e);
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common;
|
package io.gitlab.jfronny.inceptum.common;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.commons.logging.Logger;
|
import io.gitlab.jfronny.commons.logger.HotswapLoggerFinder;
|
||||||
import io.gitlab.jfronny.commons.logging.StdoutLogger;
|
import io.gitlab.jfronny.commons.logger.StdoutLogger;
|
||||||
|
import io.gitlab.jfronny.commons.logger.SystemLoggerPlus;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class InceptumEnvironmentInitializer {
|
public class InceptumEnvironmentInitializer {
|
||||||
public static void initialize() throws IOException {
|
public static void initialize() throws IOException {
|
||||||
Logger.registerFactory(InceptumEnvironmentInitializer::defaultFactory);
|
HotswapLoggerFinder.updateAllStrategies(InceptumEnvironmentInitializer::defaultFactory);
|
||||||
HttpClient.setUserAgent("jfmods/inceptum/" + BuildMetadata.VERSION);
|
HttpClient.setUserAgent("jfmods/inceptum/" + BuildMetadata.VERSION);
|
||||||
InceptumConfig.load();
|
InceptumConfig.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Logger defaultFactory(String name) {
|
public static SystemLoggerPlus defaultFactory(String name, Module module, System.Logger.Level level) {
|
||||||
return StdoutLogger.fancy(name);
|
return StdoutLogger.fancy(name, module, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package io.gitlab.jfronny.inceptum.common;
|
|||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
import io.gitlab.jfronny.commons.io.HashUtils;
|
import io.gitlab.jfronny.commons.io.HashUtils;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonTransport;
|
||||||
|
import io.gitlab.jfronny.commons.throwable.ThrowingBiFunction;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingSupplier;
|
import io.gitlab.jfronny.commons.throwable.ThrowingSupplier;
|
||||||
|
|
||||||
@ -34,22 +37,42 @@ public class Net {
|
|||||||
return downloadObject(url, func, true);
|
return downloadObject(url, func, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, ThrowingFunction<JsonReader, T, IOException> func) throws IOException {
|
||||||
|
return downloadJObject(url, func, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> T downloadObject(String url, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
public static <T> T downloadObject(String url, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
||||||
return downloadObject(url, () -> HttpClient.get(url).sendString(), func, cache);
|
return downloadObject(url, () -> HttpClient.get(url).sendString(), func, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, ThrowingFunction<JsonReader, T, IOException> func, boolean cache) throws IOException {
|
||||||
|
return downloadJObject(url, () -> HttpClient.get(url).sendString(), func, cache);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> T downloadObject(String url, ThrowingFunction<String, T, IOException> func, String apiKey) throws IOException {
|
public static <T> T downloadObject(String url, ThrowingFunction<String, T, IOException> func, String apiKey) throws IOException {
|
||||||
return downloadObject(url, () -> downloadStringAuthenticated(url, apiKey), func, true);
|
return downloadObject(url, () -> downloadStringAuthenticated(url, apiKey), func, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, ThrowingFunction<JsonReader, T, IOException> func, String apiKey) throws IOException {
|
||||||
|
return downloadJObject(url, () -> downloadStringAuthenticated(url, apiKey), func, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> T downloadObject(String url, String sha1, ThrowingFunction<String, T, IOException> func) throws IOException {
|
public static <T> T downloadObject(String url, String sha1, ThrowingFunction<String, T, IOException> func) throws IOException {
|
||||||
return downloadObject(url, sha1, func, true);
|
return downloadObject(url, sha1, func, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, String sha1, ThrowingFunction<JsonReader, T, IOException> func) throws IOException {
|
||||||
|
return downloadJObject(url, sha1, func, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> T downloadObject(String url, String sha1, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
public static <T> T downloadObject(String url, String sha1, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
||||||
return downloadObject(url, () -> downloadString(url, sha1), func, cache);
|
return downloadObject(url, () -> downloadString(url, sha1), func, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, String sha1, ThrowingFunction<JsonReader, T, IOException> func, boolean cache) throws IOException {
|
||||||
|
return downloadJObject(url, () -> downloadString(url, sha1), func, cache);
|
||||||
|
}
|
||||||
|
|
||||||
private static <T> T downloadObject(String url, ThrowingSupplier<String, Exception> sourceString, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
private static <T> T downloadObject(String url, ThrowingSupplier<String, Exception> sourceString, ThrowingFunction<String, T, IOException> func, boolean cache) throws IOException {
|
||||||
try {
|
try {
|
||||||
ThrowingSupplier<T, Exception> builder = () -> func.apply(sourceString.get());
|
ThrowingSupplier<T, Exception> builder = () -> func.apply(sourceString.get());
|
||||||
@ -59,6 +82,10 @@ public class Net {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T downloadJObject(String url, ThrowingSupplier<String, Exception> sourceString, ThrowingFunction<JsonReader, T, IOException> func, boolean cache) throws IOException {
|
||||||
|
return downloadObject(url, sourceString, s -> func.apply(GsonPreset.API.createReader(s)), cache);
|
||||||
|
}
|
||||||
|
|
||||||
public static String buildUrl(String host, String url, Map<String, String> params) {
|
public static String buildUrl(String host, String url, Map<String, String> params) {
|
||||||
StringBuilder res = new StringBuilder(host);
|
StringBuilder res = new StringBuilder(host);
|
||||||
if (res.toString().endsWith("/")) res = new StringBuilder(res.substring(0, res.length() - 1));
|
if (res.toString().endsWith("/")) res = new StringBuilder(res.substring(0, res.length() - 1));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common;
|
package io.gitlab.jfronny.inceptum.common;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.OSUtils;
|
import io.gitlab.jfronny.commons.OSUtils;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonTransport;
|
||||||
import io.gitlab.jfronny.inceptum.common.api.MavenApi;
|
import io.gitlab.jfronny.inceptum.common.api.MavenApi;
|
||||||
import io.gitlab.jfronny.inceptum.common.model.inceptum.*;
|
import io.gitlab.jfronny.inceptum.common.model.inceptum.*;
|
||||||
import io.gitlab.jfronny.inceptum.common.model.maven.*;
|
import io.gitlab.jfronny.inceptum.common.model.maven.*;
|
||||||
@ -53,7 +54,7 @@ public class Updater {
|
|||||||
config.natives().put(Utils.getCurrentFlavor(), natives);
|
config.natives().put(Utils.getCurrentFlavor(), natives);
|
||||||
}
|
}
|
||||||
|
|
||||||
GC_WrapperConfig.write(config, MetaHolder.WRAPPER_CONFIG_PATH);
|
GC_WrapperConfig.serialize(config, MetaHolder.WRAPPER_CONFIG_PATH, GsonPreset.CONFIG);
|
||||||
|
|
||||||
if (relaunch) {
|
if (relaunch) {
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||||
@ -94,7 +95,7 @@ public class Updater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configChanged) GC_WrapperConfig.write(wrapperConfig, MetaHolder.WRAPPER_CONFIG_PATH);
|
if (configChanged) GC_WrapperConfig.serialize(wrapperConfig, MetaHolder.WRAPPER_CONFIG_PATH, GsonPreset.CONFIG);
|
||||||
|
|
||||||
return buildClasspath(Stream.concat(libs.stream(), natives.stream())).toList();
|
return buildClasspath(Stream.concat(libs.stream(), natives.stream())).toList();
|
||||||
}
|
}
|
||||||
@ -141,10 +142,10 @@ public class Updater {
|
|||||||
|
|
||||||
public static @Nullable UpdateMetadata check(UpdateChannel channel, boolean versionCompare, boolean checkEnv, Consumer<UpdateChannel> channelInvalid) throws UpdateCheckException {
|
public static @Nullable UpdateMetadata check(UpdateChannel channel, boolean versionCompare, boolean checkEnv, Consumer<UpdateChannel> channelInvalid) throws UpdateCheckException {
|
||||||
try {
|
try {
|
||||||
UpdateMetadata experimental = Net.downloadObject(ARTIFACTS_URL + "version.json", json -> GC_UpdateMetadata.read(json));
|
UpdateMetadata experimental = Net.downloadObject(ARTIFACTS_URL + "version.json", json -> GC_UpdateMetadata.deserialize(json, GsonPreset.API));
|
||||||
UpdateMetadata stable = null;
|
UpdateMetadata stable = null;
|
||||||
try {
|
try {
|
||||||
stable = Net.downloadObject(STABLE_URL + "version.json", json -> GC_UpdateMetadata.read(json));
|
stable = Net.downloadObject(STABLE_URL + "version.json", json -> GC_UpdateMetadata.deserialize(json, GsonPreset.API));
|
||||||
} catch (Throwable ignored) {}
|
} catch (Throwable ignored) {}
|
||||||
if (stable == null && channel == UpdateChannel.Stable) {
|
if (stable == null && channel == UpdateChannel.Stable) {
|
||||||
channel = UpdateChannel.CI;
|
channel = UpdateChannel.CI;
|
||||||
|
@ -2,7 +2,7 @@ package io.gitlab.jfronny.inceptum.common;
|
|||||||
|
|
||||||
import io.gitlab.jfronny.commons.OSUtils;
|
import io.gitlab.jfronny.commons.OSUtils;
|
||||||
import io.gitlab.jfronny.commons.io.JFiles;
|
import io.gitlab.jfronny.commons.io.JFiles;
|
||||||
import io.gitlab.jfronny.commons.logging.Logger;
|
import io.gitlab.jfronny.commons.logger.SystemLoggerPlus;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -19,7 +19,7 @@ public class Utils {
|
|||||||
public static final int CACHE_SIZE = 128;
|
public static final int CACHE_SIZE = 128;
|
||||||
public static final Pattern NEW_LINE = Pattern.compile("[\r\n]+");
|
public static final Pattern NEW_LINE = Pattern.compile("[\r\n]+");
|
||||||
public static final Pattern VALID_FILENAME = Pattern.compile("[a-zA-Z0-9_\\-.][a-zA-Z0-9 _\\-.]*[a-zA-Z0-9_\\-.]");
|
public static final Pattern VALID_FILENAME = Pattern.compile("[a-zA-Z0-9_\\-.][a-zA-Z0-9 _\\-.]*[a-zA-Z0-9_\\-.]");
|
||||||
public static final Logger LOGGER = Logger.forName("Inceptum");
|
public static final SystemLoggerPlus LOGGER = SystemLoggerPlus.forName("Inceptum");
|
||||||
private static ClassLoader SYSTEM_LOADER = ClassLoader.getSystemClassLoader();
|
private static ClassLoader SYSTEM_LOADER = ClassLoader.getSystemClassLoader();
|
||||||
|
|
||||||
public static void openWebBrowser(URI uri) {
|
public static void openWebBrowser(URI uri) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common.model.inceptum;
|
package io.gitlab.jfronny.inceptum.common.model.inceptum;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record UpdateMetadata(int wrapperVersion,
|
public record UpdateMetadata(int wrapperVersion,
|
||||||
String version,
|
String version,
|
||||||
long buildTime,
|
long buildTime,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package io.gitlab.jfronny.inceptum.common.model.inceptum;
|
package io.gitlab.jfronny.inceptum.common.model.inceptum;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Config.class)
|
@GSerializable
|
||||||
public record WrapperConfig(Set<String> libraries, Set<String> repositories, Map<String, Set<String>> natives) {
|
public record WrapperConfig(Set<String> libraries, Set<String> repositories, Map<String, Set<String>> natives) {
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,11 @@ module io.gitlab.jfronny.inceptum.common {
|
|||||||
requires transitive java.desktop;
|
requires transitive java.desktop;
|
||||||
requires java.xml;
|
requires java.xml;
|
||||||
requires transitive io.gitlab.jfronny.commons;
|
requires transitive io.gitlab.jfronny.commons;
|
||||||
requires transitive io.gitlab.jfronny.commons.gson;
|
|
||||||
requires transitive io.gitlab.jfronny.commons.http.client;
|
requires transitive io.gitlab.jfronny.commons.http.client;
|
||||||
requires transitive io.gitlab.jfronny.commons.io;
|
requires transitive io.gitlab.jfronny.commons.io;
|
||||||
requires transitive io.gitlab.jfronny.commons.logging;
|
requires transitive io.gitlab.jfronny.commons.logger;
|
||||||
requires transitive io.gitlab.jfronny.gson;
|
requires transitive io.gitlab.jfronny.commons.serialize.json;
|
||||||
requires transitive io.gitlab.jfronny.gson.compile.core;
|
|
||||||
requires static org.jetbrains.annotations;
|
requires static org.jetbrains.annotations;
|
||||||
requires static io.gitlab.jfronny.gson.compile.annotations;
|
requires static io.gitlab.jfronny.commons.serialize.generator.annotations;
|
||||||
|
requires io.gitlab.jfronny.commons.serialize;
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
jf-commons = "1.5-SNAPSHOT"
|
jf-commons = "1.7-SNAPSHOT"
|
||||||
gson-compile = "1.4-SNAPSHOT"
|
|
||||||
annotations = "24.0.1"
|
annotations = "24.0.1"
|
||||||
lwjgl = "3.3.2"
|
lwjgl = "3.3.2"
|
||||||
imgui = "1.86.10"
|
imgui = "1.86.10"
|
||||||
@ -36,12 +35,10 @@ commons = { module = "io.gitlab.jfronny:commons", version.ref = "jf-commons" }
|
|||||||
commons-http-client = { module = "io.gitlab.jfronny:commons-http-client", version.ref = "jf-commons" }
|
commons-http-client = { module = "io.gitlab.jfronny:commons-http-client", version.ref = "jf-commons" }
|
||||||
commons-http-server = { module = "io.gitlab.jfronny:commons-http-server", version.ref = "jf-commons" }
|
commons-http-server = { module = "io.gitlab.jfronny:commons-http-server", version.ref = "jf-commons" }
|
||||||
commons-io = { module = "io.gitlab.jfronny:commons-io", version.ref = "jf-commons" }
|
commons-io = { module = "io.gitlab.jfronny:commons-io", version.ref = "jf-commons" }
|
||||||
commons-logging = { module = "io.gitlab.jfronny:commons-logging", version.ref = "jf-commons" }
|
commons-logger = { module = "io.gitlab.jfronny:commons-logger", version.ref = "jf-commons" }
|
||||||
commons-serialize-gson = { module = "io.gitlab.jfronny:commons-serialize-gson", version.ref = "jf-commons" }
|
commons-serialize-json = { module = "io.gitlab.jfronny:commons-serialize-json", version.ref = "jf-commons" }
|
||||||
|
commons-serialize-generator-annotations = { module = "io.gitlab.jfronny:commons-serialize-generator-annotations", version.ref = "jf-commons" }
|
||||||
gson-compile-core = { module = "io.gitlab.jfronny.gson:gson-compile-core", version.ref = "gson-compile" }
|
commons-serialize-generator = { module = "io.gitlab.jfronny:commons-serialize-generator", version.ref = "jf-commons" }
|
||||||
gson-compile-annotations = { module = "io.gitlab.jfronny.gson:gson-compile-annotations", version.ref = "gson-compile" }
|
|
||||||
gson-compile-processor = { module = "io.gitlab.jfronny.gson:gson-compile-processor", version.ref = "gson-compile" }
|
|
||||||
|
|
||||||
annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }
|
annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }
|
||||||
|
|
||||||
@ -49,4 +46,4 @@ annotations = { module = "org.jetbrains:annotations", version.ref = "annotations
|
|||||||
lwjgl = ["lwjgl-core", "lwjgl-glfw", "lwjgl-opengl", "lwjgl-tinyfd"]
|
lwjgl = ["lwjgl-core", "lwjgl-glfw", "lwjgl-opengl", "lwjgl-tinyfd"]
|
||||||
lwjgl-natives = ["lwjgl-core-natives", "lwjgl-glfw-natives", "lwjgl-opengl-natives", "lwjgl-tinyfd-natives"]
|
lwjgl-natives = ["lwjgl-core-natives", "lwjgl-glfw-natives", "lwjgl-opengl-natives", "lwjgl-tinyfd-natives"]
|
||||||
javagi = ["javagi-glib", "javagi-gtk", "javagi-adw"]
|
javagi = ["javagi-glib", "javagi-gtk", "javagi-adw"]
|
||||||
commons = ["commons", "commons-http-client", "commons-io", "commons-logging", "commons-serialize-gson"]
|
commons = ["commons", "commons-http-client", "commons-io", "commons-logger", "commons-serialize-json"]
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.cli;
|
package io.gitlab.jfronny.inceptum.cli;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
||||||
@ -36,7 +37,7 @@ public abstract class BaseInstanceCommand extends Command {
|
|||||||
Instance instance;
|
Instance instance;
|
||||||
Path normalPath = Path.of(args.get(0));
|
Path normalPath = Path.of(args.get(0));
|
||||||
if (Files.exists(normalPath.resolve(Instance.CONFIG_NAME))) {
|
if (Files.exists(normalPath.resolve(Instance.CONFIG_NAME))) {
|
||||||
instance = new Instance(normalPath, GC_InstanceMeta.read(normalPath.resolve(Instance.CONFIG_NAME)));
|
instance = new Instance(normalPath, GC_InstanceMeta.deserialize(normalPath.resolve(Instance.CONFIG_NAME), GsonPreset.CONFIG));
|
||||||
} else {
|
} else {
|
||||||
Path instancePath = MetaHolder.INSTANCE_DIR.resolve(args.get(0)).normalize();
|
Path instancePath = MetaHolder.INSTANCE_DIR.resolve(args.get(0)).normalize();
|
||||||
if (!instancePath.startsWith(MetaHolder.INSTANCE_DIR)) {
|
if (!instancePath.startsWith(MetaHolder.INSTANCE_DIR)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.cli.commands;
|
package io.gitlab.jfronny.inceptum.cli.commands;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.logging.OutputColors;
|
import io.gitlab.jfronny.commons.logger.OutputColors;
|
||||||
import io.gitlab.jfronny.inceptum.cli.Command;
|
import io.gitlab.jfronny.inceptum.cli.Command;
|
||||||
import io.gitlab.jfronny.inceptum.cli.CommandArgs;
|
import io.gitlab.jfronny.inceptum.cli.CommandArgs;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.importer.Importers;
|
import io.gitlab.jfronny.inceptum.launcher.system.importer.Importers;
|
||||||
|
@ -24,7 +24,8 @@ tasks.shadowJar {
|
|||||||
archiveBaseName.set("Inceptum")
|
archiveBaseName.set("Inceptum")
|
||||||
exclude("about.html")
|
exclude("about.html")
|
||||||
exclude("plugin.properties")
|
exclude("plugin.properties")
|
||||||
exclude("META-INF/**")
|
// exclude("META-INF/**")
|
||||||
|
mergeServiceFiles()
|
||||||
}
|
}
|
||||||
|
|
||||||
(components["java"] as AdhocComponentWithVariants).withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
(components["java"] as AdhocComponentWithVariants).withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
||||||
|
@ -16,8 +16,6 @@ samWithReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
val javagiVersion: String by rootProject.extra
|
|
||||||
|
|
||||||
implementation(libs.bundles.javagi)
|
implementation(libs.bundles.javagi)
|
||||||
implementation(projects.launcher)
|
implementation(projects.launcher)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.gtk.util
|
package io.gitlab.jfronny.inceptum.gtk.util
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.logging.Logger
|
import io.gitlab.jfronny.commons.logger.SystemLoggerPlus
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils
|
import io.gitlab.jfronny.inceptum.common.Utils
|
||||||
|
|
||||||
object Log : Logger by Utils.LOGGER
|
object Log : SystemLoggerPlus by Utils.LOGGER
|
@ -10,6 +10,6 @@ module io.gitlab.jfronny.inceptum.launcher.gtk {
|
|||||||
// Should theoretically already be included transitively through inceptum.launcher and inceptum.common
|
// Should theoretically already be included transitively through inceptum.launcher and inceptum.common
|
||||||
requires io.gitlab.jfronny.commons;
|
requires io.gitlab.jfronny.commons;
|
||||||
requires io.gitlab.jfronny.commons.io;
|
requires io.gitlab.jfronny.commons.io;
|
||||||
requires io.gitlab.jfronny.commons.logging;
|
requires io.gitlab.jfronny.commons.logger;
|
||||||
requires java.desktop;
|
requires java.desktop;
|
||||||
}
|
}
|
@ -5,7 +5,9 @@ import imgui.ImGuiIO;
|
|||||||
import imgui.flag.ImGuiConfigFlags;
|
import imgui.flag.ImGuiConfigFlags;
|
||||||
import imgui.gl3.ImGuiImplGl3;
|
import imgui.gl3.ImGuiImplGl3;
|
||||||
import imgui.glfw.ImGuiImplGlfw;
|
import imgui.glfw.ImGuiImplGlfw;
|
||||||
import io.gitlab.jfronny.commons.logging.*;
|
import io.gitlab.jfronny.commons.logger.CompoundLogger;
|
||||||
|
import io.gitlab.jfronny.commons.logger.HotswapLoggerFinder;
|
||||||
|
import io.gitlab.jfronny.commons.logger.MemoryLogger;
|
||||||
import io.gitlab.jfronny.inceptum.common.*;
|
import io.gitlab.jfronny.inceptum.common.*;
|
||||||
import io.gitlab.jfronny.inceptum.common.model.inceptum.UpdateMetadata;
|
import io.gitlab.jfronny.inceptum.common.model.inceptum.UpdateMetadata;
|
||||||
import io.gitlab.jfronny.inceptum.imgui.window.MainWindow;
|
import io.gitlab.jfronny.inceptum.imgui.window.MainWindow;
|
||||||
@ -32,7 +34,7 @@ import java.nio.file.Paths;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class GuiMain {
|
public class GuiMain {
|
||||||
public static final MemoryLogger MEMLOG = new MemoryLogger("Inceptum");
|
public static final MemoryLogger MEMLOG = new MemoryLogger("Inceptum", System.Logger.Level.INFO);
|
||||||
public static final Set<Window> WINDOWS = new LinkedHashSet<>();
|
public static final Set<Window> WINDOWS = new LinkedHashSet<>();
|
||||||
private static final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw();
|
private static final ImGuiImplGlfw imGuiGlfw = new ImGuiImplGlfw();
|
||||||
private static final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3();
|
private static final ImGuiImplGl3 imGuiGl3 = new ImGuiImplGl3();
|
||||||
@ -54,7 +56,7 @@ public class GuiMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showGui() {
|
public static void showGui() {
|
||||||
Logger.registerFactory(name -> new CompoundLogger(name, InceptumEnvironmentInitializer.defaultFactory(name), MEMLOG));
|
HotswapLoggerFinder.updateAllStrategies((name, module, level) -> new CompoundLogger(name, new System.Logger[] { InceptumEnvironmentInitializer.defaultFactory(name, module, level), MEMLOG }));
|
||||||
UpdateMetadata update = null;
|
UpdateMetadata update = null;
|
||||||
Updater.UpdateCheckException updateCheckFail = null;
|
Updater.UpdateCheckException updateCheckFail = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api;
|
package io.gitlab.jfronny.inceptum.launcher.api;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
||||||
@ -27,7 +28,7 @@ public class CurseforgeApi {
|
|||||||
private static final int pageSize = 20;
|
private static final int pageSize = 20;
|
||||||
|
|
||||||
public static List<CurseforgeMod> search(String gameVersion, String query, int page, String sort) throws IOException {
|
public static List<CurseforgeMod> search(String gameVersion, String query, int page, String sort) throws IOException {
|
||||||
return Net.downloadObject(Net.buildUrl(API_URL, "mods/search", Map.of(
|
return Net.downloadJObject(Net.buildUrl(API_URL, "mods/search", Map.of(
|
||||||
"gameId", "432", // minecraft
|
"gameId", "432", // minecraft
|
||||||
"modLoaderType", "4", // fabric
|
"modLoaderType", "4", // fabric
|
||||||
"classId", "6", // mods
|
"classId", "6", // mods
|
||||||
@ -38,27 +39,27 @@ public class CurseforgeApi {
|
|||||||
"gameVersion", gameVersion,
|
"gameVersion", gameVersion,
|
||||||
"pageSize", Integer.toString(pageSize),
|
"pageSize", Integer.toString(pageSize),
|
||||||
"index", Integer.toString(page * pageSize)
|
"index", Integer.toString(page * pageSize)
|
||||||
)), GC_SearchResponse::read, API_KEY).data();
|
)), GC_SearchResponse::deserialize, API_KEY).data();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CurseforgeMod getMod(String slug) throws IOException {
|
public static CurseforgeMod getMod(String slug) throws IOException {
|
||||||
SearchResponse response = Net.downloadObject(Net.buildUrl(API_URL, "mods/search", Map.of(
|
SearchResponse response = Net.downloadJObject(Net.buildUrl(API_URL, "mods/search", Map.of(
|
||||||
"gameId", "432",
|
"gameId", "432",
|
||||||
"classId", "6",
|
"classId", "6",
|
||||||
"slug", slug
|
"slug", slug
|
||||||
)), GC_SearchResponse::read, API_KEY);
|
)), GC_SearchResponse::deserialize, API_KEY);
|
||||||
if (response.pagination().totalCount() != 1) {
|
if (response.pagination().totalCount() != 1) {
|
||||||
throw new FileNotFoundException("Could not find mod with slug \"" + slug + "\"");
|
throw new FileNotFoundException("Could not find mod with slug \"" + slug + "\"");
|
||||||
}
|
}
|
||||||
return checkDistribution(response.data().get(0));
|
return checkDistribution(response.data().getFirst());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CurseforgeMod getMod(int id) throws IOException {
|
public static CurseforgeMod getMod(int id) throws IOException {
|
||||||
return checkDistribution(Net.downloadObject(API_URL + "mods/" + id, GC_GetModResponse::read, API_KEY).data());
|
return checkDistribution(Net.downloadJObject(API_URL + "mods/" + id, GC_GetModResponse::deserialize, API_KEY).data());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDescription(int id) throws IOException {
|
public static String getDescription(int id) throws IOException {
|
||||||
return Net.downloadObject(API_URL + "mods/" + id + "/description", GC_GetModDescriptionResponse::read, API_KEY).data();
|
return Net.downloadJObject(API_URL + "mods/" + id + "/description", GC_GetModDescriptionResponse::deserialize, API_KEY).data();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CurseforgeMod checkDistribution(CurseforgeMod mod) {
|
private static CurseforgeMod checkDistribution(CurseforgeMod mod) {
|
||||||
@ -70,12 +71,12 @@ public class CurseforgeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CurseforgeFile getFile(int modId, int fileId) throws IOException {
|
public static CurseforgeFile getFile(int modId, int fileId) throws IOException {
|
||||||
return Net.downloadObject(API_URL + "mods/" + modId + "/files/" + fileId, GC_GetModFileResponse::read, API_KEY).data();
|
return Net.downloadJObject(API_URL + "mods/" + modId + "/files/" + fileId, GC_GetModFileResponse::deserialize, API_KEY).data();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FingerprintMatchesResponse.Result checkFingerprint(long hash) throws IOException, URISyntaxException {
|
public static FingerprintMatchesResponse.Result checkFingerprint(long hash) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.post(API_URL + "fingerprints").bodyJson("{\"fingerprints\":[" + hash + "]}").sendReader()) {
|
try (Reader r = HttpClient.post(API_URL + "fingerprints").bodyJson("{\"fingerprints\":[" + hash + "]}").sendReader()) {
|
||||||
return GC_FingerprintMatchesResponse.read(r).data();
|
return GC_FingerprintMatchesResponse.deserialize(r, GsonPreset.API).data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api;
|
package io.gitlab.jfronny.inceptum.launcher.api;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.io.cache.MemoryOperationResultCache;
|
import io.gitlab.jfronny.commons.io.cache.MemoryOperationResultCache;
|
||||||
import io.gitlab.jfronny.gson.compile.util.GList;
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.inceptum.common.GList;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.common.model.maven.ArtifactMeta;
|
import io.gitlab.jfronny.inceptum.common.model.maven.ArtifactMeta;
|
||||||
@ -23,10 +23,8 @@ public class FabricMetaApi {
|
|||||||
public static List<FabricVersionLoaderInfo> getLoaderVersions(VersionsListInfo version) {
|
public static List<FabricVersionLoaderInfo> getLoaderVersions(VersionsListInfo version) {
|
||||||
try {
|
try {
|
||||||
return LOADER_VERSIONS_CACHE.get(version, () -> {
|
return LOADER_VERSIONS_CACHE.get(version, () -> {
|
||||||
return Net.downloadObject(META_URL + "v2/versions/loader/" + version.id, s -> {
|
return Net.downloadJObject(META_URL + "v2/versions/loader/" + version.id, s -> {
|
||||||
try (JsonReader r = new JsonReader(new StringReader(s))) {
|
return GList.read(s, GC_FabricVersionLoaderInfo::deserialize);
|
||||||
return GList.read(r, GC_FabricVersionLoaderInfo::read);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -35,7 +33,7 @@ public class FabricMetaApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static FabricVersionLoaderInfo getLoaderVersion(String gameVersion, String fabricVersion) throws IOException {
|
public static FabricVersionLoaderInfo getLoaderVersion(String gameVersion, String fabricVersion) throws IOException {
|
||||||
return Net.downloadObject(META_URL + "v2/versions/loader/" + gameVersion + "/" + fabricVersion, GC_FabricVersionLoaderInfo.WithMeta::read);
|
return Net.downloadJObject(META_URL + "v2/versions/loader/" + gameVersion + "/" + fabricVersion, GC_FabricVersionLoaderInfo.WithMeta::deserialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VersionInfo addFabric(VersionInfo version, String fabricVersion, FabricVersionInfoType type) throws IOException {
|
public static VersionInfo addFabric(VersionInfo version, String fabricVersion, FabricVersionInfoType type) throws IOException {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api;
|
package io.gitlab.jfronny.inceptum.launcher.api;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.OSUtils;
|
import io.gitlab.jfronny.commons.OSUtils;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.mojang.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.mojang.*;
|
||||||
@ -12,19 +13,20 @@ import java.nio.file.Path;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static io.gitlab.jfronny.inceptum.common.Net.downloadJObject;
|
||||||
import static io.gitlab.jfronny.inceptum.common.Net.downloadObject;
|
import static io.gitlab.jfronny.inceptum.common.Net.downloadObject;
|
||||||
|
|
||||||
public class McApi {
|
public class McApi {
|
||||||
public static VersionsList getVersions() {
|
public static VersionsList getVersions() {
|
||||||
try {
|
try {
|
||||||
return downloadObject("https://launchermeta.mojang.com/mc/game/version_manifest_v2.json", GC_VersionsList::read);
|
return downloadJObject("https://launchermeta.mojang.com/mc/game/version_manifest_v2.json", GC_VersionsList::deserialize);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Could not load version manifest", e);
|
throw new RuntimeException("Could not load version manifest", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VersionInfo getVersionInfo(VersionsListInfo listInfo) throws IOException {
|
public static VersionInfo getVersionInfo(VersionsListInfo listInfo) throws IOException {
|
||||||
return downloadObject(listInfo.url, listInfo.sha1, GC_VersionInfo::read);
|
return downloadJObject(listInfo.url, listInfo.sha1, GC_VersionInfo::deserialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AssetIndex getAssetIndex(VersionInfo info) throws IOException, URISyntaxException {
|
public static AssetIndex getAssetIndex(VersionInfo info) throws IOException, URISyntaxException {
|
||||||
@ -36,12 +38,12 @@ public class McApi {
|
|||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
if (!Files.exists(file)) throw e;
|
if (!Files.exists(file)) throw e;
|
||||||
}
|
}
|
||||||
return GC_AssetIndex.read(file);
|
return GC_AssetIndex.deserialize(file, GsonPreset.API);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, JvmFileInfo.File> getJvm(String component, int majorVersion) throws IOException {
|
public static Map<String, JvmFileInfo.File> getJvm(String component, int majorVersion) throws IOException {
|
||||||
// https://github.com/ATLauncher/ATLauncher/blob/master/src/main/java/com/atlauncher/constants/Constants.java#L123
|
// https://github.com/ATLauncher/ATLauncher/blob/master/src/main/java/com/atlauncher/constants/Constants.java#L123
|
||||||
JvmInfo info = Net.downloadObject("https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json", GC_JvmInfo::read);
|
JvmInfo info = downloadJObject("https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json", GC_JvmInfo::deserialize);
|
||||||
Map<String, List<JvmInfo.Jvm>> vms = switch (OSUtils.TYPE) {
|
Map<String, List<JvmInfo.Jvm>> vms = switch (OSUtils.TYPE) {
|
||||||
case WINDOWS -> info.windowsX64();
|
case WINDOWS -> info.windowsX64();
|
||||||
case LINUX -> info.linux();
|
case LINUX -> info.linux();
|
||||||
@ -52,7 +54,7 @@ public class McApi {
|
|||||||
throw new IOException("Invalid component: " + component + " (available: " + String.join(", ", vms.keySet()));
|
throw new IOException("Invalid component: " + component + " (available: " + String.join(", ", vms.keySet()));
|
||||||
for (JvmInfo.Jvm jvm : vmList) {
|
for (JvmInfo.Jvm jvm : vmList) {
|
||||||
if (jvm.version().name().startsWith(Integer.toString(majorVersion))) {
|
if (jvm.version().name().startsWith(Integer.toString(majorVersion))) {
|
||||||
return downloadObject(jvm.manifest().url, jvm.manifest().sha1, GC_JvmFileInfo::read).files();
|
return downloadJObject(jvm.manifest().url, jvm.manifest().sha1, GC_JvmFileInfo::deserialize).files();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IOException("JVM not found");
|
throw new IOException("JVM not found");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api;
|
package io.gitlab.jfronny.inceptum.launcher.api;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.util.GList;
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.inceptum.common.GList;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.*;
|
||||||
|
|
||||||
@ -16,31 +16,27 @@ public class ModrinthApi {
|
|||||||
//TODO search by categories: facets:[["versions:$ver","versions:$ver"],["categories:$cat","categories:$cat"]]
|
//TODO search by categories: facets:[["versions:$ver","versions:$ver"],["categories:$cat","categories:$cat"]]
|
||||||
//TODO filter server/client-only mods
|
//TODO filter server/client-only mods
|
||||||
public static ModrinthSearchResult search(String query, int page, String version, ModrinthProjectType type) throws IOException {
|
public static ModrinthSearchResult search(String query, int page, String version, ModrinthProjectType type) throws IOException {
|
||||||
return Net.downloadObject(Net.buildUrl(API_HOST, "v2/search", Map.of(
|
return Net.downloadJObject(Net.buildUrl(API_HOST, "v2/search", Map.of(
|
||||||
"query", query,
|
"query", query,
|
||||||
"facets", "[[\"versions:" + version + "\"],[\"categories:fabric\"],[\"project_type:" + type + "\"]]",
|
"facets", "[[\"versions:" + version + "\"],[\"categories:fabric\"],[\"project_type:" + type + "\"]]",
|
||||||
"index", "relevance",
|
"index", "relevance",
|
||||||
"offset", Integer.toString(page * ITEMS_PER_PAGE),
|
"offset", Integer.toString(page * ITEMS_PER_PAGE),
|
||||||
"limit", Integer.toString(ITEMS_PER_PAGE)
|
"limit", Integer.toString(ITEMS_PER_PAGE)
|
||||||
)), GC_ModrinthSearchResult::read);
|
)), GC_ModrinthSearchResult::deserialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModrinthProject getMod(String id) throws IOException {
|
public static ModrinthProject getMod(String id) throws IOException {
|
||||||
return Net.downloadObject(API_HOST + "v2/project/" + id, GC_ModrinthProject::read);
|
return Net.downloadJObject(API_HOST + "v2/project/" + id, GC_ModrinthProject::deserialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ModrinthVersion> getVersions(String mod) throws IOException {
|
public static List<ModrinthVersion> getVersions(String mod) throws IOException {
|
||||||
List<ModrinthVersion> versions = Net.downloadObject(API_HOST + "v2/project/" + mod + "/version", s -> {
|
List<ModrinthVersion> versions = Net.downloadJObject(API_HOST + "v2/project/" + mod + "/version", s -> GList.read(s, GC_ModrinthVersion::deserialize));
|
||||||
try (JsonReader r = new JsonReader(new StringReader(s))) {
|
|
||||||
return GList.read(r, GC_ModrinthVersion::read);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
versions.sort(Comparator.comparing(ModrinthVersion::date_published));
|
versions.sort(Comparator.comparing(ModrinthVersion::date_published));
|
||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModrinthVersion getVersion(String id) throws IOException {
|
public static ModrinthVersion getVersion(String id) throws IOException {
|
||||||
return Net.downloadObject(API_HOST + "v2/version/" + id, GC_ModrinthVersion::read);
|
return Net.downloadJObject(API_HOST + "v2/version/" + id, GC_ModrinthVersion::deserialize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModrinthLatest getLatestVersions(String mod, String gameVersion) throws IOException {
|
public static ModrinthLatest getLatestVersions(String mod, String gameVersion) throws IOException {
|
||||||
@ -60,6 +56,6 @@ public class ModrinthApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ModrinthVersion getVersionByHash(String sha1) throws IOException {
|
public static ModrinthVersion getVersionByHash(String sha1) throws IOException {
|
||||||
return Net.downloadObject(API_HOST + "v2/version_file/" + sha1 + "?algorithm=sha1", GC_ModrinthVersion::read);
|
return Net.downloadJObject(API_HOST + "v2/version_file/" + sha1 + "?algorithm=sha1", GC_ModrinthVersion::deserialize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.util.GList;
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.json.JsonWriter;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
|
||||||
import io.gitlab.jfronny.inceptum.common.*;
|
import io.gitlab.jfronny.inceptum.common.*;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
|
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ public class AccountManager {
|
|||||||
public static void saveAccounts() {
|
public static void saveAccounts() {
|
||||||
try (JsonWriter w = new JsonWriter(Files.newBufferedWriter(MetaHolder.ACCOUNTS_PATH))) {
|
try (JsonWriter w = new JsonWriter(Files.newBufferedWriter(MetaHolder.ACCOUNTS_PATH))) {
|
||||||
GsonPreset.Config.configure(w);
|
GsonPreset.Config.configure(w);
|
||||||
GList.write(w, ACCOUNTS, GC_MicrosoftAccount::write);
|
GList.write(w, ACCOUNTS, GC_MicrosoftAccount::serialize);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Utils.LOGGER.error("Could not save accounts", e);
|
Utils.LOGGER.error("Could not save accounts", e);
|
||||||
}
|
}
|
||||||
@ -52,7 +51,7 @@ public class AccountManager {
|
|||||||
if (Files.exists(MetaHolder.ACCOUNTS_PATH)) {
|
if (Files.exists(MetaHolder.ACCOUNTS_PATH)) {
|
||||||
try (JsonReader r = new JsonReader(Files.newBufferedReader(MetaHolder.ACCOUNTS_PATH))) {
|
try (JsonReader r = new JsonReader(Files.newBufferedReader(MetaHolder.ACCOUNTS_PATH))) {
|
||||||
GsonPreset.Config.configure(r);
|
GsonPreset.Config.configure(r);
|
||||||
ACCOUNTS.addAll(GList.read(r, GC_MicrosoftAccount::read));
|
ACCOUNTS.addAll(GList.read(r, GC_MicrosoftAccount::deserialize));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Utils.LOGGER.error("Could not load accounts", e);
|
Utils.LOGGER.error("Could not load accounts", e);
|
||||||
}
|
}
|
||||||
@ -79,7 +78,7 @@ public class AccountManager {
|
|||||||
if (ACCOUNTS.size() == 1)
|
if (ACCOUNTS.size() == 1)
|
||||||
switchAccount(null);
|
switchAccount(null);
|
||||||
else
|
else
|
||||||
switchAccount(ACCOUNTS.get(0));
|
switchAccount(ACCOUNTS.getFirst());
|
||||||
}
|
}
|
||||||
ACCOUNTS.remove(account);
|
ACCOUNTS.remove(account);
|
||||||
saveAccounts();
|
saveAccounts();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
|
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv;
|
||||||
@ -13,7 +13,7 @@ import java.io.IOException;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@GSerializable(with = MicrosoftAccountAdapter.class, configure = GsonPreset.Config.class)
|
@GSerializable(with = MicrosoftAccountAdapter.class)
|
||||||
public class MicrosoftAccount {
|
public class MicrosoftAccount {
|
||||||
/**
|
/**
|
||||||
* The username/email/id of the account.
|
* The username/email/id of the account.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
package io.gitlab.jfronny.inceptum.launcher.api.account;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
import io.gitlab.jfronny.commons.http.client.HttpClient;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.*;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.request.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.request.*;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.*;
|
||||||
@ -38,7 +39,7 @@ public class MicrosoftAuthAPI {
|
|||||||
"redirect_uri", MICROSOFT_LOGIN_REDIRECT_URL,
|
"redirect_uri", MICROSOFT_LOGIN_REDIRECT_URL,
|
||||||
"scope", String.join(" ", MICROSOFT_LOGIN_SCOPES)))
|
"scope", String.join(" ", MICROSOFT_LOGIN_SCOPES)))
|
||||||
.sendReader()) {
|
.sendReader()) {
|
||||||
return GC_OauthTokenResponse.read(r);
|
return GC_OauthTokenResponse.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,14 +50,14 @@ public class MicrosoftAuthAPI {
|
|||||||
"grant_type", "refresh_token",
|
"grant_type", "refresh_token",
|
||||||
"redirect_uri", MICROSOFT_LOGIN_REDIRECT_URL))
|
"redirect_uri", MICROSOFT_LOGIN_REDIRECT_URL))
|
||||||
.sendReader()) {
|
.sendReader()) {
|
||||||
return GC_OauthTokenResponse.read(r);
|
return GC_OauthTokenResponse.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XboxLiveAuthResponse getXBLToken(String accessToken) throws IOException, URISyntaxException {
|
public static XboxLiveAuthResponse getXBLToken(String accessToken) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.post(MICROSOFT_XBL_AUTH_TOKEN_URL)
|
try (Reader r = HttpClient.post(MICROSOFT_XBL_AUTH_TOKEN_URL)
|
||||||
.header("x-xbl-contract-version", "1")
|
.header("x-xbl-contract-version", "1")
|
||||||
.bodyJson(GC_XblTokenRequest.toJson(new XblTokenRequest(
|
.bodyJson(GsonPreset.API.write(writer -> GC_XblTokenRequest.serialize(new XblTokenRequest(
|
||||||
new XblTokenRequest.Properties(
|
new XblTokenRequest.Properties(
|
||||||
"RPS",
|
"RPS",
|
||||||
"user.auth.xboxlive.com",
|
"user.auth.xboxlive.com",
|
||||||
@ -64,48 +65,48 @@ public class MicrosoftAuthAPI {
|
|||||||
),
|
),
|
||||||
"http://auth.xboxlive.com",
|
"http://auth.xboxlive.com",
|
||||||
"JWT"
|
"JWT"
|
||||||
)))
|
), writer)))
|
||||||
.sendReader()) {
|
.sendReader()) {
|
||||||
return GC_XboxLiveAuthResponse.read(r);
|
return GC_XboxLiveAuthResponse.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XboxLiveAuthResponse getXstsToken(String xblToken) throws IOException, URISyntaxException {
|
public static XboxLiveAuthResponse getXstsToken(String xblToken) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.post(MICROSOFT_XSTS_AUTH_TOKEN_URL)
|
try (Reader r = HttpClient.post(MICROSOFT_XSTS_AUTH_TOKEN_URL)
|
||||||
.header("x-xbl-contract-version", "1")
|
.header("x-xbl-contract-version", "1")
|
||||||
.bodyJson(GC_XstsTokenRequest.toJson(new XstsTokenRequest(
|
.bodyJson(GsonPreset.API.write(writer -> GC_XstsTokenRequest.serialize(new XstsTokenRequest(
|
||||||
new XstsTokenRequest.Properties(
|
new XstsTokenRequest.Properties(
|
||||||
"RETAIL",
|
"RETAIL",
|
||||||
List.of(xblToken)
|
List.of(xblToken)
|
||||||
),
|
),
|
||||||
"rp://api.minecraftservices.com/",
|
"rp://api.minecraftservices.com/",
|
||||||
"JWT"
|
"JWT"
|
||||||
)))
|
), writer)))
|
||||||
.sendReader()) {
|
.sendReader()) {
|
||||||
return GC_XboxLiveAuthResponse.read(r);
|
return GC_XboxLiveAuthResponse.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoginResponse loginToMinecraft(String xstsToken) throws IOException, URISyntaxException {
|
public static LoginResponse loginToMinecraft(String xstsToken) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.post(MICROSOFT_MINECRAFT_LOGIN_URL)
|
try (Reader r = HttpClient.post(MICROSOFT_MINECRAFT_LOGIN_URL)
|
||||||
.bodyJson(GC_LoginRequest.toJson(new LoginRequest(
|
.bodyJson(GsonPreset.API.write(writer -> GC_LoginRequest.serialize(new LoginRequest(
|
||||||
xstsToken,
|
xstsToken,
|
||||||
"PC_LAUNCHER"
|
"PC_LAUNCHER"
|
||||||
)))
|
), writer)))
|
||||||
.sendReader()) {
|
.sendReader()) {
|
||||||
return GC_LoginResponse.read(r);
|
return GC_LoginResponse.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entitlements getEntitlements(String accessToken) throws IOException, URISyntaxException {
|
public static Entitlements getEntitlements(String accessToken) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.get(MICROSOFT_MINECRAFT_ENTITLEMENTS_URL + UUID.randomUUID()).bearer(accessToken).sendReader()) {
|
try (Reader r = HttpClient.get(MICROSOFT_MINECRAFT_ENTITLEMENTS_URL + UUID.randomUUID()).bearer(accessToken).sendReader()) {
|
||||||
return GC_Entitlements.read(r);
|
return GC_Entitlements.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Profile getMcProfile(String accessToken) throws IOException, URISyntaxException {
|
public static Profile getMcProfile(String accessToken) throws IOException, URISyntaxException {
|
||||||
try (Reader r = HttpClient.get(MICROSOFT_MINECRAFT_PROFILE_URL).bearer(accessToken).sendReader()) {
|
try (Reader r = HttpClient.get(MICROSOFT_MINECRAFT_PROFILE_URL).bearer(accessToken).sendReader()) {
|
||||||
return GC_Profile.read(r);
|
return GC_Profile.deserialize(r, GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAccount;
|
import io.gitlab.jfronny.inceptum.launcher.api.account.MicrosoftAccount;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MicrosoftAccountAdapter {
|
public class MicrosoftAccountAdapter {
|
||||||
public static void write(MicrosoftAccount value, JsonWriter writer) throws IOException {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void serialize(MicrosoftAccount value, Writer writer) throws TEx, MalformedDataException {
|
||||||
GC_MicrosoftAccountMeta.write(value == null ? null : value.toMeta(), writer);
|
GC_MicrosoftAccountMeta.serialize(value == null ? null : value.toMeta(), writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MicrosoftAccount read(JsonReader reader) throws IOException {
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> MicrosoftAccount deserialize(Reader reader) throws TEx, MalformedDataException {
|
||||||
MicrosoftAccountMeta meta = GC_MicrosoftAccountMeta.read(reader);
|
MicrosoftAccountMeta meta = GC_MicrosoftAccountMeta.deserialize(reader);
|
||||||
return meta == null ? null : new MicrosoftAccount(meta);
|
return meta == null ? null : new MicrosoftAccount(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.OauthTokenResponse;
|
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.OauthTokenResponse;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.XboxLiveAuthResponse;
|
import io.gitlab.jfronny.inceptum.launcher.model.microsoft.response.XboxLiveAuthResponse;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record MicrosoftAccountMeta(String accountId, String minecraftUsername, String uuid, String accessToken, OauthTokenResponse oauthToken, XboxLiveAuthResponse xstsAuth, Date accessTokenExpiresAt, boolean mustLogin) {
|
public record MicrosoftAccountMeta(String accountId, String minecraftUsername, String uuid, String accessToken, OauthTokenResponse oauthToken, XboxLiveAuthResponse xstsAuth, Date accessTokenExpiresAt, boolean mustLogin) {
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,33 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.JsonParseException;
|
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
||||||
import io.gitlab.jfronny.gson.compile.util.GList;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
import io.gitlab.jfronny.gson.stream.*;
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.Token;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GList;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.mojang.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.mojang.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MinecraftArgumentAdapter {
|
public class MinecraftArgumentAdapter {
|
||||||
public static void write(MinecraftArgument rules, JsonWriter writer) throws IOException {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void serialize(MinecraftArgument rules, Writer writer) throws TEx {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MinecraftArgument read(JsonReader reader) throws IOException {
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> MinecraftArgument deserialize(Reader reader) throws TEx, MalformedDataException {
|
||||||
if (reader.peek() == JsonToken.STRING) return new MinecraftArgument(Set.of(reader.nextString()));
|
if (reader.peek() == Token.STRING) return new MinecraftArgument(Set.of(reader.nextString()));
|
||||||
Rules rules = null;
|
Rules rules = null;
|
||||||
List<String> value = null;
|
List<String> value = null;
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
switch (reader.nextName()) {
|
switch (reader.nextName()) {
|
||||||
case "rules" -> rules = GC_Rules.read(reader);
|
case "rules" -> rules = GC_Rules.deserialize(reader);
|
||||||
case "value" -> value = GList.read(reader, JsonReader::nextString);
|
case "value" -> value = GList.read(reader, Reader::nextString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
if (rules == null || value == null) throw new JsonParseException("Not a valid minecraft argument");
|
if (rules == null || value == null) throw new MalformedDataException("Not a valid minecraft argument");
|
||||||
if (!rules.allow()) return new MinecraftArgument(Set.of());
|
if (!rules.allow()) return new MinecraftArgument(Set.of());
|
||||||
return new MinecraftArgument(Set.copyOf(value));
|
return new MinecraftArgument(Set.copyOf(value));
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta.Sources;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta.Sources;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.source.GC_ModSource;
|
import io.gitlab.jfronny.inceptum.launcher.system.source.GC_ModSource;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
|
import io.gitlab.jfronny.inceptum.launcher.system.source.ModSource;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ModMetaSourcesAdapter {
|
public class ModMetaSourcesAdapter {
|
||||||
public static void write(Sources value, JsonWriter writer) throws IOException {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void serialize(Sources value, Writer writer) throws TEx, MalformedDataException {
|
||||||
writer.beginArray();
|
writer.beginArray();
|
||||||
for (ModSource source : value.keySet()) GC_ModSource.write(source, writer);
|
for (ModSource source : value.keySet()) GC_ModSource.serialize(source, writer);
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Sources read(JsonReader reader) throws IOException {
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> Sources deserialize(Reader reader) throws TEx, MalformedDataException {
|
||||||
reader.beginArray();
|
reader.beginArray();
|
||||||
Sources sources = new Sources();
|
Sources sources = new Sources();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
sources.put(GC_ModSource.read(reader), Optional.empty());
|
sources.put(GC_ModSource.deserialize(reader), Optional.empty());
|
||||||
}
|
}
|
||||||
reader.endArray();
|
reader.endArray();
|
||||||
return sources;
|
return sources;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.JsonParseException;
|
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.source.*;
|
import io.gitlab.jfronny.inceptum.launcher.system.source.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -10,22 +10,23 @@ import java.util.LinkedHashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ModSourceAdapter {
|
public class ModSourceAdapter {
|
||||||
public static void write(ModSource src, JsonWriter writer) throws IOException {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void serialize(ModSource src, Writer writer) throws TEx {
|
||||||
writer.beginObject();
|
writer.beginObject();
|
||||||
if (src instanceof ModrinthModSource mo) {
|
switch (src) {
|
||||||
writer.name("type").value("modrinth")
|
case ModrinthModSource mo -> writer.name("type").value("modrinth")
|
||||||
.name("id").value(mo.getVersionId());
|
.name("id").value(mo.getVersionId());
|
||||||
} else if (src instanceof DirectModSource di) {
|
case DirectModSource di -> {
|
||||||
writer.name("type").value("direct")
|
writer.name("type").value("direct")
|
||||||
.name("fileName").value(di.getFileName())
|
.name("fileName").value(di.getFileName())
|
||||||
.name("url").value(di.url())
|
.name("url").value(di.url())
|
||||||
.name("dependencies");
|
.name("dependencies");
|
||||||
writer.beginArray();
|
writer.beginArray();
|
||||||
for (ModSource dependency : di.dependencies()) {
|
for (ModSource dependency : di.dependencies()) {
|
||||||
write(dependency, writer);
|
serialize(dependency, writer);
|
||||||
}
|
}
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
} else if (src instanceof CurseforgeModSource cu) {
|
}
|
||||||
|
case CurseforgeModSource cu -> {
|
||||||
writer.name("type").value("curseforge");
|
writer.name("type").value("curseforge");
|
||||||
if (cu.getShortName().matches("\\d+")) {
|
if (cu.getShortName().matches("\\d+")) {
|
||||||
writer.name("projectId").value(cu.getProjectId());
|
writer.name("projectId").value(cu.getProjectId());
|
||||||
@ -33,11 +34,14 @@ public class ModSourceAdapter {
|
|||||||
writer.name("project").value(cu.getShortName());
|
writer.name("project").value(cu.getShortName());
|
||||||
}
|
}
|
||||||
writer.name("fileId").value(cu.getFileId());
|
writer.name("fileId").value(cu.getFileId());
|
||||||
} else throw new RuntimeException("ModSources with the type " + src.getClass() + " are not supported");
|
}
|
||||||
|
case null, default ->
|
||||||
|
throw new RuntimeException("ModSources with the type " + (src == null ? null : src.getClass()) + " are not supported");
|
||||||
|
}
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModSource read(JsonReader reader) throws IOException {
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> ModSource deserialize(Reader reader) throws TEx, MalformedDataException {
|
||||||
String type = null;
|
String type = null;
|
||||||
|
|
||||||
String mr$id = null;
|
String mr$id = null;
|
||||||
@ -63,34 +67,40 @@ public class ModSourceAdapter {
|
|||||||
case "dependencies" -> {
|
case "dependencies" -> {
|
||||||
direct$dependencies = new LinkedHashSet<>();
|
direct$dependencies = new LinkedHashSet<>();
|
||||||
reader.beginArray();
|
reader.beginArray();
|
||||||
while (reader.hasNext()) direct$dependencies.add(read(reader));
|
while (reader.hasNext()) direct$dependencies.add(deserialize(reader));
|
||||||
reader.endArray();
|
reader.endArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
if (type == null) throw new JsonParseException("Expected ModSource to contain a type");
|
if (type == null) throw new MalformedDataException("Expected ModSource to contain a type");
|
||||||
|
try {
|
||||||
return switch (type) {
|
return switch (type) {
|
||||||
case "modrinth" -> {
|
case "modrinth" -> {
|
||||||
if (mr$id == null) throw new JsonParseException("Expected ModrinthModSource to contain a version ID");
|
if (mr$id == null) throw new MalformedDataException("Expected ModrinthModSource to contain a version ID");
|
||||||
yield new ModrinthModSource(mr$id);
|
yield new ModrinthModSource(mr$id);
|
||||||
}
|
}
|
||||||
case "curseforge" -> {
|
case "curseforge" -> {
|
||||||
if (cf$fileId == null)
|
if (cf$fileId == null)
|
||||||
throw new JsonParseException("Expected a fileId in this curseforge project");
|
throw new MalformedDataException("Expected a fileId in this curseforge project");
|
||||||
if (cf$projectId != null) yield new CurseforgeModSource(cf$projectId, cf$fileId);
|
if (cf$projectId != null) yield new CurseforgeModSource(cf$projectId, cf$fileId);
|
||||||
else if (cf$project != null) yield new CurseforgeModSource(cf$project, cf$fileId);
|
else if (cf$project != null) yield new CurseforgeModSource(cf$project, cf$fileId);
|
||||||
else throw new JsonParseException("Expected a projectId in this curseforge project");
|
else throw new MalformedDataException("Expected a projectId in this curseforge project");
|
||||||
}
|
}
|
||||||
case "direct" -> {
|
case "direct" -> {
|
||||||
if (direct$fileName == null) throw new JsonParseException("Expected direct download to have a fileName");
|
if (direct$fileName == null) throw new MalformedDataException("Expected direct download to have a fileName");
|
||||||
if (direct$url == null) throw new JsonParseException("Expected direct download to have a url");
|
if (direct$url == null) throw new MalformedDataException("Expected direct download to have a url");
|
||||||
if (direct$dependencies == null) yield new DirectModSource(direct$fileName, direct$url, Set.of());
|
if (direct$dependencies == null) yield new DirectModSource(direct$fileName, direct$url, Set.of());
|
||||||
else {
|
else {
|
||||||
yield new DirectModSource(direct$fileName, direct$url, direct$dependencies);
|
yield new DirectModSource(direct$fileName, direct$url, direct$dependencies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default -> throw new JsonParseException("Unexpected ModSource type: " + type);
|
default -> throw new MalformedDataException("Unexpected ModSource type: " + type);
|
||||||
};
|
};
|
||||||
|
} catch (MalformedDataException mde) {
|
||||||
|
throw mde;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new MalformedDataException("Failed to read ModSource", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.gson;
|
package io.gitlab.jfronny.inceptum.launcher.gson;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.OSUtils;
|
import io.gitlab.jfronny.commons.OSUtils;
|
||||||
import io.gitlab.jfronny.gson.JsonParseException;
|
import io.gitlab.jfronny.commons.serialize.MalformedDataException;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.commons.serialize.SerializeReader;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonWriter;
|
import io.gitlab.jfronny.commons.serialize.SerializeWriter;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.mojang.Rules;
|
import io.gitlab.jfronny.inceptum.launcher.model.mojang.Rules;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class RulesAdapter {
|
public class RulesAdapter {
|
||||||
public static void write(Rules rules, JsonWriter writer) throws IOException {
|
public static <TEx extends Exception, Writer extends SerializeWriter<TEx, Writer>> void serialize(Rules rules, Writer writer) throws TEx {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Rules read(JsonReader reader) throws IOException {
|
public static <TEx extends Exception, Reader extends SerializeReader<TEx, Reader>> Rules deserialize(Reader reader) throws TEx, MalformedDataException {
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
reader.beginArray();
|
reader.beginArray();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
@ -48,7 +46,7 @@ public class RulesAdapter {
|
|||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
if (actionType == null || (!actionType.equals("allow") && !actionType.equals("disallow"))) {
|
if (actionType == null || (!actionType.equals("allow") && !actionType.equals("disallow"))) {
|
||||||
throw new JsonParseException("Unexpected action in argument: " + actionType);
|
throw new MalformedDataException("Unexpected action in argument: " + actionType);
|
||||||
}
|
}
|
||||||
if (hasFeatures) valid = false;
|
if (hasFeatures) valid = false;
|
||||||
if (osName != null && !OSUtils.TYPE.getMojName().equals(osName)) valid = false;
|
if (osName != null && !OSUtils.TYPE.getMojName().equals(osName)) valid = false;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record CurseforgeFile(
|
public record CurseforgeFile(
|
||||||
int id,
|
int id,
|
||||||
int gameId,
|
int gameId,
|
||||||
@ -52,11 +52,11 @@ public record CurseforgeFile(
|
|||||||
/* Possible algorithms:
|
/* Possible algorithms:
|
||||||
1=Sha1
|
1=Sha1
|
||||||
2=Md5*/
|
2=Md5*/
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Hash(String value, int algo) {
|
public record Hash(String value, int algo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record GameVersion(String gameVersionName,
|
public record GameVersion(String gameVersionName,
|
||||||
String gameVersionPadded,
|
String gameVersionPadded,
|
||||||
String gameVersion,
|
String gameVersion,
|
||||||
@ -71,11 +71,11 @@ public record CurseforgeFile(
|
|||||||
4=Tool
|
4=Tool
|
||||||
5=Incompatible
|
5=Incompatible
|
||||||
6=Include*/
|
6=Include*/
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Dependency(int modId, int relationType) {
|
public record Dependency(int modId, int relationType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Module(String name, long fingerprint) {
|
public record Module(String name, long fingerprint) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record CurseforgeMod(
|
public record CurseforgeMod(
|
||||||
int id,
|
int id,
|
||||||
int gameId,
|
int gameId,
|
||||||
@ -45,11 +45,11 @@ public record CurseforgeMod(
|
|||||||
boolean isAvailable,
|
boolean isAvailable,
|
||||||
int thumbsUpCount
|
int thumbsUpCount
|
||||||
) {
|
) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Links(String websiteUrl, String wikiUrl, String issuesUrl, String sourcesUrl) {
|
public record Links(String websiteUrl, String wikiUrl, String issuesUrl, String sourcesUrl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Category(int id,
|
public record Category(int id,
|
||||||
int gameId,
|
int gameId,
|
||||||
String name,
|
String name,
|
||||||
@ -62,11 +62,11 @@ public record CurseforgeMod(
|
|||||||
int primaryCategoryId) {
|
int primaryCategoryId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Author(int id, String name, String url) {
|
public record Author(int id, String name, String url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Logo(int id,
|
public record Logo(int id,
|
||||||
int modId,
|
int modId,
|
||||||
String title,
|
String title,
|
||||||
@ -75,7 +75,7 @@ public record CurseforgeMod(
|
|||||||
String url) {
|
String url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Screenshot(int id,
|
public record Screenshot(int id,
|
||||||
int modId,
|
int modId,
|
||||||
String title,
|
String title,
|
||||||
@ -84,7 +84,7 @@ public record CurseforgeMod(
|
|||||||
String url) {
|
String url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record LatestFileIndex(String gameVersion,
|
public record LatestFileIndex(String gameVersion,
|
||||||
int fileId,
|
int fileId,
|
||||||
String filename,
|
String filename,
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record CurseforgeModpackManifest(Minecraft minecraft,
|
public record CurseforgeModpackManifest(Minecraft minecraft,
|
||||||
String manifestType,
|
String manifestType,
|
||||||
int manifestVersion,
|
int manifestVersion,
|
||||||
@ -14,14 +14,14 @@ public record CurseforgeModpackManifest(Minecraft minecraft,
|
|||||||
String author,
|
String author,
|
||||||
Set<File> files,
|
Set<File> files,
|
||||||
String overrides) {
|
String overrides) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Minecraft(String version, Set<ModLoader> modLoaders) {
|
public record Minecraft(String version, Set<ModLoader> modLoaders) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModLoader(String id, boolean primary) {
|
public record ModLoader(String id, boolean primary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record File(int projectID, int fileID, boolean required) {
|
public record File(int projectID, int fileID, boolean required) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record FingerprintMatchesResponse(Result data) {
|
public record FingerprintMatchesResponse(Result data) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Result(boolean isCacheBuilt,
|
public record Result(boolean isCacheBuilt,
|
||||||
List<Match> exactMatches,
|
List<Match> exactMatches,
|
||||||
List<Integer> exactFingerprints,
|
List<Integer> exactFingerprints,
|
||||||
List<Match> partialMatches,
|
List<Match> partialMatches,
|
||||||
List<Integer> installedFingerprints,
|
List<Integer> installedFingerprints,
|
||||||
List<Integer> unmatchedFingerprints) {
|
List<Integer> unmatchedFingerprints) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Match(int id, CurseforgeFile file, List<CurseforgeFile> latestFiles) {
|
public record Match(int id, CurseforgeFile file, List<CurseforgeFile> latestFiles) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record GetModDescriptionResponse(String data) {
|
public record GetModDescriptionResponse(String data) {
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeFile;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record GetModFileResponse(CurseforgeFile data) {
|
public record GetModFileResponse(CurseforgeFile data) {
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record GetModResponse(CurseforgeMod data) {
|
public record GetModResponse(CurseforgeMod data) {
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.curseforge.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeMod;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record SearchResponse(List<CurseforgeMod> data, Pagination pagination) {
|
public record SearchResponse(List<CurseforgeMod> data, Pagination pagination) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Pagination(int index, int pageSite, int resultCount, int totalCount) {
|
public record Pagination(int index, int pageSite, int resultCount, int totalCount) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record FabricLoaderVersion(String separator, int build, String maven, String version, boolean stable) {
|
public record FabricLoaderVersion(String separator, int build, String maven, String version, boolean stable) {
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record FabricModJson(String id, String name, String description, String version) {
|
public record FabricModJson(String id, String name, String description, String version) {
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public class FabricVersionLoaderInfo {
|
public class FabricVersionLoaderInfo {
|
||||||
public FabricLoaderVersion loader;
|
public FabricLoaderVersion loader;
|
||||||
public IntermediaryVersion intermediary;
|
public IntermediaryVersion intermediary;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public static class WithMeta extends FabricVersionLoaderInfo {
|
public static class WithMeta extends FabricVersionLoaderInfo {
|
||||||
public LauncherMeta launcherMeta;
|
public LauncherMeta launcherMeta;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record LauncherMeta(int version, Libraries libraries, MainClass mainClass) {
|
public record LauncherMeta(int version, Libraries libraries, MainClass mainClass) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Libraries(List<Library> client, List<Library> common, List<Library> server) {
|
public record Libraries(List<Library> client, List<Library> common, List<Library> server) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Library(String name, String url) {
|
public record Library(String name, String url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record MainClass(String client, String server) {
|
public record MainClass(String client, String server) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
package io.gitlab.jfronny.inceptum.launcher.model.fabric;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record IntermediaryVersion(String maven, String version, boolean stable) {
|
public record IntermediaryVersion(String maven, String version, boolean stable) {
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.inceptum;
|
package io.gitlab.jfronny.inceptum.launcher.model.inceptum;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GPrefer;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Config.class)
|
@GSerializable
|
||||||
public class InstanceMeta {
|
public class InstanceMeta {
|
||||||
public String instanceVersion = "1.0";
|
public String instanceVersion = "1.0";
|
||||||
public String gameVersion;
|
public String gameVersion;
|
||||||
@ -43,11 +42,12 @@ public class InstanceMeta {
|
|||||||
arguments = Arguments.checked(arguments);
|
arguments = Arguments.checked(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Config.class)
|
@GSerializable
|
||||||
public record Arguments(List<String> jvm, List<String> client, List<String> server) {
|
public record Arguments(List<String> jvm, List<String> client, List<String> server) {
|
||||||
public static final Arguments EMPTY = new Arguments(List.of(), List.of(), List.of());
|
public static final Arguments EMPTY = new Arguments(List.of(), List.of(), List.of());
|
||||||
|
|
||||||
@GPrefer public Arguments {}
|
@GPrefer
|
||||||
|
public Arguments {}
|
||||||
|
|
||||||
public static Arguments checked(Arguments of) {
|
public static Arguments checked(Arguments of) {
|
||||||
if (of == null) return EMPTY;
|
if (of == null) return EMPTY;
|
||||||
|
@ -3,9 +3,8 @@ package io.gitlab.jfronny.inceptum.launcher.model.inceptum;
|
|||||||
import io.gitlab.jfronny.commons.data.MutCollection;
|
import io.gitlab.jfronny.commons.data.MutCollection;
|
||||||
import io.gitlab.jfronny.commons.data.delegate.DelegateMap;
|
import io.gitlab.jfronny.commons.data.delegate.DelegateMap;
|
||||||
import io.gitlab.jfronny.commons.io.HashUtils;
|
import io.gitlab.jfronny.commons.io.HashUtils;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GPrefer;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.api.CurseforgeApi;
|
import io.gitlab.jfronny.inceptum.launcher.api.CurseforgeApi;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.api.ModrinthApi;
|
import io.gitlab.jfronny.inceptum.launcher.api.ModrinthApi;
|
||||||
@ -21,7 +20,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Config.class)
|
@GSerializable
|
||||||
public record ModMeta(
|
public record ModMeta(
|
||||||
Sources sources, //key: source, value: update
|
Sources sources, //key: source, value: update
|
||||||
String sha1,
|
String sha1,
|
||||||
@ -30,7 +29,7 @@ public record ModMeta(
|
|||||||
List<String> dependencies, // by file name
|
List<String> dependencies, // by file name
|
||||||
boolean explicit
|
boolean explicit
|
||||||
) {
|
) {
|
||||||
@GSerializable(with = ModMetaSourcesAdapter.class, configure = GsonPreset.Config.class)
|
@GSerializable(with = ModMetaSourcesAdapter.class)
|
||||||
public static class Sources extends DelegateMap<ModSource, Optional<ModSource>> {
|
public static class Sources extends DelegateMap<ModSource, Optional<ModSource>> {
|
||||||
public Sources() {
|
public Sources() {
|
||||||
super(MutCollection.mapOf());
|
super(MutCollection.mapOf());
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Entitlements(List<StoreItem> items, String signature) {
|
public record Entitlements(List<StoreItem> items, String signature) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record StoreItem(String name, String signature) {
|
public record StoreItem(String name, String signature) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Profile(String id, String name, List<Skin> skins, List<Cape> capes) {
|
public record Profile(String id, String name, List<Skin> skins, List<Cape> capes) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Skin(String id, String state, String url, String variant, String alias) {
|
public record Skin(String id, String state, String url, String variant, String alias) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Cape(String id) {
|
public record Cape(String id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record LoginRequest(String xtoken, String platform) {
|
public record LoginRequest(String xtoken, String platform) {
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record XblTokenRequest(@SerializedName("Properties") Properties properties,
|
public record XblTokenRequest(@SerializedName("Properties") Properties properties,
|
||||||
@SerializedName("RelyingParty") String relyingParty,
|
@SerializedName("RelyingParty") String relyingParty,
|
||||||
@SerializedName("TokenType") String tokenType) {
|
@SerializedName("TokenType") String tokenType) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Properties(@SerializedName("AuthMethod") String authMethod,
|
public record Properties(@SerializedName("AuthMethod") String authMethod,
|
||||||
@SerializedName("SiteName") String siteName,
|
@SerializedName("SiteName") String siteName,
|
||||||
@SerializedName("RpsTicket") String rpsTicket) {
|
@SerializedName("RpsTicket") String rpsTicket) {
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.request;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record XstsTokenRequest(@SerializedName("Properties") Properties properties,
|
public record XstsTokenRequest(@SerializedName("Properties") Properties properties,
|
||||||
@SerializedName("RelyingParty") String relyingParty,
|
@SerializedName("RelyingParty") String relyingParty,
|
||||||
@SerializedName("TokenType") String tokenType) {
|
@SerializedName("TokenType") String tokenType) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Properties(@SerializedName("SandboxId") String sandboxId, @SerializedName("UserTokens") List<String> userTokens) {
|
public record Properties(@SerializedName("SandboxId") String sandboxId, @SerializedName("UserTokens") List<String> userTokens) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record LoginResponse(String username,
|
public record LoginResponse(String username,
|
||||||
@SerializedName("access_token") String accessToken,
|
@SerializedName("access_token") String accessToken,
|
||||||
@SerializedName("token_type") String tokenType,
|
@SerializedName("token_type") String tokenType,
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GPrefer;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record OauthTokenResponse(
|
public record OauthTokenResponse(
|
||||||
@SerializedName("token_type") String tokenType,
|
@SerializedName("token_type") String tokenType,
|
||||||
@SerializedName("expires_in") int expiresIn,
|
@SerializedName("expires_in") int expiresIn,
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
package io.gitlab.jfronny.inceptum.launcher.model.microsoft.response;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record XboxLiveAuthResponse(@SerializedName("IssueInstant") Date issueInstant,
|
public record XboxLiveAuthResponse(@SerializedName("IssueInstant") Date issueInstant,
|
||||||
@SerializedName("NotAfter") Date notAfter,
|
@SerializedName("NotAfter") Date notAfter,
|
||||||
@SerializedName("Token") String token,
|
@SerializedName("Token") String token,
|
||||||
@SerializedName("DisplayClaims") DisplayClaims displayClaims) {
|
@SerializedName("DisplayClaims") DisplayClaims displayClaims) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record DisplayClaims(List<XUIClaim> xui) {
|
public record DisplayClaims(List<XUIClaim> xui) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record XUIClaim(String uhs) {
|
public record XUIClaim(String uhs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModrinthHashes(String sha1, String sha512) {
|
public record ModrinthHashes(String sha1, String sha512) {
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModrinthModpackManifest(
|
public record ModrinthModpackManifest(
|
||||||
int formatVersion, // 1
|
int formatVersion, // 1
|
||||||
String game, // "minecraft"
|
String game, // "minecraft"
|
||||||
@ -17,15 +16,15 @@ public record ModrinthModpackManifest(
|
|||||||
List<File> files,
|
List<File> files,
|
||||||
Dependencies dependencies
|
Dependencies dependencies
|
||||||
) {
|
) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record File(String path, ModrinthHashes hashes, @Nullable Env env, List<String> downloads, long fileSize) {
|
public record File(String path, ModrinthHashes hashes, @Nullable Env env, List<String> downloads, long fileSize) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Env(ModrinthDependencyType client, ModrinthDependencyType server) {
|
public record Env(ModrinthDependencyType client, ModrinthDependencyType server) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All are nullable
|
// All are nullable
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Dependencies(String minecraft,
|
public record Dependencies(String minecraft,
|
||||||
String forge,
|
String forge,
|
||||||
@SerializedName("fabric-loader") String fabricLoader,
|
@SerializedName("fabric-loader") String fabricLoader,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModrinthProject(
|
public record ModrinthProject(
|
||||||
String id,
|
String id,
|
||||||
String slug,
|
String slug,
|
||||||
@ -34,15 +34,15 @@ public record ModrinthProject(
|
|||||||
List<DonationUrl> donation_urls,
|
List<DonationUrl> donation_urls,
|
||||||
List<GalleryItem> gallery
|
List<GalleryItem> gallery
|
||||||
) {
|
) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record DonationUrl(String id, String platform, String url) {
|
public record DonationUrl(String id, String platform, String url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record License(String id, String name, String url) {
|
public record License(String id, String name, String url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record GalleryItem(String url, boolean featured, String title, String description, Date created) {
|
public record GalleryItem(String url, boolean featured, String title, String description, Date created) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModrinthSearchResult(List<ModResult> hits, int offset, int limit, int total_hits) {
|
public record ModrinthSearchResult(List<ModResult> hits, int offset, int limit, int total_hits) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModResult(
|
public record ModResult(
|
||||||
String project_id,
|
String project_id,
|
||||||
ModrinthProjectType project_type,
|
ModrinthProjectType project_type,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
package io.gitlab.jfronny.inceptum.launcher.model.modrinth;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record ModrinthVersion(
|
public record ModrinthVersion(
|
||||||
String id,
|
String id,
|
||||||
String project_id,
|
String project_id,
|
||||||
@ -28,11 +28,11 @@ public record ModrinthVersion(
|
|||||||
alpha, beta, release
|
alpha, beta, release
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record File(ModrinthHashes hashes, String url, String filename, boolean primary) {
|
public record File(ModrinthHashes hashes, String url, String filename, boolean primary) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Dependency(String version_id, String project_id, DependencyType dependency_type) {
|
public record Dependency(String version_id, String project_id, DependencyType dependency_type) {
|
||||||
public enum DependencyType {
|
public enum DependencyType {
|
||||||
required,
|
required,
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record AssetIndex(Map<String, Asset> objects) {
|
public record AssetIndex(Map<String, Asset> objects) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Asset(String hash, int size) {
|
public record Asset(String hash, int size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record JvmFileInfo(Map<String, File> files) {
|
public record JvmFileInfo(Map<String, File> files) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record File(Downloads downloads, boolean executable, String type) {
|
public record File(Downloads downloads, boolean executable, String type) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Downloads(MojangFileDownload lzma, MojangFileDownload raw) {
|
public record Downloads(MojangFileDownload lzma, MojangFileDownload raw) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.annotations.SerializedName;
|
import io.gitlab.jfronny.commons.serialize.annotations.SerializedName;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record JvmInfo(Map<String, List<Jvm>> linux,
|
public record JvmInfo(Map<String, List<Jvm>> linux,
|
||||||
@SerializedName("mac-os") Map<String, List<Jvm>> macOs,
|
@SerializedName("mac-os") Map<String, List<Jvm>> macOs,
|
||||||
@SerializedName("windows-x64") Map<String, List<Jvm>> windowsX64) {
|
@SerializedName("windows-x64") Map<String, List<Jvm>> windowsX64) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Jvm(Availability availability, MojangFileDownload manifest, Version version) {
|
public record Jvm(Availability availability, MojangFileDownload manifest, Version version) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Availability(int group, int progress) {
|
public record Availability(int group, int progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Version(String name, String released) {
|
public record Version(String name, String released) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.gson.MinecraftArgumentAdapter;
|
import io.gitlab.jfronny.inceptum.launcher.gson.MinecraftArgumentAdapter;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@GSerializable(with = MinecraftArgumentAdapter.class, configure = GsonPreset.Api.class)
|
@GSerializable(with = MinecraftArgumentAdapter.class)
|
||||||
public record MinecraftArgument(Set<String> arg) implements Cloneable {
|
public record MinecraftArgument(Set<String> arg) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
protected MinecraftArgument clone() {
|
protected MinecraftArgument clone() {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public class MojangFileDownload implements Cloneable {
|
public class MojangFileDownload implements Cloneable {
|
||||||
public String sha1;
|
public String sha1;
|
||||||
public int size;
|
public int size;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.gson.RulesAdapter;
|
import io.gitlab.jfronny.inceptum.launcher.gson.RulesAdapter;
|
||||||
|
|
||||||
@GSerializable(with = RulesAdapter.class, configure = GsonPreset.Api.class)
|
@GSerializable(with = RulesAdapter.class)
|
||||||
public record Rules(boolean allow) implements Cloneable {
|
public record Rules(boolean allow) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
protected Rules clone() {
|
protected Rules clone() {
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GPrefer;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@SuppressWarnings("MethodDoesntCallSuperMethod")
|
@SuppressWarnings("MethodDoesntCallSuperMethod")
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public class VersionInfo extends VersionsListInfo implements Cloneable {
|
public class VersionInfo extends VersionsListInfo implements Cloneable {
|
||||||
public Arguments arguments;
|
public Arguments arguments;
|
||||||
public AssetIndex assetIndex;
|
public AssetIndex assetIndex;
|
||||||
@ -36,7 +35,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Arguments(List<MinecraftArgument> game, List<MinecraftArgument> jvm) implements Cloneable {
|
public record Arguments(List<MinecraftArgument> game, List<MinecraftArgument> jvm) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public Arguments clone() {
|
public Arguments clone() {
|
||||||
@ -47,7 +46,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public static class AssetIndex extends MojangFileDownload {
|
public static class AssetIndex extends MojangFileDownload {
|
||||||
public String id;
|
public String id;
|
||||||
public int totalSize;
|
public int totalSize;
|
||||||
@ -62,7 +61,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Downloads(MojangFileDownload client,
|
public record Downloads(MojangFileDownload client,
|
||||||
MojangFileDownload client_mappings,
|
MojangFileDownload client_mappings,
|
||||||
MojangFileDownload server,
|
MojangFileDownload server,
|
||||||
@ -78,7 +77,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record JavaVersion(String component, int majorVersion) implements Cloneable {
|
public record JavaVersion(String component, int majorVersion) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public JavaVersion clone() {
|
public JavaVersion clone() {
|
||||||
@ -86,7 +85,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Library(Downloads downloads, String name, Map<String, String> natives, Rules rules) implements Cloneable {
|
public record Library(Downloads downloads, String name, Map<String, String> natives, Rules rules) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public Library clone() {
|
public Library clone() {
|
||||||
@ -100,7 +99,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Downloads(Artifact artifact, Map<String, Artifact> classifiers) implements Cloneable {
|
public record Downloads(Artifact artifact, Map<String, Artifact> classifiers) implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public Downloads clone() {
|
public Downloads clone() {
|
||||||
@ -109,7 +108,7 @@ public class VersionInfo extends VersionsListInfo implements Cloneable {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public static class Artifact extends MojangFileDownload implements Cloneable {
|
public static class Artifact extends MojangFileDownload implements Cloneable {
|
||||||
public String path;
|
public String path;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record VersionsList(Latest latest, List<VersionsListInfo> versions) {
|
public record VersionsList(Latest latest, List<VersionsListInfo> versions) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Latest(String release, String snapshot) {
|
public record Latest(String release, String snapshot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
package io.gitlab.jfronny.inceptum.launcher.model.mojang;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public class VersionsListInfo {
|
public class VersionsListInfo {
|
||||||
public String id;
|
public String id;
|
||||||
public String type;
|
public String type;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.model.multimc;
|
package io.gitlab.jfronny.inceptum.launcher.model.multimc;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record MMCPackMeta(List<Component> components, int formatVersion) {
|
public record MMCPackMeta(List<Component> components, int formatVersion) {
|
||||||
@GSerializable(configure = GsonPreset.Api.class)
|
@GSerializable
|
||||||
public record Component(boolean dependencyOnly, boolean important, String uid, String version) {
|
public record Component(boolean dependencyOnly, boolean important, String uid, String version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.InceptumConfig;
|
import io.gitlab.jfronny.inceptum.common.InceptumConfig;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.GC_CurseforgeModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.GC_CurseforgeModpackManifest;
|
||||||
@ -41,7 +42,7 @@ public class CurseForgeExporter extends Exporter<CurseforgeModpackManifest> {
|
|||||||
true
|
true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
GC_CurseforgeModpackManifest.write(manifest, root.resolve("manifest.json"));
|
GC_CurseforgeModpackManifest.serialize(manifest, root.resolve("manifest.json"), GsonPreset.API);
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +61,6 @@ public class CurseForgeExporter extends Exporter<CurseforgeModpackManifest> {
|
|||||||
Files.createDirectories(modsOverrides);
|
Files.createDirectories(modsOverrides);
|
||||||
Files.copy(mod.getJarPath(), modsOverrides.resolve(mod.getJarPath().getFileName().toString()));
|
Files.copy(mod.getJarPath(), modsOverrides.resolve(mod.getJarPath().getFileName().toString()));
|
||||||
}
|
}
|
||||||
GC_CurseforgeModpackManifest.write(manifest, root.resolve("manifest.json"));
|
GC_CurseforgeModpackManifest.serialize(manifest, root.resolve("manifest.json"), GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.GC_ModrinthModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.GC_ModrinthModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.ModrinthModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.ModrinthModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
||||||
@ -33,7 +34,7 @@ public class ModrinthExporter extends Exporter<ModrinthModpackManifest> {
|
|||||||
null
|
null
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
GC_ModrinthModpackManifest.write(manifest, root.resolve("modrinth.index.json"));
|
GC_ModrinthModpackManifest.serialize(manifest, root.resolve("modrinth.index.json"), GsonPreset.API);
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,6 @@ public class ModrinthExporter extends Exporter<ModrinthModpackManifest> {
|
|||||||
Files.createDirectories(modsOverrides);
|
Files.createDirectories(modsOverrides);
|
||||||
Files.copy(mod.getJarPath(), modsOverrides.resolve(mod.getJarPath().getFileName().toString()));
|
Files.copy(mod.getJarPath(), modsOverrides.resolve(mod.getJarPath().getFileName().toString()));
|
||||||
}
|
}
|
||||||
GC_ModrinthModpackManifest.write(manifest, root.resolve("modrinth.index.json"));
|
GC_ModrinthModpackManifest.serialize(manifest, root.resolve("modrinth.index.json"), GsonPreset.API);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
package io.gitlab.jfronny.inceptum.launcher.system.exporter;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.multimc.GC_MMCPackMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.multimc.GC_MMCPackMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.multimc.MMCPackMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.multimc.MMCPackMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
||||||
@ -54,7 +55,7 @@ public class MultiMCExporter extends Exporter<MMCPackMeta> {
|
|||||||
manifest.components().add(new MMCPackMeta.Component(true, false, "net.fabricmc.intermediary", instance.getGameVersion()));
|
manifest.components().add(new MMCPackMeta.Component(true, false, "net.fabricmc.intermediary", instance.getGameVersion()));
|
||||||
manifest.components().add(new MMCPackMeta.Component(false, false, "net.fabricmc.fabric-loader", instance.getLoaderVersion()));
|
manifest.components().add(new MMCPackMeta.Component(false, false, "net.fabricmc.fabric-loader", instance.getLoaderVersion()));
|
||||||
}
|
}
|
||||||
GC_MMCPackMeta.write(manifest, root.resolve("mmc-pack.json"));
|
GC_MMCPackMeta.serialize(manifest, root.resolve("mmc-pack.json"), GsonPreset.API);
|
||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.CurseforgeModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.GC_CurseforgeModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.GC_CurseforgeModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
||||||
@ -15,7 +16,7 @@ import java.nio.file.Path;
|
|||||||
|
|
||||||
public class CurseForgeImporter extends Importer<CurseforgeModpackManifest> {
|
public class CurseForgeImporter extends Importer<CurseforgeModpackManifest> {
|
||||||
public CurseForgeImporter() {
|
public CurseForgeImporter() {
|
||||||
super("CurseForge", "manifest.json", GC_CurseforgeModpackManifest::read);
|
super("CurseForge", "manifest.json", path -> GC_CurseforgeModpackManifest.deserialize(path, GsonPreset.API));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +48,7 @@ public class CurseForgeImporter extends Importer<CurseforgeModpackManifest> {
|
|||||||
ModDownload download = source.download();
|
ModDownload download = source.download();
|
||||||
ModMeta imod = ModMeta.of(download.sha1(), download.murmur2(), source, manifest.minecraft().version());
|
ModMeta imod = ModMeta.of(download.sha1(), download.murmur2(), source, manifest.minecraft().version());
|
||||||
Files.createDirectories(modsPath);
|
Files.createDirectories(modsPath);
|
||||||
GC_ModMeta.write(imod, modsPath.resolve(source.getShortName() + ModPath.EXT_IMOD));
|
GC_ModMeta.serialize(imod, modsPath.resolve(source.getShortName() + ModPath.EXT_IMOD), GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
|||||||
|
|
||||||
import io.gitlab.jfronny.commons.io.JFiles;
|
import io.gitlab.jfronny.commons.io.JFiles;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.api.FabricMetaApi;
|
import io.gitlab.jfronny.inceptum.launcher.api.FabricMetaApi;
|
||||||
@ -61,7 +62,7 @@ public abstract class Importer<T> {
|
|||||||
Instance.setSetupLock(iDir, true);
|
Instance.setSetupLock(iDir, true);
|
||||||
InstanceMeta meta = new InstanceMeta();
|
InstanceMeta meta = new InstanceMeta();
|
||||||
meta.gameVersion = createVersionString(man.gameVersion(), man.fabricVersion());
|
meta.gameVersion = createVersionString(man.gameVersion(), man.fabricVersion());
|
||||||
GC_InstanceMeta.write(meta, iDir.resolve(Instance.CONFIG_NAME));
|
GC_InstanceMeta.serialize(meta, iDir.resolve(Instance.CONFIG_NAME), GsonPreset.CONFIG);
|
||||||
|
|
||||||
if (state.isCancelled()) {
|
if (state.isCancelled()) {
|
||||||
JFiles.deleteRecursive(iDir);
|
JFiles.deleteRecursive(iDir);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.GC_ModrinthModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.GC_ModrinthModpackManifest;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.ModrinthModpackManifest;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.ModrinthModpackManifest;
|
||||||
@ -11,7 +12,7 @@ import java.nio.file.Path;
|
|||||||
|
|
||||||
public class ModrinthImporter extends Importer<ModrinthModpackManifest> {
|
public class ModrinthImporter extends Importer<ModrinthModpackManifest> {
|
||||||
public ModrinthImporter() {
|
public ModrinthImporter() {
|
||||||
super("Modrinth", "modrinth.index.json", GC_ModrinthModpackManifest::read);
|
super("Modrinth", "modrinth.index.json", path -> GC_ModrinthModpackManifest.deserialize(path, GsonPreset.API));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
package io.gitlab.jfronny.inceptum.launcher.system.importer;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.multimc.GC_MMCPackMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.multimc.GC_MMCPackMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.multimc.MMCPackMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.multimc.MMCPackMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.util.ProcessState;
|
import io.gitlab.jfronny.inceptum.launcher.util.ProcessState;
|
||||||
@ -11,7 +12,7 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
public class MultiMCImporter extends Importer<MMCPackMeta> {
|
public class MultiMCImporter extends Importer<MMCPackMeta> {
|
||||||
public MultiMCImporter() {
|
public MultiMCImporter() {
|
||||||
super("MultiMC", "mmc-pack.json", GC_MMCPackMeta::read);
|
super("MultiMC", "mmc-pack.json", path -> GC_MMCPackMeta.deserialize(path, GsonPreset.API));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.instance;
|
package io.gitlab.jfronny.inceptum.launcher.system.instance;
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.ref.R;
|
import io.gitlab.jfronny.commons.ref.R;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
||||||
@ -154,7 +155,7 @@ public record Instance(String id, Path path, InstanceMeta meta, ModsDirScanner m
|
|||||||
|
|
||||||
public void writeMeta() {
|
public void writeMeta() {
|
||||||
try {
|
try {
|
||||||
GC_InstanceMeta.write(meta, path.resolve(CONFIG_NAME));
|
GC_InstanceMeta.serialize(meta, path.resolve(CONFIG_NAME), GsonPreset.CONFIG);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Utils.LOGGER.error("Could not write instance config", e);
|
Utils.LOGGER.error("Could not write instance config", e);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package io.gitlab.jfronny.inceptum.launcher.system.instance;
|
|||||||
import io.gitlab.jfronny.commons.io.JFiles;
|
import io.gitlab.jfronny.commons.io.JFiles;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingConsumer;
|
import io.gitlab.jfronny.commons.throwable.ThrowingConsumer;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingRunnable;
|
import io.gitlab.jfronny.commons.throwable.ThrowingRunnable;
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
||||||
@ -76,7 +77,7 @@ public class InstanceList {
|
|||||||
if (!metas.containsKey(instancePath)) {
|
if (!metas.containsKey(instancePath)) {
|
||||||
metas.put(instancePath, new IEntry(
|
metas.put(instancePath, new IEntry(
|
||||||
instancePath,
|
instancePath,
|
||||||
new FileBackedRef<>(instancePath.resolve(Instance.CONFIG_NAME), GC_InstanceMeta::read)
|
new FileBackedRef<>(instancePath.resolve(Instance.CONFIG_NAME), GC_InstanceMeta::deserialize, GsonPreset.CONFIG)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return metas.get(instancePath).toPub();
|
return metas.get(instancePath).toPub();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.instance;
|
package io.gitlab.jfronny.inceptum.launcher.system.instance;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.mds.ModsDirScanner;
|
import io.gitlab.jfronny.inceptum.launcher.system.mds.ModsDirScanner;
|
||||||
@ -31,7 +32,7 @@ public class ModManager {
|
|||||||
|
|
||||||
public record DownloadMeta(ModDownload download, ModMeta meta, ModSource source, Path metaFile) {
|
public record DownloadMeta(ModDownload download, ModMeta meta, ModSource source, Path metaFile) {
|
||||||
public void write() throws IOException {
|
public void write() throws IOException {
|
||||||
GC_ModMeta.write(meta, metaFile);
|
GC_ModMeta.serialize(meta, metaFile, GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.mds.threaded;
|
package io.gitlab.jfronny.inceptum.launcher.system.mds.threaded;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.JsonParseException;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils;
|
import io.gitlab.jfronny.inceptum.common.Utils;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.fabric.FabricModJson;
|
import io.gitlab.jfronny.inceptum.launcher.model.fabric.FabricModJson;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.fabric.GC_FabricModJson;
|
import io.gitlab.jfronny.inceptum.launcher.model.fabric.GC_FabricModJson;
|
||||||
@ -25,7 +25,7 @@ public record FileScanTask(ProtoInstance instance, Path file, BiConsumer<Path, M
|
|||||||
if (ModPath.isJar(file)) discover(file, ModPath.appendImod(file));
|
if (ModPath.isJar(file)) discover(file, ModPath.appendImod(file));
|
||||||
else if (ModPath.isImod(file)) discover(ModPath.trimImod(file), file);
|
else if (ModPath.isImod(file)) discover(ModPath.trimImod(file), file);
|
||||||
else discovered.accept(file, new NoopMod(file));
|
else discovered.accept(file, new NoopMod(file));
|
||||||
} catch (IOException | URISyntaxException | JsonParseException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
Utils.LOGGER.error("Could not scan file for mod info", e);
|
Utils.LOGGER.error("Could not scan file for mod info", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,14 +33,14 @@ public record FileScanTask(ProtoInstance instance, Path file, BiConsumer<Path, M
|
|||||||
private void discover(Path jarPath, Path imodPath) throws IOException, URISyntaxException {
|
private void discover(Path jarPath, Path imodPath) throws IOException, URISyntaxException {
|
||||||
boolean managed = false;
|
boolean managed = false;
|
||||||
ModMeta meta;
|
ModMeta meta;
|
||||||
if (Files.exists(imodPath)) meta = GC_ModMeta.read(imodPath);
|
if (Files.exists(imodPath)) meta = GC_ModMeta.deserialize(imodPath, GsonPreset.CONFIG);
|
||||||
else {
|
else {
|
||||||
meta = ModMeta.of(jarPath);
|
meta = ModMeta.of(jarPath);
|
||||||
GC_ModMeta.write(meta, imodPath);
|
GC_ModMeta.serialize(meta, imodPath, GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
if (meta.initialize(gameVersion)) {
|
if (meta.initialize(gameVersion)) {
|
||||||
GC_ModMeta.write(meta, imodPath);
|
GC_ModMeta.serialize(meta, imodPath, GsonPreset.CONFIG);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
ModSource selectedSource = null;
|
ModSource selectedSource = null;
|
||||||
@ -60,12 +60,12 @@ public record FileScanTask(ProtoInstance instance, Path file, BiConsumer<Path, M
|
|||||||
jarPath = selectedSource.getJarPath();
|
jarPath = selectedSource.getJarPath();
|
||||||
managed = true;
|
managed = true;
|
||||||
} else if (!Files.exists(jarPath)) throw new IOException("Mod has no jar and no sources");
|
} else if (!Files.exists(jarPath)) throw new IOException("Mod has no jar and no sources");
|
||||||
if (modified) meta = GC_ModMeta.read(imodPath);
|
if (modified) meta = GC_ModMeta.deserialize(imodPath, GsonPreset.CONFIG);
|
||||||
|
|
||||||
FabricModJson fmj;
|
FabricModJson fmj;
|
||||||
try (FileSystem fs = Utils.openZipFile(jarPath, false)) {
|
try (FileSystem fs = Utils.openZipFile(jarPath, false)) {
|
||||||
Path fmjPath = fs.getPath("fabric.mod.json");
|
Path fmjPath = fs.getPath("fabric.mod.json");
|
||||||
if (Files.exists(fmjPath)) fmj = GC_FabricModJson.read(fmjPath);
|
if (Files.exists(fmjPath)) fmj = GC_FabricModJson.deserialize(fmjPath, GsonPreset.API);
|
||||||
else fmj = null;
|
else fmj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.mds.threaded;
|
package io.gitlab.jfronny.inceptum.launcher.system.mds.threaded;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.fabric.FabricModJson;
|
import io.gitlab.jfronny.inceptum.launcher.model.fabric.FabricModJson;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_ModMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.ModMeta;
|
||||||
@ -131,6 +132,6 @@ public class MdsMod extends Mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void write() throws IOException {
|
private void write() throws IOException {
|
||||||
GC_ModMeta.write(meta, imodPath);
|
GC_ModMeta.serialize(meta, imodPath, GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.setup.steps;
|
package io.gitlab.jfronny.inceptum.launcher.system.setup.steps;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
||||||
@ -15,7 +16,7 @@ public class RunMdsStep implements Step {
|
|||||||
public void execute(SetupStepInfo info) throws IOException {
|
public void execute(SetupStepInfo info) throws IOException {
|
||||||
info.setState("Running MDS");
|
info.setState("Running MDS");
|
||||||
Path instance = MetaHolder.INSTANCE_DIR.resolve(info.name());
|
Path instance = MetaHolder.INSTANCE_DIR.resolve(info.name());
|
||||||
ModsDirScanner.get(instance.resolve("mods"), GC_InstanceMeta.read(instance.resolve(Instance.CONFIG_NAME)))
|
ModsDirScanner.get(instance.resolve("mods"), GC_InstanceMeta.deserialize(instance.resolve(Instance.CONFIG_NAME), GsonPreset.CONFIG))
|
||||||
.runOnce((path, iwModDescription) -> info.setState("Scanned " + path));
|
.runOnce((path, iwModDescription) -> info.setState("Scanned " + path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.setup.steps;
|
package io.gitlab.jfronny.inceptum.launcher.system.setup.steps;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.GC_InstanceMeta;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta;
|
||||||
@ -20,7 +21,7 @@ public class WriteMetadataStep implements Step {
|
|||||||
if (!Files.exists(metaPath)) {
|
if (!Files.exists(metaPath)) {
|
||||||
InstanceMeta meta = new InstanceMeta();
|
InstanceMeta meta = new InstanceMeta();
|
||||||
meta.gameVersion = info.version().id;
|
meta.gameVersion = info.version().id;
|
||||||
GC_InstanceMeta.write(meta, metaPath);
|
GC_InstanceMeta.serialize(meta, metaPath, GsonPreset.CONFIG);
|
||||||
}
|
}
|
||||||
if (!Files.exists(instance.resolve(".gitignore"))) {
|
if (!Files.exists(instance.resolve(".gitignore"))) {
|
||||||
Files.writeString(instance.resolve(".gitignore"), """
|
Files.writeString(instance.resolve(".gitignore"), """
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.system.source;
|
package io.gitlab.jfronny.inceptum.launcher.system.source;
|
||||||
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.commons.serialize.generator.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
import io.gitlab.jfronny.inceptum.common.MetaHolder;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.gson.ModSourceAdapter;
|
import io.gitlab.jfronny.inceptum.launcher.gson.ModSourceAdapter;
|
||||||
@ -10,7 +10,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@GSerializable(with = ModSourceAdapter.class, configure = GsonPreset.Api.class)
|
@GSerializable(with = ModSourceAdapter.class)
|
||||||
public interface ModSource {
|
public interface ModSource {
|
||||||
ModDownload download() throws IOException;
|
ModDownload download() throws IOException;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public final class ModrinthModSource implements ModSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModDownload download() throws IOException {
|
public ModDownload download() throws IOException {
|
||||||
ModrinthVersion.File file = current.files().get(0);
|
ModrinthVersion.File file = current.files().getFirst();
|
||||||
Path path = getJarPath();
|
Path path = getJarPath();
|
||||||
try {
|
try {
|
||||||
Net.downloadFile(file.url(), file.hashes().sha1(), path);
|
Net.downloadFile(file.url(), file.hashes().sha1(), path);
|
||||||
@ -80,7 +80,7 @@ public final class ModrinthModSource implements ModSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return current.files().get(0).filename();
|
return current.files().getFirst().filename();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -117,7 +117,7 @@ public final class ModrinthModSource implements ModSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ModrinthModpackManifest.File toManifest() throws IOException {
|
public ModrinthModpackManifest.File toManifest() throws IOException {
|
||||||
ModrinthVersion.File orig = current.files().get(0);
|
ModrinthVersion.File orig = current.files().getFirst();
|
||||||
return new ModrinthModpackManifest.File(
|
return new ModrinthModpackManifest.File(
|
||||||
"mods/" + orig.filename(),
|
"mods/" + orig.filename(),
|
||||||
new ModrinthHashes(
|
new ModrinthHashes(
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package io.gitlab.jfronny.inceptum.launcher.util;
|
package io.gitlab.jfronny.inceptum.launcher.util;
|
||||||
|
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonReader;
|
||||||
|
import io.gitlab.jfronny.commons.serialize.json.JsonTransport;
|
||||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@ -19,6 +21,14 @@ public class FileBackedRef<T> implements Closeable {
|
|||||||
filePath.getParent().register(service, StandardWatchEventKinds.ENTRY_MODIFY);
|
filePath.getParent().register(service, StandardWatchEventKinds.ENTRY_MODIFY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileBackedRef(Path filePath, ThrowingFunction<JsonReader, T, IOException> read, JsonTransport transport) throws IOException {
|
||||||
|
this(filePath, path -> {
|
||||||
|
try (JsonReader reader = transport.createReader(Files.newBufferedReader(path))) {
|
||||||
|
return read.apply(reader);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public T get() throws IOException {
|
public T get() throws IOException {
|
||||||
WatchKey key = service.poll();
|
WatchKey key = service.poll();
|
||||||
boolean update = cache == null;
|
boolean update = cache == null;
|
||||||
|
@ -28,5 +28,6 @@ module io.gitlab.jfronny.inceptum.launcher {
|
|||||||
requires transitive io.gitlab.jfronny.inceptum.common;
|
requires transitive io.gitlab.jfronny.inceptum.common;
|
||||||
requires transitive io.gitlab.jfronny.commons.http.server;
|
requires transitive io.gitlab.jfronny.commons.http.server;
|
||||||
requires static org.jetbrains.annotations;
|
requires static org.jetbrains.annotations;
|
||||||
requires static io.gitlab.jfronny.gson.compile.annotations;
|
requires static io.gitlab.jfronny.commons.serialize.generator.annotations;
|
||||||
|
requires io.gitlab.jfronny.commons.serialize;
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ public class Wrapper {
|
|||||||
throw new FileNotFoundException("Something went wrong while downloading the latest version.");
|
throw new FileNotFoundException("Something went wrong while downloading the latest version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Path> classpath = Updater.getLaunchClasspath(GC_WrapperConfig.read(MetaHolder.WRAPPER_CONFIG_PATH));
|
List<Path> classpath = Updater.getLaunchClasspath(GC_WrapperConfig.deserialize(MetaHolder.WRAPPER_CONFIG_PATH, GsonPreset.CONFIG));
|
||||||
if (!BuildMetadata.IS_RELEASE) {
|
if (!BuildMetadata.IS_RELEASE) {
|
||||||
System.out.println("Using classpath: " + classpath.stream().map(Path::toString).collect(Collectors.joining("" + File.pathSeparator)));
|
System.out.println("Using classpath: " + classpath.stream().map(Path::toString).collect(Collectors.joining("" + File.pathSeparator)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user