diff options
| -rw-r--r-- | RELEASE_NOTES.md | 4 | ||||
| -rw-r--r-- | activitypub.c | 2 | ||||
| -rw-r--r-- | mastoapi.c | 21 |
3 files changed, 19 insertions, 8 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7d3f683..4614da6 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | Added support for Peertube videos. | 5 | Added support for Peertube videos. |
| 6 | 6 | ||
| 7 | Mastodon API: Added support for editing posts, fixed an error related to the edit date of a post. | 7 | Mastodon API: Added support for editing posts, fixed an error related to the edit date of a post, fixed some crashes. |
| 8 | 8 | ||
| 9 | Added a handshake emoji next to a user name if it's a mutual relation (follower and followed), because friendship is bliss. | 9 | Added a handshake emoji next to a user name if it's a mutual relation (follower and followed), because friendship is bliss. |
| 10 | 10 | ||
| 11 | Tweaked some retry timeout values for better behaviour in larger instances (thanks to me@mysmallinstance.homelinux.org for their help). | ||
| 12 | |||
| 11 | ## 2.45 | 13 | ## 2.45 |
| 12 | 14 | ||
| 13 | Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade. | 15 | Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade. |
diff --git a/activitypub.c b/activitypub.c index e680e33..698758c 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2220,7 +2220,7 @@ void process_queue_item(xs_dict *q_item) | |||
| 2220 | 2220 | ||
| 2221 | /* deliver (if previous error status was a timeout, try now longer) */ | 2221 | /* deliver (if previous error status was a timeout, try now longer) */ |
| 2222 | status = send_to_inbox_raw(keyid, seckey, inbox, msg, | 2222 | status = send_to_inbox_raw(keyid, seckey, inbox, msg, |
| 2223 | &payload, &p_size, p_status == 599 ? 20 : 3); | 2223 | &payload, &p_size, p_status == 599 ? 8 : 6); |
| 2224 | 2224 | ||
| 2225 | if (payload) { | 2225 | if (payload) { |
| 2226 | if (p_size > 64) { | 2226 | if (p_size > 64) { |
| @@ -240,8 +240,10 @@ int oauth_post_handler(const xs_dict *req, const char *q_path, | |||
| 240 | char *i_ctype = xs_dict_get(req, "content-type"); | 240 | char *i_ctype = xs_dict_get(req, "content-type"); |
| 241 | xs *args = NULL; | 241 | xs *args = NULL; |
| 242 | 242 | ||
| 243 | if (i_ctype && xs_startswith(i_ctype, "application/json")) | 243 | if (i_ctype && xs_startswith(i_ctype, "application/json")) { |
| 244 | args = xs_json_loads(payload); | 244 | if (!xs_is_null(payload)) |
| 245 | args = xs_json_loads(payload); | ||
| 246 | } | ||
| 245 | else | 247 | else |
| 246 | if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded") && payload) { | 248 | if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded") && payload) { |
| 247 | xs *upl = xs_url_dec(payload); | 249 | xs *upl = xs_url_dec(payload); |
| @@ -250,6 +252,9 @@ int oauth_post_handler(const xs_dict *req, const char *q_path, | |||
| 250 | else | 252 | else |
| 251 | args = xs_dup(xs_dict_get(req, "p_vars")); | 253 | args = xs_dup(xs_dict_get(req, "p_vars")); |
| 252 | 254 | ||
| 255 | if (args == NULL) | ||
| 256 | return 400; | ||
| 257 | |||
| 253 | xs *cmd = xs_replace_n(q_path, "/oauth", "", 1); | 258 | xs *cmd = xs_replace_n(q_path, "/oauth", "", 1); |
| 254 | 259 | ||
| 255 | srv_debug(1, xs_fmt("oauth_post_handler %s", q_path)); | 260 | srv_debug(1, xs_fmt("oauth_post_handler %s", q_path)); |
| @@ -1981,8 +1986,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1981 | xs *args = NULL; | 1986 | xs *args = NULL; |
| 1982 | char *i_ctype = xs_dict_get(req, "content-type"); | 1987 | char *i_ctype = xs_dict_get(req, "content-type"); |
| 1983 | 1988 | ||
| 1984 | if (i_ctype && xs_startswith(i_ctype, "application/json")) | 1989 | if (i_ctype && xs_startswith(i_ctype, "application/json")) { |
| 1985 | args = xs_json_loads(payload); | 1990 | if (!xs_is_null(payload)) |
| 1991 | args = xs_json_loads(payload); | ||
| 1992 | } | ||
| 1986 | else | 1993 | else |
| 1987 | args = xs_dup(xs_dict_get(req, "p_vars")); | 1994 | args = xs_dup(xs_dict_get(req, "p_vars")); |
| 1988 | 1995 | ||
| @@ -2504,8 +2511,10 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path, | |||
| 2504 | xs *args = NULL; | 2511 | xs *args = NULL; |
| 2505 | char *i_ctype = xs_dict_get(req, "content-type"); | 2512 | char *i_ctype = xs_dict_get(req, "content-type"); |
| 2506 | 2513 | ||
| 2507 | if (i_ctype && xs_startswith(i_ctype, "application/json")) | 2514 | if (i_ctype && xs_startswith(i_ctype, "application/json")) { |
| 2508 | args = xs_json_loads(payload); | 2515 | if (!xs_is_null(payload)) |
| 2516 | args = xs_json_loads(payload); | ||
| 2517 | } | ||
| 2509 | else | 2518 | else |
| 2510 | args = xs_dup(xs_dict_get(req, "p_vars")); | 2519 | args = xs_dup(xs_dict_get(req, "p_vars")); |
| 2511 | 2520 | ||