snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 2f0d604f0c58ed89b4f93a483024f1122927c385
parent a0906208ea3906b3820307aa4bfe811b8d2eadb6
Author: default <nobody@localhost>
Date:   Sun, 13 Aug 2023 13:00:36 +0200

More mastoapi tweaks.

Diffstat:
Mmastoapi.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/mastoapi.c b/mastoapi.c @@ -992,6 +992,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, xs *res = xs_list_new(); const char *md5 = xs_dict_get(args, "id[]"); + if (xs_is_null(md5)) + md5 = xs_dict_get(args, "id"); + if (!xs_is_null(md5)) { if (xs_type(md5) == XSTYPE_LIST) md5 = xs_list_get(md5, 0); @@ -1792,6 +1795,9 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, if (xs_is_null(media_ids)) media_ids = xs_dict_get(args, "media_ids[]"); + if (xs_is_null(media_ids)) + media_ids = xs_dict_get(args, "media_ids"); + if (xs_is_null(visibility)) visibility = "public"; @@ -2158,6 +2164,9 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, if (strcmp(op, "votes") == 0) { xs_list *choices = xs_dict_get(args, "choices[]"); + if (xs_is_null(choices)) + choices = xs_dict_get(args, "choices"); + if (xs_type(choices) == XSTYPE_LIST) { xs_str *v;