diff --git a/README.md b/README.md index f828c27e6..ba97feb4d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ OneConfig is a free, open sourced configuration library by [Polyfrost](https://p ### How to get: -For beginners, we recommend using [SkyClient](https://skyclient.co/), a free and open-sourced mod installer. For more technical users, all of our mods, including [Hytils](https://github.com/Polyfrost/Hytils-Reborn), [CrashPatch](https://github.com/Polyfrost/crashpatch), [EvergreenHUD](https://github.com/Polyfrost/EvergreenHUD), and [Chatting](https://github.com/Polyfrost/chatting) have full support, and come with OneConfig. Mods which use [Vigilance](https://github.com/EssentialGG/Vigilance) are also supported through our [compatability layer](https://docs.polyfrost.cc/oneconfig/config/compatibility). +For beginners, we recommend using [SkyClient](https://skyclient.co/), a free and open-sourced mod installer. For more technical users, all of our mods, including [Hytils](https://github.com/Polyfrost/Hytils-Reborn), [CrashPatch](https://github.com/Polyfrost/crashpatch), [EvergreenHUD](https://github.com/Polyfrost/EvergreenHUD), and [Chatting](https://github.com/Polyfrost/chatting) have full support, and come with OneConfig. Mods which use [Vigilance](https://github.com/EssentialGG/Vigilance) are also supported through our [compatibility layer](https://docs.polyfrost.cc/oneconfig/config/compatibility). ### Is it a client? While it may look like OneConfig is a client, in reality it's actually a standalone mod. You can actually [see for yourself](https://github.com/Polyfrost/OneConfig-Bootstrap), it doesn't come with any mods of it's own. It's left up to the user to decide which mods they want to actually use. diff --git a/build.gradle.kts b/build.gradle.kts index b9ee19bf3..df12db3ba 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,7 +40,8 @@ blossom { } repositories { - maven("https://repo.polyfrost.cc/releases") + maven("https://repo.polyfrost.org/releases") + maven("https://repo.polyfrost.org/snapshots") } val relocated = registerRelocationAttribute("relocate") { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a74ab389d..80acbd44d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ deencapsulation = "42b829f373" caffeine = "2.9.3" mixin = "0.7.11-SNAPSHOT" -lwjgl = "1.0.0-alpha26" +lwjgl = "1.0.0-alpha29" fabric-asm = "v2.3" [libraries] diff --git a/settings.gradle.kts b/settings.gradle.kts index 5b8dcf034..2879d390d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,7 +3,7 @@ pluginManagement { gradlePluginPortal() maven("https://repo.polyfrost.org/releases") } - val pgtVersion = "0.6.2" + val pgtVersion = "0.6.6" plugins { id("org.polyfrost.multi-version.root") version pgtVersion id("org.polyfrost.defaults") version pgtVersion diff --git a/versions/build.gradle.kts b/versions/build.gradle.kts index d417b965a..8eda5366a 100644 --- a/versions/build.gradle.kts +++ b/versions/build.gradle.kts @@ -75,7 +75,8 @@ loom { } repositories { - maven("https://repo.polyfrost.cc/releases") + maven("https://repo.polyfrost.org/releases") + maven("https://repo.polyfrost.org/snapshots") } val relocatedCommonProject = registerRelocationAttribute("common-lwjgl") { @@ -165,20 +166,11 @@ dependencies { } } - val repackedVersions = when (platform.mcVersion) { - in 10809..11202 -> listOf(RepackedVersion.LEGACY) - in 11203..11802 -> listOf(RepackedVersion.PRE119NOARM, RepackedVersion.PRE119ARM) - else -> listOf(RepackedVersion.POST119) - } - - repackedVersions.forEachIndexed { index, version -> - val configuration = configurations.create("tempLwjglConfiguration$index") - - compileOnly(configuration("cc.polyfrost:lwjgl-$version:${libs.versions.lwjgl.get()}"){ - isTransitive = false - }) - shadeNoPom(implementationNoPom(prebundle(configuration, "lwjgl-$version.jar"))!!) - } + val configuration = configurations.create("tempLwjglConfiguration0") + compileOnly(configuration("cc.polyfrost:lwjgl-legacy:${libs.versions.lwjgl.get()}") { + isTransitive = false + }) + shadeNoPom(implementationNoPom(prebundle(configuration, "lwjgl-legacy.jar"))!!) modRuntimeOnly("me.djtheredstoner:DevAuth-" + (if (platform.isForge) { if (platform.isLegacyForge) "forge-legacy" else "forge-latest" } else "fabric") diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/hacks/SkyClientUpdaterHack.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/hacks/SkyClientUpdaterHack.java new file mode 100644 index 000000000..5bc4bfea4 --- /dev/null +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/hacks/SkyClientUpdaterHack.java @@ -0,0 +1,55 @@ +/* + * This file is part of OneConfig. + * OneConfig - Next Generation Config Library for Minecraft: Java Edition + * Copyright (C) 2021~2023 Polyfrost. + * + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * OneConfig is licensed under the terms of version 3 of the GNU Lesser + * General Public License as published by the Free Software Foundation, AND + * under the Additional Terms Applicable to OneConfig, as published by Polyfrost, + * either version 1.0 of the Additional Terms, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License. If not, see . You should + * have also received a copy of the Additional Terms Applicable + * to OneConfig, as published by Polyfrost. If not, see + * + */ + +package cc.polyfrost.oneconfig.internal.hacks; + +import cc.polyfrost.oneconfig.internal.OneConfig; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; +import java.security.KeyStore; + +public class SkyClientUpdaterHack { + public static final SkyClientUpdaterHack INSTANCE = new SkyClientUpdaterHack(); + + public SSLContext getSSLContext() { + try { + KeyStore keystore = KeyStore.getInstance("JKS"); + keystore.load(SkyClientUpdaterHack.class.getResourceAsStream("/polyfrost_backup.jks"), "changeit".toCharArray()); + KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + kmf.init(keystore, null); + tmf.init(keystore); + SSLContext ctx = SSLContext.getInstance("TLS"); + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + return ctx; + } catch (Exception e) { + OneConfig.LOGGER.warn("Failed to load keystore. Web requests may fail on older Java versions", e); + return null; + } + } +} diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/SkyClientUpdaterMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/SkyClientUpdaterMixin.java new file mode 100644 index 000000000..43f23982e --- /dev/null +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/SkyClientUpdaterMixin.java @@ -0,0 +1,61 @@ +/* + * This file is part of OneConfig. + * OneConfig - Next Generation Config Library for Minecraft: Java Edition + * Copyright (C) 2021~2023 Polyfrost. + * + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * OneConfig is licensed under the terms of version 3 of the GNU Lesser + * General Public License as published by the Free Software Foundation, AND + * under the Additional Terms Applicable to OneConfig, as published by Polyfrost, + * either version 1.0 of the Additional Terms, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License. If not, see . You should + * have also received a copy of the Additional Terms Applicable + * to OneConfig, as published by Polyfrost. If not, see + * + */ + +package cc.polyfrost.oneconfig.internal.mixin; + +import cc.polyfrost.oneconfig.internal.hacks.SkyClientUpdaterHack; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import javax.net.ssl.HttpsURLConnection; +import java.io.InputStream; + +@Pseudo +@Mixin(targets = "mynameisjeff.skyblockclientupdater.UpdateChecker", remap = false) +public class SkyClientUpdaterMixin { + + @Unique private HttpsURLConnection oneconfig$connection; + + @Dynamic("SCC 1.3.6 or below. If this doesn't apply, Minecraft should still work fine.") + @Redirect(method = "setupConnection", at = @At(value = "INVOKE", target = "Lkotlin/jvm/internal/Intrinsics;checkNotNull(Ljava/lang/Object;Ljava/lang/String;)V")) + private void fixSSLOnOlderSCC(Object connection, String error) { + this.oneconfig$connection = (HttpsURLConnection) connection; + } + + @Dynamic("SCC 1.3.6 or below. If this doesn't apply, Minecraft should still work fine.") + @Inject(method = "setupConnection", at = @At(value = "INVOKE", target = "Ljavax/net/ssl/HttpsURLConnection;getInputStream()Ljava/io/InputStream;")) + private void fixSSLOnOlderSCC(String url, CallbackInfoReturnable cir) { + if (this.oneconfig$connection != null) { + this.oneconfig$connection.setSSLSocketFactory(SkyClientUpdaterHack.INSTANCE.getSSLContext().getSocketFactory()); + } + } +} diff --git a/versions/src/main/resources/mixins.oneconfig.json b/versions/src/main/resources/mixins.oneconfig.json index b3f3fb0ac..3b4534727 100644 --- a/versions/src/main/resources/mixins.oneconfig.json +++ b/versions/src/main/resources/mixins.oneconfig.json @@ -17,6 +17,7 @@ "OptifineConfigMixin", "RedactionNameHighlightMixin", "ShaderGroupAccessor", + "SkyClientUpdaterMixin", "VigilantMixin", "WorldClientMixin" ] diff --git a/versions/src/main/resources/polyfrost_backup.jks b/versions/src/main/resources/polyfrost_backup.jks new file mode 100644 index 000000000..fac44e35e Binary files /dev/null and b/versions/src/main/resources/polyfrost_backup.jks differ