diff options
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 21 |
1 files changed, 21 insertions, 0 deletions
| @@ -1118,9 +1118,14 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1118 | acct = xs_dict_append(acct, "acct", xs_dict_get(snac1.config, "uid")); | 1118 | acct = xs_dict_append(acct, "acct", xs_dict_get(snac1.config, "uid")); |
| 1119 | acct = xs_dict_append(acct, "display_name", xs_dict_get(snac1.config, "name")); | 1119 | acct = xs_dict_append(acct, "display_name", xs_dict_get(snac1.config, "name")); |
| 1120 | acct = xs_dict_append(acct, "created_at", xs_dict_get(snac1.config, "published")); | 1120 | acct = xs_dict_append(acct, "created_at", xs_dict_get(snac1.config, "published")); |
| 1121 | acct = xs_dict_append(acct, "last_status_at", xs_dict_get(snac1.config, "published")); | ||
| 1121 | acct = xs_dict_append(acct, "note", xs_dict_get(snac1.config, "bio")); | 1122 | acct = xs_dict_append(acct, "note", xs_dict_get(snac1.config, "bio")); |
| 1122 | acct = xs_dict_append(acct, "url", snac1.actor); | 1123 | acct = xs_dict_append(acct, "url", snac1.actor); |
| 1123 | acct = xs_dict_append(acct, "header", ""); | 1124 | acct = xs_dict_append(acct, "header", ""); |
| 1125 | acct = xs_dict_append(acct, "header_static", ""); | ||
| 1126 | acct = xs_dict_append(acct, "locked", xs_stock_false); | ||
| 1127 | // FIXME: check value of "type" to set this correctly? | ||
| 1128 | acct = xs_dict_append(acct, "bot", xs_stock_false); | ||
| 1124 | 1129 | ||
| 1125 | xs *src = xs_json_loads("{\"privacy\":\"public\"," | 1130 | xs *src = xs_json_loads("{\"privacy\":\"public\"," |
| 1126 | "\"sensitive\":false,\"fields\":[],\"note\":\"\"}"); | 1131 | "\"sensitive\":false,\"fields\":[],\"note\":\"\"}"); |
| @@ -2479,6 +2484,22 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2479 | } | 2484 | } |
| 2480 | 2485 | ||
| 2481 | 2486 | ||
| 2487 | int mastoapi_delete_handler(const xs_dict *req, const char *q_path, | ||
| 2488 | char **body, int *b_size, char **ctype) { | ||
| 2489 | |||
| 2490 | if (!xs_startswith(q_path, "/api/v1/") && !xs_startswith(q_path, "/api/v2/")) | ||
| 2491 | return 0; | ||
| 2492 | |||
| 2493 | srv_debug(1, xs_fmt("mastoapi_delete_handler %s", q_path)); | ||
| 2494 | xs *cmd = xs_replace_n(q_path, "/api", "", 1); | ||
| 2495 | if (xs_startswith(cmd, "/v1/push/subscription") || xs_startswith(cmd, "/v2/push/subscription")) { /** **/ | ||
| 2496 | // pretend we deleted it, since it doesn't exist anyway | ||
| 2497 | return 200; | ||
| 2498 | } | ||
| 2499 | return 0; | ||
| 2500 | } | ||
| 2501 | |||
| 2502 | |||
| 2482 | int mastoapi_put_handler(const xs_dict *req, const char *q_path, | 2503 | int mastoapi_put_handler(const xs_dict *req, const char *q_path, |
| 2483 | const char *payload, int p_size, | 2504 | const char *payload, int p_size, |
| 2484 | char **body, int *b_size, char **ctype) | 2505 | char **body, int *b_size, char **ctype) |