diff options
| -rw-r--r-- | activitypub.c | 11 | ||||
| -rw-r--r-- | snac.h | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index b21120f..0caf970 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -299,8 +299,17 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg) | |||
| 299 | { | 299 | { |
| 300 | const char *type = xs_dict_get(c_msg, "type"); | 300 | const char *type = xs_dict_get(c_msg, "type"); |
| 301 | 301 | ||
| 302 | /* if it's an Announce by someone we don't follow, reject */ | ||
| 303 | if (strcmp(type, "Announce") == 0) { | 302 | if (strcmp(type, "Announce") == 0) { |
| 303 | const char *object = xs_dict_get(c_msg, "object"); | ||
| 304 | |||
| 305 | if (xs_type(object) == XSTYPE_DICT) | ||
| 306 | object = xs_dict_get(object, "id"); | ||
| 307 | |||
| 308 | /* if it's about one of our posts, accept it */ | ||
| 309 | if (xs_startswith(object, snac->actor)) | ||
| 310 | return 2; | ||
| 311 | |||
| 312 | /* if it's by someone we don't follow, reject */ | ||
| 304 | if (!following_check(snac, xs_dict_get(c_msg, "actor"))) | 313 | if (!following_check(snac, xs_dict_get(c_msg, "actor"))) |
| 305 | return 0; | 314 | return 0; |
| 306 | } | 315 | } |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | 1 | /* snac - A simple, minimalistic ActivityPub instance */ |
| 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ | 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ |
| 3 | 3 | ||
| 4 | #define VERSION "2.26" | 4 | #define VERSION "2.27-dev" |
| 5 | 5 | ||
| 6 | #define USER_AGENT "snac/" VERSION | 6 | #define USER_AGENT "snac/" VERSION |
| 7 | 7 | ||