mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-09-12 19:50:57 +05:00
fix(snapshots): honor SNAPSHOTS_PER_PAGE without silent clamping; bump default to 50
admin_snapshots.py:571 had min(max(50, SNAPSHOTS_PER_PAGE), 500), and admin_archiveresults.py:501 had min(max(5, SNAPSHOTS_PER_PAGE), 5000). Both clamps silently overrode the configured value — a documented default of 40 was inaccessible in the Snapshot admin, and the ArchiveResult admin also reused the same setting without being mentioned in the docs. - Drop both clamps; admin changelists now use SNAPSHOTS_PER_PAGE as-is. - Bump the default in common.py from 40 to 50 (matches what users were actually seeing in the admin under the old floor). - Add ge=1 validation so non-positive values are rejected at config parse time instead of producing broken pagination. - Update Configuration.md: new default 50, clarify the option drives both Snapshot and ArchiveResult admin changelists plus the public index, and that it must be >= 1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
01d6ae2082
commit
deb0940f5f
@ -193,7 +193,7 @@ class ServerConfig(BaseConfigSet):
|
||||
CSRF_TRUSTED_ORIGINS: str = Field(default="")
|
||||
SERVER_SECURITY_MODE: str = Field(default="safe-subdomains-fullreplay")
|
||||
|
||||
SNAPSHOTS_PER_PAGE: int = Field(default=40)
|
||||
SNAPSHOTS_PER_PAGE: int = Field(default=50, ge=1)
|
||||
FOOTER_INFO: str = Field(
|
||||
default="Content is hosted for personal archiving purposes only. Contact server owner for any takedown requests.",
|
||||
)
|
||||
|
||||
@ -498,7 +498,7 @@ class ArchiveResultAdmin(BaseModelAdmin):
|
||||
self.request = request
|
||||
request.archivebox_config = getattr(request, "archivebox_config", None) or get_config()
|
||||
saved_list_per_page = self.list_per_page
|
||||
self.list_per_page = min(max(5, request.archivebox_config.SNAPSHOTS_PER_PAGE), 5000)
|
||||
self.list_per_page = request.archivebox_config.SNAPSHOTS_PER_PAGE
|
||||
try:
|
||||
return super().changelist_view(request, extra_context)
|
||||
finally:
|
||||
|
||||
@ -568,7 +568,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ConfigEditorMixin, BaseModelAdmin):
|
||||
requested_per_page = 200
|
||||
self.list_per_page = min(max(200, requested_per_page), 500)
|
||||
else:
|
||||
self.list_per_page = min(max(50, request.archivebox_config.SNAPSHOTS_PER_PAGE), 500)
|
||||
self.list_per_page = request.archivebox_config.SNAPSHOTS_PER_PAGE
|
||||
extra_context = extra_context or {}
|
||||
extra_context["embedded_changelist"] = embedded_changelist
|
||||
extra_context["CONFIG"] = request.archivebox_config
|
||||
|
||||
@ -424,9 +424,9 @@ More info:
|
||||
|
||||
---
|
||||
#### `SNAPSHOTS_PER_PAGE`
|
||||
**Possible Values:** [`40`]/`100`/...
|
||||
**Possible Values:** [`50`]/`25`/`100`/`200`/...
|
||||
|
||||
Maximum number of Snapshots to render per page on the snapshot list views (both the admin index and the public index). Larger values speed up bulk browsing at the cost of heavier per-request rendering.
|
||||
Number of rows to render per page on the Snapshot and ArchiveResult list views (admin index, public index, and the Django admin changelists for both models). Lower values reduce per-request render time; higher values speed up bulk browsing at the cost of heavier rendering. Must be ≥ 1.
|
||||
|
||||
---
|
||||
#### `FOOTER_INFO`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user