snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 8ea199a9966fd661762de89fbbe7313de318872f
parent 0c3c79f0b9df136c8e676abb8e0a70a829e3b4b5
Author: default <nobody@localhost>
Date:   Thu, 29 Aug 2024 07:45:22 +0200

The list of bookmarked posts also work.

Diffstat:
Mdata.c | 7+++++++
Mhtml.c | 15+++++++++++++++
Msnac.h | 1+
3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/data.c b/data.c @@ -1583,6 +1583,13 @@ int unbookmark(snac *user, const char *id) } +xs_list *bookmark_list(snac *user) +/* return the lists of bookmarked posts */ +{ + return object_user_cache_list(user, "bookmark", XS_ALL, 1); +} + + /** pinning **/ int is_pinned(snac *user, const char *id) diff --git a/html.c b/html.c @@ -2925,6 +2925,21 @@ int html_get_handler(const xs_dict *req, const char *q_path, } } else + if (strcmp(p_path, "list/bookmarks") == 0) { /** list of bookmarked posts **/ + if (!login(&snac, req)) { + *body = xs_dup(uid); + status = HTTP_STATUS_UNAUTHORIZED; + } + else { + xs *list = bookmark_list(&snac); + + *body = html_timeline(&snac, list, 0, skip, show, + 0, L("Bookmarked posts"), "", 0); + *b_size = strlen(*body); + status = HTTP_STATUS_OK; + } + } + else if (xs_startswith(p_path, "list/")) { /** list timelines **/ if (!login(&snac, req)) { *body = xs_dup(uid); diff --git a/snac.h b/snac.h @@ -169,6 +169,7 @@ int is_muted(snac *snac, const char *actor); int is_bookmarked(snac *user, const char *id); int bookmark(snac *user, const char *id); int unbookmark(snac *user, const char *id); +xs_list *bookmark_list(snac *user); int pin(snac *user, const char *id); int unpin(snac *user, const char *id);