From d1e00da51a0e120550544d52651fb3eec0943ed3 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Thu, 15 Apr 2021 10:13:32 +0300 Subject: [PATCH] Started using player UUID instead of name in URLs - Changed instances where player name was given in a link instead of UUID where possible - Could not change for Extensions where "isPlayerName=true" is set for String data, the UUID is not available from the query - Changed 404 error message to have '/player/{uuid/name}' instead of '/player/PlayerName' - Changed export directory from names to uuids, change log should recommend export users to clear their player directory and to run /plan export players - Fixed issue where Web users with level 2 could not access their own player page via /player/{uuid} Affects issues: - Close #1841 --- .../plan/commands/subcommands/LinkCommands.java | 11 ++--------- .../plan/delivery/export/PlayerPageExporter.java | 12 ++++++------ .../rendering/json/PlayersTableJSONCreator.java | 2 +- .../webserver/resolver/PlayerPageResolver.java | 10 +++++++--- .../djrapitops/plan/identification/UUIDUtility.java | 13 +++++++++++++ .../plan/settings/locale/lang/ErrorPageLang.java | 2 +- .../main/resources/assets/plan/locale/locale_CS.txt | 2 +- .../main/resources/assets/plan/locale/locale_DE.txt | 2 +- .../main/resources/assets/plan/locale/locale_EN.txt | 2 +- .../main/resources/assets/plan/locale/locale_ES.txt | 2 +- .../main/resources/assets/plan/locale/locale_FI.txt | 2 +- .../main/resources/assets/plan/locale/locale_FR.txt | 2 +- .../main/resources/assets/plan/locale/locale_IT.txt | 2 +- .../main/resources/assets/plan/locale/locale_JA.txt | 2 +- .../main/resources/assets/plan/locale/locale_KO.txt | 2 +- .../resources/assets/plan/locale/locale_PT_BR.txt | 2 +- .../main/resources/assets/plan/locale/locale_RU.txt | 2 +- .../main/resources/assets/plan/locale/locale_TR.txt | 2 +- .../assets/plan/web/js/sessionAccordion.js | 2 +- .../plan/delivery/webserver/AccessControlTest.java | 8 ++++++++ .../src/test/java/utilities/TestConstants.java | 6 ++++-- 21 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/LinkCommands.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/LinkCommands.java index 2f8194d0a..13f430cbe 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/LinkCommands.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/subcommands/LinkCommands.java @@ -32,7 +32,6 @@ import com.djrapitops.plan.settings.locale.lang.CommandLang; import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; -import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import javax.inject.Inject; @@ -158,11 +157,8 @@ public class LinkCommands { throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND, identifier)); } - String playerName = dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)) - .orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND_REGISTER, identifier))); - if (sender.hasPermission(Permissions.PLAYER_OTHER) || playerUUID.equals(senderUUID)) { - String address = getAddress(sender) + "/player/" + Html.encodeToURL(playerName); + String address = getAddress(sender) + "/player/" + playerUUID; sender.buildMessage() .addPart(colors.getMainColor() + locale.getString(CommandLang.LINK_PLAYER)) .apply(builder -> linkTo(builder, sender, address)) @@ -240,11 +236,8 @@ public class LinkCommands { throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND, identifier)); } - String playerName = dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)) - .orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND_REGISTER, identifier))); - if (sender.hasPermission(Permissions.JSON_OTHER) || playerUUID.equals(senderUUID)) { - String address = getAddress(sender) + "/player/" + Html.encodeToURL(playerName) + "/raw"; + String address = getAddress(sender) + "/player/" + playerUUID + "/raw"; sender.buildMessage() .addPart(colors.getMainColor() + locale.getString(CommandLang.LINK_JSON)) .apply(builder -> linkTo(builder, sender, address)) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayerPageExporter.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayerPageExporter.java index 2f5806531..f2646f471 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayerPageExporter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/export/PlayerPageExporter.java @@ -91,8 +91,8 @@ public class PlayerPageExporter extends FileExporter { exportPaths.put("../server/", toRelativePathFromRoot("server")); exportRequiredResources(exportPaths, toDirectory); - Path playerDirectory = toDirectory.resolve("player/" + toFileName(playerName)); - exportJSON(exportPaths, playerDirectory, playerUUID, playerName); + Path playerDirectory = toDirectory.resolve("player/" + toFileName(playerUUID.toString())); + exportJSON(exportPaths, playerDirectory, playerUUID); exportHtml(exportPaths, playerDirectory, playerUUID); exportPaths.clear(); } @@ -108,11 +108,11 @@ public class PlayerPageExporter extends FileExporter { } } - private void exportJSON(ExportPaths exportPaths, Path toDirectory, UUID playerUUID, String playerName) throws IOException { - exportJSON(exportPaths, toDirectory, "player?player=" + playerUUID, playerName); + private void exportJSON(ExportPaths exportPaths, Path toDirectory, UUID playerUUID) throws IOException { + exportJSON(exportPaths, toDirectory, "player?player=" + playerUUID); } - private void exportJSON(ExportPaths exportPaths, Path toDirectory, String resource, String playerName) throws IOException { + private void exportJSON(ExportPaths exportPaths, Path toDirectory, String resource) throws IOException { Optional found = getJSONResponse(resource); if (!found.isPresent()) { throw new NotFoundException(resource + " was not properly exported: no response"); @@ -201,7 +201,7 @@ public class PlayerPageExporter extends FileExporter { } private String toRelativePathFromRoot(String resourceName) { - // Player html is exported at /player//index.html + // Player html is exported at /player//index.html return "../../" + toNonRelativePath(resourceName); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/json/PlayersTableJSONCreator.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/json/PlayersTableJSONCreator.java index 85e12bddd..590edd914 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/json/PlayersTableJSONCreator.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/rendering/json/PlayersTableJSONCreator.java @@ -122,7 +122,7 @@ public class PlayersTableJSONCreator { private void addPlayerData(Map dataJson, TablePlayer player) { String name = player.getName().orElse(player.getPlayerUUID().toString()); - String url = "../player/" + Html.encodeToURL(name); + String url = "../player/" + Html.encodeToURL(player.getPlayerUUID().toString()); int loginTimes = player.getSessionCount().orElse(0); long activePlaytime = player.getActivePlaytime().orElse(-1L); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/resolver/PlayerPageResolver.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/resolver/PlayerPageResolver.java index 30bf5362b..d8e8d3a60 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/resolver/PlayerPageResolver.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/webserver/resolver/PlayerPageResolver.java @@ -55,7 +55,11 @@ public class PlayerPageResolver implements Resolver { public boolean canAccess(Request request) { URIPath path = request.getPath(); WebUser user = request.getUser().orElse(new WebUser("")); - boolean isOwnPage = path.getPart(1).map(user.getName()::equalsIgnoreCase).orElse(true); + boolean isOwnPage = path.getPart(1).map(nameOrUUID -> { + if (user.getName().equalsIgnoreCase(nameOrUUID)) return true; // name matches user + return uuidUtility.getNameOf(nameOrUUID).map(user.getName()::equalsIgnoreCase) // uuid matches user + .orElse(false); // uuid or name don't match + }).orElse(true); // No name or UUID given return user.hasPermission("page.player.other") || (user.hasPermission("page.player.self") && isOwnPage); } @@ -79,8 +83,8 @@ public class PlayerPageResolver implements Resolver { } if (path.getPart(2).isPresent()) { - // Redirect /player/Name/ to /player/Name - return responseFactory.redirectResponse("../" + Html.encodeToURL(playerName)); + // Redirect /player/{uuid/name}/ to /player/{uuid} + return responseFactory.redirectResponse("../" + Html.encodeToURL(playerUUID.toString())); } return responseFactory.playerPageResponse(playerUUID); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/identification/UUIDUtility.java b/Plan/common/src/main/java/com/djrapitops/plan/identification/UUIDUtility.java index 50bd6c2f6..a7ba469e0 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/identification/UUIDUtility.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/identification/UUIDUtility.java @@ -57,6 +57,19 @@ public class UUIDUtility { } } + public Optional getNameOf(String possiblePlayerUUID) { + try { + return getNameOf(UUID.fromString(possiblePlayerUUID)); + } catch (IllegalArgumentException notUUID) { + return Optional.empty(); + } + } + + public Optional getNameOf(UUID playerUUID) { + if (playerUUID == null) throw new IllegalArgumentException("Player uuid can not be null!"); + return dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)); + } + /** * Get UUID of a player. * diff --git a/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/lang/ErrorPageLang.java b/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/lang/ErrorPageLang.java index 6939cd005..65f333de5 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/lang/ErrorPageLang.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/settings/locale/lang/ErrorPageLang.java @@ -25,7 +25,7 @@ public enum ErrorPageLang implements Lang { UUID_404("Player UUID was not found in the database."), NO_SERVERS_404("No Servers online to perform the request."), NOT_PLAYED_404("Plan has not seen this player."), - UNKNOWN_PAGE_404("Make sure you're accessing a link given by a command, Examples:

