diff options
| author | 2023-10-08 00:06:37 +0200 | |
|---|---|---|
| committer | 2023-10-08 00:06:37 +0200 | |
| commit | 8524ace23f1ebec07fd4d51171e121b1f1e75007 (patch) | |
| tree | 03f98d1ce6d29b85c31dc85e104dbfda2ff9aab8 /mastoapi.c | |
| parent | Merge branch 'master' of /home/angel/git/snac2 (diff) | |
| download | snac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.tar.gz snac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.tar.xz snac2-8524ace23f1ebec07fd4d51171e121b1f1e75007.zip | |
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, | |||
| 1377 | if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) | 1377 | if (strcmp(type, "Note") != 0 && strcmp(type, "Question") != 0) |
| 1378 | continue; | 1378 | continue; |
| 1379 | 1379 | ||
| 1380 | /* discard private users */ | ||
| 1381 | { | ||
| 1382 | const char *atto = xs_dict_get(msg, "attributedTo"); | ||
| 1383 | xs *l = xs_split(atto, "/"); | ||
| 1384 | const char *uid = xs_list_get(l, -1); | ||
| 1385 | snac p_user; | ||
| 1386 | int skip = 1; | ||
| 1387 | |||
| 1388 | if (uid && user_open(&p_user, uid)) { | ||
| 1389 | if (xs_type(xs_dict_get(p_user.config, "private")) != XSTYPE_TRUE) | ||
| 1390 | skip = 0; | ||
| 1391 | |||
| 1392 | user_free(&p_user); | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | if (skip) | ||
| 1396 | continue; | ||
| 1397 | } | ||
| 1398 | |||
| 1380 | /* convert the Note into a Mastodon status */ | 1399 | /* convert the Note into a Mastodon status */ |
| 1381 | xs *st = mastoapi_status(user, msg); | 1400 | xs *st = mastoapi_status(user, msg); |
| 1382 | 1401 | ||