mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2026-06-04 09:06:54 +00:00
Replace IP-based auth with XenForo OAuth2
Also, resolves the long standing issues #2 and #3
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package dev.plex.request.impl;
|
||||
|
||||
import dev.plex.HTTPDModule;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.cache.DataUtils;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
@@ -16,9 +15,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class PunishmentsUIEndpoint extends AbstractServlet
|
||||
{
|
||||
private static final DateTimeFormatter DATE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm z");
|
||||
@@ -50,7 +46,7 @@ public class PunishmentsUIEndpoint extends AbstractServlet
|
||||
return goodHTML(escapeHtml(punished.getName()) + " has no punishments on record.");
|
||||
}
|
||||
|
||||
boolean showIps = canViewIps(request.getRemoteAddr());
|
||||
boolean showIps = currentStaff(request) != null;
|
||||
return resultsHTML(punished, punishments, showIps);
|
||||
}
|
||||
|
||||
@@ -66,15 +62,6 @@ public class PunishmentsUIEndpoint extends AbstractServlet
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canViewIps(String requesterIp)
|
||||
{
|
||||
if (requesterIp == null) return false;
|
||||
PlexPlayer viewer = DataUtils.getPlayerByIP(requesterIp);
|
||||
if (viewer == null) return false;
|
||||
OfflinePlayer offline = Bukkit.getOfflinePlayer(viewer.getUuid());
|
||||
return HTTPDModule.getPermissions().playerHas(null, offline, "plex.httpd.punishments.access");
|
||||
}
|
||||
|
||||
private String resultsHTML(PlexPlayer player, List<Punishment> punishments, boolean showIps)
|
||||
{
|
||||
StringBuilder cards = new StringBuilder();
|
||||
|
||||
Reference in New Issue
Block a user