snac2

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

commit 67f0efa689b47870554cb5aeb401fa406b958114
parent 72c31c28efeaa12eb886d49df177e45726e76eff
Author: default <nobody@localhost>
Date:   Thu, 29 Aug 2024 07:57:29 +0200

Added web UI for [un]bookmarking.

Diffstat:
Mhtml.c | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/html.c b/html.c @@ -1331,6 +1331,13 @@ xs_html *html_entry_controls(snac *snac, const char *actor, } } + if (is_bookmarked(snac, id)) + xs_html_add(form, + html_button("unbookmark", L("Unbookmark"), L("Delete this post from your bookmarks"))); + else + xs_html_add(form, + html_button("bookmark", L("Bookmark"), L("Add this post to your bookmarks"))); + if (strcmp(actor, snac->actor) != 0) { /* controls for other actors than this one */ if (following_check(snac, actor)) { @@ -3388,6 +3395,16 @@ int html_post_handler(const xs_dict *req, const char *q_path, timeline_touch(&snac); } else + if (strcmp(action, L("Bookmark")) == 0) { /** **/ + bookmark(&snac, id); + timeline_touch(&snac); + } + else + if (strcmp(action, L("Unbookmark")) == 0) { /** **/ + unbookmark(&snac, id); + timeline_touch(&snac); + } + else status = HTTP_STATUS_NOT_FOUND; /* delete the cached timeline */