From a45c1ce152011e8fe25eb1d25594ac5705f65404 Mon Sep 17 00:00:00 2001 From: rako Date: Fri, 28 Nov 2025 10:37:49 +0100 Subject: Fix user matching In order to be a proper prefix, the actor url must end with a '/' otherwise it can match another user that starts with the same prefix: for example 'testuser' will match anything made by 'testuser2' --- rss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rss.c') diff --git a/rss.c b/rss.c index 6e77205..6124e7a 100644 --- a/rss.c +++ b/rss.c @@ -59,7 +59,7 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, const char *content = xs_dict_get(msg, "content"); const char *published = xs_dict_get(msg, "published"); - if (user && !xs_startswith(id, user->actor)) + if (user && !is_msg_mine(user, id)) continue; if (!id || !content || !published) -- cgit v1.2.3 From 89053095eb70eff4527dfc3052d517eeb07fc816 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 1 Jan 2026 16:27:21 +0100 Subject: truncate rss title at utf8 char boundary Advance a whole utf8 char at a time while looking for where to truncate the title. --- rss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'rss.c') diff --git a/rss.c b/rss.c index 6124e7a..09446dc 100644 --- a/rss.c +++ b/rss.c @@ -10,6 +10,7 @@ #include "xs_openssl.h" #include "xs_json.h" #include "xs_http.h" +#include "xs_unicode.h" #include "snac.h" @@ -74,7 +75,14 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, title = xs_regex_replace_i(title, "&[^;]+;", " "); int i; - for (i = 0; title[i] && title[i] != '\n' && i < 50; i++); + for (i = 0; title[i] && title[i] != '\n' && i < 50; ) { + const char *p = &title[i]; + unsigned int cp = xs_utf8_dec(&p); + int n = p - title; + if (cp == 0xfffd || n > 50) + break; + i = n; + } if (title[i] != '\0') { title[i] = '\0'; -- cgit v1.2.3 From 11af00194e3e0ec15e17a23556dc2929f92e0210 Mon Sep 17 00:00:00 2001 From: grunfink Date: Thu, 1 Jan 2026 17:01:03 +0100 Subject: Bumped copyright year. --- rss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rss.c') diff --git a/rss.c b/rss.c index 09446dc..dc26071 100644 --- a/rss.c +++ b/rss.c @@ -1,5 +1,5 @@ /* snac - A simple, minimalistic ActivityPub instance */ -/* copyright (c) 2025 grunfink et al. / MIT license */ +/* copyright (c) 2025 - 2026 grunfink et al. / MIT license */ #include "xs.h" #include "xs_html.h" -- cgit v1.2.3