Status page for GenSoc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
815 B

import React from "react";
import { Router } from "express";
import { renderToString } from "react-dom/server";
import Status from "./components/Status";
import { getFromCache } from "src/lib/status";
const development = process.env.NODE_ENV === "development";
const STATIC_HOST = development
? "http://localhost:8080"
: "https://status.gensokyo.social";
const router = Router();
router.get("/", (_, res) => {
getFromCache().then(([mastodonStatus, mumbleStatus, XMPPStatus]) => {
const statusPage = (
<Status
mastodon={mastodonStatus}
mumble={mumbleStatus}
xmpp={XMPPStatus}
staticHost={STATIC_HOST}
/>
);
const page = `
<!DOCTYPE html>
${renderToString(statusPage)}
`;
res.status(200).send(page);
});
});
export default router;