diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2024-09-20 17:06:51 -0230 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-20 21:36:51 +0200 |
commit | 23d779a47fdd114cad12552603b931fc2a31c318 (patch) | |
tree | 51dd0eee8bd348c2d73ac5710db70aa108718382 /src/main/java/at/hannibal2/skyhanni | |
parent | 20a0aeb8cc9e795adf54cafbf381ab5c9dfe2595 (diff) | |
download | skyhanni-23d779a47fdd114cad12552603b931fc2a31c318.tar.gz skyhanni-23d779a47fdd114cad12552603b931fc2a31c318.tar.bz2 skyhanni-23d779a47fdd114cad12552603b931fc2a31c318.zip |
Fix: github source checking (#2548)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java b/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java index 5fb46592e..5672ee87c 100644 --- a/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java +++ b/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java @@ -1,7 +1,5 @@ package at.hannibal2.skyhanni.tweaker; -import at.hannibal2.skyhanni.SkyHanniMod; - import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -16,7 +14,8 @@ import java.util.concurrent.atomic.AtomicBoolean; public class DownloadSourceChecker { - private static final String GITHUB_REPO_TEXT = "repo_id=511310721"; + private static final String GITHUB_REPO = "511310721"; + private static final String GITHUB_REPO_TEXT = "repo_id=" + GITHUB_REPO; private static final String MODRINTH_URL = "/data/byNkmv5G/"; private static final String THE_PASSWORD = "danger"; @@ -96,11 +95,12 @@ public class DownloadSourceChecker { } )); - String version = SkyHanniMod.Companion.getVersion(); + // TODO FIX THIS CAUSING CLASS LOADING AND CRASHING + //String version = SkyHanniMod.Companion.getVersion(); JOptionPane.showOptionDialog( frame, String.format(String.join("\n", SECURITY_POPUP), uriToSimpleString(host)), - "SkyHanni " + version + " Security Error", + "SkyHanni Security Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, @@ -124,8 +124,12 @@ public class DownloadSourceChecker { URI host = getHost(file); if (host == null) return null; - if (host.getHost().equals("objects.githubusercontent.com") && host.getQuery().contains(GITHUB_REPO_TEXT)) { - return null; + if (host.getHost().equals("objects.githubusercontent.com")) { + if (host.getQuery().contains(GITHUB_REPO_TEXT)) { + return null; + } else if (host.getPath().contains("/" + GITHUB_REPO + "/")) { + return null; + } } else if (host.getHost().equals("cdn.modrinth.com") && host.getPath().startsWith(MODRINTH_URL)) { return null; } |