/player/PlayerName
/server/ServerName

"), + UNKNOWN_PAGE_404("Make sure you're accessing a link given by a command, Examples:

/player/{uuid/name}
/server/{uuid/name/id}

"), UNAUTHORIZED_401("Unauthorized"), AUTHENTICATION_FAILED_401("Authentication Failed."), AUTH_FAIL_TIPS_401("- Ensure you have registered a user with /plan register
- Check that the username and password are correct
- Username and password are case-sensitive

If you have forgotten your password, ask a staff member to delete your old user and re-register."), diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_CS.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_CS.txt index e3d0aac41..83c1c4687 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_CS.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_CS.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Nenalezeno HTML ERRORS - NOT_PLAYED_404 || Hráč nebyl nenalezen. HTML ERRORS - PAGE_NOT_FOUND_404 || Stránka neexistuje. HTML ERRORS - UNAUTHORIZED_401 || Neautorizováno -HTML ERRORS - UNKNOWN_PAGE_404 || Ujistěte se, že přistupujete na odkaz poskytnutý příkazem, Příklad:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Ujistěte se, že přistupujete na odkaz poskytnutý příkazem, Příklad:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || Hráčské UUID nebylo nalezeno v databázi. In Depth Help - /plan db || Použít jiné subpříkazy databáze ke změně dat In Depth Help - /plan db backup || Použití SQLite k zálohování cílové databáze do souboru. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt index b97f78c02..e6f5d2a2f 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_DE.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Nicht gefunden. HTML ERRORS - NOT_PLAYED_404 || Der Spieler war nie auf dem Server. HTML ERRORS - PAGE_NOT_FOUND_404 || Diese Seite existiert nicht. HTML ERRORS - UNAUTHORIZED_401 || Unautorisiert -HTML ERRORS - UNKNOWN_PAGE_404 || Stelle sicher, dass du einen Link benutzt, der von einem Befehl generiert wurde. Beispielsweise:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Stelle sicher, dass du einen Link benutzt, der von einem Befehl generiert wurde. Beispielsweise:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || Die UUID des Spielers wurde nicht in der Datenbank gefunden. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt index 0e29967d1..bebbf54ae 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_EN.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Not Found HTML ERRORS - NOT_PLAYED_404 || Plan has not seen this player. HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. HTML ERRORS - UNAUTHORIZED_401 || Unauthorized -HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || Player UUID was not found in the database. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_ES.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_ES.txt index 1f8f9313f..c3471ce0a 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_ES.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_ES.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || No encontrado HTML ERRORS - NOT_PLAYED_404 || Ese jugador no ha jugado en este servidor. HTML ERRORS - PAGE_NOT_FOUND_404 || La pagina no existe. HTML ERRORS - UNAUTHORIZED_401 || No autorizado -HTML ERRORS - UNKNOWN_PAGE_404 || Asegurate que estas entrando por un link dado por un comando, Ejemplos:

