diff options
author | default <nobody@localhost> | 2023-10-08 00:06:37 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-10-08 00:06:37 +0200 |
commit | 8524ace23f1ebec07fd4d51171e121b1f1e75007 (patch) | |
tree | 03f98d1ce6d29b85c31dc85e104dbfda2ff9aab8 /mastoapi.c | |
parent | 8676d872996c7486ada76c344deee0d3fdc3f188 (diff) |
Hide posts from the public web for accounts with 'private' == true.
Diffstat (limited to 'mastoapi.c')
-rw-r--r-- | mastoapi.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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); |