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");
|
s = xs_str_cat(s, "<div class=\"snac-instance-blurb\">\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
xs *s1 = xs_fmt(
|
xs *s1 = xs_replace(snac_blurb, "%host%", host);
|
||||||
"<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);
|
|
||||||
s = xs_str_cat(s, s1);
|
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 adduser(const char *uid);
|
||||||
int resetpwd(snac *snac);
|
int resetpwd(snac *snac);
|
||||||
|
|
||||||
|
extern const char *snac_blurb;
|
||||||
|
|
||||||
int job_fifo_ready(void);
|
int job_fifo_ready(void);
|
||||||
void job_post(const xs_val *job, int urgent);
|
void job_post(const xs_val *job, int urgent);
|
||||||
void job_wait(xs_val **job);
|
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"
|
".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 =
|
static const char *greeting_html =
|
||||||
"<!DOCTYPE html>\n"
|
"<!DOCTYPE html>\n"
|
||||||
"<html><head>\n"
|
"<html><head>\n"
|
||||||
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"
|
||||||
"<title>Welcome to %host%</title>\n"
|
"<title>Welcome to %host%</title>\n"
|
||||||
"<body style=\"margin: auto; max-width: 50em\">\n"
|
"<body style=\"margin: auto; max-width: 50em\">\n"
|
||||||
"<h1>Welcome to %host%</h1>\n"
|
"%blurb%"
|
||||||
"<p>This is a <a href=\"https://en.wikipedia.org/wiki/Fediverse\">Fediverse</a> instance\n"
|
"<p>The following users are part of this community:</p>\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"
|
|
||||||
"\n"
|
"\n"
|
||||||
"%userlist%\n"
|
"%userlist%\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -180,7 +183,8 @@ int snac_init(const char *basedir)
|
||||||
return 1;
|
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);
|
fclose(f);
|
||||||
|
|
||||||
xs *sfn = xs_fmt("%s/style.css", srv_basedir);
|
xs *sfn = xs_fmt("%s/style.css", srv_basedir);
|
||||||
|
|
55
xs_mime.h
55
xs_mime.h
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
#define _XS_MIME
|
#define _XS_MIME
|
||||||
|
|
||||||
char *xs_mime_by_ext(const char *file);
|
const char *xs_mime_by_ext(const char *file);
|
||||||
|
|
||||||
#ifdef XS_IMPLEMENTATION
|
#ifdef XS_IMPLEMENTATION
|
||||||
|
|
||||||
/* intentionally brain-dead simple */
|
/* intentionally brain-dead simple */
|
||||||
struct _mime_info {
|
struct _mime_info {
|
||||||
char *type;
|
const char *type;
|
||||||
char *ext;
|
const char *ext;
|
||||||
} mime_info[] = {
|
} mime_info[] = {
|
||||||
{ "application/json", ".json" },
|
{ "application/json", ".json" },
|
||||||
{ "image/gif", ".gif" },
|
{ "image/gif", ".gif" },
|
||||||
|
@ -19,23 +19,23 @@ struct _mime_info {
|
||||||
{ "image/jpeg", ".jpg" },
|
{ "image/jpeg", ".jpg" },
|
||||||
{ "image/png", ".png" },
|
{ "image/png", ".png" },
|
||||||
{ "image/webp", ".webp" },
|
{ "image/webp", ".webp" },
|
||||||
{ "video/mp4", ".mp4"},
|
{ "video/mp4", ".mp4" },
|
||||||
{ "video/mp4", ".mpg4"},
|
{ "video/mp4", ".mpg4" },
|
||||||
{ "video/mp4", ".m4v"},
|
{ "video/mp4", ".m4v" },
|
||||||
{ "video/webm", ".webm"},
|
{ "video/webm", ".webm" },
|
||||||
{ "video/quicktime", ".mov"},
|
{ "video/quicktime", ".mov" },
|
||||||
{ "video/3gpp", ".3gp"},
|
{ "video/3gpp", ".3gp" },
|
||||||
{ "video/ogg", ".ogv"},
|
{ "video/ogg", ".ogv" },
|
||||||
{ "video/flv", ".flv"},
|
{ "video/flv", ".flv" },
|
||||||
{ "audio/mp3", ".mp3"},
|
{ "audio/mp3", ".mp3" },
|
||||||
{ "audio/ogg", ".ogg"},
|
{ "audio/ogg", ".ogg" },
|
||||||
{ "audio/ogg", ".oga"},
|
{ "audio/ogg", ".oga" },
|
||||||
{ "audio/ogg", ".opus"},
|
{ "audio/ogg", ".opus" },
|
||||||
{ "audio/flac", ".flac"},
|
{ "audio/flac", ".flac" },
|
||||||
{ "audio/wav", ".wav"},
|
{ "audio/wav", ".wav" },
|
||||||
{ "audio/wma", ".wma"},
|
{ "audio/wma", ".wma" },
|
||||||
{ "audio/aac", ".aac"},
|
{ "audio/aac", ".aac" },
|
||||||
{ "audio/aac", ".m4a"},
|
{ "audio/aac", ".m4a" },
|
||||||
{ "text/css", ".css" },
|
{ "text/css", ".css" },
|
||||||
{ "text/html", ".html" },
|
{ "text/html", ".html" },
|
||||||
{ "text/plain", ".txt" },
|
{ "text/plain", ".txt" },
|
||||||
|
@ -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 */
|
/* returns the MIME type by file extension */
|
||||||
{
|
{
|
||||||
struct _mime_info *mi = mime_info;
|
struct _mime_info *mi = mime_info;
|
||||||
char *p = NULL;
|
xs *lfile = xs_tolower_i(xs_dup(file));
|
||||||
|
|
||||||
while (p == NULL && mi->type != NULL) {
|
while (mi->type != NULL) {
|
||||||
if (xs_endswith(file, mi->ext))
|
if (xs_endswith(lfile, mi->ext))
|
||||||
p = mi->type;
|
return mi->type;
|
||||||
|
|
||||||
mi++;
|
mi++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == NULL)
|
return "application/octet-stream";
|
||||||
p = "application/octet-stream";
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/* 5b007ed034f8598be964d72f5becf24b379a7dd8 */
|
/* 17cae699036ab791f9bd4e9c1b875b1f808121f0 */
|
||||||
|
|
Loading…
Reference in a new issue