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 b7b1e0fc7..7e0ea5943 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 @@ -2,12 +2,15 @@ import com.google.common.base.Charsets; import com.google.common.base.Splitter; +import com.skcraft.launcher.Launcher; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; import lombok.extern.java.Log; +import org.apache.commons.io.IOUtils; import java.io.IOException; +import java.io.InputStream; import java.net.InetSocketAddress; import java.util.Map; import java.util.concurrent.Executor; @@ -56,7 +59,14 @@ public void handle(HttpExchange httpExchange) throws IOException { OauthHttpHandler.this.notifyAll(); } - byte[] response = "OK: you can close the browser now".getBytes(Charsets.UTF_8); + byte[] response; + InputStream is = Launcher.class.getResourceAsStream("login.html"); + if (is != null) { + response = IOUtils.toByteArray(is); + } else { + response = "Unable to fetch resource login.html".getBytes(Charsets.UTF_8); + } + 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 new file mode 100644 index 000000000..e0663e499 --- /dev/null +++ b/launcher/src/main/resources/com/skcraft/launcher/login.html @@ -0,0 +1 @@ +

OK: you can close the browser now