mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-10 06:34:16 +00:00
Merge branch 'speedups' into dev
This commit is contained in:
commit
dcab47d85f
6 changed files with 26 additions and 22 deletions
|
@ -105,6 +105,6 @@ API_AUTH_METHODS = [
|
||||||
HeaderTokenAuth(),
|
HeaderTokenAuth(),
|
||||||
BearerTokenAuth(),
|
BearerTokenAuth(),
|
||||||
QueryParamTokenAuth(),
|
QueryParamTokenAuth(),
|
||||||
django_auth_superuser,
|
# django_auth_superuser, # django admin cookie auth, not secure to use with csrf=False
|
||||||
UsernameAndPasswordAuth(),
|
UsernameAndPasswordAuth(),
|
||||||
]
|
]
|
||||||
|
|
|
@ -152,10 +152,10 @@ CONFIG_SCHEMA: Dict[str, ConfigDefaultDict] = {
|
||||||
'CHECK_SSL_VALIDITY': {'type': bool, 'default': True},
|
'CHECK_SSL_VALIDITY': {'type': bool, 'default': True},
|
||||||
'MEDIA_MAX_SIZE': {'type': str, 'default': '750m'},
|
'MEDIA_MAX_SIZE': {'type': str, 'default': '750m'},
|
||||||
|
|
||||||
'USER_AGENT': {'type': str, 'default': None},
|
'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'] 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}'},
|
'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'] 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}'},
|
'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'] 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/)'},
|
'CHROME_USER_AGENT': {'type': str, 'default': lambda c: c['USER_AGENT']},
|
||||||
|
|
||||||
'COOKIES_FILE': {'type': str, 'default': None},
|
'COOKIES_FILE': {'type': str, 'default': None},
|
||||||
'CHROME_USER_DATA_DIR': {'type': str, 'default': None},
|
'CHROME_USER_DATA_DIR': {'type': str, 'default': None},
|
||||||
|
|
|
@ -251,6 +251,7 @@ from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
|
|
||||||
class SnapshotActionForm(ActionForm):
|
class SnapshotActionForm(ActionForm):
|
||||||
tags = forms.ModelMultipleChoiceField(
|
tags = forms.ModelMultipleChoiceField(
|
||||||
|
label='Edit tags',
|
||||||
queryset=Tag.objects.all(),
|
queryset=Tag.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
widget=FilteredSelectMultiple(
|
widget=FilteredSelectMultiple(
|
||||||
|
@ -526,16 +527,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
|
||||||
# return super().changelist_view(request, extra_context=None)
|
# return super().changelist_view(request, extra_context=None)
|
||||||
|
|
||||||
@admin.action(
|
@admin.action(
|
||||||
description="Pull"
|
description="ℹ️ Get Title"
|
||||||
)
|
|
||||||
def update_snapshots(self, request, queryset):
|
|
||||||
archive_links([
|
|
||||||
snapshot.as_link()
|
|
||||||
for snapshot in queryset
|
|
||||||
], out_dir=CONFIG.OUTPUT_DIR)
|
|
||||||
|
|
||||||
@admin.action(
|
|
||||||
description="⬇️ Title"
|
|
||||||
)
|
)
|
||||||
def update_titles(self, request, queryset):
|
def update_titles(self, request, queryset):
|
||||||
archive_links([
|
archive_links([
|
||||||
|
@ -544,7 +536,17 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
|
||||||
], overwrite=True, methods=('title','favicon'), out_dir=CONFIG.OUTPUT_DIR)
|
], overwrite=True, methods=('title','favicon'), out_dir=CONFIG.OUTPUT_DIR)
|
||||||
|
|
||||||
@admin.action(
|
@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):
|
def resnapshot_snapshot(self, request, queryset):
|
||||||
for snapshot in queryset:
|
for snapshot in queryset:
|
||||||
|
@ -553,7 +555,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
|
||||||
add(new_url, tag=snapshot.tags_str())
|
add(new_url, tag=snapshot.tags_str())
|
||||||
|
|
||||||
@admin.action(
|
@admin.action(
|
||||||
description="Reset"
|
description="♲ Redo"
|
||||||
)
|
)
|
||||||
def overwrite_snapshots(self, request, queryset):
|
def overwrite_snapshots(self, request, queryset):
|
||||||
archive_links([
|
archive_links([
|
||||||
|
@ -562,7 +564,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, ABIDModelAdmin):
|
||||||
], overwrite=True, out_dir=CONFIG.OUTPUT_DIR)
|
], overwrite=True, out_dir=CONFIG.OUTPUT_DIR)
|
||||||
|
|
||||||
@admin.action(
|
@admin.action(
|
||||||
description="Delete"
|
description="☠️ Delete"
|
||||||
)
|
)
|
||||||
def delete_snapshots(self, request, queryset):
|
def delete_snapshots(self, request, queryset):
|
||||||
remove(snapshots=queryset, yes=True, delete=True, out_dir=CONFIG.OUTPUT_DIR)
|
remove(snapshots=queryset, yes=True, delete=True, out_dir=CONFIG.OUTPUT_DIR)
|
||||||
|
|
|
@ -4,8 +4,10 @@ from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class PkgsConfig(AppConfig):
|
class PkgsConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
|
||||||
name = 'pkg'
|
name = 'pkg'
|
||||||
|
verbose_name = 'Package Management'
|
||||||
|
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
from .settings import LOADED_DEPENDENCIES
|
from .settings import LOADED_DEPENDENCIES
|
||||||
|
|
|
@ -143,11 +143,11 @@ body.model-snapshot.change-list #content .object-tools {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
#content #changelist .actions .button[name=update_snapshots] {
|
#content #changelist .actions .button[name=update_snapshots] {
|
||||||
background-color:lightseagreen;
|
background-color: #9ee54b;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
#content #changelist .actions .button[name=resnapshot_snapshot] {
|
#content #changelist .actions .button[name=resnapshot_snapshot] {
|
||||||
background-color: #9ee54b;
|
background-color:lightseagreen;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
#content #changelist .actions .button[name=overwrite_snapshots] {
|
#content #changelist .actions .button[name=overwrite_snapshots] {
|
||||||
|
|
2
archivebox/vendor/pydantic-pkgr
vendored
2
archivebox/vendor/pydantic-pkgr
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 2cd844533d888ce29b9bf32b8363510dd0d76166
|
Subproject commit c97de57f8df5f36a0f8cd1e51645f114e74bffb0
|
Loading…
Reference in a new issue