commit 2410c73

Paul Wilde  ·  2024-01-26 23:14:27 +0000 UTC
parents 1060baa, d5c2c44
Merge remote-tracking branch 'upstream/master'
3 files changed,  +19, -8
+3, -1
 1@@ -4,10 +4,12 @@
 2 
 3 Added support for Peertube videos.
 4 
 5-Mastodon API: Added support for editing posts, fixed an error related to the edit date of a post.
 6+Mastodon API: Added support for editing posts, fixed an error related to the edit date of a post, fixed some crashes.
 7 
 8 Added a handshake emoji next to a user name if it's a mutual relation (follower and followed), because friendship is bliss.
 9 
10+Tweaked some retry timeout values for better behaviour in larger instances (thanks to me@mysmallinstance.homelinux.org for their help).
11+
12 ## 2.45
13 
14 Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade.
+1, -1
1@@ -2220,7 +2220,7 @@ void process_queue_item(xs_dict *q_item)
2 
3         /* deliver (if previous error status was a timeout, try now longer) */
4         status = send_to_inbox_raw(keyid, seckey, inbox, msg,
5-                    &payload, &p_size, p_status == 599 ? 20 : 3);
6+                    &payload, &p_size, p_status == 599 ? 8 : 6);
7 
8         if (payload) {
9             if (p_size > 64) {
+15, -6
 1@@ -240,8 +240,10 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
 2     char *i_ctype = xs_dict_get(req, "content-type");
 3     xs *args      = NULL;
 4 
 5-    if (i_ctype && xs_startswith(i_ctype, "application/json"))
 6-        args = xs_json_loads(payload);
 7+    if (i_ctype && xs_startswith(i_ctype, "application/json")) {
 8+        if (!xs_is_null(payload))
 9+            args = xs_json_loads(payload);
10+    }
11     else
12     if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded") && payload) {
13         xs *upl = xs_url_dec(payload);
14@@ -250,6 +252,9 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
15     else
16         args = xs_dup(xs_dict_get(req, "p_vars"));
17 
18+    if (args == NULL)
19+        return 400;
20+
21     xs *cmd = xs_replace_n(q_path, "/oauth", "", 1);
22 
23     srv_debug(1, xs_fmt("oauth_post_handler %s", q_path));
24@@ -1981,8 +1986,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
25     xs *args      = NULL;
26     char *i_ctype = xs_dict_get(req, "content-type");
27 
28-    if (i_ctype && xs_startswith(i_ctype, "application/json"))
29-        args = xs_json_loads(payload);
30+    if (i_ctype && xs_startswith(i_ctype, "application/json")) {
31+        if (!xs_is_null(payload))
32+            args = xs_json_loads(payload);
33+    }
34     else
35         args = xs_dup(xs_dict_get(req, "p_vars"));
36 
37@@ -2504,8 +2511,10 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path,
38     xs *args      = NULL;
39     char *i_ctype = xs_dict_get(req, "content-type");
40 
41-    if (i_ctype && xs_startswith(i_ctype, "application/json"))
42-        args = xs_json_loads(payload);
43+    if (i_ctype && xs_startswith(i_ctype, "application/json")) {
44+        if (!xs_is_null(payload))
45+            args = xs_json_loads(payload);
46+    }
47     else
48         args = xs_dup(xs_dict_get(req, "p_vars"));
49