From 00eb4bb8bd7c65948015274c3616a8bf396d0e3e Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Fri, 19 Feb 2021 11:35:54 +0200 Subject: [PATCH] Stopped ignoring old data on exported files Adds technical debt that replaces stuff in the exported files. Affects issues: - Fixed #1763 --- .../delivery/export/NetworkPageExporter.java | 8 +++++++- .../delivery/export/PlayersPageExporter.java | 8 +++++++- .../plan/delivery/export/ServerPageExporter.java | 16 +++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/NetworkPageExporter.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/NetworkPageExporter.java index ce9a22565..6279cb09f 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/NetworkPageExporter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/NetworkPageExporter.java @@ -95,7 +95,13 @@ public class NetworkPageExporter extends FileExporter { .resolve("index.html"); Page page = pageFactory.networkPage(); - export(to, exportPaths.resolveExportPaths(page.toHtml())); + + // Fixes refreshingJsonRequest ignoring old data of export + String html = StringUtils.replaceEach(page.toHtml(), + new String[]{"loadPlayersOnlineGraph, 'network-overview', true);"}, + new String[]{"loadPlayersOnlineGraph, 'network-overview');"}); + + export(to, exportPaths.resolveExportPaths(html)); } /** diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayersPageExporter.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayersPageExporter.java index e35c80306..ab33f4a76 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayersPageExporter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayersPageExporter.java @@ -93,7 +93,13 @@ public class PlayersPageExporter extends FileExporter { .resolve("index.html"); Page page = pageFactory.playersPage(); - export(to, exportPaths.resolveExportPaths(page.toHtml())); + + // Fixes refreshingJsonRequest ignoring old data of export + String html = StringUtils.replaceEach(page.toHtml(), + new String[]{"}, 'playerlist', true);"}, + new String[]{"}, 'playerlist');"}); + + export(to, exportPaths.resolveExportPaths(html)); } private void exportJSON(Path toDirectory) throws IOException { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/ServerPageExporter.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/ServerPageExporter.java index 5be76b5f4..92a94014a 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/ServerPageExporter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/ServerPageExporter.java @@ -105,7 +105,21 @@ public class ServerPageExporter extends FileExporter { .resolve("index.html"); Page page = pageFactory.serverPage(serverUUID); - export(to, exportPaths.resolveExportPaths(page.toHtml())); + + // Fixes refreshingJsonRequest ignoring old data of export + String html = StringUtils.replaceEach(page.toHtml(), + new String[]{ + "loadOptimizedPerformanceGraph, 'performance', true);", + "loadServerCalendar, 'online-activity-overview', true);", + "}, 'playerlist', true);" + }, + new String[]{ + "loadOptimizedPerformanceGraph, 'performance');", + "loadServerCalendar, 'online-activity-overview');", + "}, 'playerlist');" + }); + + export(to, exportPaths.resolveExportPaths(html)); } /**