summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar poesty2023-05-07 07:27:24 +0000
committerGravatar poesty2023-05-07 07:27:24 +0000
commite65760a349112abce39404ca50f6bc2f1301bed9 (patch)
treec2484af8006961d95dcf39cf16c3749100a713c9 /html.c
parentFixed webfinger and curl issues (diff)
parentVersion 2.30 RELEASED. (diff)
downloadsnac2-e65760a349112abce39404ca50f6bc2f1301bed9.tar.gz
snac2-e65760a349112abce39404ca50f6bc2f1301bed9.tar.xz
snac2-e65760a349112abce39404ca50f6bc2f1301bed9.zip
Merge pull request 'master' (#1) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/poesty/snac2/pulls/1
Diffstat (limited to 'html.c')
-rw-r--r--html.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/html.c b/html.c
index 5f57262..8d4203d 100644
--- a/html.c
+++ b/html.c
@@ -79,7 +79,7 @@ xs_str *actor_name(xs_dict *actor)
79} 79}
80 80
81 81
82d_char *html_actor_icon(snac *snac, d_char *os, char *actor, 82xs_str *html_actor_icon(xs_str *os, char *actor,
83 const char *date, const char *udate, const char *url, int priv) 83 const char *date, const char *udate, const char *url, int priv)
84{ 84{
85 xs *s = xs_str_new(NULL); 85 xs *s = xs_str_new(NULL);
@@ -168,7 +168,7 @@ d_char *html_msg_icon(snac *snac, d_char *os, char *msg)
168 date = xs_dict_get(msg, "published"); 168 date = xs_dict_get(msg, "published");
169 udate = xs_dict_get(msg, "updated"); 169 udate = xs_dict_get(msg, "updated");
170 170
171 os = html_actor_icon(snac, os, actor, date, udate, url, priv); 171 os = html_actor_icon(os, actor, date, udate, url, priv);
172 } 172 }
173 173
174 return os; 174 return os;
@@ -983,7 +983,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local,
983} 983}
984 984
985 985
986d_char *html_user_footer(snac *snac, d_char *s) 986xs_str *html_user_footer(xs_str *s)
987{ 987{
988 xs *s1 = xs_fmt( 988 xs *s1 = xs_fmt(
989 "<div class=\"snac-footer\">\n" 989 "<div class=\"snac-footer\">\n"
@@ -1064,7 +1064,7 @@ d_char *html_timeline(snac *snac, char *list, int local, int skip, int show, int
1064 s = xs_str_cat(s, s1); 1064 s = xs_str_cat(s, s1);
1065 } 1065 }
1066 1066
1067 s = html_user_footer(snac, s); 1067 s = html_user_footer(s);
1068 1068
1069 s = xs_str_cat(s, "</body>\n</html>\n"); 1069 s = xs_str_cat(s, "</body>\n</html>\n");
1070 1070
@@ -1088,8 +1088,7 @@ d_char *html_people_list(snac *snac, d_char *os, d_char *list, const char *heade
1088 if (valid_status(actor_get(snac, actor_id, &actor))) { 1088 if (valid_status(actor_get(snac, actor_id, &actor))) {
1089 s = xs_str_cat(s, "<div class=\"snac-post\">\n"); 1089 s = xs_str_cat(s, "<div class=\"snac-post\">\n");
1090 1090
1091 s = html_actor_icon(snac, s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0); 1091 s = html_actor_icon(s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
1092
1093 1092
1094 /* content (user bio) */ 1093 /* content (user bio) */
1095 char *c = xs_dict_get(actor, "summary"); 1094 char *c = xs_dict_get(actor, "summary");
@@ -1182,7 +1181,7 @@ d_char *html_people(snac *snac)
1182 1181
1183 s = html_people_list(snac, s, wers, L("People that follows you"), "e"); 1182 s = html_people_list(snac, s, wers, L("People that follows you"), "e");
1184 1183
1185 s = html_user_footer(snac, s); 1184 s = html_user_footer(s);
1186 1185
1187 s = xs_str_cat(s, "</body>\n</html>\n"); 1186 s = xs_str_cat(s, "</body>\n</html>\n");
1188 1187
@@ -1226,7 +1225,7 @@ xs_str *html_notifications(snac *snac)
1226 const char *actor_id = xs_dict_get(noti, "actor"); 1225 const char *actor_id = xs_dict_get(noti, "actor");
1227 xs *actor = NULL; 1226 xs *actor = NULL;
1228 1227
1229 if (!valid_status(object_get(actor_id, &actor))) 1228 if (!valid_status(actor_get(snac, actor_id, &actor)))
1230 continue; 1229 continue;
1231 1230
1232 xs *a_name = actor_name(actor); 1231 xs *a_name = actor_name(actor);
@@ -1277,12 +1276,13 @@ xs_str *html_notifications(snac *snac)
1277 s = xs_str_cat(s, s1); 1276 s = xs_str_cat(s, s1);
1278 } 1277 }
1279 1278
1280 s = html_user_footer(snac, s); 1279 s = html_user_footer(s);
1281 1280
1282 s = xs_str_cat(s, "</body>\n</html>\n"); 1281 s = xs_str_cat(s, "</body>\n</html>\n");
1283 1282
1284 /* set the check time to now */ 1283 /* set the check time to now */
1285 xs *dummy = notify_check_time(snac, 1); 1284 xs *dummy = notify_check_time(snac, 1);
1285 dummy = xs_free(dummy);
1286 1286
1287 timeline_touch(snac); 1287 timeline_touch(snac);
1288 1288
@@ -1290,7 +1290,8 @@ xs_str *html_notifications(snac *snac)
1290} 1290}
1291 1291
1292 1292
1293int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype) 1293int html_get_handler(const xs_dict *req, const char *q_path,
1294 char **body, int *b_size, char **ctype)
1294{ 1295{
1295 char *accept = xs_dict_get(req, "accept"); 1296 char *accept = xs_dict_get(req, "accept");
1296 int status = 404; 1297 int status = 404;
@@ -1547,9 +1548,13 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
1547} 1548}
1548 1549
1549 1550
1550int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, 1551int html_post_handler(const xs_dict *req, const char *q_path,
1552 char *payload, int p_size,
1551 char **body, int *b_size, char **ctype) 1553 char **body, int *b_size, char **ctype)
1552{ 1554{
1555 (void)p_size;
1556 (void)ctype;
1557
1553 int status = 0; 1558 int status = 0;
1554 snac snac; 1559 snac snac;
1555 char *uid, *p_path; 1560 char *uid, *p_path;