mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 22:45:05 +00:00
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.
This commit is contained in:
parent
7c5fb6f178
commit
526d4e8abb
2 changed files with 9 additions and 0 deletions
5
httpd.c
5
httpd.c
|
@ -183,17 +183,21 @@ void httpd_connection(FILE *f)
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype);
|
status = activitypub_get_handler(req, q_path, &body, &b_size, &ctype);
|
||||||
|
|
||||||
|
#ifndef NO_MASTODON_API
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = oauth_get_handler(req, q_path, &body, &b_size, &ctype);
|
status = oauth_get_handler(req, q_path, &body, &b_size, &ctype);
|
||||||
|
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = mastoapi_get_handler(req, q_path, &body, &b_size, &ctype);
|
status = mastoapi_get_handler(req, q_path, &body, &b_size, &ctype);
|
||||||
|
#endif /* NO_MASTODON_API */
|
||||||
|
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = html_get_handler(req, q_path, &body, &b_size, &ctype);
|
status = html_get_handler(req, q_path, &body, &b_size, &ctype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(method, "POST") == 0) {
|
if (strcmp(method, "POST") == 0) {
|
||||||
|
|
||||||
|
#ifndef NO_MASTODON_API
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = oauth_post_handler(req, q_path,
|
status = oauth_post_handler(req, q_path,
|
||||||
payload, p_size, &body, &b_size, &ctype);
|
payload, p_size, &body, &b_size, &ctype);
|
||||||
|
@ -201,6 +205,7 @@ void httpd_connection(FILE *f)
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = mastoapi_post_handler(req, q_path,
|
status = mastoapi_post_handler(req, q_path,
|
||||||
payload, p_size, &body, &b_size, &ctype);
|
payload, p_size, &body, &b_size, &ctype);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = activitypub_post_handler(req, q_path,
|
status = activitypub_post_handler(req, q_path,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/* snac - A simple, minimalistic ActivityPub instance */
|
/* snac - A simple, minimalistic ActivityPub instance */
|
||||||
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
/* copyright (c) 2022 - 2023 grunfink / MIT license */
|
||||||
|
|
||||||
|
#ifndef NO_MASTODON_API
|
||||||
|
|
||||||
#include "xs.h"
|
#include "xs.h"
|
||||||
#include "xs_encdec.h"
|
#include "xs_encdec.h"
|
||||||
#include "xs_openssl.h"
|
#include "xs_openssl.h"
|
||||||
|
@ -1453,3 +1455,5 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* #ifndef NO_MASTODON_API */
|
||||||
|
|
Loading…
Reference in a new issue