mastoapi.c 557 B

123456789101112131415161718192021222324
  1. /* snac - A simple, minimalistic ActivityPub instance */
  2. /* copyright (c) 2022 - 2023 grunfink / MIT license */
  3. #include "xs.h"
  4. #include "xs_encdec.h"
  5. #include "xs_json.h"
  6. #include "xs_time.h"
  7. #include "snac.h"
  8. int mastoapi_post_handler(xs_dict *req, char *q_path, char *payload, int p_size,
  9. char **body, int *b_size, char **ctype)
  10. {
  11. int status = 404;
  12. if (!xs_startswith(q_path, "/api/v1/"))
  13. return 0;
  14. xs *j = xs_json_dumps_pp(req, 4);
  15. printf("%s\n", j);
  16. printf("%s\n", payload);
  17. return status;
  18. }