change url back

This commit is contained in:
Telesphoreo 2022-04-17 19:10:12 -05:00
parent e1dd36a0fb
commit 3fa54cec72
11 changed files with 94 additions and 21 deletions

View File

@ -8,7 +8,8 @@ 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.request.impl.SchematicEndpoint;
import dev.plex.request.impl.SchematicDownloadEndpoint;
import dev.plex.request.impl.SchematicUploadEndpoint;
import dev.plex.util.PlexLog;
import java.util.concurrent.atomic.AtomicReference;
import lombok.Getter;
@ -71,7 +72,8 @@ public class HTTPDModule extends PlexModule
new IndexEndpoint();
new ListEndpoint();
new PunishmentsEndpoint();
new SchematicEndpoint();
new SchematicDownloadEndpoint();
new SchematicUploadEndpoint();
server.setConnectors(new Connector[]{connector});
server.setHandler(context);

View File

@ -11,10 +11,10 @@ import java.io.OutputStream;
import java.util.Arrays;
import org.bukkit.Bukkit;
public class SchematicEndpoint extends AbstractServlet
public class SchematicDownloadEndpoint extends AbstractServlet
{
@GetMapping(endpoint = "/api/download_schematic/")
public String schematicIndex(HttpServletRequest request, HttpServletResponse response)
@GetMapping(endpoint = "/api/schematics/download/")
public String downloadSchematic(HttpServletRequest request, HttpServletResponse response)
{
if (request.getPathInfo() == null || request.getPathInfo().equals("/"))
{
@ -79,7 +79,7 @@ public class SchematicEndpoint extends AbstractServlet
private String schematicHTML()
{
String file = readFile(this.getClass().getResourceAsStream("/httpd/schematic_list.html"));
String file = readFile(this.getClass().getResourceAsStream("/httpd/schematic_download.html"));
File worldeditFolder = getWorldeditFolder();
if (worldeditFolder == null)
{

View File

@ -0,0 +1,15 @@
package dev.plex.request.impl;
import dev.plex.request.AbstractServlet;
import dev.plex.request.GetMapping;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
public class SchematicUploadEndpoint extends AbstractServlet
{
@GetMapping(endpoint = "/api/schematics/upload/")
public String downloadSchematic(HttpServletRequest request, HttpServletResponse response)
{
return readFile(this.getClass().getResourceAsStream("/httpd/schematic_upload.html"));
}
}

View File

@ -40,8 +40,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -40,8 +40,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -40,8 +40,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -40,8 +40,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -40,8 +40,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -39,8 +39,8 @@
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -34,13 +34,14 @@
<li class="nav-item">
<a class="nav-link" href="/api/punishments/">Punishments</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" role="button"
<a class="nav-link active dropdown-toggle" aria-current="page" id="navbarDropdownMenuLink"
role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/download_schematic/">Download</a></li>
<li><a class="dropdown-item" href="/api/upload_schematic/">Upload</a></li>
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</li>
</ul>

View File

@ -0,0 +1,55 @@
<!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>Schematics - 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</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 class="nav-item dropdown">
<a class="nav-link active dropdown-toggle" aria-current="page" id="navbarDropdownMenuLink" role="button"
data-bs-toggle="dropdown" aria-expanded="false">
Schematics
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="/api/schematics/download/">Download</a></li>
<li><a class="dropdown-item" href="/api/schematics/upload/">Upload</a></li>
</ul>
</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>Page coming soon.</h5>
</div>
</body>
</html>