Compare commits

...

3 Commits

Author SHA1 Message Date
Magi1053 c6bc5b95f7
Merge 9147cb2ad0 into d197bc80cc 2024-05-02 21:01:37 +01:00
Magi1053 9147cb2ad0 Add icon to favicon 2024-05-01 22:30:35 -05:00
Magi1053 5eca6c2b43 Visually improve oauth login response page 2024-03-29 23:18:23 -05:00
2 changed files with 35 additions and 1 deletions

View File

@ -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();

View File

@ -1 +1,25 @@
<p>OK: you can close the browser now</p>
<html>
<head>
<meta charset="UTF-8"/>
<title>You can now close your browser</title>
<link rel="icon" href="data:image/png;base64,%1$s">
<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,%1$s" alt="icon.png" onerror="this.style.display='none'">
<h2>You can now close your browser</h2>
</main>
</body>
</html>