diff --git a/archivebox/core/admin.py b/archivebox/core/admin.py
index f69b809d..5ef6f4ed 100644
--- a/archivebox/core/admin.py
+++ b/archivebox/core/admin.py
@@ -13,6 +13,7 @@ from django.contrib.auth import get_user_model
from core.models import Snapshot
from core.forms import AddLinkForm
+from core.utils import get_icons
from util import htmldecode, urldecode, ansi_to_html
from logging_util import printable_filesize
@@ -93,34 +94,7 @@ class SnapshotAdmin(admin.ModelAdmin):
) + mark_safe(f'{tags}')
def files(self, obj):
- link = obj.as_link()
- canon = link.canonical_outputs()
- out_dir = Path(link.link_dir)
-
- link_tuple = lambda link, method: (link.archive_path, canon[method] or '', canon[method] and (out_dir / (canon[method] or 'notdone')).exists())
-
- return format_html(
- ''
- '🌐 '
- '📄 '
- '🖥 '
- '🅷 '
- '🆆 '
- '🗜 '
- '📼 '
- '📦 '
- '🏛 '
- '',
- *link_tuple(link, 'wget_path'),
- *link_tuple(link, 'pdf_path'),
- *link_tuple(link, 'screenshot_path'),
- *link_tuple(link, 'dom_path'),
- *link_tuple(link, 'warc_path')[:2], any((out_dir / canon['warc_path']).glob('*.warc.gz')),
- *link_tuple(link, 'singlefile_path'),
- *link_tuple(link, 'media_path')[:2], any((out_dir / canon['media_path']).glob('*')),
- *link_tuple(link, 'git_path')[:2], any((out_dir / canon['git_path']).glob('*')),
- canon['archive_org_path'], (out_dir / 'archive.org.txt').exists(),
- )
+ return get_icons(obj)
def size(self, obj):
return format_html(
diff --git a/archivebox/core/utils.py b/archivebox/core/utils.py
new file mode 100644
index 00000000..8dffb4af
--- /dev/null
+++ b/archivebox/core/utils.py
@@ -0,0 +1,36 @@
+from pathlib import Path
+
+from django.utils.html import format_html
+
+from core.models import Snapshot
+
+
+def get_icons(snapshot: Snapshot) -> str:
+ link = snapshot.as_link()
+ canon = link.canonical_outputs()
+ out_dir = Path(link.link_dir)
+
+ link_tuple = lambda link, method: (link.archive_path, canon[method] or '', canon[method] and (out_dir / (canon[method] or 'notdone')).exists())
+
+ return format_html(
+ ''
+ '🌐 '
+ '📄 '
+ '🖥 '
+ '🅷 '
+ '🆆 '
+ '🗜 '
+ '📼 '
+ '📦 '
+ '🏛 '
+ '',
+ *link_tuple(link, 'wget_path'),
+ *link_tuple(link, 'pdf_path'),
+ *link_tuple(link, 'screenshot_path'),
+ *link_tuple(link, 'dom_path'),
+ *link_tuple(link, 'warc_path')[:2], any((out_dir / canon['warc_path']).glob('*.warc.gz')),
+ *link_tuple(link, 'singlefile_path'),
+ *link_tuple(link, 'media_path')[:2], any((out_dir / canon['media_path']).glob('*')),
+ *link_tuple(link, 'git_path')[:2], any((out_dir / canon['git_path']).glob('*')),
+ canon['archive_org_path'], (out_dir / 'archive.org.txt').exists(),
+ )
\ No newline at end of file
diff --git a/archivebox/core/views.py b/archivebox/core/views.py
index 9a71c42a..e6d19de7 100644
--- a/archivebox/core/views.py
+++ b/archivebox/core/views.py
@@ -10,6 +10,8 @@ from django.views.generic.list import ListView
from django_datatables_view.base_datatable_view import BaseDatatableView
from core.models import Snapshot
+from core.utils import get_icons
+
from ..index import load_main_index, load_main_index_meta
from ..config import (
@@ -110,12 +112,12 @@ class LinkDetails(View):
class PublicArchiveView(ListView):
template = 'snapshot_list.html'
model = Snapshot
- paginate_by = 50
+ paginate_by = 100
def get_queryset(self, *args, **kwargs):
qs = super(PublicArchiveView, self).get_queryset(*args, **kwargs)
for snapshot in qs:
- snapshot.canonical_outputs = snapshot.as_link().canonical_outputs()
+ snapshot.icons = get_icons(snapshot)
return qs
def get(self, *args, **kwargs):
@@ -125,17 +127,6 @@ class PublicArchiveView(ListView):
else:
return redirect(f'/admin/login/?next={self.request.path}')
-# should we use it?
-class SnapshotDatatableView(BaseDatatableView):
- model = Snapshot
- columns = ['url', 'timestamp', 'title', 'tags', 'added']
-
- def filter_queryset(self, qs):
- sSearch = self.request.GET.get('sSearch', None)
- if sSearch:
- qs = qs.filter(Q(title__icontains=sSearch))
- return qs
-
class SearchResultsView(PublicArchiveView):
def get_queryset(self, *args, **kwargs):
qs = super(PublicArchiveView, self).get_queryset(*args, **kwargs)
diff --git a/archivebox/themes/default/core/snapshot_list.html b/archivebox/themes/default/core/snapshot_list.html
index 1acdd708..befec1be 100644
--- a/archivebox/themes/default/core/snapshot_list.html
+++ b/archivebox/themes/default/core/snapshot_list.html
@@ -257,14 +257,14 @@
{% else %}
{% endif %}
-
+
{{link.title|default:'Loading...'}}
{{link.tags|default:''}}
📄
- Entry to files
+ {{link.icons}}
|
{{link.url}} |