diff options
| author | 2024-05-31 09:50:37 +0200 | |
|---|---|---|
| committer | 2024-05-31 09:50:37 +0200 | |
| commit | 15bca0921f850aa7922ad12d7da7f2ea45ea3c11 (patch) | |
| tree | 1bd118e0354fa04670122eb60b0a90daa7c3e0ea /mastoapi.c | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | penes-snac2-15bca0921f850aa7922ad12d7da7f2ea45ea3c11.tar.gz penes-snac2-15bca0921f850aa7922ad12d7da7f2ea45ea3c11.tar.xz penes-snac2-15bca0921f850aa7922ad12d7da7f2ea45ea3c11.zip | |
mastoapi: some tweaks to list entry points.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 28 |
1 files changed, 22 insertions, 6 deletions
| @@ -1446,9 +1446,27 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1446 | if (strcmp(opt, "featured_tags") == 0) { | 1446 | if (strcmp(opt, "featured_tags") == 0) { |
| 1447 | /* snac doesn't have features tags, yet? */ | 1447 | /* snac doesn't have features tags, yet? */ |
| 1448 | /* implement empty response so apps like Tokodon don't show an error */ | 1448 | /* implement empty response so apps like Tokodon don't show an error */ |
| 1449 | *body = xs_dup("[]"); | 1449 | out = xs_list_new(); |
| 1450 | *ctype = "application/json"; | 1450 | } |
| 1451 | status = HTTP_STATUS_OK; | 1451 | else |
| 1452 | if (strcmp(opt, "following") == 0) { | ||
| 1453 | xs *wing = following_list(&snac1); | ||
| 1454 | out = xs_list_new(); | ||
| 1455 | int c = 0; | ||
| 1456 | const char *v; | ||
| 1457 | |||
| 1458 | while (xs_list_next(wing, &v, &c)) { | ||
| 1459 | xs *actor = NULL; | ||
| 1460 | |||
| 1461 | if (valid_status(object_get(v, &actor))) { | ||
| 1462 | xs *acct = mastoapi_account(actor); | ||
| 1463 | out = xs_list_append(out, acct); | ||
| 1464 | } | ||
| 1465 | } | ||
| 1466 | } | ||
| 1467 | else | ||
| 1468 | if (strcmp(opt, "followers") == 0) { | ||
| 1469 | out = xs_list_new(); | ||
| 1452 | } | 1470 | } |
| 1453 | 1471 | ||
| 1454 | user_free(&snac2); | 1472 | user_free(&snac2); |
| @@ -1469,9 +1487,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1469 | if (strcmp(opt, "featured_tags") == 0) { | 1487 | if (strcmp(opt, "featured_tags") == 0) { |
| 1470 | /* snac doesn't have features tags, yet? */ | 1488 | /* snac doesn't have features tags, yet? */ |
| 1471 | /* implement empty response so apps like Tokodon don't show an error */ | 1489 | /* implement empty response so apps like Tokodon don't show an error */ |
| 1472 | *body = xs_dup("[]"); | 1490 | out = xs_list_new(); |
| 1473 | *ctype = "application/json"; | ||
| 1474 | status = HTTP_STATUS_OK; | ||
| 1475 | } | 1491 | } |
| 1476 | } | 1492 | } |
| 1477 | } | 1493 | } |