summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-08-26 11:26:34 +0200
committerGravatar default2024-08-26 11:26:34 +0200
commit70f0bcec200b99195d6733abe9b7647420f71ff0 (patch)
tree705e8d461007855a9d5194f56ed8079d959546bd
parentOnly archive error content that is not NULL. (diff)
downloadpenes-snac2-70f0bcec200b99195d6733abe9b7647420f71ff0.tar.gz
penes-snac2-70f0bcec200b99195d6733abe9b7647420f71ff0.tar.xz
penes-snac2-70f0bcec200b99195d6733abe9b7647420f71ff0.zip
Added a 'featured' property to the actor object.
When this URL is requested via ActivityPub, it returns the pinned posts.
-rw-r--r--activitypub.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/activitypub.c b/activitypub.c
index b18514f..d67fb34 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1163,7 +1163,7 @@ xs_dict *msg_actor(snac *snac)
1163 msg = xs_dict_set(msg, "summary", f_bio); 1163 msg = xs_dict_set(msg, "summary", f_bio);
1164 msg = xs_dict_set(msg, "tag", tags); 1164 msg = xs_dict_set(msg, "tag", tags);
1165 1165
1166 char *folders[] = { "inbox", "outbox", "followers", "following", NULL }; 1166 char *folders[] = { "inbox", "outbox", "followers", "following", "featured", NULL };
1167 for (n = 0; folders[n]; n++) { 1167 for (n = 0; folders[n]; n++) {
1168 xs *f = xs_fmt("%s/%s", snac->actor, folders[n]); 1168 xs *f = xs_fmt("%s/%s", snac->actor, folders[n]);
1169 msg = xs_dict_set(msg, folders[n], f); 1169 msg = xs_dict_set(msg, folders[n], f);
@@ -2683,16 +2683,17 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
2683 snac_debug(&snac, 0, xs_fmt("serving actor [%s]", ua ? ua : "No UA")); 2683 snac_debug(&snac, 0, xs_fmt("serving actor [%s]", ua ? ua : "No UA"));
2684 } 2684 }
2685 else 2685 else
2686 if (strcmp(p_path, "outbox") == 0) { 2686 if (strcmp(p_path, "outbox") == 0 || strcmp(p_path, "featured") == 0) {
2687 xs *id = xs_fmt("%s/outbox", snac.actor); 2687 xs *id = xs_fmt("%s/%s", snac.actor, p_path);
2688 xs *elems = timeline_simple_list(&snac, "public", 0, 20);
2689 xs *list = xs_list_new(); 2688 xs *list = xs_list_new();
2690 msg = msg_collection(&snac, id); 2689 msg = msg_collection(&snac, id);
2691 char *p;
2692 const char *v; 2690 const char *v;
2691 int tc = 0;
2693 2692
2694 p = elems; 2693 /* get the public outbox or the pinned list */
2695 while (xs_list_iter(&p, &v)) { 2694 xs *elems = *p_path == 'o' ? timeline_simple_list(&snac, "public", 0, 20) : pinned_list(&snac);
2695
2696 while (xs_list_next(elems, &v, &tc)) {
2696 xs *i = NULL; 2697 xs *i = NULL;
2697 2698
2698 if (valid_status(object_get_by_md5(v, &i))) { 2699 if (valid_status(object_get_by_md5(v, &i))) {