commit 70f0bce
default
·
2024-08-26 09:26:34 +0000 UTC
parent 367597e
Added a 'featured' property to the actor object. When this URL is requested via ActivityPub, it returns the pinned posts.
1 files changed,
+8,
-7
+8,
-7
1@@ -1163,7 +1163,7 @@ xs_dict *msg_actor(snac *snac)
2 msg = xs_dict_set(msg, "summary", f_bio);
3 msg = xs_dict_set(msg, "tag", tags);
4
5- char *folders[] = { "inbox", "outbox", "followers", "following", NULL };
6+ char *folders[] = { "inbox", "outbox", "followers", "following", "featured", NULL };
7 for (n = 0; folders[n]; n++) {
8 xs *f = xs_fmt("%s/%s", snac->actor, folders[n]);
9 msg = xs_dict_set(msg, folders[n], f);
10@@ -2683,16 +2683,17 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
11 snac_debug(&snac, 0, xs_fmt("serving actor [%s]", ua ? ua : "No UA"));
12 }
13 else
14- if (strcmp(p_path, "outbox") == 0) {
15- xs *id = xs_fmt("%s/outbox", snac.actor);
16- xs *elems = timeline_simple_list(&snac, "public", 0, 20);
17+ if (strcmp(p_path, "outbox") == 0 || strcmp(p_path, "featured") == 0) {
18+ xs *id = xs_fmt("%s/%s", snac.actor, p_path);
19 xs *list = xs_list_new();
20 msg = msg_collection(&snac, id);
21- char *p;
22 const char *v;
23+ int tc = 0;
24
25- p = elems;
26- while (xs_list_iter(&p, &v)) {
27+ /* get the public outbox or the pinned list */
28+ xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, 20) : pinned_list(&snac);
29+
30+ while (xs_list_next(elems, &v, &tc)) {
31 xs *i = NULL;
32
33 if (valid_status(object_get_by_md5(v, &i))) {