Skip to content

Commit

Permalink
Merge pull request #366 from Polyfrost/develop-v0
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest authored Nov 6, 2024
2 parents 04f6ec1 + c17c03e commit 4a0bd69
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OneConfig is a free, open sourced configuration library by [Polyfrost](https://p
</details>

### 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.
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 7 additions & 15 deletions versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* This file is part of OneConfig.
* OneConfig - Next Generation Config Library for Minecraft: Java Edition
* Copyright (C) 2021~2023 Polyfrost.
* <https://polyfrost.cc> <https://github.com/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 <https://www.gnu.org/licenses/>. You should
* have also received a copy of the Additional Terms Applicable
* to OneConfig, as published by Polyfrost. If not, see
* <https://polyfrost.cc/legal/oneconfig/additional-terms>
*/

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;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* This file is part of OneConfig.
* OneConfig - Next Generation Config Library for Minecraft: Java Edition
* Copyright (C) 2021~2023 Polyfrost.
* <https://polyfrost.cc> <https://github.com/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 <https://www.gnu.org/licenses/>. You should
* have also received a copy of the Additional Terms Applicable
* to OneConfig, as published by Polyfrost. If not, see
* <https://polyfrost.cc/legal/oneconfig/additional-terms>
*/

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<InputStream> cir) {
if (this.oneconfig$connection != null) {
this.oneconfig$connection.setSSLSocketFactory(SkyClientUpdaterHack.INSTANCE.getSSLContext().getSocketFactory());
}
}
}
1 change: 1 addition & 0 deletions versions/src/main/resources/mixins.oneconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"OptifineConfigMixin",
"RedactionNameHighlightMixin",
"ShaderGroupAccessor",
"SkyClientUpdaterMixin",
"VigilantMixin",
"WorldClientMixin"
]
Expand Down
Binary file added versions/src/main/resources/polyfrost_backup.jks
Binary file not shown.

0 comments on commit 4a0bd69

Please sign in to comment.