diff --git a/activitypub.c b/activitypub.c index 4843067..b3c7367 100644 --- a/activitypub.c +++ b/activitypub.c @@ -152,18 +152,19 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level) int status = 0; if (!xs_is_null(*id)) { - xs *object = NULL; + xs *msg = NULL; /* is the object already there? */ - if (!valid_status(object_get(*id, &object))) { + if (!valid_status(object_get(*id, &msg))) { /* no; download it */ - status = activitypub_request(snac, *id, &object); + status = activitypub_request(snac, *id, &msg); if (valid_status(status)) { - char *type = xs_dict_get(object, "type"); + xs_dict *object = msg; + const char *type = xs_dict_get(object, "type"); /* get the id again from the object, as it may be different */ - char *nid = xs_dict_get(object, "id"); + const char *nid = xs_dict_get(object, "id"); if (wrk && strcmp(nid, *id) != 0) { snac_debug(snac, 1, @@ -173,8 +174,21 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level) *id = *wrk; } - if (!xs_is_null(type) && strcmp(type, "Note") == 0) { - char *actor = xs_dict_get(object, "attributedTo"); + if (xs_is_null(type)) + type = "(null)"; + + srv_debug(0, xs_fmt("timeline_request type %s '%s'", *id, type)); + + if (strcmp(type, "Create") == 0) { + /* some software like lemmy nest Announce + Create + Note */ + if (!xs_is_null(object = xs_dict_get(object, "object"))) + type = xs_dict_get(object, "type"); + else + type = "(null)"; + } + + if (strcmp(type, "Note") == 0 || strcmp(type, "Page") == 0) { + const char *actor = xs_dict_get(object, "attributedTo"); /* request (and drop) the actor for this entry */ if (!xs_is_null(actor)) diff --git a/html.c b/html.c index 8e3152d..d74c44d 100644 --- a/html.c +++ b/html.c @@ -189,8 +189,9 @@ xs_str *html_msg_icon(snac *snac, xs_str *os, const xs_dict *msg) char *udate = NULL; char *url = NULL; int priv = 0; + const char *type = xs_dict_get(msg, "type"); - if (strcmp(xs_dict_get(msg, "type"), "Note") == 0) + if (strcmp(type, "Note") == 0 || strcmp(type, "Question") == 0 || strcmp(type, "Page") == 0) url = xs_dict_get(msg, "id"); priv = !is_msg_public(snac, msg); @@ -856,7 +857,7 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, return xs_str_cat(os, s); } else - if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) { + if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0 && strcmp(type, "Page") != 0) { /* skip oddities */ return os; } @@ -974,6 +975,12 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, /* add the content */ s = xs_str_cat(s, "\n
\n"); /** **/ + if (!xs_is_null(v = xs_dict_get(msg, "name"))) { + xs *es1 = encode_html(v); + xs *s1 = xs_fmt("

%s

\n", es1); + s = xs_str_cat(s, s1); + } + /* is it sensitive? */ if (!xs_is_null(v = xs_dict_get(msg, "sensitive")) && xs_type(v) == XSTYPE_TRUE) { if (xs_is_null(v = xs_dict_get(msg, "summary")) || *v == '\0')