mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 06:25:04 +00:00
Unify the instance description text.
This commit is contained in:
parent
16c14060a8
commit
3f7e3c1d81
5 changed files with 47 additions and 55 deletions
13
html.c
13
html.c
|
@ -273,18 +273,7 @@ xs_str *html_instance_header(xs_str *s)
|
|||
s = xs_str_cat(s, "<div class=\"snac-instance-blurb\">\n");
|
||||
|
||||
{
|
||||
xs *s1 = xs_fmt(
|
||||
"<p><b>%s</b> is a "
|
||||
"<a href=\"https:/" "/en.wikipedia.org/wiki/Fediverse\">Fediverse</a> "
|
||||
"instance that uses the "
|
||||
"<a href=\"https:/" "/en.wikipedia.org/wiki/ActivityPub\">ActivityPub</a> "
|
||||
"protocol. In other words, users at this host can communicate with people "
|
||||
"that use software like Mastodon, Pleroma, Friendica, etc. "
|
||||
"all around the world.</p>\n"
|
||||
"<p>This server runs the "
|
||||
"<a href=\"" WHAT_IS_SNAC_URL "\">snac</a> software and there is no "
|
||||
"automatic sign-up process.</p>\n",
|
||||
host);
|
||||
xs *s1 = xs_replace(snac_blurb, "%host%", host);
|
||||
s = xs_str_cat(s, s1);
|
||||
}
|
||||
|
||||
|
|
2
snac.h
2
snac.h
|
@ -271,6 +271,8 @@ int snac_init(const char *_basedir);
|
|||
int adduser(const char *uid);
|
||||
int resetpwd(snac *snac);
|
||||
|
||||
extern const char *snac_blurb;
|
||||
|
||||
int job_fifo_ready(void);
|
||||
void job_post(const xs_val *job, int urgent);
|
||||
void job_wait(xs_val **job);
|
||||
|
|
30
utils.c
30
utils.c
|
@ -62,24 +62,27 @@ static const char *default_css =
|
|||
".snac-poll-result { margin-left: auto; margin-right: auto; }\n"
|
||||
;
|
||||
|
||||
const char *snac_blurb =
|
||||
"<p><b>%host%</b> is a <a href=\"https:/"
|
||||
"/en.wikipedia.org/wiki/Fediverse\">Fediverse</a> "
|
||||
"instance that uses the <a href=\"https:/"
|
||||
"/en.wikipedia.org/wiki/ActivityPub\">ActivityPub</a> "
|
||||
"protocol. In other words, users at this host can communicate with people "
|
||||
"that use software like Mastodon, Pleroma, Friendica, etc. "
|
||||
"all around the world.</p>\n"
|
||||
"<p>This server runs the "
|
||||
"<a href=\"" WHAT_IS_SNAC_URL "\">snac</a> software and there is no "
|
||||
"automatic sign-up process.</p>\n"
|
||||
;
|
||||
|
||||
static const char *greeting_html =
|
||||
"<!DOCTYPE html>\n"
|
||||
"<html><head>\n"
|
||||
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"
|
||||
"<title>Welcome to %host%</title>\n"
|
||||
"<body style=\"margin: auto; max-width: 50em\">\n"
|
||||
"<h1>Welcome to %host%</h1>\n"
|
||||
"<p>This is a <a href=\"https://en.wikipedia.org/wiki/Fediverse\">Fediverse</a> instance\n"
|
||||
"that uses the <a href=\"https://en.wikipedia.org/wiki/ActivityPub\">ActivityPub</a> protocol.\n"
|
||||
"In other words, users at this host can communicate with people that use software like\n"
|
||||
"Mastodon, Pleroma, Friendica, etc. all around the world.</p>\n"
|
||||
"\n"
|
||||
"<p>There is no automatic sign up process for this server. If you want to be a part of\n"
|
||||
"this community, please write an email to %admin_email%\n"
|
||||
"and ask politely indicating what is your preferred user id (alphanumeric characters\n"
|
||||
"only).</p>\n"
|
||||
"\n"
|
||||
"<p>The following users are already part of this community:</p>\n"
|
||||
"%blurb%"
|
||||
"<p>The following users are part of this community:</p>\n"
|
||||
"\n"
|
||||
"%userlist%\n"
|
||||
"\n"
|
||||
|
@ -180,7 +183,8 @@ int snac_init(const char *basedir)
|
|||
return 1;
|
||||
}
|
||||
|
||||
fwrite(greeting_html, strlen(greeting_html), 1, f);
|
||||
xs *gh = xs_replace(greeting_html, "%blurb%", snac_blurb);
|
||||
fwrite(gh, strlen(gh), 1, f);
|
||||
fclose(f);
|
||||
|
||||
xs *sfn = xs_fmt("%s/style.css", srv_basedir);
|
||||
|
|
21
xs_mime.h
21
xs_mime.h
|
@ -4,14 +4,14 @@
|
|||
|
||||
#define _XS_MIME
|
||||
|
||||
char *xs_mime_by_ext(const char *file);
|
||||
const char *xs_mime_by_ext(const char *file);
|
||||
|
||||
#ifdef XS_IMPLEMENTATION
|
||||
|
||||
/* intentionally brain-dead simple */
|
||||
struct _mime_info {
|
||||
char *type;
|
||||
char *ext;
|
||||
const char *type;
|
||||
const char *ext;
|
||||
} mime_info[] = {
|
||||
{ "application/json", ".json" },
|
||||
{ "image/gif", ".gif" },
|
||||
|
@ -46,23 +46,20 @@ struct _mime_info {
|
|||
};
|
||||
|
||||
|
||||
char *xs_mime_by_ext(const char *file)
|
||||
const char *xs_mime_by_ext(const char *file)
|
||||
/* returns the MIME type by file extension */
|
||||
{
|
||||
struct _mime_info *mi = mime_info;
|
||||
char *p = NULL;
|
||||
xs *lfile = xs_tolower_i(xs_dup(file));
|
||||
|
||||
while (p == NULL && mi->type != NULL) {
|
||||
if (xs_endswith(file, mi->ext))
|
||||
p = mi->type;
|
||||
while (mi->type != NULL) {
|
||||
if (xs_endswith(lfile, mi->ext))
|
||||
return mi->type;
|
||||
|
||||
mi++;
|
||||
}
|
||||
|
||||
if (p == NULL)
|
||||
p = "application/octet-stream";
|
||||
|
||||
return p;
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
/* 5b007ed034f8598be964d72f5becf24b379a7dd8 */
|
||||
/* 17cae699036ab791f9bd4e9c1b875b1f808121f0 */
|
||||
|
|
Loading…
Reference in a new issue