diff options
| author | 2022-09-24 10:03:27 +0200 | |
|---|---|---|
| committer | 2022-09-24 10:03:27 +0200 | |
| commit | a6712ba79a617e4481117fe486858d62977f0260 (patch) | |
| tree | d975efbf9ddacd7a7aa6cf77514b0048a74ab764 /activitypub.c | |
| parent | More ActivityPub work. (diff) | |
| download | snac2-a6712ba79a617e4481117fe486858d62977f0260.tar.gz snac2-a6712ba79a617e4481117fe486858d62977f0260.tar.xz snac2-a6712ba79a617e4481117fe486858d62977f0260.zip | |
Also store the req object in enqueue_input().
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index 8ee7b3d..7701ecf 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -122,6 +122,9 @@ void process_message(snac *snac, char *msg) | |||
| 122 | char *actor = xs_dict_get(msg, "actor"); | 122 | char *actor = xs_dict_get(msg, "actor"); |
| 123 | char *type = xs_dict_get(msg, "type"); | 123 | char *type = xs_dict_get(msg, "type"); |
| 124 | 124 | ||
| 125 | /* check the signature */ | ||
| 126 | /* ... */ | ||
| 127 | |||
| 125 | if (strcmp(type, "Follow") == 0) { | 128 | if (strcmp(type, "Follow") == 0) { |
| 126 | } | 129 | } |
| 127 | else | 130 | else |
| @@ -179,7 +182,7 @@ void process_queue(snac *snac) | |||
| 179 | snac_log(snac, xs_fmt("process_queue giving up %s %d", actor, status)); | 182 | snac_log(snac, xs_fmt("process_queue giving up %s %d", actor, status)); |
| 180 | else { | 183 | else { |
| 181 | /* reenqueue */ | 184 | /* reenqueue */ |
| 182 | enqueue_output(snac, actor, msg, retries + 1); | 185 | enqueue_output(snac, msg, actor, retries + 1); |
| 183 | snac_log(snac, xs_fmt("process_queue requeue %s %d", actor, retries + 1)); | 186 | snac_log(snac, xs_fmt("process_queue requeue %s %d", actor, retries + 1)); |
| 184 | } | 187 | } |
| 185 | } | 188 | } |
| @@ -292,14 +295,11 @@ int activitypub_post_handler(d_char *req, char *q_path, | |||
| 292 | return 404; | 295 | return 404; |
| 293 | } | 296 | } |
| 294 | 297 | ||
| 295 | /* signature checking should happen here */ | ||
| 296 | /* ... */ | ||
| 297 | |||
| 298 | /* decode */ | 298 | /* decode */ |
| 299 | xs *msg = xs_json_loads(payload); | 299 | xs *msg = xs_json_loads(payload); |
| 300 | 300 | ||
| 301 | if (msg && xs_dict_get(msg, "actor") && xs_dict_get(msg, "type")) | 301 | if (msg && xs_dict_get(msg, "actor") && xs_dict_get(msg, "type")) |
| 302 | enqueue_input(&snac, msg); | 302 | enqueue_input(&snac, msg, req); |
| 303 | else { | 303 | else { |
| 304 | srv_log(xs_fmt("activitypub_post_handler JSON error %s", q_path)); | 304 | srv_log(xs_fmt("activitypub_post_handler JSON error %s", q_path)); |
| 305 | status = 400; | 305 | status = 400; |