commit: 108dfd1f87087e9bb61bffa310ddb67a58d5336a
parent 0b2119d4a791b3623b304b0bab683609d23271d4
Author: Alex Gleason <alex@alexgleason.me>
Date: Sun, 12 Dec 2021 22:50:07 -0600
Search: limit number of results
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex
@@ -17,6 +17,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
require Logger
+ @search_limit 40
+
plug(Pleroma.Web.ApiSpec.CastAndValidate)
# Note: Mastodon doesn't allow unauthenticated access (requires read:accounts / read:search)
@@ -77,7 +79,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
[
resolve: params[:resolve],
following: params[:following],
- limit: params[:limit],
+ limit: min(params[:limit], @search_limit),
offset: params[:offset],
type: params[:type],
author: get_author(params),