mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Fixed overzealous rejection of Announces.
This commit is contained in:
parent
1cdd6d1996
commit
5d26f31a8a
2 changed files with 11 additions and 2 deletions
|
@ -299,8 +299,17 @@ int is_msg_for_me(snac *snac, xs_dict *c_msg)
|
||||||
{
|
{
|
||||||
const char *type = xs_dict_get(c_msg, "type");
|
const char *type = xs_dict_get(c_msg, "type");
|
||||||
|
|
||||||
/* if it's an Announce by someone we don't follow, reject */
|
|
||||||
if (strcmp(type, "Announce") == 0) {
|
if (strcmp(type, "Announce") == 0) {
|
||||||
|
const char *object = xs_dict_get(c_msg, "object");
|
||||||
|
|
||||||
|
if (xs_type(object) == XSTYPE_DICT)
|
||||||
|
object = xs_dict_get(object, "id");
|
||||||
|
|
||||||
|
/* if it's about one of our posts, accept it */
|
||||||
|
if (xs_startswith(object, snac->actor))
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
/* if it's by someone we don't follow, reject */
|
||||||
if (!following_check(snac, xs_dict_get(c_msg, "actor")))
|
if (!following_check(snac, xs_dict_get(c_msg, "actor")))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -1,7 +1,7 @@
|
||||||
/* snac - A simple, minimalistic ActivityPub instance */
|
/* snac - A simple, minimalistic ActivityPub instance */
|
||||||
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
||||||
|
|
||||||
#define VERSION "2.26"
|
#define VERSION "2.27-dev"
|
||||||
|
|
||||||
#define USER_AGENT "snac/" VERSION
|
#define USER_AGENT "snac/" VERSION
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue