mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2024-12-22 16:04:59 +00:00
Actually make the HTTPD look nice
This commit is contained in:
parent
e6e8439a72
commit
2ce0a1e698
14 changed files with 390 additions and 73 deletions
|
@ -4,6 +4,7 @@ import dev.plex.config.ModuleConfig;
|
|||
import dev.plex.module.PlexModule;
|
||||
import dev.plex.request.impl.AdminsEndpoint;
|
||||
import dev.plex.request.impl.IndefBansEndpoint;
|
||||
import dev.plex.request.impl.IndexEndpoint;
|
||||
import dev.plex.request.impl.ListEndpoint;
|
||||
import dev.plex.request.impl.PunishmentsEndpoint;
|
||||
import dev.plex.util.PlexLog;
|
||||
|
@ -63,6 +64,7 @@ public class HTTPDModule extends PlexModule
|
|||
|
||||
new AdminsEndpoint();
|
||||
new IndefBansEndpoint();
|
||||
new IndexEndpoint();
|
||||
new ListEndpoint();
|
||||
new PunishmentsEndpoint();
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import dev.plex.HTTPDModule;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
|
||||
public class Log
|
||||
{
|
||||
public static void log(String message, Object... strings)
|
||||
|
|
|
@ -3,15 +3,18 @@ package dev.plex.request;
|
|||
import com.google.common.collect.Lists;
|
||||
import dev.plex.HTTPDModule;
|
||||
import dev.plex.logging.Log;
|
||||
import jakarta.servlet.AsyncContext;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.Data;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
|
@ -79,14 +82,23 @@ public class AbstractServlet extends HttpServlet
|
|||
});
|
||||
}
|
||||
|
||||
public String createBasicHTML(String title, String body)
|
||||
public String readFile(InputStream filename)
|
||||
{
|
||||
return "<!DOCTYPE html><html><head><title>" + title + "</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"></head><body>" + body + "</body></html>";
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
try
|
||||
{
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(Objects.requireNonNull(filename)));
|
||||
String str;
|
||||
while ((str = in.readLine()) != null)
|
||||
{
|
||||
contentBuilder.append(str);
|
||||
}
|
||||
|
||||
public String createJSONHTML(String title, String json)
|
||||
in.close();
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
return "<!DOCTYPE html><html><head><title>" + title + "</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"></head><body><pre><code>" + json + "</code></pre></body></html>";
|
||||
}
|
||||
return contentBuilder.toString();
|
||||
}
|
||||
|
||||
@Data
|
||||
|
|
|
@ -27,13 +27,13 @@ public class AdminsEndpoint extends AbstractServlet
|
|||
String ipAddress = request.getRemoteAddr();
|
||||
if (ipAddress == null)
|
||||
{
|
||||
return createBasicHTML(TITLE, "An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
return adminsHTML("An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
}
|
||||
final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress);
|
||||
if (player == null)
|
||||
{
|
||||
// This likely means they've never joined the server before. That's okay. We can just not return IPs.
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList())));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList()));
|
||||
}
|
||||
if (Plex.get().getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public class AdminsEndpoint extends AbstractServlet
|
|||
if (!player.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
// Don't return IPs either if the person is not an Admin or above.
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList())));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
else if (Plex.get().getSystem().equalsIgnoreCase("permissions"))
|
||||
|
@ -51,9 +51,16 @@ public class AdminsEndpoint extends AbstractServlet
|
|||
if (!HTTPDModule.getPermissions().playerHas(null, offlinePlayer, "plex.httpd.admins.access"))
|
||||
{
|
||||
// If the person doesn't have permission, don't return IPs
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList())));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers().stream().peek(plexPlayer -> plexPlayer.setIps(Lists.newArrayList())).peek(plexPlayer -> plexPlayer.setPunishments(Lists.newArrayList())).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers()));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(Plex.get().getAdminList().getAllAdminPlayers());
|
||||
}
|
||||
|
||||
private String adminsHTML(String message)
|
||||
{
|
||||
String file = readFile(this.getClass().getResourceAsStream("/httpd/admins.html"));
|
||||
file = file.replace("${MESSAGE}", message);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,19 +23,19 @@ public class IndefBansEndpoint extends AbstractServlet
|
|||
String ipAddress = request.getRemoteAddr();
|
||||
if (ipAddress == null)
|
||||
{
|
||||
return createBasicHTML(TITLE, "An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
return indefbansHTML("An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
}
|
||||
final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress);
|
||||
if (player == null)
|
||||
{
|
||||
return createBasicHTML(TITLE, "Couldn't load your IP Address: " + ipAddress + ". Have you joined the server before?");
|
||||
return indefbansHTML("Couldn't load your IP Address: " + ipAddress + ". Have you joined the server before?");
|
||||
}
|
||||
if (Plex.get().getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
PlexLog.debug("Plex-HTTPD using ranks check");
|
||||
if (!player.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
return createBasicHTML(TITLE, "Not a high enough rank to view this page.");
|
||||
return indefbansHTML("Not a high enough rank to view this page.");
|
||||
}
|
||||
}
|
||||
else if (Plex.get().getSystem().equalsIgnoreCase("permissions"))
|
||||
|
@ -44,9 +44,16 @@ public class IndefBansEndpoint extends AbstractServlet
|
|||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.getUuid());
|
||||
if (!HTTPDModule.getPermissions().playerHas(null, offlinePlayer, "plex.httpd.indefbans.access"))
|
||||
{
|
||||
return createBasicHTML(TITLE, "Not enough permissions to view this page.");
|
||||
return indefbansHTML("Not enough permissions to view this page.");
|
||||
}
|
||||
}
|
||||
return createJSONHTML(TITLE, new GsonBuilder().setPrettyPrinting().create().toJson(Plex.get().getPunishmentManager().getIndefiniteBans().stream().toList()));
|
||||
return new GsonBuilder().setPrettyPrinting().create().toJson(Plex.get().getPunishmentManager().getIndefiniteBans().stream().toList());
|
||||
}
|
||||
|
||||
private String indefbansHTML(String message)
|
||||
{
|
||||
String file = readFile(this.getClass().getResourceAsStream("/httpd/indefbans.html"));
|
||||
file = file.replace("${MESSAGE}", message);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
33
src/main/java/dev/plex/request/impl/IndexEndpoint.java
Normal file
33
src/main/java/dev/plex/request/impl/IndexEndpoint.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
package dev.plex.request.impl;
|
||||
|
||||
import dev.plex.request.AbstractServlet;
|
||||
import dev.plex.request.GetMapping;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class IndexEndpoint extends AbstractServlet
|
||||
{
|
||||
@GetMapping(endpoint = "//")
|
||||
public String getIndex(HttpServletRequest request)
|
||||
{
|
||||
return indexHTML();
|
||||
}
|
||||
|
||||
@GetMapping(endpoint = "/api/")
|
||||
public String getAPI(HttpServletRequest request)
|
||||
{
|
||||
return indexHTML();
|
||||
}
|
||||
|
||||
private String indexHTML()
|
||||
{
|
||||
String file = readFile(this.getClass().getResourceAsStream("/httpd/index.html"));
|
||||
String isAre = Bukkit.getOnlinePlayers().size() == 1 ? " is " : " are ";
|
||||
String pluralOnline = Bukkit.getOnlinePlayers().size() == 1 ? " player " : " players ";
|
||||
String pluralMax = Bukkit.getMaxPlayers() == 1 ? " player " : " players ";
|
||||
file = file.replace("${is_are}", isAre);
|
||||
file = file.replace("${server_online_players}", Bukkit.getOnlinePlayers().size() + pluralOnline);
|
||||
file = file.replace("${server_total_players}", Bukkit.getMaxPlayers() + pluralMax);
|
||||
return file;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,6 @@ public class ListEndpoint extends AbstractServlet
|
|||
{
|
||||
players.add(player.getName());
|
||||
}
|
||||
return createJSONHTML("List - Plex HTTPD", new GsonBuilder().setPrettyPrinting().create().toJson(players.stream().toList()));
|
||||
return new GsonBuilder().setPrettyPrinting().create().toJson(players.stream().toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,44 +11,24 @@ import dev.plex.request.GetMapping;
|
|||
import dev.plex.util.PlexLog;
|
||||
import dev.plex.util.adapter.LocalDateTimeSerializer;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class PunishmentsEndpoint extends AbstractServlet
|
||||
{
|
||||
private static final String TITLE = "Punishments - Plex HTTPD";
|
||||
|
||||
@GetMapping(endpoint = "/api/punishments/")
|
||||
public String getPunishments(HttpServletRequest request)
|
||||
{
|
||||
String ipAddress = request.getRemoteAddr();
|
||||
if (ipAddress == null)
|
||||
{
|
||||
return createBasicHTML(TITLE, "An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
return punishmentsHTML("An IP address could not be detected. Please ensure you are connecting using IPv4.");
|
||||
}
|
||||
if (request.getPathInfo() == null)
|
||||
if (request.getPathInfo() == null || request.getPathInfo().equals("/"))
|
||||
{
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
try
|
||||
{
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(Objects.requireNonNull(this.getClass().getResourceAsStream("/httpd/punishments.html"))));
|
||||
String str;
|
||||
while ((str = in.readLine()) != null)
|
||||
{
|
||||
contentBuilder.append(str);
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
}
|
||||
return contentBuilder.toString();
|
||||
return readFile(this.getClass().getResourceAsStream("/httpd/punishments.html"));
|
||||
}
|
||||
UUID pathUUID;
|
||||
String pathPlexPlayer;
|
||||
|
@ -67,16 +47,16 @@ public class PunishmentsEndpoint extends AbstractServlet
|
|||
final PlexPlayer player = DataUtils.getPlayerByIP(ipAddress);
|
||||
if (punishedPlayer == null)
|
||||
{
|
||||
return createBasicHTML(TITLE, "This player has never joined the server before.");
|
||||
return punishmentsHTML("This player has never joined the server before.");
|
||||
}
|
||||
if (punishedPlayer.getPunishments().isEmpty())
|
||||
{
|
||||
return createBasicHTML(TITLE, "This player has been a good boy. They have no punishments!");
|
||||
return punishmentsGoodHTML("This player has been a good boy. They have no punishments!");
|
||||
}
|
||||
if (player == null)
|
||||
{
|
||||
// If the player is null, give it to them without the IPs
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList()));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList());
|
||||
}
|
||||
if (Plex.get().getSystem().equalsIgnoreCase("ranks"))
|
||||
{
|
||||
|
@ -84,7 +64,7 @@ public class PunishmentsEndpoint extends AbstractServlet
|
|||
if (!player.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
// Don't return IPs either if the person is not an Admin or above.
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList()));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList());
|
||||
}
|
||||
}
|
||||
else if (Plex.get().getSystem().equalsIgnoreCase("permissions"))
|
||||
|
@ -94,9 +74,23 @@ public class PunishmentsEndpoint extends AbstractServlet
|
|||
if (!HTTPDModule.getPermissions().playerHas(null, offlinePlayer, "plex.httpd.punishments.access"))
|
||||
{
|
||||
// If the person doesn't have permission, don't return IPs
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList()));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().peek(punishment -> punishment.setIp("")).toList());
|
||||
}
|
||||
}
|
||||
return createJSONHTML(TITLE, new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().toList()));
|
||||
return new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer()).setPrettyPrinting().create().toJson(punishedPlayer.getPunishments().stream().toList());
|
||||
}
|
||||
|
||||
private String punishmentsHTML(String message)
|
||||
{
|
||||
String file = readFile(this.getClass().getResourceAsStream("/httpd/punishments_error.html"));
|
||||
file = file.replace("${MESSAGE}", message);
|
||||
return file;
|
||||
}
|
||||
|
||||
private String punishmentsGoodHTML(String message)
|
||||
{
|
||||
String file = readFile(this.getClass().getResourceAsStream("/httpd/punishments_good.html"));
|
||||
file = file.replace("${MESSAGE}", message);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
46
src/main/resources/httpd/admins.html
Normal file
46
src/main/resources/httpd/admins.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Admins - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="indefbans/">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="punishments">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 row justify-content-center p-4">
|
||||
<h2>Plex HTTPD</h2>
|
||||
<h5 class="alert alert-danger mb-3 w-auto p-3" role="alert"><b>Error:</b> ${MESSAGE}</h5>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
46
src/main/resources/httpd/indefbans.html
Normal file
46
src/main/resources/httpd/indefbans.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Indefinite Bans - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../admins/">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../punishments">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 row justify-content-center p-4">
|
||||
<h2>Plex HTTPD</h2>
|
||||
<h5 class="alert alert-danger mb-3 w-auto p-3" role="alert"><b>Error:</b> ${MESSAGE}</h5>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
47
src/main/resources/httpd/index.html
Normal file
47
src/main/resources/httpd/index.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Home - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="api/admins/">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="api/indefbans/">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="api/list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="api/punishments">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 row justify-content-center p-4">
|
||||
<h2>Welcome to the Plex HTTPD!</h2>
|
||||
<h4>Use the sidebar to navigate the available pages.</h4>
|
||||
<h4><br>There ${is_are} currently ${server_online_players} online out of ${server_total_players} total.</h4>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Punishments - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<h2 style="font-family:Helvetica,serif">Enter the UUID or username of the player you want to lookup</h2>
|
||||
<input type="text"
|
||||
id="uuid"
|
||||
autofocus
|
||||
autocomplete="off"
|
||||
style="width: 250px;"
|
||||
onkeydown="if (event.keyCode === 13)
|
||||
document.getElementById('submit').click()"/>
|
||||
|
||||
|
||||
<input type="button"
|
||||
id="submit"
|
||||
value="Submit"
|
||||
onclick="redirect();"/>
|
||||
|
||||
<script>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="admins/">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="indefbans/">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 p-4 row justify-content-center">
|
||||
<h2>Enter the UUID or username of the player you want to lookup</h2>
|
||||
<div class="input-group mb-3 w-75 p-3">
|
||||
<input id="uuid" type="text" autocomplete="off" class="form-control">
|
||||
<button class="btn btn-outline-primary" type="submit" onKeyUp="{this.onKeyUpValue.bind(this)"
|
||||
onclick="redirect();">Submit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function redirect() {
|
||||
const url = document.getElementById('uuid').value;
|
||||
window.location = "punishments/" + url
|
||||
window.location = "/api/punishments/" + url
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('uuid').addEventListener('keypress', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
redirect();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
46
src/main/resources/httpd/punishments_error.html
Normal file
46
src/main/resources/httpd/punishments_error.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Punishments - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../admins/">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../indefbans/">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 row justify-content-center p-4">
|
||||
<h2>Plex HTTPD</h2>
|
||||
<h5 class="alert alert-danger mb-3 w-auto p-3" role="alert"><b>Error:</b> ${MESSAGE}</h5>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
46
src/main/resources/httpd/punishments_good.html
Normal file
46
src/main/resources/httpd/punishments_good.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
||||
crossorigin="anonymous"></script>
|
||||
<title>Punishments - Plex HTTPD</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">Plex HTTPD</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../admins/">Admins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../indefbans/">Indefinite Bans</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="../list/">List</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Punishments</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div style="text-align: center;" class="col-auto m-0 row justify-content-center p-4">
|
||||
<h2>Plex HTTPD</h2>
|
||||
<h5 class="alert alert-success mb-3 w-auto p-3" role="alert">${MESSAGE}</h5>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue