diff options
| author | Roman / Linnea Gräf <roman.graef@gmail.com> | 2023-02-04 14:39:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-04 14:39:11 +0100 |
| commit | 2cdedc4e5db57564d05c50230c52e8e887d2d8b5 (patch) | |
| tree | 1badb0bb9bcd6caf504000abc7def79222775fdc /src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java | |
| parent | e9a07b41c5124a357ea1231af04f2a6b3c2daffa (diff) | |
| download | notenoughupdates-2cdedc4e5db57564d05c50230c52e8e887d2d8b5.tar.gz notenoughupdates-2cdedc4e5db57564d05c50230c52e8e887d2d8b5.tar.bz2 notenoughupdates-2cdedc4e5db57564d05c50230c52e8e887d2d8b5.zip | |
Restrict texture https upgrading to only minecraft.net (#578)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java b/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java index 4fa57360..e84fce11 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Linnea Gräf + * Copyright (C) 2022-2023 Linnea Gräf * * This file is part of NotEnoughUpdates. * @@ -26,15 +26,22 @@ import javax.net.ssl.HttpsURLConnection; import java.net.HttpURLConnection; public class ThreadDownloadImageHook { + public static String hookThreadImageLink(String originalLink) { + if (!NotEnoughUpdates.INSTANCE.config.misc.fixSteveSkulls || originalLink == null || !originalLink.startsWith( + "http://textures.minecraft.net")) + return originalLink; + return originalLink.replace("http://", "https://"); + } + public static void hookThreadImageConnection(HttpURLConnection connection) { if ((connection instanceof HttpsURLConnection) && NotEnoughUpdates.INSTANCE.config.misc.fixSteveSkulls) { ApiUtil.patchHttpsRequest((HttpsURLConnection) connection); } } - public static String hookThreadImageLink(String originalLink) { - if (!NotEnoughUpdates.INSTANCE.config.misc.fixSteveSkulls || originalLink == null) - return originalLink; - return originalLink.replace("http://", "https://"); + public interface AccessorThreadDownloadImageData { + String getOriginalUrl(); + + String getPatchedUrl(); } } |
