From 5de45dbf30c277fd39c2c4388cdcae1f159efb6b Mon Sep 17 00:00:00 2001 From: Ben Muthalaly Date: Mon, 8 Jan 2024 22:55:30 -0600 Subject: [PATCH 1/3] Show upgrade notification in admin snapshot view --- archivebox/core/admin.py | 14 +++++++++++++- archivebox/core/urls.py | 8 -------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/archivebox/core/admin.py b/archivebox/core/admin.py index c4974c3a..30aacc90 100644 --- a/archivebox/core/admin.py +++ b/archivebox/core/admin.py @@ -23,8 +23,16 @@ from core.mixins import SearchResultsAdminMixin from index.html import snapshot_icons from logging_util import printable_filesize from main import add, remove -from config import OUTPUT_DIR, SNAPSHOTS_PER_PAGE from extractors import archive_links +from config import ( + OUTPUT_DIR, + SNAPSHOTS_PER_PAGE, + VERSION, + VERSIONS_AVAILABLE, + CAN_UPGRADE +) + +GLOBAL_CONTEXT = {'VERSION': VERSION, 'VERSIONS_AVAILABLE': VERSIONS_AVAILABLE, 'CAN_UPGRADE': CAN_UPGRADE} # Admin URLs # /admin/ @@ -96,6 +104,10 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin): action_form = SnapshotActionForm + def changelist_view(self, request, extra_context=None): + extra_context = extra_context or {} + return super().changelist_view(request, extra_context | GLOBAL_CONTEXT) + def get_urls(self): urls = super().get_urls() custom_urls = [ diff --git a/archivebox/core/urls.py b/archivebox/core/urls.py index f89273ff..1111ead4 100644 --- a/archivebox/core/urls.py +++ b/archivebox/core/urls.py @@ -8,11 +8,6 @@ from django.views.generic.base import RedirectView from core.views import HomepageView, SnapshotView, PublicIndexView, AddView, HealthCheckView -# GLOBAL_CONTEXT doesn't work as-is, disabled for now: https://github.com/ArchiveBox/ArchiveBox/discussions/1306 -# from config import VERSION, VERSIONS_AVAILABLE, CAN_UPGRADE -# GLOBAL_CONTEXT = {'VERSION': VERSION, 'VERSIONS_AVAILABLE': VERSIONS_AVAILABLE, 'CAN_UPGRADE': CAN_UPGRADE} - - # print('DEBUG', settings.DEBUG) urlpatterns = [ @@ -36,9 +31,6 @@ urlpatterns = [ path('accounts/', include('django.contrib.auth.urls')), path('admin/', admin.site.urls), - # do not add extra_context like this as not all admin views (e.g. ModelAdmin.autocomplete_view accept extra kwargs) - # path('admin/', admin.site.urls, {'extra_context': GLOBAL_CONTEXT}), - path('health/', HealthCheckView.as_view(), name='healthcheck'), path('error/', lambda _: 1/0), From 233388f94d2dcf452ca6e03ccf7d5666e137d30e Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 19 Jan 2024 19:54:53 -0800 Subject: [PATCH 2/3] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d9945c5..36fae2a6 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ ls ./archive/*/index.json # or browse directly via the filesyste #### ✳️  Easy Setup -
+
Docker docker-compose (macOS/Linux/Windows)   👈  recommended   (click to expand)
👍 Docker Compose is recommended for the easiest install/update UX + best security + all the extras out-of-the-box. @@ -159,10 +159,11 @@ curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/dev/docker-comp
  • Run the initial setup and create an admin user.
    docker compose run archivebox init --setup
     
  • -
  • Optional: Start the server then login to the Web UI http://127.0.0.1:8000 ⇢ Admin. +
  • Next steps: Start the server then login to the Web UI http://127.0.0.1:8000 ⇢ Admin.
    docker compose up
     # completely optional, CLI can always be used without running a server
     # docker compose run [-T] archivebox [subcommand] [--args]
    +docker compose run archivebox add 'https://example.com'
     
  • From 10922d426e9dccbee0754c21667e3ca957133fe8 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 19 Jan 2024 19:56:18 -0800 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36fae2a6..eae35350 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ ls ./archive/*/index.json # or browse directly via the filesyste 👍 Docker Compose is recommended for the easiest install/update UX + best security + all the extras out-of-the-box.

      -
    1. Install Docker and Docker Compose on your system (if not already installed).
    2. +
    3. Install Docker on your system (if not already installed).
    4. Download the docker-compose.yml file into a new empty directory (can be anywhere).
      mkdir ~/archivebox && cd ~/archivebox
       curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/dev/docker-compose.yml'