diff options
| -rw-r--r-- | html.c | 40 | ||||
| -rw-r--r-- | snac.h | 2 |
2 files changed, 39 insertions, 3 deletions
| @@ -180,7 +180,7 @@ d_char *html_msg_icon(snac *snac, d_char *s, char *msg) | |||
| 180 | 180 | ||
| 181 | { | 181 | { |
| 182 | xs *s1 = xs_fmt("<a href=\"%s\" class=\"p-author h-card snac-author\">%s</a>", | 182 | xs *s1 = xs_fmt("<a href=\"%s\" class=\"p-author h-card snac-author\">%s</a>", |
| 183 | actor, name); | 183 | actor_id, name); |
| 184 | s = xs_str_cat(s, s1); | 184 | s = xs_str_cat(s, s1); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| @@ -207,7 +207,7 @@ d_char *html_msg_icon(snac *snac, d_char *s, char *msg) | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | 209 | ||
| 210 | d_char *html_user_header(snac *snac, d_char *s) | 210 | d_char *html_user_header(snac *snac, d_char *s, int local) |
| 211 | /* creates the HTML header */ | 211 | /* creates the HTML header */ |
| 212 | { | 212 | { |
| 213 | char *p, *v; | 213 | char *p, *v; |
| @@ -243,6 +243,40 @@ d_char *html_user_header(snac *snac, d_char *s) | |||
| 243 | 243 | ||
| 244 | s = xs_str_cat(s, "</head>\n<body>\n"); | 244 | s = xs_str_cat(s, "</head>\n<body>\n"); |
| 245 | 245 | ||
| 246 | /* top nav */ | ||
| 247 | s = xs_str_cat(s, "<nav style=\"snac-top-nav\">"); | ||
| 248 | |||
| 249 | { | ||
| 250 | xs *s1; | ||
| 251 | |||
| 252 | if (local) | ||
| 253 | s1 = xs_fmt("<a href=\"%s/admin\">%s</a></nav>", snac->actor, L("admin")); | ||
| 254 | else | ||
| 255 | s1 = xs_fmt("<a href=\"%s\">%s</a></nav>", snac->actor, L("public")); | ||
| 256 | |||
| 257 | s = xs_str_cat(s, s1); | ||
| 258 | } | ||
| 259 | |||
| 260 | /* user info */ | ||
| 261 | { | ||
| 262 | s = xs_str_cat(s, "<div class=\"h-card snac-top-user\">\n"); | ||
| 263 | |||
| 264 | xs *s1 = xs_fmt("<p class=\"p-name snac-top-user-name\">%s</p>\n", | ||
| 265 | xs_dict_get(snac->config, "name")); | ||
| 266 | s = xs_str_cat(s, s1); | ||
| 267 | |||
| 268 | xs *s2 = xs_fmt("<p class=\"snac-top-user-id\">@%s@%s</p>\n", | ||
| 269 | xs_dict_get(snac->config, "uid"), xs_dict_get(srv_config, "host")); | ||
| 270 | s = xs_str_cat(s, s2); | ||
| 271 | |||
| 272 | xs *bio = NULL; | ||
| 273 | not_really_markdown(xs_dict_get(snac->config, "bio"), &bio); | ||
| 274 | xs *s3 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio); | ||
| 275 | s = xs_str_cat(s, s3); | ||
| 276 | |||
| 277 | s = xs_str_cat(s, "</div>\n"); | ||
| 278 | } | ||
| 279 | |||
| 246 | return s; | 280 | return s; |
| 247 | } | 281 | } |
| 248 | 282 | ||
| @@ -252,7 +286,7 @@ d_char *html_timeline(snac *snac, char *list, int local) | |||
| 252 | { | 286 | { |
| 253 | d_char *s = xs_str_new(NULL); | 287 | d_char *s = xs_str_new(NULL); |
| 254 | 288 | ||
| 255 | s = html_user_header(snac, s); | 289 | s = html_user_header(snac, s, local); |
| 256 | 290 | ||
| 257 | s = xs_str_cat(s, "<h1>HI</h1>\n"); | 291 | s = xs_str_cat(s, "<h1>HI</h1>\n"); |
| 258 | 292 | ||
| @@ -16,6 +16,8 @@ extern const char *susie; | |||
| 16 | 16 | ||
| 17 | #define valid_status(status) ((status) >= 200 && (status) <= 299) | 17 | #define valid_status(status) ((status) >= 200 && (status) <= 299) |
| 18 | 18 | ||
| 19 | #define L(s) (s) | ||
| 20 | |||
| 19 | d_char *xs_time(char *fmt, int local); | 21 | d_char *xs_time(char *fmt, int local); |
| 20 | #define xs_local_time(fmt) xs_time(fmt, 1) | 22 | #define xs_local_time(fmt) xs_time(fmt, 1) |
| 21 | #define xs_utc_time(fmt) xs_time(fmt, 0) | 23 | #define xs_utc_time(fmt) xs_time(fmt, 0) |