/player/NombreJugador
/server/NombreServidor

+HTML ERRORS - UNKNOWN_PAGE_404 || Asegurate que estas entrando por un link dado por un comando, Ejemplos:

/player/{uuid/nombre}
/server/{uuid/nombre/id}

HTML ERRORS - UUID_404 || La UUID del jugador no ha sido encontrada. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt index 3d52fe599..2b1277e11 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_FI.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Ei löytynyt HTML ERRORS - NOT_PLAYED_404 || Pelaaja ei ole pelannut palvelimella. HTML ERRORS - PAGE_NOT_FOUND_404 || Sivua ei ole olemassa. HTML ERRORS - UNAUTHORIZED_401 || Todennusta ei suoritettu loppuun. -HTML ERRORS - UNKNOWN_PAGE_404 || Varmista menneeesi komennon antamaan osoitteeseen, Esim:

/player/PelaajanNimi
/server/PalvelimenNimi

+HTML ERRORS - UNKNOWN_PAGE_404 || Varmista menneeesi komennon antamaan osoitteeseen, Esim:

/player/{uuid/nimi}
/server/{uuid/nimi/id}

HTML ERRORS - UUID_404 || Pelaajan UUID:ta ei löytynyt tietokannasta. In Depth Help - /plan db || Käytä eri tietokanta alikomentoja vaikuttaaksesi tietokantaan In Depth Help - /plan db backup || Käyttää SQLiteä varmuuskopioimaan tiedot tiedostoon. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt index 28cf30459..ffd33560a 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_FR.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Non trouvé. HTML ERRORS - NOT_PLAYED_404 || Cet utilisateur ne s'est jamais connecté sur ce serveur. HTML ERRORS - PAGE_NOT_FOUND_404 || Cette page n'existe pas. HTML ERRORS - UNAUTHORIZED_401 || Non autorisé. -HTML ERRORS - UNKNOWN_PAGE_404 || Assurez-vous que vous accédez à un lien donné par une commande. Exemples :

