[MOD] Make / actually reasonably nicer

Merely cosmetic.
This commit is contained in:
LDA 2024-07-25 01:14:05 +02:00
commit 1f26684913

View file

@ -1,40 +1,98 @@
#include <Routes.h>
#include <Cytoplasm/Cytoplasm.h>
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Rand.h>
#include <AS.h>
RouteHead(RouteRoot, arr, argp)
{
ParseeHttpArg *args = argp;
const char *quote = RandInt(2) ?
"Kinda jealous of that, to be fair." :
"Why look inward when you can challenge the mainstream media?";
char *mxid, *jid;
char *m_to;
mxid = ParseeMXID(args->data);
m_to = ParseeGenerateMTO(mxid);
jid = ParseeJID(args->data);
HttpResponseHeader(args->ctx, "Content-Type", "text/html");
HttpSendHeaders(args->ctx);
StreamPrintf(args->stream, "<html lang=\"en\">");
StreamPrintf(args->stream, " <head>");
StreamPrintf(args->stream, " <title>Parsee Lander</title>");
StreamPrintf(args->stream, " </head>");
StreamPrintf(args->stream, " <body>");
StreamPrintf(args->stream, " <center><h1>");
StreamPrintf(args->stream, " Your Parsee is running!");
StreamPrintf(args->stream, " </h1></center>");
StreamPrintf(args->stream, " <hr/>");
StreamPrintf(args->stream, " <p>");
StreamPrintf(args->stream, " Kinda jealous of that, to be ");
StreamPrintf(args->stream, " fair.");
StreamPrintf(args->stream, " </p>");
StreamPrintf(args->stream, " <p>");
StreamPrintf(args->stream, " Your homeserver now can interact");
StreamPrintf(args->stream, " with the bridge, with the ");
StreamPrintf(args->stream, " generated YAML file.");
StreamPrintf(args->stream, " </p>");
StreamPrintf(args->stream, " <p>");
StreamPrintf(args->stream, " More information available at ");
StreamPrintf(args->stream, " <a href=");
StreamPrintf(args->stream, " \"https://kappach.at/parsee\"");
StreamPrintf(args->stream, " >the actual page</a>.");
StreamPrintf(args->stream, " </p>");
StreamPrintf(args->stream, " <img src=\"https://kappach.at/parsee.gif\" />");
StreamPrintf(args->stream, " </body>");
StreamPrintf(args->stream, "</html>");
#define P(...) StreamPrintf(args->stream, __VA_ARGS__)
P("<html lang='en'>");
P(" <head>");
P(" <title>%s Lander</title>", NAME);
P(" <style>");
P(" html {");
P(" background-color: #222;");
P(" color: #eee;");
P(" }");
P(" blockquote {");
P(" border-left: 2px solid #ccc;");
P(" margin: 1.5em 10px;");
P(" background: #444;");
P(" padding: 0.5em;");
P(" }");
P(" blockquote p {");
P(" display: inline-block;");
P(" }");
P(" </style>");
P(" </head>");
P(" <body>");
P(" <center><h1>");
P(" Your %s is running!", NAME);
P(" </h1></center>");
P(" <hr/>");
P(" <blockquote><i>");
P(" %s", quote);
P(" </i></blockquote>");
P(" <p>");
P(" Your homeserver now can interact with the bridge, with ");
P(" the generated YAML file and Jabber component shared ");
P(" secret.");
P(" </p>");
P(" <p>");
P(" You may be interested in sending <code>!help</code> to ");
P(" the Matrix <a href='%s'>%s bridge</a>, or pop out ", m_to, NAME);
P(" <code>%s</code>'s command list on XMPP as a starter.", jid);
P(" </p>");
P(" <p>");
P(" More information available at ");
P(" <a");
P(" href='https://kappach.at/parsee'");
P(" >the actual page</a>.");
P(" </p>");
P(" <h2>Extra information</h2>");
P(" <p>");
P(" <h3>Parsee statistics</h3>");
P("<pre><code>");
P("Software: %s (v%s/Cyto %s)\n", NAME, VERSION, CytoplasmGetVersionStr());
P("Cytoplasm heap used: %d B\n", MemoryAllocated());
P("</code></pre>");
P(" </p>");
P(" <p>");
P(" Some clicky links relating to %s:", NAME);
P(" <ul>");
P(" <li><a href='%s'>Repository</a></li>", REPOSITORY);
P(" <li><a href='%s'>Fediverse</a></li>", "https://ak.ari.lt/parsee");
P(" <li><img src='%s' /></li>", "https://kappach.at/parsee.gif");
P(" </ul>");
P(" </p>");
P(" <blockquote><p>");
P(" Good luck, and have fun! :D");
P(" </p></blockquote>");
P(" <p>&mdash;LDA</p>");
P(" </body>");
P("</html>");
#undef P
Free(mxid);
Free(m_to);
Free(jid);
return NULL;
}