mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
mastoapi: some tweaks to list entry points.
This commit is contained in:
parent
a41b66ce08
commit
15bca0921f
1 changed files with 22 additions and 6 deletions
28
mastoapi.c
28
mastoapi.c
|
@ -1446,9 +1446,27 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
if (strcmp(opt, "featured_tags") == 0) {
|
||||
/* snac doesn't have features tags, yet? */
|
||||
/* implement empty response so apps like Tokodon don't show an error */
|
||||
*body = xs_dup("[]");
|
||||
*ctype = "application/json";
|
||||
status = HTTP_STATUS_OK;
|
||||
out = xs_list_new();
|
||||
}
|
||||
else
|
||||
if (strcmp(opt, "following") == 0) {
|
||||
xs *wing = following_list(&snac1);
|
||||
out = xs_list_new();
|
||||
int c = 0;
|
||||
const char *v;
|
||||
|
||||
while (xs_list_next(wing, &v, &c)) {
|
||||
xs *actor = NULL;
|
||||
|
||||
if (valid_status(object_get(v, &actor))) {
|
||||
xs *acct = mastoapi_account(actor);
|
||||
out = xs_list_append(out, acct);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (strcmp(opt, "followers") == 0) {
|
||||
out = xs_list_new();
|
||||
}
|
||||
|
||||
user_free(&snac2);
|
||||
|
@ -1469,9 +1487,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
|||
if (strcmp(opt, "featured_tags") == 0) {
|
||||
/* snac doesn't have features tags, yet? */
|
||||
/* implement empty response so apps like Tokodon don't show an error */
|
||||
*body = xs_dup("[]");
|
||||
*ctype = "application/json";
|
||||
status = HTTP_STATUS_OK;
|
||||
out = xs_list_new();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue