mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Use uuid instead of name on player page for data request
Affects issues: - Fixed #2226
This commit is contained in:
parent
d831bdc9e5
commit
957b7f400f
@ -121,7 +121,7 @@ public class PlayerPageExporter extends FileExporter {
|
||||
String jsonResourceName = toFileName(toJSONResourceName(resource)) + ".json";
|
||||
|
||||
export(toDirectory.resolve(jsonResourceName), found.get().getBytes());
|
||||
exportPaths.put("../v1/player?player=${encodeURIComponent(playerName)}", "./" + jsonResourceName);
|
||||
exportPaths.put("../v1/player?player=${encodeURIComponent(playerUUID)}", "./" + jsonResourceName);
|
||||
}
|
||||
|
||||
private String toJSONResourceName(String resource) {
|
||||
|
@ -100,6 +100,7 @@ public class PlayerPage implements Page {
|
||||
|
||||
String playerName = player.getValue(PlayerKeys.NAME).orElse(playerUUID.toString());
|
||||
placeholders.put("playerName", playerName);
|
||||
placeholders.put("playerUUID", playerUUID);
|
||||
|
||||
placeholders.put("timeZone", config.getTimeZoneOffsetHours());
|
||||
placeholders.put("gmPieColors", theme.getValue(ThemeVal.GRAPH_GM_PIE));
|
||||
|
@ -60,28 +60,29 @@ public class ActiveCookieExpiryCleanupTask extends TaskSystem.Task {
|
||||
@Override
|
||||
public void run() {
|
||||
long time = System.currentTimeMillis();
|
||||
Set<String> removed = new HashSet<>();
|
||||
|
||||
Set<String> cookiesToRemove = new HashSet<>();
|
||||
for (Map.Entry<String, Long> entry : expiryDates.entrySet()) {
|
||||
Long expiryTime = entry.getValue();
|
||||
if (config.isTrue(PluginSettings.DEV_MODE)) {
|
||||
logger.info("Cookie " + entry.getKey() + " will expire " + expiryTime);
|
||||
}
|
||||
if (expiryTime <= time) {
|
||||
String cookie = entry.getKey();
|
||||
activeCookieStore.get().removeCookie(cookie);
|
||||
removed.add(cookie);
|
||||
cookiesToRemove.add(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
for (String removedCookie : removed) {
|
||||
expiryDates.remove(removedCookie);
|
||||
for (String cookie : cookiesToRemove) {
|
||||
activeCookieStore.get().removeCookie(cookie);
|
||||
expiryDates.remove(cookie);
|
||||
if (config.isTrue(PluginSettings.DEV_MODE)) {
|
||||
logger.info("Cookie " + removedCookie + " has expired: " + time);
|
||||
logger.info("Cookie " + cookie + " has expired: " + time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addExpiry(String cookie, Long time) {
|
||||
expiryDates.put(cookie, time);
|
||||
if (config.isTrue(PluginSettings.DEV_MODE)) {
|
||||
logger.info("Cookie " + cookie + " will expire " + time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,13 +110,13 @@ function newConfiguredXHR(callback) {
|
||||
callback(null, "Request did not reach the server. (Server offline / Adblocker?)")
|
||||
}
|
||||
} catch (e) {
|
||||
callback(null, e.message + " (See " + address + ")")
|
||||
callback(null, e.message)
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.timeout = 45000;
|
||||
xhr.ontimeout = function () {
|
||||
callback(null, "Timed out after 45 seconds. (" + address + ")")
|
||||
callback(null, "Timed out after 45 seconds.")
|
||||
};
|
||||
|
||||
return xhr;
|
||||
|
@ -717,9 +717,9 @@
|
||||
Highcharts.setOptions({
|
||||
lang: {noData: "No Data to Display"}, time: {timezoneOffset: ${timeZone} * 60}
|
||||
});
|
||||
const playerName = '${playerName}';
|
||||
const playerUUID = '${playerUUID}';
|
||||
setLoadingText('Loading player values..');
|
||||
jsonRequest(`../v1/player?player=${encodeURIComponent(playerName)}`, function (json, error) {
|
||||
jsonRequest(`../v1/player?player=${encodeURIComponent(playerUUID)}`, function (json, error) {
|
||||
loadPlayerOverviewValues(json, error);
|
||||
loadSessionAccordion(json, error);
|
||||
loadserverAccordion(json, error);
|
||||
|
Loading…
Reference in New Issue
Block a user