From 86571f37bb3e85acaed6d0212b5543130a6766ce Mon Sep 17 00:00:00 2001 From: default Date: Mon, 14 Aug 2023 11:24:41 +0200 Subject: The instance URL can now show a timeline. --- html.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'html.c') diff --git a/html.c b/html.c index b941464..1da0b9c 100644 --- a/html.c +++ b/html.c @@ -244,8 +244,81 @@ xs_str *html_instance_header(xs_str *s) { s = html_base_header(s); + { + FILE *f; + xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir); + + if ((f = fopen(g_css_fn, "r")) != NULL) { + xs *css = xs_readall(f); + fclose(f); + + xs *s1 = xs_fmt("\n", css); + s = xs_str_cat(s, s1); + } + } + + const char *host = xs_dict_get(srv_config, "host"); + const char *title = xs_dict_get(srv_config, "title"); + const char *sdesc = xs_dict_get(srv_config, "short_description"); + const char *email = xs_dict_get(srv_config, "admin_email"); + const char *acct = xs_dict_get(srv_config, "admin_account"); + + { + xs *s1 = xs_fmt("%s\n", title && *title ? title : host); + s = xs_str_cat(s, s1); + } + s = xs_str_cat(s, "\n\n"); + s = xs_str_cat(s, "
\n"); + + { + xs *s1 = xs_fmt( + "

%s is a " + "Fediverse " + "instance that uses the " + "ActivityPub " + "protocol. In other words, users at this host can communicate with people " + "that use software like Mastodon, Pleroma, Friendica, etc. " + "all around the world.

\n" + "

This server runs the " + "snac software and there is no " + "automatic sign-up process.

\n", + host); + s = xs_str_cat(s, s1); + } + + s = xs_str_cat(s, "
\n"); + + if (sdesc && *sdesc) { + xs *s1 = xs_fmt("
%s
%s
\n", L("Site description"), sdesc); + s = xs_str_cat(s, s1); + } + if (email && *email) { + xs *s1 = xs_fmt("
%s
" + "%s
\n", + L("Admin email"), email, email); + + s = xs_str_cat(s, s1); + } + if (acct && *acct) { + xs *s1 = xs_fmt("
%s
" + "@%s@%s
\n", + L("Admin account"), srv_baseurl, acct, acct, host); + + s = xs_str_cat(s, s1); + } + + s = xs_str_cat(s, "
\n"); + + s = xs_str_cat(s, "
\n"); + + { + xs *s1 = xs_fmt("

%s

\n", + L("Recent posts by users in this instance")); + s = xs_str_cat(s, s1); + } + return s; } -- cgit v1.2.3