summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-12 21:46:54 +0200
committerdefault <nobody@localhost>2023-08-12 21:46:54 +0200
commit07be3721c10e96f05c1b18ca3b5c5a151e331e21 (patch)
tree86f63f614ed8c44ce4453dfd3093f2e20b3b7bc8 /mastoapi.c
parent94149d262d0ec40fb72b68965e5b396a6756bb1a (diff)
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 @@
#include "xs_glob.h"
#include "xs_set.h"
#include "xs_random.h"
+#include "xs_httpd.h"
#include "snac.h"
@@ -234,6 +235,11 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
if (i_ctype && xs_startswith(i_ctype, "application/json"))
args = xs_json_loads(payload);
else
+ if (i_ctype && xs_startswith(i_ctype, "application/x-www-form-urlencoded") && payload) {
+ xs *upl = xs_url_dec(payload);
+ args = xs_url_vars(upl);
+ }
+ else
args = xs_dup(xs_dict_get(req, "p_vars"));
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,
acct = xs_dict_append(acct, "url", snac1.actor);
acct = xs_dict_append(acct, "header", "");
+ xs *src = xs_json_loads("{\"privacy\":\"public\","
+ "\"sensitive\":false,\"fields\":[],\"note\":\"\"}");
+ acct = xs_dict_append(acct, "source", src);
+
xs *avatar = NULL;
char *av = xs_dict_get(snac1.config, "avatar");
@@ -1458,8 +1468,6 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
ins = xs_dict_append(ins, "languages", l1);
xs *d1 = xs_dict_new();
- xs *wss = xs_replace(srv_baseurl, "https:", "wss:");
- d1 = xs_dict_append(d1, "streaming_api", wss);
ins = xs_dict_append(ins, "urls", d1);
xs *z = xs_number_new(0);