diff options
| author | 2023-04-08 06:09:05 +0200 | |
|---|---|---|
| committer | 2023-04-08 06:09:05 +0200 | |
| commit | 353e393f4de68a209f2d454ca62516e180a3f54a (patch) | |
| tree | 39c03f8abc377244aa06dc11d18d80b374f224a6 /mastoapi.c | |
| parent | Updated RELEASE_NOTES. (diff) | |
| download | snac2-353e393f4de68a209f2d454ca62516e180a3f54a.tar.gz snac2-353e393f4de68a209f2d454ca62516e180a3f54a.tar.xz snac2-353e393f4de68a209f2d454ca62516e180a3f54a.zip | |
New file mastoapi.c.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c new file mode 100644 index 0000000..1e4e309 --- /dev/null +++ b/mastoapi.c | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | ||
| 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ | ||
| 3 | |||
| 4 | #include "xs.h" | ||
| 5 | #include "xs_encdec.h" | ||
| 6 | #include "xs_json.h" | ||
| 7 | #include "xs_time.h" | ||
| 8 | |||
| 9 | #include "snac.h" | ||
| 10 | |||
| 11 | int mastoapi_post_handler(xs_dict *req, char *q_path, char *payload, int p_size, | ||
| 12 | char **body, int *b_size, char **ctype) | ||
| 13 | { | ||
| 14 | int status = 404; | ||
| 15 | |||
| 16 | if (!xs_startswith(q_path, "/api/v1/")) | ||
| 17 | return 0; | ||
| 18 | |||
| 19 | xs *j = xs_json_dumps_pp(req, 4); | ||
| 20 | printf("%s\n", j); | ||
| 21 | printf("%s\n", payload); | ||
| 22 | |||
| 23 | return status; | ||
| 24 | } | ||