aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-29 19:28:52 +0100
committerGitHub <noreply@github.com>2024-03-29 19:28:52 +0100
commitdfec491a7177e1e9763d20d97f3d2a17f173c794 (patch)
treeac3b463702a17db3f8f9ddaf30aa399ac4fbe314
parente5785a55191c0066ba7706ba585fb938a5eb4a0a (diff)
downloadskyhanni-dfec491a7177e1e9763d20d97f3d2a17f173c794.tar.gz
skyhanni-dfec491a7177e1e9763d20d97f3d2a17f173c794.tar.bz2
skyhanni-dfec491a7177e1e9763d20d97f3d2a17f173c794.zip
Use custom https ssl context for auto updater (#1317)
-rw-r--r--gradle/libs.versions.toml2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt28
3 files changed, 33 insertions, 2 deletions
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 99aad1330..652e4fb07 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
[versions]
-libautoupdate = "1.0.3"
+libautoupdate = "1.3.1"
moulconfig = "2.5.0"
headlessLwjgl = "1.7.2"
jbAnnotations = "24.1.0"
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java
index 480d2955e..97d378e2d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java
@@ -98,6 +98,11 @@ public class DebugConfig {
public boolean hotSwapDetection = false;
@Expose
+ @ConfigOption(name = "Always Outdated", desc = "For the sake of the auto updater, act like you are always oudated.")
+ @ConfigEditorBoolean
+ public boolean alwaysOutdated = false;
+
+ @Expose
@ConfigOption(name = "SkyHanni Event Counter", desc = "Count once per second how many skyhanni events gets triggered, " +
"show the total amount in console output.")
@ConfigEditorBoolean
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
index 53a7db0f3..f064ac574 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt
@@ -7,17 +7,21 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.LorenzLogger
+import com.google.gson.JsonElement
import io.github.moulberry.moulconfig.processor.MoulConfigProcessor
+import io.github.moulberry.notenoughupdates.util.ApiUtil
import io.github.moulberry.notenoughupdates.util.MinecraftExecutor
import moe.nea.libautoupdate.CurrentVersion
import moe.nea.libautoupdate.PotentialUpdate
import moe.nea.libautoupdate.UpdateContext
import moe.nea.libautoupdate.UpdateSource
import moe.nea.libautoupdate.UpdateTarget
+import moe.nea.libautoupdate.UpdateUtils
import net.minecraft.client.Minecraft
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.concurrent.CompletableFuture
+import javax.net.ssl.HttpsURLConnection
object UpdateManager {
@@ -129,12 +133,34 @@ object UpdateManager {
private val context = UpdateContext(
UpdateSource.githubUpdateSource("hannibal002", "SkyHanni"),
UpdateTarget.deleteAndSaveInTheSameFolder(UpdateManager::class.java),
- CurrentVersion.ofTag(SkyHanniMod.version),
+ object : CurrentVersion {
+ val normalDelegate = CurrentVersion.ofTag(SkyHanniMod.version)
+ override fun display(): String {
+ if (SkyHanniMod.feature.dev.debug.alwaysOutdated)
+ return "Force Outdated"
+ return normalDelegate.display()
+ }
+
+ override fun isOlderThan(element: JsonElement): Boolean {
+ if (SkyHanniMod.feature.dev.debug.alwaysOutdated)
+ return true
+ return normalDelegate.isOlderThan(element)
+ }
+
+ override fun toString(): String {
+ return "ForceOutdateDelegate($normalDelegate)"
+ }
+ },
SkyHanniMod.MODID,
)
init {
context.cleanup()
+ UpdateUtils.patchConnection {
+ if (it is HttpsURLConnection) {
+ ApiUtil.patchHttpsRequest(it)
+ }
+ }
}
enum class UpdateState {