summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2023-08-12 21:46:54 +0200
committerGravatar default2023-08-12 21:46:54 +0200
commit07be3721c10e96f05c1b18ca3b5c5a151e331e21 (patch)
tree86f63f614ed8c44ce4453dfd3093f2e20b3b7bc8 /mastoapi.c
parentArchive unattended method errors. (diff)
downloadsnac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.tar.gz
snac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.tar.xz
snac2-07be3721c10e96f05c1b18ca3b5c5a151e331e21.zip
Some mastoapi tweaks to support the semaphore.social web client.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 2acef04..172d03a 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -11,6 +11,7 @@
11#include "xs_glob.h" 11#include "xs_glob.h"
12#include "xs_set.h" 12#include "xs_set.h"
13#include "xs_random.h" 13#include "xs_random.h"
14#include "xs_httpd.h"
14 15
15#include "snac.h" 16#include "snac.h"
16 17
@@ -234,6 +235,11 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
234 if (i_ctype && xs_startswith(i_ctype, "application/json")) 235 if (i_ctype && xs_startswith(i_ctype, "application/json"))
235 args = xs_json_loads(payload); 236 args = xs_json_loads(payload);
236 else 237 else
238 if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded") && payload) {
239 xs *upl = xs_url_dec(payload);
240 args = xs_url_vars(upl);
241 }
242 else
237 args = xs_dup(xs_dict_get(req, "p_vars")); 243 args = xs_dup(xs_dict_get(req, "p_vars"));
238 244
239 xs *cmd = xs_replace_n(q_path, "/oauth", "", 1); 245 xs *cmd = xs_replace_n(q_path, "/oauth", "", 1);
@@ -954,6 +960,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
954 acct = xs_dict_append(acct, "url", snac1.actor); 960 acct = xs_dict_append(acct, "url", snac1.actor);
955 acct = xs_dict_append(acct, "header", ""); 961 acct = xs_dict_append(acct, "header", "");
956 962
963 xs *src = xs_json_loads("{\"privacy\":\"public\","
964 "\"sensitive\":false,\"fields\":[],\"note\":\"\"}");
965 acct = xs_dict_append(acct, "source", src);
966
957 xs *avatar = NULL; 967 xs *avatar = NULL;
958 char *av = xs_dict_get(snac1.config, "avatar"); 968 char *av = xs_dict_get(snac1.config, "avatar");
959 969
@@ -1458,8 +1468,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1458 ins = xs_dict_append(ins, "languages", l1); 1468 ins = xs_dict_append(ins, "languages", l1);
1459 1469
1460 xs *d1 = xs_dict_new(); 1470 xs *d1 = xs_dict_new();
1461 xs *wss = xs_replace(srv_baseurl, "https:", "wss:");
1462 d1 = xs_dict_append(d1, "streaming_api", wss);
1463 ins = xs_dict_append(ins, "urls", d1); 1471 ins = xs_dict_append(ins, "urls", d1);
1464 1472
1465 xs *z = xs_number_new(0); 1473 xs *z = xs_number_new(0);