#include #include #include #include #include #include static bool HasAdmin(ParseeData *data) { DbRef *admins; HashMap *json; bool ret = false; admins = DbLock(data->db, 1, "admins"); if (!admins) { return false; } json = DbJson(admins); ret = ArraySize(JsonValueAsArray(HashMapGet(json, "admins"))); DbUnlock(data->db, admins); 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!", "'Wow parsee can save the world' - said a wise guy", "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!", "'Won't you hold my <presence/> safe?' - Kanako", NAME ": the federated world's little little kobashi", "Go take a look at your stanzas!", "Go take a look at your objects!", "DEC Alpha AXP-Certified!", "this is the moment parsee started parsing or smth idk" " - another wise person", "Ah, merde, mon TGV est en retard de 53 minutes !" }; const size_t count = sizeof(quotes)/sizeof(*quotes); return quotes[RandInt(count) % count]; } RouteHead(RouteRoot, arr, argp) { ParseeHttpArg *args = argp; const ParseeConfig *config = args->data->config; HttpResponseHeader(args->ctx, "Content-Type", "text/html"); HttpSendHeaders(args->ctx); #define P(...) StreamPrintf(args->stream, __VA_ARGS__) P(""); P(""); { P(""); { P("%s Lander", NAME); P(""); P("", media_parsee_logo); P(""); } P(""); P(""); { size_t i; P("
"); P("

Your %s is running, all with that %s!

", NAME, CODE); P("
"); P("
"); P("
"); { P("%s", GetRandomQuote()); } P("
"); P("
");
            for (i = 0; i < PARSEE_ASCII_LINES; i++)
            {
                XMLElement *e = XMLCreateText((char *) parsee_ascii[i]);
                XMLEncode(args->stream, e);
                XMLFreeElement(e);
                P("
"); } P("
"); P("

"); { P("Welcome, sysadmin! "); } 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("

"); { char *mxid, *jid; char *m_to; mxid = ParseeMXID(args->data); m_to = ParseeGenerateMTO(mxid); jid = ParseeJID(args->data); P("You may be interested in sending !help to "); P("the Matrix %s bridge, or pop out ", m_to, NAME); P("%s's command list on XMPP as a starter.", jid); Free(mxid); Free(m_to); Free(jid); } P("

"); P("

"); { P("More information available at "); P("the actual page."); } P("

"); P("

Permissions?

"); P("

"); { const char *perms = !HasAdmin(args->data) ? " (which I know you do)" : ""; P("If you have problems running commands%s, you may want to ", perms); P("look into if you have set yourself as an admin."); } P("

"); P("

"); { P("With a packaged and installed version of %s, ", NAME); P("you may add an admin with "); P("parsee-adminify '%s' '[glob]'. ", config->db_path); P("Please see its manual page for more information."); } P("

"); P("

Extra information

"); P("

"); { P("

Dev documentations!!!!

"); P("Developers may be interested into looking up the "); P("at.kappach.at "); P("page for extensions used by Parsee on Matrix and XMPP. "); } P("

"); P("

Parsee statistics

"); P("

"); { const char *cyto_ver = CytoplasmGetVersionStr(); size_t alloc = MemoryAllocated(); P("

");
                P("Software: %s ", NAME);
                P("(v%s [%s]/Cytoplasm %s)\n", VERSION, CODE, cyto_ver);
                P("Cytoplasm heap used: %d B\n", alloc);
                P("
"); } P("

"); P("

"); { P("Some clicky links relating to %s:", NAME); P("

    "); { const char *fedi = "https://tengu.kappach.at/parsee"; const char *icon = "https://kappach.at/parsee.gif"; P("
  • Repository
  • ", REPOSITORY); P("
  • Fediverse
  • ", fedi); P("
  • CC0 88x31:
  • ", icon); } P("
"); } P("

"); P("
"); P("Good luck, and have fun! :D"); P("
"); P("

— LDA

"); } P(""); } P(""); #undef P (void) arr; return NULL; }