Just say fuck you if an IP wasn't detected

This commit is contained in:
Telesphoreo 2022-04-02 16:50:15 -05:00
parent 98f974b634
commit 1096ed1e09
2 changed files with 4 additions and 4 deletions

View file

@ -21,10 +21,10 @@ public class AdminsEndpoint extends AbstractServlet
@GetMapping(endpoint = "/api/admins/") @GetMapping(endpoint = "/api/admins/")
public String getAdmins(HttpServletRequest request) public String getAdmins(HttpServletRequest request)
{ {
String ipAddress = request.getHeader("X-FORWARDED-FOR"); String ipAddress = request.getRemoteAddr();
if (ipAddress == null) if (ipAddress == null)
{ {
ipAddress = request.getRemoteAddr(); return "An IP address could not be detected. Please ensure you are connecting using IPv4.";
} }
final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress); final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress);
if (player == null) if (player == null)

View file

@ -19,10 +19,10 @@ public class IndefBansEndpoint extends AbstractServlet
@GetMapping(endpoint = "/api/indefbans/") @GetMapping(endpoint = "/api/indefbans/")
public String getBans(HttpServletRequest request) public String getBans(HttpServletRequest request)
{ {
String ipAddress = request.getHeader("X-FORWARDED-FOR"); String ipAddress = request.getRemoteAddr();
if (ipAddress == null) if (ipAddress == null)
{ {
ipAddress = request.getRemoteAddr(); return "An IP address could not be detected. Please ensure you are connecting using IPv4.";
} }
final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress); final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress);
if (player == null) if (player == null)