From fa58484b773d5220a42469ed243a35b2ecc1e261 Mon Sep 17 00:00:00 2001 From: gsd Date: Wed, 15 Feb 2023 16:08:52 +0300 Subject: [PATCH] puk --- .../java/app/controllers/user/ProfileController.java | 9 +++++++-- src/main/java/app/entities/db/Ban.java | 5 +++++ src/main/java/app/entities/other/SteamID.java | 6 +++--- src/main/java/app/services/ProfileService.java | 4 ++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/app/controllers/user/ProfileController.java b/src/main/java/app/controllers/user/ProfileController.java index 7a3a87e..2460a9b 100644 --- a/src/main/java/app/controllers/user/ProfileController.java +++ b/src/main/java/app/controllers/user/ProfileController.java @@ -30,9 +30,14 @@ public class ProfileController { @GetMapping("/current") @NeedValidCookie public ResponseEntity GetCurrentUser(HttpServletRequest request, - @CookieValue(value = "steam64", defaultValue = "") String steam64 + @CookieValue(value = "steam64", defaultValue = "") String steam64, + @RequestParam(value = "requests", defaultValue = "") String requests ){ - return new ResponseEntity(profileService.GetProfile(steam64), HttpStatus.OK); + if (requests.isEmpty()) { + return new ResponseEntity(profileService.GetProfile(steam64), HttpStatus.OK); + } else { + return new ResponseEntity(profileService.GetProfile(steam64, requests), HttpStatus.OK); + } } @PostMapping("/current/freevip") diff --git a/src/main/java/app/entities/db/Ban.java b/src/main/java/app/entities/db/Ban.java index a51d4cf..8e36a0d 100644 --- a/src/main/java/app/entities/db/Ban.java +++ b/src/main/java/app/entities/db/Ban.java @@ -1,5 +1,6 @@ package app.entities.db; +import com.fasterxml.jackson.annotation.JsonGetter; import lombok.Data; import java.math.BigInteger; @@ -13,11 +14,13 @@ public class Ban { Long account_id; String player_name; int ban_length; + long ban_length_seconds; String ban_reason; String banned_by; String banned_by_id; String ip; Timestamp timestamp; + long ban_utime; boolean active; String unbanned_by_id; Timestamp unbanned_timestamp; @@ -36,5 +39,7 @@ public class Ban { active = (boolean) obj[10]; unbanned_by_id = (String) obj[11]; unbanned_timestamp = (Timestamp) obj[12]; + ban_length_seconds = ban_length * 60L; + ban_utime = timestamp.getTime() / 1000; } } diff --git a/src/main/java/app/entities/other/SteamID.java b/src/main/java/app/entities/other/SteamID.java index fa8c64e..aa6774b 100644 --- a/src/main/java/app/entities/other/SteamID.java +++ b/src/main/java/app/entities/other/SteamID.java @@ -7,7 +7,7 @@ public class SteamID { public String steam3; public String steam2; public long steam64; - public String steam_url; + public String community_url; public long account_id; @@ -18,13 +18,13 @@ public class SteamID { this.steam3 = steam3; this.steam2 = steam2; this.steam64 = Long.parseLong(steam64); - this.steam_url = String.format("https://steamcommunity.com/profiles/%s", steam64); + this.community_url = String.format("https://steamcommunity.com/profiles/%s", steam64); this.account_id = account_id; } @Override public String toString(){ - return steam_url; + return community_url; } public boolean is(SteamID steamID){ diff --git a/src/main/java/app/services/ProfileService.java b/src/main/java/app/services/ProfileService.java index 195f70c..9852b80 100644 --- a/src/main/java/app/services/ProfileService.java +++ b/src/main/java/app/services/ProfileService.java @@ -99,6 +99,10 @@ public class ProfileService { return GetProfile(steam64, List.of("steam_data,lastplay,usertime,permition,ban".split(","))); } + public PlayerProfile GetProfile(String steam64, String requests) { + return GetProfile(steam64, List.of(requests.split(","))); + } + public PlayerProfile GetProfileOnPlayerOnServers(String name, List requests) { SteamID steamID = statsService.searchPlayer(name); if (steamID == null) return null;