Set maximum value

This commit is contained in:
Michael 2021-05-18 07:01:23 +00:00
parent ce427b248e
commit 0a6127ea6e

View file

@ -65,12 +65,16 @@ class Search extends BaseApi
// Attempt WebFinger lookup. Defaults to false. // Attempt WebFinger lookup. Defaults to false.
$resolve = $request['resolve']; $resolve = $request['resolve'];
// Maximum number of results to load, per type. Defaults to 20. Max 40. // Maximum number of results to load, per type. Defaults to 20. Max 40.
$limit = $request['limit']; $limit = max($request['limit'], 40);
// Offset in search results. Used for pagination. Defaults to 0. // Offset in search results. Used for pagination. Defaults to 0.
$offset = $request['offset']; $offset = $request['offset'];
// Only who the user is following. Defaults to false. // Only who the user is following. Defaults to false.
$following = $request['following']; $following = $request['following'];
if (empty($q)) {
DI::mstdnError()->UnprocessableEntity();
}
$result = ['accounts' => [], 'statuses' => [], 'hashtags' => []]; $result = ['accounts' => [], 'statuses' => [], 'hashtags' => []];
if (empty($type) || ($type == 'accounts')) { if (empty($type) || ($type == 'accounts')) {