/player/Nom_du_Joueur
/server/Nom_du_Serveur

+HTML ERRORS - UNKNOWN_PAGE_404 || Assurez-vous que vous accédez à un lien donné par une commande. Exemples :

/player/{uuid/nom}
/server/{uuid/nom/id}

HTML ERRORS - UUID_404 || L'UUID de cet utilisateur n'a pas été trouvé dans la base de données. In Depth Help - /plan db || Utilise différentes sous-commandes de base de données pour modifier les données d'une manière ou d'une autre. In Depth Help - /plan db backup || Utilise SQLite pour sauvegarder la base de données cible dans un fichier. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt index 1d7edcea7..b4615657a 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_IT.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Non Trovato HTML ERRORS - NOT_PLAYED_404 || Questo giocatore non ha mai giocato su questo server. HTML ERRORS - PAGE_NOT_FOUND_404 || Questa pagina non esiste. HTML ERRORS - UNAUTHORIZED_401 || Non Autorizzato -HTML ERRORS - UNKNOWN_PAGE_404 || Assicurati che stai seguendo il link usando il commando, Esempi:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Assicurati che stai seguendo il link usando il commando, Esempi:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || UUID del Giocatore non trovato nel database. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt index 6595e3766..2b7a7d002 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_JA.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || ページが見つかりま HTML ERRORS - NOT_PLAYED_404 || プレイヤーはこのサーバーでプレイしていません HTML ERRORS - PAGE_NOT_FOUND_404 || ページは存在しません HTML ERRORS - UNAUTHORIZED_401 || 未認証状態です -HTML ERRORS - UNKNOWN_PAGE_404 || リンクが間違っています、コマンド等を使用しURLを確認して下さい。 URL例:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || リンクが間違っています、コマンド等を使用しURLを確認して下さい。 URL例:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || データベース内にプレヤーのUUIDが存在しません In Depth Help - /plan db || 異なるデータベースのサブコマンドを使用することで、様々な方法でデータを変更/更新/削除します In Depth Help - /plan db backup || SQLiteによってデータベースをファイルにバックアップします diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_KO.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_KO.txt index 15b6ee90c..bf1ea1a5c 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_KO.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_KO.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Not Found 404 HTML ERRORS - NOT_PLAYED_404 || Plan has not seen this player. 404 HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. 404 HTML ERRORS - UNAUTHORIZED_401 || Unauthorized 401 -HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || Player UUID was not found in the database. 404 In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_PT_BR.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_PT_BR.txt index f7b8b5cfd..5beee62c1 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_PT_BR.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_PT_BR.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Não Encontrado HTML ERRORS - NOT_PLAYED_404 || Esse jogador não jogou nesse servidor. HTML ERRORS - PAGE_NOT_FOUND_404 || Página não existe. HTML ERRORS - UNAUTHORIZED_401 || Acesso não autorizado -HTML ERRORS - UNKNOWN_PAGE_404 || Certifique-se de que você está acessando um link fornecido por comando, exemplos:

