From d3309f8b5e43c8116f99e548bb9f874b5cdaf70e Mon Sep 17 00:00:00 2001 From: violette Date: Thu, 21 May 2026 19:40:58 +0200 Subject: Added a new 'admiration' timeline. --- data.c | 5 ++++- html.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/data.c b/data.c index 7fb261c..ad71b85 100644 --- a/data.c +++ b/data.c @@ -1606,12 +1606,15 @@ int timeline_admire(snac *snac, const char *id, const char *content = xs_dict_get_path(msg, "content"); const char *type = xs_dict_get_path(msg, "type"); - /* if we are admiring this, add to both timelines */ + /* if we are admiring this, add to both timelines, and store for later */ if (!like && strcmp(admirer, snac->actor) == 0) { object_user_cache_add(snac, id, "public"); object_user_cache_add(snac, id, "private"); } + if (strcmp(admirer, snac->actor) == 0) + object_user_cache_add(snac, id, "admire"); + /* use utf <3 as a like, as it is ugly */ if (type && xs_match(type, "Like|EmojiReact|Emoji") && content && strcmp(content, "❤") != 0) { diff --git a/html.c b/html.c index cd1746a..29dd8e8 100644 --- a/html.c +++ b/html.c @@ -3520,6 +3520,18 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only, xs_html_text(L("pinned"))))); } + { + /* show the list of bookmarked posts */ + xs *url = xs_fmt("%s/admirations", user->actor); + xs_html_add(lol, + xs_html_tag("li", + xs_html_tag("a", + xs_html_attr("href", url), + xs_html_attr("class", "snac-list-link"), + xs_html_attr("title", L("Liked, boosted or reacted posts")), + xs_html_text(L("admirations"))))); + } + { /* show the list of bookmarked posts */ xs *url = xs_fmt("%s/bookmarks", user->actor); @@ -5042,6 +5054,22 @@ int html_get_handler(const xs_dict *req, const char *q_path, } } else + if (strcmp(p_path, "admirations") == 0) { /** list of admired posts **/ + if (!login(&snac, req)) { + *body = xs_dup(uid); + status = HTTP_STATUS_UNAUTHORIZED; + } + else { + int more = 0; + xs *list = timeline_list(&snac, "admire", skip, show, &more); + + *body = html_timeline(&snac, list, 0, skip, show, + more, L("Liked, boosted or reacted posts"), "/admirations", 0, error, terse); + *b_size = strlen(*body); + status = HTTP_STATUS_OK; + } + } + else if (strcmp(p_path, "bookmarks") == 0) { /** list of bookmarked posts **/ if (!login(&snac, req)) { *body = xs_dup(uid); -- cgit