mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Fixed Inspect & Analysis request handling on Bungee
This commit is contained in:
parent
a55b17246a
commit
58f2d7f02c
@ -54,6 +54,8 @@ public class BungeeConnectionSystem extends ConnectionSystem {
|
||||
Optional<UUID> serverUUID = getServerWherePlayerIsOnline((GenerateInspectPageRequest) infoRequest);
|
||||
if (serverUUID.isPresent()) {
|
||||
server = bukkitServers.getOrDefault(serverUUID.get(), getOneBukkitServer());
|
||||
} else {
|
||||
server = getOneBukkitServer();
|
||||
}
|
||||
}
|
||||
if (server == null) {
|
||||
|
@ -8,6 +8,7 @@ import com.djrapitops.plan.api.exceptions.connection.TransferDatabaseException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.api.exceptions.database.DBException;
|
||||
import com.djrapitops.plan.system.database.databases.Database;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processor;
|
||||
import com.djrapitops.plan.system.settings.Settings;
|
||||
import com.djrapitops.plan.system.webserver.response.DefaultResponses;
|
||||
@ -18,7 +19,9 @@ import com.djrapitops.plan.system.webserver.response.pages.InspectPageResponse;
|
||||
import com.djrapitops.plan.utilities.Base64Util;
|
||||
import com.djrapitops.plan.utilities.file.export.HtmlExport;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -71,7 +74,9 @@ public class CacheInspectPageRequest implements CacheRequest {
|
||||
UUID uuid = entry.getKey();
|
||||
String html = Base64Util.decode(entry.getValue());
|
||||
|
||||
cache(export, uuid, html);
|
||||
Map<String, String> replace = Collections.singletonMap("networkName", ServerInfo.getServerName());
|
||||
|
||||
cache(export, uuid, StrSubstitutor.replace(html, replace));
|
||||
}
|
||||
} catch (DBException e) {
|
||||
throw new TransferDatabaseException(e);
|
||||
|
@ -69,6 +69,7 @@ public class GenerateAnalysisPageRequest extends InfoRequestWithVariables implem
|
||||
InfoSystem infoSystem = InfoSystem.getInstance();
|
||||
infoSystem.sendRequest(new CacheAnalysisPageRequest(serverUUID, AnalysisPageResponse.getRefreshingHtml()));
|
||||
infoSystem.sendRequest(new CacheAnalysisPageRequest(serverUUID, analyseAndGetHtml()));
|
||||
infoSystem.updateNetworkPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,11 +1,15 @@
|
||||
package com.djrapitops.plan.system.webserver.response.pages;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.connection.NoServersException;
|
||||
import com.djrapitops.plan.api.exceptions.connection.WebException;
|
||||
import com.djrapitops.plan.system.info.InfoSystem;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.processing.Processor;
|
||||
import com.djrapitops.plan.system.webserver.response.Response;
|
||||
import com.djrapitops.plan.system.webserver.response.cache.PageId;
|
||||
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
|
||||
import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -24,9 +28,11 @@ public class AnalysisPageResponse extends Response {
|
||||
Processor.queue(() -> {
|
||||
try {
|
||||
InfoSystem.getInstance().generateAnalysisPage(serverUUID);
|
||||
} catch (NoServersException e) {
|
||||
ResponseCache.cacheResponse(PageId.SERVER.of(serverUUID), () -> new NotFoundResponse(e.getMessage()));
|
||||
} catch (WebException e) {
|
||||
// TODO Exception handling
|
||||
Log.toLog(AnalysisPageResponse.class, e);
|
||||
Log.toLog(AnalysisPageResponse.class.getName(), e);
|
||||
}
|
||||
});
|
||||
return new AnalysisPageResponse(getRefreshingHtml());
|
||||
|
@ -93,7 +93,7 @@ public class DebugPageResponse extends ErrorResponse {
|
||||
for (Server server : servers) {
|
||||
content.append(server.getName()).append(" | ")
|
||||
.append(server.getWebAddress()).append(" | ")
|
||||
.append(server.getUuid()).append(" | ").append("<br>");
|
||||
.append(server.getUuid()).append("<br>");
|
||||
}
|
||||
content.append("</pre>");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user