commit ee60773

default  ·  2024-12-15 14:17:38 +0000 UTC
parent e94db27
mastoapi: fixed incorrect field 'bot' for newly created accounts.
1 files changed,  +5, -2
+5, -2
 1@@ -1193,10 +1193,13 @@ int process_auth_token(snac *snac, const xs_dict *req)
 2     return logged_in;
 3 }
 4 
 5+
 6 void credentials_get(char **body, char **ctype, int *status, snac snac)
 7 {
 8     xs *acct = xs_dict_new();
 9 
10+    const xs_val *bot = xs_dict_get(snac.config, "bot");
11+
12     acct = xs_dict_append(acct, "id", snac.md5);
13     acct = xs_dict_append(acct, "username", xs_dict_get(snac.config, "uid"));
14     acct = xs_dict_append(acct, "acct", xs_dict_get(snac.config, "uid"));
15@@ -1206,7 +1209,7 @@ void credentials_get(char **body, char **ctype, int *status, snac snac)
16     acct = xs_dict_append(acct, "note", xs_dict_get(snac.config, "bio"));
17     acct = xs_dict_append(acct, "url", snac.actor);
18     acct = xs_dict_append(acct, "locked", xs_stock(XSTYPE_FALSE));
19-    acct = xs_dict_append(acct, "bot", xs_dict_get(snac.config, "bot"));
20+    acct = xs_dict_append(acct, "bot", xs_stock(xs_is_true(bot) ? XSTYPE_TRUE : XSTYPE_FALSE));
21     acct = xs_dict_append(acct, "emojis", xs_stock(XSTYPE_LIST));
22 
23     xs *src = xs_json_loads("{\"privacy\":\"public\", \"language\":\"en\","
24@@ -1220,7 +1223,7 @@ void credentials_get(char **body, char **ctype, int *status, snac snac)
25     src = xs_dict_set(src, "sensitive",
26         strcmp(cw, "open") == 0 ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
27 
28-    src = xs_dict_set(src, "bot", xs_dict_get(snac.config, "bot"));
29+    src = xs_dict_set(src, "bot", xs_stock(xs_is_true(bot) ? XSTYPE_TRUE : XSTYPE_FALSE));
30 
31     xs *avatar = NULL;
32     const char *av = xs_dict_get(snac.config, "avatar");