From 353e393f4de68a209f2d454ca62516e180a3f54a Mon Sep 17 00:00:00 2001 From: default Date: Sat, 8 Apr 2023 06:09:05 +0200 Subject: New file mastoapi.c. --- mastoapi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mastoapi.c (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c new file mode 100644 index 0000000..1e4e309 --- /dev/null +++ b/mastoapi.c @@ -0,0 +1,24 @@ +/* snac - A simple, minimalistic ActivityPub instance */ +/* copyright (c) 2022 - 2023 grunfink / MIT license */ + +#include "xs.h" +#include "xs_encdec.h" +#include "xs_json.h" +#include "xs_time.h" + +#include "snac.h" + +int mastoapi_post_handler(xs_dict *req, char *q_path, char *payload, int p_size, + char **body, int *b_size, char **ctype) +{ + int status = 404; + + if (!xs_startswith(q_path, "/api/v1/")) + return 0; + + xs *j = xs_json_dumps_pp(req, 4); + printf("%s\n", j); + printf("%s\n", payload); + + return status; +} -- cgit v1.2.3