From 9afcb3379056f1d067776ea1f4883855009434d6 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Mon, 12 Sep 2022 12:02:36 +0200 Subject: [PATCH] Push BlueMapVue and add version to index.html on web-app creation --- BlueMapCommon/BlueMapVue | 2 +- .../de/bluecolored/bluemap/common/BlueMapService.java | 6 +++++- .../de/bluecolored/bluemap/common/WebFilesManager.java | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/BlueMapCommon/BlueMapVue b/BlueMapCommon/BlueMapVue index 0dc79bb9..65841378 160000 --- a/BlueMapCommon/BlueMapVue +++ b/BlueMapCommon/BlueMapVue @@ -1 +1 @@ -Subproject commit 0dc79bb9ad37188c9a1d220c3902f9da7d25594c +Subproject commit 65841378855748c78ebe927e8002cd18c96df7ac diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java index 48857bd0..006fa4d7 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java @@ -173,7 +173,11 @@ private synchronized void loadWorldsAndMaps() throws InterruptedException { try { loadMapConfig(entry.getKey(), entry.getValue()); } catch (ConfigurationException ex) { - Logger.global.logError(ex); + Logger.global.logWarning(ex.getFormattedExplanation()); + Throwable cause = ex.getRootCause(); + if (cause != null) { + Logger.global.logError("Detailed error:", ex); + } } } diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java index 9e682aee..b0dffab5 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java @@ -26,6 +26,7 @@ import com.google.gson.GsonBuilder; import de.bluecolored.bluemap.common.config.WebappConfig; +import de.bluecolored.bluemap.core.BlueMap; import de.bluecolored.bluemap.core.logger.Logger; import de.bluecolored.bluemap.core.resources.adapter.ResourcesGson; import org.apache.commons.io.FileUtils; @@ -115,6 +116,13 @@ public void updateFiles() throws IOException { } } } + + // set version in index.html + Path indexFile = webRoot.resolve("index.html"); + String indexContent = Files.readString(indexFile); + indexContent = indexContent.replace("%version%", BlueMap.VERSION); + Files.writeString(indexFile, indexContent); + } finally { if (!tempFile.delete()) { Logger.global.logWarning("Failed to delete file: " + tempFile); @@ -125,6 +133,8 @@ public void updateFiles() throws IOException { @SuppressWarnings("all") private static class Settings { + private String version = BlueMap.VERSION; + private boolean useCookies = true; private boolean enableFreeFlight = true;