mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-27 12:46:22 +01:00
Visually improve oauth login response page
This commit is contained in:
parent
847106f1fb
commit
5eca6c2b43
@ -12,6 +12,7 @@ import org.apache.commons.io.IOUtils;
|
||||
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 class OauthHttpHandler {
|
||||
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();
|
||||
|
@ -1 +1,24 @@
|
||||
<p>OK: you can close the browser now</p>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>You can now close your browser</title>
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: nowrap;
|
||||
text-align: center;
|
||||
font-family: system-ui;
|
||||
background-color: #0e0e0e;
|
||||
color: #eee;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<img src="data:image/png;base64,%s" alt="icon.png" onerror="this.style.display='none'">
|
||||
<h2>You can now close your browser</h2>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user