commit 15bca09
default
·
2024-05-31 07:50:37 +0000 UTC
parent a41b66c
mastoapi: some tweaks to list entry points.
1 files changed,
+22,
-6
+22,
-6
1@@ -1446,9 +1446,27 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 if (strcmp(opt, "featured_tags") == 0) {
3 /* snac doesn't have features tags, yet? */
4 /* implement empty response so apps like Tokodon don't show an error */
5- *body = xs_dup("[]");
6- *ctype = "application/json";
7- status = HTTP_STATUS_OK;
8+ out = xs_list_new();
9+ }
10+ else
11+ if (strcmp(opt, "following") == 0) {
12+ xs *wing = following_list(&snac1);
13+ out = xs_list_new();
14+ int c = 0;
15+ const char *v;
16+
17+ while (xs_list_next(wing, &v, &c)) {
18+ xs *actor = NULL;
19+
20+ if (valid_status(object_get(v, &actor))) {
21+ xs *acct = mastoapi_account(actor);
22+ out = xs_list_append(out, acct);
23+ }
24+ }
25+ }
26+ else
27+ if (strcmp(opt, "followers") == 0) {
28+ out = xs_list_new();
29 }
30
31 user_free(&snac2);
32@@ -1469,9 +1487,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
33 if (strcmp(opt, "featured_tags") == 0) {
34 /* snac doesn't have features tags, yet? */
35 /* implement empty response so apps like Tokodon don't show an error */
36- *body = xs_dup("[]");
37- *ctype = "application/json";
38- status = HTTP_STATUS_OK;
39+ out = xs_list_new();
40 }
41 }
42 }