From 1a13b265c2130afb30fcb811c12880a244fa180d Mon Sep 17 00:00:00 2001 From: Patrick Dinklage Date: Tue, 6 Aug 2024 10:01:59 +0200 Subject: [PATCH] Keep client version in index.html and refuse update if client is outdated #257 --- .../java/de/pdinklag/mcstats/Updater.java | 51 ++++++++++++++++++- .../mcstats/bukkit/BukkitUpdater.java | 12 +++-- .../de/pdinklag/mcstats/cli/CLIUpdater.java | 10 ++-- www/index.html | 1 + 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/pdinklag/mcstats/Updater.java b/src/main/java/de/pdinklag/mcstats/Updater.java index a6e7ab9e..3adc8d51 100644 --- a/src/main/java/de/pdinklag/mcstats/Updater.java +++ b/src/main/java/de/pdinklag/mcstats/Updater.java @@ -1,5 +1,6 @@ package de.pdinklag.mcstats; +import java.io.BufferedReader; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -17,6 +18,7 @@ import org.json.JSONArray; import org.json.JSONObject; +import de.pdinklag.mcstats.Log.Category; import de.pdinklag.mcstats.util.ClientUtils; import de.pdinklag.mcstats.util.JSONUtils; import de.pdinklag.mcstats.util.MinecraftServerUtils; @@ -42,6 +44,9 @@ public abstract class Updater { private static final String DATABASE_SUMMARY = "summary.json"; private static final String DATABASE_LEGACY_SUMMARY = "summary.json.gz"; + private static final String CLIENT_INDEX_HTML = "index.html"; + private static final String CLIENT_VERSION_PREFIX = "