From 8524ace23f1ebec07fd4d51171e121b1f1e75007 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 8 Oct 2023 00:06:37 +0200 Subject: Hide posts from the public web for accounts with 'private' == true. --- mastoapi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 40ad12b..273807b 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1377,6 +1377,25 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) continue; + /* discard private users */ + { + const char *atto = xs_dict_get(msg, "attributedTo"); + xs *l = xs_split(atto, "/"); + const char *uid = xs_list_get(l, -1); + snac p_user; + int skip = 1; + + if (uid && user_open(&p_user, uid)) { + if (xs_type(xs_dict_get(p_user.config, "private")) != XSTYPE_TRUE) + skip = 0; + + user_free(&p_user); + } + + if (skip) + continue; + } + /* convert the Note into a Mastodon status */ xs *st = mastoapi_status(user, msg); -- cgit v1.2.3