commit 526d4e8
default
·
2023-04-21 21:17:58 +0000 UTC
parent 7c5fb6f
Added a new compilation variable NO_MASTODON_API. The Mastodon API is a big and ugly beast; if you don't want it in your snac, you can compile it out by running make CFLAGS=-DNO_MASTODON_API And your snac binary will be as slim as always.
2 files changed,
+9,
-0
M
httpd.c
M
httpd.c
+5,
-0
1@@ -183,17 +183,21 @@ void httpd_connection(FILE *f)
2 if (status == 0)
3 status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype);
4
5+#ifndef NO_MASTODON_API
6 if (status == 0)
7 status = oauth_get_handler(req, q_path, &body, &b_size, &ctype);
8
9 if (status == 0)
10 status = mastoapi_get_handler(req, q_path, &body, &b_size, &ctype);
11+#endif /* NO_MASTODON_API */
12
13 if (status == 0)
14 status = html_get_handler(req, q_path, &body, &b_size, &ctype);
15 }
16 else
17 if (strcmp(method, "POST") == 0) {
18+
19+#ifndef NO_MASTODON_API
20 if (status == 0)
21 status = oauth_post_handler(req, q_path,
22 payload, p_size, &body, &b_size, &ctype);
23@@ -201,6 +205,7 @@ void httpd_connection(FILE *f)
24 if (status == 0)
25 status = mastoapi_post_handler(req, q_path,
26 payload, p_size, &body, &b_size, &ctype);
27+#endif
28
29 if (status == 0)
30 status = activitypub_post_handler(req, q_path,
+4,
-0
1@@ -1,6 +1,8 @@
2 /* snac - A simple, minimalistic ActivityPub instance */
3 /* copyright (c) 2022 - 2023 grunfink / MIT license */
4
5+#ifndef NO_MASTODON_API
6+
7 #include "xs.h"
8 #include "xs_encdec.h"
9 #include "xs_openssl.h"
10@@ -1453,3 +1455,5 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
11
12 return status;
13 }
14+
15+#endif /* #ifndef NO_MASTODON_API */