mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-20 09:35:47 +01:00
parent
bb59b76c68
commit
46631c9ae0
@ -16,11 +16,9 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.export;
|
||||
|
||||
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
|
||||
import com.djrapitops.plan.db.access.queries.objects.UserIdentifierQueries;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
import com.djrapitops.plan.system.file.PlanFiles;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||
import com.djrapitops.plan.system.json.JSONFactory;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
@ -90,19 +88,6 @@ public class JSONExport extends SpecificExport {
|
||||
}
|
||||
|
||||
public void exportServerJSON(UUID serverUUID) {
|
||||
String json = responseFactory.rawServerPageResponse(serverUUID).getContent();
|
||||
dbSystem.getDatabase().query(ServerQueries.fetchServerMatchingIdentifier(serverUUID))
|
||||
.map(Server::getName)
|
||||
.ifPresent(serverName -> {
|
||||
try {
|
||||
File htmlLocation = getServerFolder();
|
||||
htmlLocation.mkdirs();
|
||||
File exportFile = new File(htmlLocation, URLEncoder.encode(serverName, "UTF-8") + ".json");
|
||||
|
||||
export(exportFile, Collections.singletonList(json));
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
// TODO Export JSON Parser results
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import java.util.UUID;
|
||||
public enum PageId {
|
||||
|
||||
SERVER("serverPage:"),
|
||||
RAW_SERVER("rawServer:"),
|
||||
PLAYER("playerPage:"),
|
||||
RAW_PLAYER("rawPlayer:"),
|
||||
PLAYERS("playersPage"),
|
||||
@ -38,11 +37,7 @@ public enum PageId {
|
||||
JS("js:"),
|
||||
CSS("css:"),
|
||||
|
||||
FAVICON("Favicon"),
|
||||
|
||||
@Deprecated
|
||||
PLAYER_PLUGINS_TAB("playerPluginsTab:"),
|
||||
NETWORK_CONTENT("networkContent");
|
||||
FAVICON("Favicon");
|
||||
|
||||
private final String id;
|
||||
|
||||
|
@ -64,12 +64,6 @@ public class ServerPageHandler implements PageHandler {
|
||||
public Response getResponse(Request request, RequestTarget target) throws WebException {
|
||||
UUID serverUUID = getServerUUID(target);
|
||||
|
||||
boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw");
|
||||
if (raw) {
|
||||
checkDBState();
|
||||
return ResponseCache.loadResponse(PageId.RAW_SERVER.of(serverUUID), () -> responseFactory.rawServerPageResponse(serverUUID));
|
||||
}
|
||||
|
||||
Response response = ResponseCache.loadResponse(PageId.SERVER.of(serverUUID));
|
||||
|
||||
if (response != null) {
|
||||
|
@ -118,10 +118,6 @@ public class ResponseFactory {
|
||||
return new RawPlayerDataResponse(dbSystem.getDatabase().query(ContainerFetchQueries.fetchPlayerContainer(uuid)));
|
||||
}
|
||||
|
||||
public RawDataResponse rawServerPageResponse(UUID serverUUID) {
|
||||
return new RawServerDataResponse(dbSystem.getDatabase().query(ContainerFetchQueries.fetchServerContainer(serverUUID)));
|
||||
}
|
||||
|
||||
public Response javaScriptResponse(String fileName) {
|
||||
try {
|
||||
return new JavaScriptResponse(fileName, files);
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.system.webserver.response.pages;
|
||||
|
||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||
|
||||
/**
|
||||
* Raw Data JSON response for a Server.
|
||||
*
|
||||
* @author Rsl1122
|
||||
* @deprecated Marked for removal in 5.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class RawServerDataResponse extends RawDataResponse {
|
||||
|
||||
public RawServerDataResponse(ServerContainer serverContainer) {
|
||||
super(serverContainer);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user