[MOD] Quote-of-the-day changes

This commit is contained in:
LDA 2024-08-15 22:50:19 +02:00
commit a8f1031a79
3 changed files with 42 additions and 10 deletions

View file

@ -10,6 +10,10 @@ The name 'Parsee' is actually a reference to [Parsee Mizuhashi](https://en.touho
I hate Bifrost. I also wanted to dip my toes in XMPP, XML, and bridges a bit. Also, as a sister project to KappaChat,
this means that I can integrate Parsee with KappaChat however I wish it to be, which allows me to mess around with a
codebase I'm already familiar with.
A more "up-to-date" reason may be to have a small, 'Just Werks' bridging solution *that is good*.
Well, I'm *trying* to do that, at least. Please scream at me if that fails(or just doesn't run
on a overclocked Raspberry Pi 4B, which, by the way, was literally where Parsee+XMPP ran for
a good chunk of Parsee's start.)
### "Why not just use Matrix lol"
### "Why not just use XMPP lol"

View file

@ -3,6 +3,7 @@
#include <Cytoplasm/Cytoplasm.h>
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Rand.h>
#include <Cytoplasm/Log.h>
#include <AS.h>
@ -25,6 +26,34 @@ HasAdmin(ParseeData *data)
return ret;
}
static const char *
GetRandomQuote(void)
{
const char *quotes[] =
{
"Kinda jealous of that, to be fair.",
"*(noms)*",
"Why look inward when you can challenge the mainstream "
"media?",
"Boo!",
"[...] I can make up lots of reasons to attack you.",
"Go Kontribute to C99 projects!",
"We truly live in a " CODE "...",
"You truly lack the Desire Drive for this!",
"Eeh? Bifrost mode? Only bad servers use Bifrost mode!",
"As small as a dwarf, and can run on your pie!",
"It's all wicked unsafe, memory slow 🚀🚀🚀🚀",
"XMPP kinda sucks.",
"Matrix kinda sucks.",
"Throw jabs!"
};
const size_t count = sizeof(quotes)/sizeof(*quotes);
return quotes[RandInt(count) % count];
}
RouteHead(RouteRoot, arr, argp)
{
ParseeHttpArg *args = argp;
@ -39,6 +68,7 @@ RouteHead(RouteRoot, arr, argp)
P("<head>");
{
P("<title>%s Lander</title>", NAME);
P("<meta charset='UTF-8'/>");
P("<style>");
{
P("html {");
@ -69,16 +99,12 @@ RouteHead(RouteRoot, arr, argp)
P("<body>");
{
P("<center><h1>");
P("Your %s is running!", NAME);
P("Your %s is running, all with that %s!", NAME, CODE);
P("</h1></center>");
P("<hr/>");
P("<blockquote><i>");
{
const char *quote = RandInt(2) ?
"Kinda jealous of that, to be fair." :
"Why look inward when you can challenge the mainstream "
"media?";
P("%s", quote);
P("%s", GetRandomQuote());
}
P("</i></blockquote>");
@ -138,9 +164,10 @@ RouteHead(RouteRoot, arr, argp)
P("<p>");
{
P("If you happen to have a build-from-source copy of %s, ", NAME);
P("please build all utilities and run ");
P("<code>tools/out/adminify '%s' '[glob]'</code>.", config->db_path);
P("With a packaged and installed version of %s, ", NAME);
P("you may add an admin with ");
P("<code>parsee-adminify '%s' '[glob]'</code>. ", config->db_path);
P("Please see its manual page for more information.");
}
P("</p>");
@ -150,7 +177,7 @@ RouteHead(RouteRoot, arr, argp)
P("<h3>Dev documentations!!!!</h3>");
P("Developers may be interested into looking up the ");
P("<a href='https://at.kappach.at'>at.kappach.at</a> ");
P("page for extensions used by Parsee on Matrix. ");
P("page for extensions used by Parsee on Matrix and XMPP. ");
}
P("</p>");

View file

@ -40,6 +40,7 @@ ParseeInitialiseSignals(HttpServer *s, pthread_t xmpp, XMPPComponent *j)
#define Register(act) (sigaction(act, &sa, NULL) >= 0)
if (!Register(SIGTERM) || !Register(SIGINT))
{
Log(LOG_ERR, "Couldn't register signals...");
return false;
}
#undef Register