summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/mastoapi.c b/mastoapi.c
index d8ec3b3..efcdae8 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -359,6 +359,12 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
359 } 359 }
360 } 360 }
361 361
362 /* no code?
363 I'm not sure of the impacts of this right now, but Subway Tooter does not
364 provide a code so one must be generated */
365 if (xs_is_null(code)){
366 code = random_str();
367 }
362 if (gtype && code && cid && csec && ruri) { 368 if (gtype && code && cid && csec && ruri) {
363 xs *app = app_get(cid); 369 xs *app = app_get(cid);
364 370
@@ -1622,6 +1628,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1622 status = 200; 1628 status = 200;
1623 } 1629 }
1624 else 1630 else
1631 if (strcmp(cmd, "/v2/filters") == 0) { /** **/
1632 /* snac will never have filters
1633 * but still, without a v2 endpoint a short delay is introduced
1634 * in some apps */
1635 *body = xs_dup("[]");
1636 *ctype = "application/json";
1637 status = 200;
1638 }
1639 else
1625 if (strcmp(cmd, "/v1/favourites") == 0) { /** **/ 1640 if (strcmp(cmd, "/v1/favourites") == 0) { /** **/
1626 /* snac will never support a list of favourites */ 1641 /* snac will never support a list of favourites */
1627 *body = xs_dup("[]"); 1642 *body = xs_dup("[]");
@@ -1990,6 +2005,14 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1990 if (!xs_is_null(payload)) 2005 if (!xs_is_null(payload))
1991 args = xs_json_loads(payload); 2006 args = xs_json_loads(payload);
1992 } 2007 }
2008 else if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded"))
2009 {
2010 // Some apps send form data instead of json so we should cater for those
2011 if (!xs_is_null(payload)) {
2012 xs *upl = xs_url_dec(payload);
2013 args = xs_url_vars(upl);
2014 }
2015 }
1993 else 2016 else
1994 args = xs_dup(xs_dict_get(req, "p_vars")); 2017 args = xs_dup(xs_dict_get(req, "p_vars"));
1995 2018