From 08de4913955c6a4a31c13f72fbce2601bed215ba Mon Sep 17 00:00:00 2001 From: default Date: Thu, 29 Aug 2024 08:30:09 +0200 Subject: mastoapi: added bookmark list. --- mastoapi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 069d823..13cc129 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1822,10 +1822,16 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, } else if (strcmp(cmd, "/v1/bookmarks") == 0) { /** **/ - /* snac does not support bookmarks */ - *body = xs_dup("[]"); - *ctype = "application/json"; - status = HTTP_STATUS_OK; + if (logged_in) { + xs *ifn = bookmark_index_fn(&snac1); + xs *out = mastoapi_timeline(&snac1, args, ifn); + + *body = xs_json_dumps(out, 4); + *ctype = "application/json"; + status = HTTP_STATUS_OK; + } + else + status = HTTP_STATUS_UNAUTHORIZED; } else if (strcmp(cmd, "/v1/lists") == 0) { /** list of lists **/ @@ -1850,6 +1856,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, *ctype = "application/json"; status = HTTP_STATUS_OK; } + else + status = HTTP_STATUS_UNAUTHORIZED; } else if (xs_startswith(cmd, "/v1/lists/")) { /** list information **/ @@ -1910,6 +1918,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, } } } + else + status = HTTP_STATUS_UNAUTHORIZED; } else if (strcmp(cmd, "/v1/scheduled_statuses") == 0) { /** **/ -- cgit v1.2.3