Only allow logged-in user to use search API

This commit is contained in:
poesty 2023-06-11 03:04:08 +08:00
parent 2b64892e83
commit 15137fc5c7

View File

@ -1627,6 +1627,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
}
else
if (strcmp(cmd, "/v2/search") == 0) { /** **/
if (logged_in) {
const char *q = xs_dict_get(args, "q");
const char *type = xs_dict_get(args, "type");
const char *offset = xs_dict_get(args, "offset");
@ -1665,6 +1666,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
*ctype = "application/json";
status = 200;
}
else
status = 401;
}
/* user cleanup */
if (logged_in)