diff options
author | default <nobody@localhost> | 2023-06-29 08:26:44 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-06-29 08:26:44 +0200 |
commit | a114d5094d253ed08ac59701396983c45b01a5d5 (patch) | |
tree | 611e73e0b8c95cd71fb7060631de391c4c87ff30 /activitypub.c | |
parent | 057827eaa34d390cc59f3b2821786c10156a1dc5 (diff) |
Call is_instance_blocked() from activitypub_post_handler().
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index 028e04e..ce72f3f 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1994,13 +1994,22 @@ int activitypub_post_handler(const xs_dict *req, const char *q_path, /* decode the message */ xs *msg = xs_json_loads(payload); + const char *id; - if (msg == NULL) { + if (msg == NULL || xs_is_null(id = xs_dict_get(msg, "id"))) { srv_log(xs_fmt("activitypub_post_handler JSON error %s", q_path)); *body = xs_str_new("JSON error"); *ctype = "text/plain"; - status = 400; + return 400; + } + + if (is_instance_blocked(id)) { + srv_debug(1, xs_fmt("full instance block for %s", id)); + + *body = xs_str_new("blocked"); + *ctype = "text/plain"; + return 403; } /* get the user and path */ |