forked from mirror/BlueMap
Change image response to 204 and always save an empty players.json
This commit is contained in:
parent
701f6cb2dc
commit
c2499df3a7
@ -131,9 +131,18 @@ public HttpResponse handle(HttpRequest request) {
|
||||
return new HttpResponse(HttpStatusCode.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
HttpResponse response = new HttpResponse(HttpStatusCode.OK);
|
||||
response.setData("{}");
|
||||
return response;
|
||||
if (path.endsWith(".png")) {
|
||||
return new HttpResponse(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
||||
if (path.endsWith(".json")) {
|
||||
HttpResponse response = new HttpResponse(HttpStatusCode.OK);
|
||||
response.addHeader("Content-Type", "application/json");
|
||||
response.setData("{}");
|
||||
return response;
|
||||
}
|
||||
|
||||
return new HttpResponse(HttpStatusCode.NOT_FOUND);
|
||||
}
|
||||
|
||||
private String calculateETag(String path, TileInfo tileInfo) {
|
||||
|
@ -30,6 +30,7 @@ public enum HttpStatusCode {
|
||||
PROCESSING (102, "Processing"),
|
||||
|
||||
OK (200, "OK"),
|
||||
NO_CONTENT (204, "No Content"),
|
||||
|
||||
MOVED_PERMANENTLY (301, "Moved Permanently"),
|
||||
FOUND (302, "Found"),
|
||||
|
@ -39,6 +39,7 @@
|
||||
import de.bluecolored.bluemap.core.world.World;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@ -134,6 +135,7 @@ public synchronized void save() {
|
||||
lowresTileManager.save();
|
||||
saveRenderState();
|
||||
saveMarkerState();
|
||||
savePlayerState();
|
||||
saveMapSettings();
|
||||
|
||||
// only save texture gallery if not present in storage
|
||||
@ -215,6 +217,16 @@ public synchronized void saveMarkerState() {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void savePlayerState() {
|
||||
try (
|
||||
OutputStream out = storage.writeMeta(id, META_FILE_PLAYERS);
|
||||
) {
|
||||
out.write("{}".getBytes(StandardCharsets.UTF_8));
|
||||
} catch (Exception ex) {
|
||||
Logger.global.logError("Failed to save markers for map '" + getId() + "'!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user