diff options
| -rw-r--r-- | RELEASE_NOTES.md | 2 | ||||
| -rw-r--r-- | mastoapi.c | 82 | ||||
| -rw-r--r-- | po/de_DE.po | 8 |
3 files changed, 48 insertions, 44 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9d41588..d28b125 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | Added emoji reactions (contributed by violette). | 5 | Added emoji reactions (contributed by violette). |
| 6 | 6 | ||
| 7 | Mastodon API: Fix for some client notifications (contributed by violette). | 7 | Mastodon API: Fix for some client notifications (contributed by violette), fix for a status visibility error (contributed by fruye). |
| 8 | 8 | ||
| 9 | If the query variable `terse` of a public post page is set to anything, no header is shown. | 9 | If the query variable `terse` of a public post page is set to anything, no header is shown. |
| 10 | 10 | ||
| @@ -1985,60 +1985,64 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1985 | } | 1985 | } |
| 1986 | else | 1986 | else |
| 1987 | if (strcmp(opt, "statuses") == 0) { /** **/ | 1987 | if (strcmp(opt, "statuses") == 0) { /** **/ |
| 1988 | /* the public list of posts of a user */ | 1988 | if (logged_in || xs_type(xs_dict_get(snac2.config, "private")) == XSTYPE_FALSE) { |
| 1989 | const char *limit_s = xs_dict_get(args, "limit"); | 1989 | /* the public list of posts of a user */ |
| 1990 | const char *o_max_id = xs_dict_get(args, "max_id"); | 1990 | const char *limit_s = xs_dict_get(args, "limit"); |
| 1991 | int limit = limit_s ? atoi(limit_s) : 20; | 1991 | const char *o_max_id = xs_dict_get(args, "max_id"); |
| 1992 | xs *max_id = o_max_id ? xs_tolower_i(xs_dup(o_max_id)) : NULL; | 1992 | int limit = limit_s ? atoi(limit_s) : 20; |
| 1993 | xs *max_id = o_max_id ? xs_tolower_i(xs_dup(o_max_id)) : NULL; | ||
| 1993 | 1994 | ||
| 1994 | srv_debug(1, xs_fmt("account statuses: max_id=%s limit=%d", max_id ? max_id : "(null)", limit)); | 1995 | srv_debug(1, xs_fmt("account statuses: max_id=%s limit=%d", max_id ? max_id : "(null)", limit)); |
| 1995 | 1996 | ||
| 1996 | xs *timeline = timeline_simple_list(&snac2, "public", 0, 256, NULL); | 1997 | xs *timeline = timeline_simple_list(&snac2, "public", 0, 256, NULL); |
| 1997 | xs_list *p = timeline; | 1998 | xs_list *p = timeline; |
| 1998 | const xs_str *v; | 1999 | const xs_str *v; |
| 1999 | xs_set seen; | 2000 | xs_set seen; |
| 2000 | int cnt = 0; | 2001 | int cnt = 0; |
| 2001 | int skip_until_max = max_id != NULL; | 2002 | int skip_until_max = max_id != NULL; |
| 2002 | 2003 | ||
| 2003 | out = xs_list_new(); | 2004 | out = xs_list_new(); |
| 2004 | xs_set_init(&seen); | 2005 | xs_set_init(&seen); |
| 2005 | 2006 | ||
| 2006 | while (xs_list_iter(&p, &v) && cnt < limit) { | 2007 | while (xs_list_iter(&p, &v) && cnt < limit) { |
| 2007 | xs *msg = NULL; | 2008 | xs *msg = NULL; |
| 2008 | 2009 | ||
| 2009 | if (valid_status(timeline_get_by_md5(&snac2, v, &msg))) { | 2010 | if (valid_status(timeline_get_by_md5(&snac2, v, &msg))) { |
| 2010 | const char *msg_id = xs_dict_get(msg, "id"); | 2011 | const char *msg_id = xs_dict_get(msg, "id"); |
| 2011 | 2012 | ||
| 2012 | /* add only posts by the author */ | 2013 | /* add only posts by the author */ |
| 2013 | if (!xs_is_null(msg_id) && | 2014 | if (!xs_is_null(msg_id) && |
| 2014 | strcmp(xs_dict_get(msg, "type"), "Note") == 0 && | 2015 | strcmp(xs_dict_get(msg, "type"), "Note") == 0 && |
| 2015 | is_msg_mine(&snac2, xs_dict_get(msg, "id")) && is_msg_public(msg)) { | 2016 | is_msg_mine(&snac2, xs_dict_get(msg, "id")) && is_msg_public(msg)) { |
| 2016 | 2017 | ||
| 2017 | /* if max_id is set, skip entries until we find it */ | 2018 | /* if max_id is set, skip entries until we find it */ |
| 2018 | if (skip_until_max) { | 2019 | if (skip_until_max) { |
| 2019 | xs *mid = mastoapi_id(msg); | 2020 | xs *mid = mastoapi_id(msg); |
| 2020 | if (strcmp(mid, max_id) == 0) { | 2021 | if (strcmp(mid, max_id) == 0) { |
| 2021 | skip_until_max = 0; | 2022 | skip_until_max = 0; |
| 2022 | srv_debug(2, xs_fmt("account statuses: found max_id, starting from next post")); | 2023 | srv_debug(2, xs_fmt("account statuses: found max_id, starting from next post")); |
| 2024 | } | ||
| 2025 | continue; | ||
| 2023 | } | 2026 | } |
| 2024 | continue; | ||
| 2025 | } | ||
| 2026 | 2027 | ||
| 2027 | /* deduplicate by message id */ | 2028 | /* deduplicate by message id */ |
| 2028 | if (xs_set_add(&seen, msg_id) == 1) { | 2029 | if (xs_set_add(&seen, msg_id) == 1) { |
| 2029 | xs *st = mastoapi_status(&snac2, msg); | 2030 | xs *st = mastoapi_status(&snac2, msg); |
| 2030 | 2031 | ||
| 2031 | if (st) { | 2032 | if (st) { |
| 2032 | out = xs_list_append(out, st); | 2033 | out = xs_list_append(out, st); |
| 2033 | cnt++; | 2034 | cnt++; |
| 2035 | } | ||
| 2034 | } | 2036 | } |
| 2035 | } | 2037 | } |
| 2036 | } | 2038 | } |
| 2037 | } | 2039 | } |
| 2038 | } | ||
| 2039 | 2040 | ||
| 2040 | srv_debug(1, xs_fmt("account statuses: returning %d posts (requested %d)", cnt, limit)); | 2041 | srv_debug(1, xs_fmt("account statuses: returning %d posts (requested %d)", cnt, limit)); |
| 2041 | xs_set_free(&seen); | 2042 | xs_set_free(&seen); |
| 2043 | } | ||
| 2044 | else | ||
| 2045 | status = HTTP_STATUS_UNAUTHORIZED; | ||
| 2042 | } | 2046 | } |
| 2043 | else | 2047 | else |
| 2044 | if (strcmp(opt, "featured_tags") == 0) { | 2048 | if (strcmp(opt, "featured_tags") == 0) { |
diff --git a/po/de_DE.po b/po/de_DE.po index 6257354..2db7ca3 100644 --- a/po/de_DE.po +++ b/po/de_DE.po | |||
| @@ -798,16 +798,16 @@ msgstr "Direktnachricht" | |||
| 798 | 798 | ||
| 799 | #: html.c:488 html.c:2534 html.c:2559 html.c:5177 | 799 | #: html.c:488 html.c:2534 html.c:2559 html.c:5177 |
| 800 | msgid "EmojiUnreact" | 800 | msgid "EmojiUnreact" |
| 801 | msgstr "" | 801 | msgstr "Emoji-Reaktion löschen" |
| 802 | 802 | ||
| 803 | #: html.c:488 html.c:1440 html.c:2534 html.c:2559 html.c:5188 | 803 | #: html.c:488 html.c:1440 html.c:2534 html.c:2559 html.c:5188 |
| 804 | msgid "EmojiReact" | 804 | msgid "EmojiReact" |
| 805 | msgstr "" | 805 | msgstr "Emoji-Reaktion" |
| 806 | 806 | ||
| 807 | #: html.c:2115 | 807 | #: html.c:2115 |
| 808 | msgid "Emoji react..." | 808 | msgid "Emoji react..." |
| 809 | msgstr "" | 809 | msgstr "Emoji-Reaktion..." |
| 810 | 810 | ||
| 811 | #: html.c:2609 | 811 | #: html.c:2609 |
| 812 | msgid "Emoji reactions: " | 812 | msgid "Emoji reactions: " |
| 813 | msgstr "" | 813 | msgstr "Emoji-Reaktionen:" |