|
|
|
@ -27,22 +27,26 @@ const apiHandler = filter(
|
|
|
|
|
setHeaders([["content-type", "application/json"]], serve),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const root = (req: Request) => {
|
|
|
|
|
const root = async (req: Request) => {
|
|
|
|
|
if (!req.url.endsWith("/")) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const config = await loadConfiguration();
|
|
|
|
|
|
|
|
|
|
return new Response(`
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
<meta name="description" content="${config.description ?? config.title ?? "Statue - a simple status monitor"}">
|
|
|
|
|
<script type="module">
|
|
|
|
|
${frontend}
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
${style}
|
|
|
|
|
</style>
|
|
|
|
|
<title>Statue</title>
|
|
|
|
|
<title>${config.title ?? "Statue"}</title>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<noscript>
|
|
|
|
@ -51,7 +55,7 @@ const root = (req: Request) => {
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
`, {
|
|
|
|
|
headers: { "content-type": "text/html" },
|
|
|
|
|
headers: { "content-type": "text/html; charset=utf-8" },
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|