diff options
| author | 2022-09-28 04:48:23 +0200 | |
|---|---|---|
| committer | 2022-09-28 04:48:23 +0200 | |
| commit | 32661d2be7bb718522c123e401ef35fa0307c1c0 (patch) | |
| tree | 9b99dbdad9ba918090847131014dc524f264504e /activitypub.c | |
| parent | Timeline pages are also served. (diff) | |
| download | snac2-32661d2be7bb718522c123e401ef35fa0307c1c0.tar.gz snac2-32661d2be7bb718522c123e401ef35fa0307c1c0.tar.xz snac2-32661d2be7bb718522c123e401ef35fa0307c1c0.zip | |
The outbox returns now some entries.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 5ab7a96..8a38257 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -761,10 +761,24 @@ int activitypub_get_handler(d_char *req, char *q_path, | |||
| 761 | else | 761 | else |
| 762 | if (strcmp(p_path, "outbox") == 0) { | 762 | if (strcmp(p_path, "outbox") == 0) { |
| 763 | xs *id = xs_fmt("%s/outbox", snac.actor); | 763 | xs *id = xs_fmt("%s/outbox", snac.actor); |
| 764 | xs *elems = local_list(&snac, 40); | ||
| 765 | xs *list = xs_list_new(); | ||
| 764 | msg = msg_collection(&snac, id); | 766 | msg = msg_collection(&snac, id); |
| 767 | char *p, *v; | ||
| 768 | |||
| 769 | p = elems; | ||
| 770 | while (xs_list_iter(&p, &v)) { | ||
| 771 | xs *i = timeline_get(&snac, v); | ||
| 772 | char *type = xs_dict_get(i, "type"); | ||
| 773 | char *id = xs_dict_get(i, "id"); | ||
| 774 | |||
| 775 | if (type && id && strcmp(type, "Note") == 0 && xs_startswith(id, snac.actor)) | ||
| 776 | list = xs_list_append(list, i); | ||
| 777 | } | ||
| 765 | 778 | ||
| 766 | /* replace the 'orderedItems' with the latest posts */ | 779 | /* replace the 'orderedItems' with the latest posts */ |
| 767 | /* ... */ | 780 | msg = xs_dict_set(msg, "orderedItems", list); |
| 781 | msg = xs_dict_set(msg, "totalItems", xs_number_new(xs_list_len(list))); | ||
| 768 | } | 782 | } |
| 769 | else | 783 | else |
| 770 | if (strcmp(p_path, "followers") == 0 || strcmp(p_path, "following") == 0) { | 784 | if (strcmp(p_path, "followers") == 0 || strcmp(p_path, "following") == 0) { |