summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar grunfink2025-05-18 08:43:31 +0200
committerGravatar grunfink2025-05-18 08:43:31 +0200
commit0900f69f2a4d08086e60cd5d31beac73b65f25a7 (patch)
treec19505155c98d5baf8b9c8efd0f76d0091fd3178 /mastoapi.c
parentAdded a pending follow request count next to the "people" link. (diff)
downloadpenes-snac2-0900f69f2a4d08086e60cd5d31beac73b65f25a7.tar.gz
penes-snac2-0900f69f2a4d08086e60cd5d31beac73b65f25a7.tar.xz
penes-snac2-0900f69f2a4d08086e60cd5d31beac73b65f25a7.zip
mastoapi: added endpoint /v1/follow_requests.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 6a22189..c216a0b 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2109,10 +2109,26 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2109 } 2109 }
2110 else 2110 else
2111 if (strcmp(cmd, "/v1/follow_requests") == 0) { /** **/ 2111 if (strcmp(cmd, "/v1/follow_requests") == 0) { /** **/
2112 /* snac does not support optional follow confirmations */ 2112 if (logged_in) {
2113 *body = xs_dup("[]"); 2113 xs *pend = pending_list(&snac1);
2114 *ctype = "application/json"; 2114 xs *resp = xs_list_new();
2115 status = HTTP_STATUS_OK; 2115 const char *id;
2116
2117 xs_list_foreach(pend, id) {
2118 xs *actor = NULL;
2119
2120 if (valid_status(object_get(id, &actor))) {
2121 xs *acct = mastoapi_account(&snac1, actor);
2122
2123 if (acct)
2124 resp = xs_list_append(resp, acct);
2125 }
2126 }
2127
2128 *body = xs_json_dumps(resp, 4);
2129 *ctype = "application/json";
2130 status = HTTP_STATUS_OK;
2131 }
2116 } 2132 }
2117 else 2133 else
2118 if (strcmp(cmd, "/v1/announcements") == 0) { /** **/ 2134 if (strcmp(cmd, "/v1/announcements") == 0) { /** **/