diff options
| -rw-r--r-- | httpd.c | 5 | ||||
| -rw-r--r-- | mastoapi.c | 4 |
2 files changed, 9 insertions, 0 deletions
| @@ -183,17 +183,21 @@ void httpd_connection(FILE *f) | |||
| 183 | if (status == 0) | 183 | if (status == 0) |
| 184 | status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype); | 184 | status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype); |
| 185 | 185 | ||
| 186 | #ifndef NO_MASTODON_API | ||
| 186 | if (status == 0) | 187 | if (status == 0) |
| 187 | status = oauth_get_handler(req, q_path, &body, &b_size, &ctype); | 188 | status = oauth_get_handler(req, q_path, &body, &b_size, &ctype); |
| 188 | 189 | ||
| 189 | if (status == 0) | 190 | if (status == 0) |
| 190 | status = mastoapi_get_handler(req, q_path, &body, &b_size, &ctype); | 191 | status = mastoapi_get_handler(req, q_path, &body, &b_size, &ctype); |
| 192 | #endif /* NO_MASTODON_API */ | ||
| 191 | 193 | ||
| 192 | if (status == 0) | 194 | if (status == 0) |
| 193 | status = html_get_handler(req, q_path, &body, &b_size, &ctype); | 195 | status = html_get_handler(req, q_path, &body, &b_size, &ctype); |
| 194 | } | 196 | } |
| 195 | else | 197 | else |
| 196 | if (strcmp(method, "POST") == 0) { | 198 | if (strcmp(method, "POST") == 0) { |
| 199 | |||
| 200 | #ifndef NO_MASTODON_API | ||
| 197 | if (status == 0) | 201 | if (status == 0) |
| 198 | status = oauth_post_handler(req, q_path, | 202 | status = oauth_post_handler(req, q_path, |
| 199 | payload, p_size, &body, &b_size, &ctype); | 203 | payload, p_size, &body, &b_size, &ctype); |
| @@ -201,6 +205,7 @@ void httpd_connection(FILE *f) | |||
| 201 | if (status == 0) | 205 | if (status == 0) |
| 202 | status = mastoapi_post_handler(req, q_path, | 206 | status = mastoapi_post_handler(req, q_path, |
| 203 | payload, p_size, &body, &b_size, &ctype); | 207 | payload, p_size, &body, &b_size, &ctype); |
| 208 | #endif | ||
| 204 | 209 | ||
| 205 | if (status == 0) | 210 | if (status == 0) |
| 206 | status = activitypub_post_handler(req, q_path, | 211 | status = activitypub_post_handler(req, q_path, |
| @@ -1,6 +1,8 @@ | |||
| 1 | /* snac - A simple, minimalistic ActivityPub instance */ | 1 | /* snac - A simple, minimalistic ActivityPub instance */ |
| 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ | 2 | /* copyright (c) 2022 - 2023 grunfink / MIT license */ |
| 3 | 3 | ||
| 4 | #ifndef NO_MASTODON_API | ||
| 5 | |||
| 4 | #include "xs.h" | 6 | #include "xs.h" |
| 5 | #include "xs_encdec.h" | 7 | #include "xs_encdec.h" |
| 6 | #include "xs_openssl.h" | 8 | #include "xs_openssl.h" |
| @@ -1453,3 +1455,5 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1453 | 1455 | ||
| 1454 | return status; | 1456 | return status; |
| 1455 | } | 1457 | } |
| 1458 | |||
| 1459 | #endif /* #ifndef NO_MASTODON_API */ | ||