fix #1485: allow more than 100 rows default in dashboard

The dashboard.domains_custom route was hardcoded to either return all
the domains, or at most 100, regardless of default_domain_table_size
setting.

Make this limit be dependent on default_domain_table_size instead.

The API will now limit to 100 or default_domain_table_size, whichever
one is higher. This is done to not break any seconday use-cases that
might depend on the hardcoded setting.
This commit is contained in:
Jan Koppe 2023-03-29 14:52:00 +02:00
parent 53cfa4fdaa
commit 0d0339a316
No known key found for this signature in database
GPG Key ID: BE935B0735A2129B

View File

@ -141,7 +141,7 @@ def domains_custom(tab_id):
filtered_count = domains.count() filtered_count = domains.count()
start = int(request.args.get("start", 0)) start = int(request.args.get("start", 0))
length = min(int(request.args.get("length", 0)), 100) length = min(int(request.args.get("length", 0)), max(100, int(Setting().get('default_domain_table_size'))))
if length != -1: if length != -1:
domains = domains[start:start + length] domains = domains[start:start + length]