/player/NomeDoJogador
/server/NomeDoServidor

+HTML ERRORS - UNKNOWN_PAGE_404 || Certifique-se de que você está acessando um link fornecido por comando, exemplos:

/player/{uuid/nome}
/server/{uuid/nome/id}

HTML ERRORS - UUID_404 || UUID de jogador não encontrado no banco de dados. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_RU.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_RU.txt index af50619b1..d55605b87 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_RU.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_RU.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Не обнаружена HTML ERRORS - NOT_PLAYED_404 || Plan еще не видел этого игрока. HTML ERRORS - PAGE_NOT_FOUND_404 || Страница не существует. HTML ERRORS - UNAUTHORIZED_401 || Не авторизован -HTML ERRORS - UNKNOWN_PAGE_404 || Убедитесь, что вы получаете доступ к ссылке, заданной командой, Примеры:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Убедитесь, что вы получаете доступ к ссылке, заданной командой, Примеры:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || UUID игрока не найден в базе данных. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/locale/locale_TR.txt b/Plan/common/src/main/resources/assets/plan/locale/locale_TR.txt index 5671d0940..ab2668dff 100644 --- a/Plan/common/src/main/resources/assets/plan/locale/locale_TR.txt +++ b/Plan/common/src/main/resources/assets/plan/locale/locale_TR.txt @@ -448,7 +448,7 @@ HTML ERRORS - NOT_FOUND_404 || Bulunamadı HTML ERRORS - NOT_PLAYED_404 || Oyuncu bu sunucuda hiç oynamadı. HTML ERRORS - PAGE_NOT_FOUND_404 || Böyle bir sayfa mevcut değil. HTML ERRORS - UNAUTHORIZED_401 || Yetkisiz -HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/PlayerName
/server/ServerName

+HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

/player/{uuid/name}
/server/{uuid/name/id}

