From b67e3a64f643f547ae2f397d25fddde5fc7c583a Mon Sep 17 00:00:00 2001 From: Ender <33337309+e3ndr@users.noreply.github.com> Date: Thu, 21 Sep 2023 20:58:27 -0500 Subject: [PATCH] Server: Welcome to Athena! --- .../e3ndr/athena/webui/AthenaUIServer.java | 1 + .../java/xyz/e3ndr/athena/webui/UIRoutes.java | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java b/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java index d63b0bd..6e78df9 100644 --- a/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java +++ b/server/src/main/java/xyz/e3ndr/athena/webui/AthenaUIServer.java @@ -46,6 +46,7 @@ public static class AthenaSoraAdapter extends SoraPlugin { @Override public void onInit(Sora sora) { + sora.addProvider(this, new UIRoutes()); } @Override diff --git a/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java b/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java new file mode 100644 index 0000000..a05df03 --- /dev/null +++ b/server/src/main/java/xyz/e3ndr/athena/webui/UIRoutes.java @@ -0,0 +1,49 @@ +package xyz.e3ndr.athena.webui; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import co.casterlabs.rakurai.io.http.StandardHttpStatus; +import co.casterlabs.rakurai.io.http.server.HttpResponse; +import co.casterlabs.sora.api.http.HttpProvider; +import co.casterlabs.sora.api.http.SoraHttpSession; +import co.casterlabs.sora.api.http.annotations.HttpEndpoint; + +class UIRoutes implements HttpProvider { + + @HttpEndpoint(uri = "/*") + public HttpResponse redirectToUI(SoraHttpSession session) { + return html( + "