diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 73 |
1 files changed, 73 insertions, 0 deletions
| @@ -244,8 +244,81 @@ xs_str *html_instance_header(xs_str *s) | |||
| 244 | { | 244 | { |
| 245 | s = html_base_header(s); | 245 | s = html_base_header(s); |
| 246 | 246 | ||
| 247 | { | ||
| 248 | FILE *f; | ||
| 249 | xs *g_css_fn = xs_fmt("%s/style.css", srv_basedir); | ||
| 250 | |||
| 251 | if ((f = fopen(g_css_fn, "r")) != NULL) { | ||
| 252 | xs *css = xs_readall(f); | ||
| 253 | fclose(f); | ||
| 254 | |||
| 255 | xs *s1 = xs_fmt("<style>%s</style>\n", css); | ||
| 256 | s = xs_str_cat(s, s1); | ||
| 257 | } | ||
| 258 | } | ||
| 259 | |||
| 260 | const char *host = xs_dict_get(srv_config, "host"); | ||
| 261 | const char *title = xs_dict_get(srv_config, "title"); | ||
| 262 | const char *sdesc = xs_dict_get(srv_config, "short_description"); | ||
| 263 | const char *email = xs_dict_get(srv_config, "admin_email"); | ||
| 264 | const char *acct = xs_dict_get(srv_config, "admin_account"); | ||
| 265 | |||
| 266 | { | ||
| 267 | xs *s1 = xs_fmt("<title>%s</title>\n", title && *title ? title : host); | ||
| 268 | s = xs_str_cat(s, s1); | ||
| 269 | } | ||
| 270 | |||
| 247 | s = xs_str_cat(s, "</head>\n<body>\n"); | 271 | s = xs_str_cat(s, "</head>\n<body>\n"); |
| 248 | 272 | ||
| 273 | s = xs_str_cat(s, "<div class=\"snac-instance-blurb\">\n"); | ||
| 274 | |||
| 275 | { | ||
| 276 | xs *s1 = xs_fmt( | ||
| 277 | "<p><b>%s</b> is a " | ||
| 278 | "<a href=\"https:/" "/en.wikipedia.org/wiki/Fediverse\">Fediverse</a> " | ||
| 279 | "instance that uses the " | ||
| 280 | "<a href=\"https:/" "/en.wikipedia.org/wiki/ActivityPub\">ActivityPub</a> " | ||
| 281 | "protocol. In other words, users at this host can communicate with people " | ||
| 282 | "that use software like Mastodon, Pleroma, Friendica, etc. " | ||
| 283 | "all around the world.</p>\n" | ||
| 284 | "<p>This server runs the " | ||
| 285 | "<a href=\"" WHAT_IS_SNAC_URL "\">snac</a> software and there is no " | ||
| 286 | "automatic sign-up process.</p>\n", | ||
| 287 | host); | ||
| 288 | s = xs_str_cat(s, s1); | ||
| 289 | } | ||
| 290 | |||
| 291 | s = xs_str_cat(s, "<dl>\n"); | ||
| 292 | |||
| 293 | if (sdesc && *sdesc) { | ||
| 294 | xs *s1 = xs_fmt("<di><dt>%s</dt><dd>%s</dd></di>\n", L("Site description"), sdesc); | ||
| 295 | s = xs_str_cat(s, s1); | ||
| 296 | } | ||
| 297 | if (email && *email) { | ||
| 298 | xs *s1 = xs_fmt("<di><dt>%s</dt><dd>" | ||
| 299 | "<a href=\"mailto:%s\">%s</a></dd></di>\n", | ||
| 300 | L("Admin email"), email, email); | ||
| 301 | |||
| 302 | s = xs_str_cat(s, s1); | ||
| 303 | } | ||
| 304 | if (acct && *acct) { | ||
| 305 | xs *s1 = xs_fmt("<di><dt>%s</dt><dd>" | ||
| 306 | "<a href=\"%s/%s\">@%s@%s</a></dd></di>\n", | ||
| 307 | L("Admin account"), srv_baseurl, acct, acct, host); | ||
| 308 | |||
| 309 | s = xs_str_cat(s, s1); | ||
| 310 | } | ||
| 311 | |||
| 312 | s = xs_str_cat(s, "</dl>\n"); | ||
| 313 | |||
| 314 | s = xs_str_cat(s, "</div>\n"); | ||
| 315 | |||
| 316 | { | ||
| 317 | xs *s1 = xs_fmt("<h2 class=\"snac-header\">%s</h2>\n", | ||
| 318 | L("Recent posts by users in this instance")); | ||
| 319 | s = xs_str_cat(s, s1); | ||
| 320 | } | ||
| 321 | |||
| 249 | return s; | 322 | return s; |
| 250 | } | 323 | } |
| 251 | 324 | ||