aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2022-10-11 21:43:00 +0200
committerGitHub <noreply@github.com>2022-10-11 15:43:00 -0400
commit54eea328ad47ff55f3c8498fdc13e61a30200087 (patch)
tree26a44e51b55f69891ee49518c96f42e8b7d334d2 /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java
parent90b3225afdd5e43c54e82d73478f2c2f1e046f80 (diff)
downloadnotenoughupdates-54eea328ad47ff55f3c8498fdc13e61a30200087.tar.gz
notenoughupdates-54eea328ad47ff55f3c8498fdc13e61a30200087.tar.bz2
notenoughupdates-54eea328ad47ff55f3c8498fdc13e61a30200087.zip
Add ability to sign update.json, needed for autoupdates (#354)
* Add ability to sign update.json, needed for autoupdates * Remove update from URL
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java
index 389cfc75..54fcc204 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java
@@ -26,6 +26,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSyntaxException;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.MoulSigner;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -171,6 +172,14 @@ public class AutoUpdater {
File repo = neu.manager.repoLocation;
File updateJson = new File(repo, "update.json");
if (updateJson.exists()) {
+ if (!MoulSigner.verifySignature(updateJson)) {
+ NotEnoughUpdates.LOGGER.error("update.json found without signature");
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ "§e[NEU] §cThere has been an error checking for updates. Check the log or join the discord for more information.").setChatStyle(
+ Utils.createClickStyle(
+ ClickEvent.Action.OPEN_URL, "https://discord.gg/moulberry")));
+ return;
+ }
try {
JsonObject o = neu.manager.getJsonFromFile(updateJson);