Only allow logged-in user to use statuses API

This commit is contained in:
poesty 2023-06-11 12:06:37 +08:00
parent 15137fc5c7
commit fb5f34bb5a

View File

@ -1510,6 +1510,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
else else
if (xs_startswith(cmd, "/v1/statuses/")) { /** **/ if (xs_startswith(cmd, "/v1/statuses/")) { /** **/
/* information about a status */ /* information about a status */
if (logged_in) {
xs *l = xs_split(cmd, "/"); xs *l = xs_split(cmd, "/");
const char *id = xs_list_get(l, 3); const char *id = xs_list_get(l, 3);
const char *op = xs_list_get(l, 4); const char *op = xs_list_get(l, 4);
@ -1607,6 +1608,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
} }
} }
} }
else
status = 401;
}
else else
if (strcmp(cmd, "/v1/preferences") == 0) { /** **/ if (strcmp(cmd, "/v1/preferences") == 0) { /** **/
*body = xs_dup("{}"); *body = xs_dup("{}");