From 5eca6c2b434a686ea3a4960d92011193f82825c9 Mon Sep 17 00:00:00 2001 From: Magi1053 Date: Fri, 29 Mar 2024 23:11:23 -0500 Subject: [PATCH 1/2] Visually improve oauth login response page --- .../auth/microsoft/OauthHttpHandler.java | 10 ++++++++ .../resources/com/skcraft/launcher/login.html | 25 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/OauthHttpHandler.java b/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/OauthHttpHandler.java index 7e0ea5943..0eddbb446 100644 --- a/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/OauthHttpHandler.java +++ b/launcher/src/main/java/com/skcraft/launcher/auth/microsoft/OauthHttpHandler.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.InetSocketAddress; +import java.util.Base64; import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.Executors; @@ -67,6 +68,15 @@ public void handle(HttpExchange httpExchange) throws IOException { response = "Unable to fetch resource login.html".getBytes(Charsets.UTF_8); } + InputStream iconStream = Launcher.class.getResourceAsStream("icon.png"); + if (iconStream != null) { + byte[] iconBytes = IOUtils.toByteArray(iconStream); + String encodedIcon = Base64.getEncoder().encodeToString(iconBytes); + response = String.format(new String(response), encodedIcon).getBytes(); + } else { + log.warning("Unable to fetch resource icon.png"); + } + httpExchange.sendResponseHeaders(200, response.length); httpExchange.getResponseBody().write(response); httpExchange.getResponseBody().flush(); diff --git a/launcher/src/main/resources/com/skcraft/launcher/login.html b/launcher/src/main/resources/com/skcraft/launcher/login.html index e0663e499..560fb0ee7 100644 --- a/launcher/src/main/resources/com/skcraft/launcher/login.html +++ b/launcher/src/main/resources/com/skcraft/launcher/login.html @@ -1 +1,24 @@ -

OK: you can close the browser now

+ + + + You can now close your browser + + + +
+ icon.png +

You can now close your browser

+
+ + From 9147cb2ad0086b29aa57a00d3ba7fd5a3a81be30 Mon Sep 17 00:00:00 2001 From: Magi1053 Date: Wed, 1 May 2024 22:30:35 -0500 Subject: [PATCH 2/2] Add icon to favicon --- launcher/src/main/resources/com/skcraft/launcher/login.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/launcher/src/main/resources/com/skcraft/launcher/login.html b/launcher/src/main/resources/com/skcraft/launcher/login.html index 560fb0ee7..22c54ff7f 100644 --- a/launcher/src/main/resources/com/skcraft/launcher/login.html +++ b/launcher/src/main/resources/com/skcraft/launcher/login.html @@ -2,6 +2,7 @@ You can now close your browser +