diff options
| author | 2023-04-20 18:37:09 +0200 | |
|---|---|---|
| committer | 2023-04-20 18:37:09 +0200 | |
| commit | 04e61ea47527475430c6817012578c1bd48c0335 (patch) | |
| tree | e0372673c4862ef93df50a27736c2c910502f528 /mastoapi.c | |
| parent | snac_init() now prompts for the admin_address. (diff) | |
| download | snac2-04e61ea47527475430c6817012578c1bd48c0335.tar.gz snac2-04e61ea47527475430c6817012578c1bd48c0335.tar.xz snac2-04e61ea47527475430c6817012578c1bd48c0335.zip | |
More complete mastodon api instance object.
But Megalodon keeps crashing.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 22 |
1 files changed, 21 insertions, 1 deletions
| @@ -1032,12 +1032,32 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1032 | 1032 | ||
| 1033 | xs *d1 = xs_dict_new(); | 1033 | xs *d1 = xs_dict_new(); |
| 1034 | ins = xs_dict_append(ins, "urls", d1); | 1034 | ins = xs_dict_append(ins, "urls", d1); |
| 1035 | ins = xs_dict_append(ins, "stats", d1); | ||
| 1036 | ins = xs_dict_append(ins, "configuration", d1); | 1035 | ins = xs_dict_append(ins, "configuration", d1); |
| 1037 | 1036 | ||
| 1037 | xs *z = xs_number_new(0); | ||
| 1038 | d1 = xs_dict_append(d1, "user_count", z); | ||
| 1039 | d1 = xs_dict_append(d1, "status_count", z); | ||
| 1040 | d1 = xs_dict_append(d1, "domain_count", z); | ||
| 1041 | ins = xs_dict_append(ins, "stats", d1); | ||
| 1042 | |||
| 1043 | xs *f = xs_val_new(XSTYPE_FALSE); | ||
| 1044 | ins = xs_dict_append(ins, "registrations", f); | ||
| 1045 | ins = xs_dict_append(ins, "approval_required", f); | ||
| 1046 | ins = xs_dict_append(ins, "invites_enabled", f); | ||
| 1047 | |||
| 1048 | { | ||
| 1049 | snac snac; | ||
| 1050 | user_open(&snac, "test1"); | ||
| 1051 | xs *actor = msg_actor(&snac); | ||
| 1052 | xs *acc = mastoapi_account(actor); | ||
| 1053 | ins = xs_dict_append(ins, "contact_account", acc); | ||
| 1054 | user_free(&snac); | ||
| 1055 | } | ||
| 1038 | *body = xs_json_dumps_pp(ins, 4); | 1056 | *body = xs_json_dumps_pp(ins, 4); |
| 1039 | *ctype = "application/json"; | 1057 | *ctype = "application/json"; |
| 1040 | status = 200; | 1058 | status = 200; |
| 1059 | |||
| 1060 | printf("%s\n", *body); | ||
| 1041 | } | 1061 | } |
| 1042 | else | 1062 | else |
| 1043 | if (xs_startswith(cmd, "/v1/statuses/")) { | 1063 | if (xs_startswith(cmd, "/v1/statuses/")) { |