Replace IP-based auth with XenForo OAuth2

Also, resolves the long standing issues #2 and #3
This commit is contained in:
2026-05-17 19:06:39 -04:00
parent a92be6c681
commit 94cb2a98c4
24 changed files with 870 additions and 343 deletions
@@ -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();