diff options
| author | default <nobody@localhost> | 2025-03-22 08:39:04 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-03-22 08:39:04 +0100 |
| commit | 0b4e8cac069d31de736137de08543ace912b728a (patch) | |
| tree | 8ae5c4de88b23e53b257412b550719a5c483c06f /mastoapi.c | |
| parent | 20573275ec8f7cc7f5744a3280590040a6f14203 (diff) | |
mastoapi: fixed instance peers to return only the domains.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -2259,8 +2259,18 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (strcmp(cmd, "/v1/instance/peers") == 0) { /** **/ /* get the collected inbox list as the instances "this domain is aware of" */ xs *list = inbox_list(); + xs *peers = xs_list_new(); + const char *inbox; - *body = xs_json_dumps(list, 4); + xs_list_foreach(list, inbox) { + xs *l = xs_split(inbox, "/"); + const char *domain = xs_list_get(l, 2); + + if (xs_is_string(domain)) + peers = xs_list_append(peers, domain); + } + + *body = xs_json_dumps(peers, 4); *ctype = "application/json"; status = HTTP_STATUS_OK; } |