From ce2757552cbfffb5855cce292f0f90477b272c36 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 28 Sep 2022 09:46:21 +0200 Subject: [PATCH] More HTML work. --- html.c | 40 +++++++++++++++++++++++++++++++++++++--- snac.h | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index 89df82a..5530c34 100644 --- a/html.c +++ b/html.c @@ -180,7 +180,7 @@ d_char *html_msg_icon(snac *snac, d_char *s, char *msg) { xs *s1 = xs_fmt("%s", - actor, name); + actor_id, name); s = xs_str_cat(s, s1); } @@ -207,7 +207,7 @@ d_char *html_msg_icon(snac *snac, d_char *s, char *msg) } -d_char *html_user_header(snac *snac, d_char *s) +d_char *html_user_header(snac *snac, d_char *s, int local) /* creates the HTML header */ { char *p, *v; @@ -243,6 +243,40 @@ d_char *html_user_header(snac *snac, d_char *s) s = xs_str_cat(s, "\n\n"); + /* top nav */ + s = xs_str_cat(s, "", snac->actor, L("admin")); + else + s1 = xs_fmt("%s", snac->actor, L("public")); + + s = xs_str_cat(s, s1); + } + + /* user info */ + { + s = xs_str_cat(s, "
\n"); + + xs *s1 = xs_fmt("

%s

\n", + xs_dict_get(snac->config, "name")); + s = xs_str_cat(s, s1); + + xs *s2 = xs_fmt("

@%s@%s

\n", + xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host")); + s = xs_str_cat(s, s2); + + xs *bio = NULL; + not_really_markdown(xs_dict_get(snac->config, "bio"), &bio); + xs *s3 = xs_fmt("
%s
\n", bio); + s = xs_str_cat(s, s3); + + s = xs_str_cat(s, "
\n"); + } + return s; } @@ -252,7 +286,7 @@ d_char *html_timeline(snac *snac, char *list, int local) { d_char *s = xs_str_new(NULL); - s = html_user_header(snac, s); + s = html_user_header(snac, s, local); s = xs_str_cat(s, "

HI

\n"); diff --git a/snac.h b/snac.h index 7cd46c7..2adde26 100644 --- a/snac.h +++ b/snac.h @@ -16,6 +16,8 @@ extern const char *susie; #define valid_status(status) ((status) >= 200 && (status) <= 299) +#define L(s) (s) + d_char *xs_time(char *fmt, int local); #define xs_local_time(fmt) xs_time(fmt, 1) #define xs_utc_time(fmt) xs_time(fmt, 0)