summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-08-29 08:30:09 +0200
committerdefault <nobody@localhost>2024-08-29 08:30:09 +0200
commit08de4913955c6a4a31c13f72fbce2601bed215ba (patch)
tree27192a33496fcccefe86cd49b620169c00bf9926 /mastoapi.c
parent54520f0411658ae37d6115d69c056dd1af3b7fb9 (diff)
mastoapi: added bookmark list.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c18
1 files changed, 14 insertions, 4 deletions
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) { /** **/