Skip to content

Commit

Permalink
Fix github source checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Sep 19, 2024
1 parent ae23866 commit c913637
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -16,7 +14,8 @@

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";

Expand Down Expand Up @@ -96,11 +95,12 @@ private static void openMenu(URI host) {
}
));

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,
Expand All @@ -124,8 +124,12 @@ private static URI getDangerousHost() {
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;
}
Expand Down

0 comments on commit c913637

Please sign in to comment.