Merge branch 'speedups' into dev

This commit is contained in:
Nick Sweeting 2024-09-02 15:06:32 -07:00
commit dcab47d85f
No known key found for this signature in database
6 changed files with 26 additions and 22 deletions

View file

@ -105,6 +105,6 @@ API_AUTH_METHODS = [
HeaderTokenAuth(),
BearerTokenAuth(),
QueryParamTokenAuth(),
django_auth_superuser,
# django_auth_superuser, # django admin cookie auth, not secure to use with csrf=False
UsernameAndPasswordAuth(),
]

View file

@ -152,10 +152,10 @@ CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
'CHECK_SSL_VALIDITY': {'type': bool, 'default': True},
'MEDIA_MAX_SIZE': {'type': str, 'default': '750m'},
'USER_AGENT': {'type': str, 'default': None},
'CURL_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT'] or 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/) curl/{CURL_VERSION}'},
'WGET_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT'] or 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/) wget/{WGET_VERSION}'},
'CHROME_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT'] or 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)'},
'USER_AGENT': {'type': str, 'default': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)'},
'CURL_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT'] + ' curl/{CURL_VERSION}'},
'WGET_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT'] + ' wget/{WGET_VERSION}'},
'CHROME_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT']},
'COOKIES_FILE': {'type': str, 'default': None},
'CHROME_USER_DATA_DIR': {'type': str, 'default': None},

View file

@ -251,6 +251,7 @@ from django.contrib.admin.widgets import FilteredSelectMultiple
class SnapshotActionForm(ActionForm):
tags = forms.ModelMultipleChoiceField(
label='Edit tags',
queryset=Tag.objects.all(),
required=False,
widget=FilteredSelectMultiple(
@ -526,16 +527,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
# return super().changelist_view(request, extra_context=None)
@admin.action(
description="Pull"
)
def update_snapshots(self, request, queryset):
archive_links([
snapshot.as_link()
for snapshot in queryset
], out_dir=CONFIG.OUTPUT_DIR)
@admin.action(
description="⬇️ Title"
description=" Get Title"
)
def update_titles(self, request, queryset):
archive_links([
@ -544,7 +536,17 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
], overwrite=True, methods=('title','favicon'), out_dir=CONFIG.OUTPUT_DIR)
@admin.action(
description="Re-Snapshot"
description="⬇️ Get Missing"
)
def update_snapshots(self, request, queryset):
archive_links([
snapshot.as_link()
for snapshot in queryset
], out_dir=CONFIG.OUTPUT_DIR)
@admin.action(
description="📑 Archive again"
)
def resnapshot_snapshot(self, request, queryset):
for snapshot in queryset:
@ -553,7 +555,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
add(new_url, tag=snapshot.tags_str())
@admin.action(
description="Reset"
description="♲ Redo"
)
def overwrite_snapshots(self, request, queryset):
archive_links([
@ -562,7 +564,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
], overwrite=True, out_dir=CONFIG.OUTPUT_DIR)
@admin.action(
description="Delete"
description="☠️ Delete"
)
def delete_snapshots(self, request, queryset):
remove(snapshots=queryset, yes=True, delete=True, out_dir=CONFIG.OUTPUT_DIR)

View file

@ -4,8 +4,10 @@ from django.apps import AppConfig
class PkgsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'pkg'
verbose_name = 'Package Management'
default_auto_field = 'django.db.models.BigAutoField'
def ready(self):
from .settings import LOADED_DEPENDENCIES

View file

@ -143,11 +143,11 @@ body.model-snapshot.change-list #content .object-tools {
color: #333;
}
#content #changelist .actions .button[name=update_snapshots] {
background-color:lightseagreen;
background-color: #9ee54b;
color: #333;
}
#content #changelist .actions .button[name=resnapshot_snapshot] {
background-color: #9ee54b;
background-color:lightseagreen;
color: #333;
}
#content #changelist .actions .button[name=overwrite_snapshots] {

@ -1 +1 @@
Subproject commit 2cd844533d888ce29b9bf32b8363510dd0d76166
Subproject commit c97de57f8df5f36a0f8cd1e51645f114e74bffb0