HTML ERRORS - UUID_404 || Oyuncunun UUID si veritabanında bulunamadı. In Depth Help - /plan db || Use different database subcommands to change the data in some way In Depth Help - /plan db backup || Uses SQLite to backup the target database to a file. diff --git a/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js b/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js index 592944ba9..88120eb81 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js @@ -93,7 +93,7 @@ function createAccordionBody(i, session) {
- + Player Page ${session.network_server ? ` diff --git a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/AccessControlTest.java b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/AccessControlTest.java index 4c54a5980..10c58b120 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/AccessControlTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/delivery/webserver/AccessControlTest.java @@ -183,6 +183,8 @@ public class AccessControlTest { "/v1/network/pingTable,200", "/player/" + TestConstants.PLAYER_ONE_NAME + ",200", "/player/" + TestConstants.PLAYER_TWO_NAME + ",404", + "/player/" + TestConstants.PLAYER_ONE_UUID_STRING + ",200", + "/player/" + TestConstants.PLAYER_TWO_UUID_STRING + ",404", "/v1/player?player=" + TestConstants.PLAYER_ONE_NAME + ",200", "/v1/player?player=" + TestConstants.PLAYER_TWO_NAME + ",400", "/players,200", @@ -240,6 +242,8 @@ public class AccessControlTest { "/v1/network/pingTable,403", "/player/" + TestConstants.PLAYER_ONE_NAME + ",200", "/player/" + TestConstants.PLAYER_TWO_NAME + ",404", + "/player/" + TestConstants.PLAYER_ONE_UUID_STRING + ",200", + "/player/" + TestConstants.PLAYER_TWO_UUID_STRING + ",404", "/v1/player?player=" + TestConstants.PLAYER_ONE_NAME + ",200", "/v1/player?player=" + TestConstants.PLAYER_TWO_NAME + ",400", "/players,200", @@ -297,6 +301,8 @@ public class AccessControlTest { "/v1/network/pingTable,403", "/player/" + TestConstants.PLAYER_ONE_NAME + ",200", "/player/" + TestConstants.PLAYER_TWO_NAME + ",403", + "/player/" + TestConstants.PLAYER_ONE_UUID_STRING + ",200", + "/player/" + TestConstants.PLAYER_TWO_UUID_STRING + ",403", "/v1/player?player=" + TestConstants.PLAYER_ONE_NAME + ",200", "/v1/player?player=" + TestConstants.PLAYER_TWO_NAME + ",403", "/players,403", @@ -354,6 +360,8 @@ public class AccessControlTest { "/v1/network/pingTable,403", "/player/" + TestConstants.PLAYER_ONE_NAME + ",403", "/player/" + TestConstants.PLAYER_TWO_NAME + ",403", + "/player/" + TestConstants.PLAYER_ONE_UUID_STRING + ",403", + "/player/" + TestConstants.PLAYER_TWO_UUID_STRING + ",403", "/v1/player?player=" + TestConstants.PLAYER_ONE_NAME + ",403", "/v1/player?player=" + TestConstants.PLAYER_TWO_NAME + ",403", "/players,403", diff --git a/Plan/common/src/test/java/utilities/TestConstants.java b/Plan/common/src/test/java/utilities/TestConstants.java index 159b99ee5..eccb1160a 100644 --- a/Plan/common/src/test/java/utilities/TestConstants.java +++ b/Plan/common/src/test/java/utilities/TestConstants.java @@ -38,8 +38,10 @@ public class TestConstants { public static final String SERVER_UUID_STRING = "e4ec2edd-e0ed-3c58-a87d-8a9021899479"; public static final ServerUUID SERVER_UUID = ServerUUID.fromString(SERVER_UUID_STRING); public static final ServerUUID SERVER_TWO_UUID = ServerUUID.fromString("c4ec2edd-e0ed-3c58-a87d-8a9024791899"); - public static final UUID PLAYER_ONE_UUID = UUID.fromString("45b0dfdb-f71d-4cf3-8c21-27c9d4c651db"); - public static final UUID PLAYER_TWO_UUID = UUID.fromString("ec94a954-1fa1-445b-b09b-9b698519af80"); + public static final String PLAYER_ONE_UUID_STRING = "45b0dfdb-f71d-4cf3-8c21-27c9d4c651db"; + public static final UUID PLAYER_ONE_UUID = UUID.fromString(PLAYER_ONE_UUID_STRING); + public static final String PLAYER_TWO_UUID_STRING = "ec94a954-1fa1-445b-b09b-9b698519af80"; + public static final UUID PLAYER_TWO_UUID = UUID.fromString(PLAYER_TWO_UUID_STRING); public static final UUID PLAYER_THREE_UUID = UUID.randomUUID(); public static final String PLAYER_ONE_NAME = "Test_Player_one";