diff options
| -rw-r--r-- | mastoapi.c | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -652,7 +652,7 @@ int process_auth_token(snac *snac, const xs_dict *req) | |||
| 652 | int mastoapi_get_handler(const xs_dict *req, const char *q_path, | 652 | int mastoapi_get_handler(const xs_dict *req, const char *q_path, |
| 653 | char **body, int *b_size, char **ctype) | 653 | char **body, int *b_size, char **ctype) |
| 654 | { | 654 | { |
| 655 | if (!xs_startswith(q_path, "/api/v1/")) | 655 | if (!xs_startswith(q_path, "/api/v1/") && !xs_startswith(q_path, "/api/v2/")) |
| 656 | return 0; | 656 | return 0; |
| 657 | 657 | ||
| 658 | srv_debug(1, xs_fmt("mastoapi_get_handler %s", q_path)); | 658 | srv_debug(1, xs_fmt("mastoapi_get_handler %s", q_path)); |
| @@ -1168,7 +1168,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1168 | const char *payload, int p_size, | 1168 | const char *payload, int p_size, |
| 1169 | char **body, int *b_size, char **ctype) | 1169 | char **body, int *b_size, char **ctype) |
| 1170 | { | 1170 | { |
| 1171 | if (!xs_startswith(q_path, "/api/v1/")) | 1171 | if (!xs_startswith(q_path, "/api/v1/") && !xs_startswith(q_path, "/api/v2/")) |
| 1172 | return 0; | 1172 | return 0; |
| 1173 | 1173 | ||
| 1174 | srv_debug(1, xs_fmt("mastoapi_post_handler %s", q_path)); | 1174 | srv_debug(1, xs_fmt("mastoapi_post_handler %s", q_path)); |
| @@ -1416,7 +1416,13 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1416 | } | 1416 | } |
| 1417 | else | 1417 | else |
| 1418 | status = 401; | 1418 | status = 401; |
| 1419 | 1419 | } | |
| 1420 | else | ||
| 1421 | if (strcmp(cmd, "/v1/media") == 0 || strcmp(cmd, "/v2/media") == 0) { | ||
| 1422 | if (logged_in) { | ||
| 1423 | } | ||
| 1424 | else | ||
| 1425 | status = 401; | ||
| 1420 | } | 1426 | } |
| 1421 | 1427 | ||
| 1422 | /* user cleanup */ | 1428 | /* user cleanup */ |