diff --git a/archivebox/core/views.py b/archivebox/core/views.py
index 5e8cdf3f..4c5b4fc1 100644
--- a/archivebox/core/views.py
+++ b/archivebox/core/views.py
@@ -943,6 +943,10 @@ class PublicIndexView(ListView):
for snapshot in context.get("object_list") or ():
snapshot._icons_compact = True
snapshot._is_archived_cached = bool(snapshot.downloaded_at or snapshot.status == Snapshot.StatusChoices.SEALED)
+ results = getattr(snapshot, "_prefetched_objects_cache", {}).get("archiveresult_set")
+ if results is not None:
+ snapshot.output_size_sum = sum(result.output_size or result.output_size_from_files() for result in results)
+ snapshot.num_outputs_cached = len(results)
return context
def get_queryset(self, **kwargs):
@@ -959,6 +963,8 @@ class PublicIndexView(ListView):
"snapshot_id",
"plugin",
"status",
+ "output_size",
+ "output_files",
),
),
)
@@ -968,49 +974,24 @@ class PublicIndexView(ListView):
if not query:
return qs
- query_type = self.request.GET.get("query_type")
search_mode = get_search_mode(self.request.GET.get("search_mode"))
- if not query_type or query_type == "all":
- metadata_qs = qs.filter(
- Q(title__icontains=query) | Q(url__icontains=query) | Q(timestamp__icontains=query) | Q(tags__name__icontains=query),
- )
- if search_mode == "meta":
- qs = metadata_qs
- else:
- try:
- qs = prioritize_metadata_matches(
- qs,
- metadata_qs,
- query_search_index(query, search_mode=search_mode),
- ordering=self.ordering,
- )
- except Exception as err:
- print(f"[!] Error while using search backend: {err.__class__.__name__} {err}")
- qs = metadata_qs
- elif query_type == "fulltext":
- if search_mode == "meta":
- qs = qs.none()
- else:
- try:
- qs = query_search_index(query, search_mode=search_mode).filter(pk__in=qs.values("pk"))
- except Exception as err:
- print(f"[!] Error while using search backend: {err.__class__.__name__} {err}")
- qs = qs.none()
- elif query_type == "meta":
- qs = qs.filter(
- Q(title__icontains=query) | Q(url__icontains=query) | Q(timestamp__icontains=query) | Q(tags__name__icontains=query),
- )
- elif query_type == "url":
- qs = qs.filter(Q(url__icontains=query))
- elif query_type == "title":
- qs = qs.filter(Q(title__icontains=query))
- elif query_type == "timestamp":
- qs = qs.filter(Q(timestamp__icontains=query))
- elif query_type == "tags":
- qs = qs.filter(Q(tags__name__icontains=query))
+ metadata_qs = qs.filter(
+ Q(title__icontains=query) | Q(url__icontains=query) | Q(timestamp__icontains=query) | Q(tags__name__icontains=query),
+ )
+ if search_mode == "meta":
+ qs = metadata_qs
else:
- print(f'[!] Unknown value for query_type: "{query_type}"')
+ try:
+ qs = prioritize_metadata_matches(
+ qs,
+ metadata_qs,
+ query_search_index(query, search_mode=search_mode),
+ ordering=self.ordering,
+ )
+ except Exception as err:
+ print(f"[!] Error while using search backend: {err.__class__.__name__} {err}")
+ qs = metadata_qs
return qs.distinct()
diff --git a/archivebox/templates/core/index_row.html b/archivebox/templates/core/index_row.html
index f2306aeb..6ad92662 100644
--- a/archivebox/templates/core/index_row.html
+++ b/archivebox/templates/core/index_row.html
@@ -1,44 +1,89 @@
{% load static tz core_tags %}
-
- |
- {{ link.bookmarked_at|localtime }}
- |
-
- {% if link.is_archived %}
-
- {% else %}
-
- {% endif %}
+{% snapshot_base_url link as snapshot_base %}
+{% snapshot_url link 'screenshot/screenshot.png' as screenshot_plugin_url %}
+{% snapshot_url link 'screenshot.png' as screenshot_root_url %}
+{% snapshot_url link 'favicon/favicon.ico' as favicon_plugin_url %}
+{% snapshot_url link 'favicon.ico' as favicon_root_url %}
-
-
- {{link.title|default:'Loading...'|truncatechars:128}}
-
- {% if link.tags_str %}
- {% for tag in link.tags_str|split:',' %}
-
- {{tag}}
-
- {% endfor %}
+
+ |
+
+ {{ link.bookmarked_at|localtime|date:"Y-m-d" }}
+ {{ link.bookmarked_at|localtime|date:"H:i" }}
+
+ |
+
+
+ {% if link.is_archived %}
+
+ {% else %}
+
{% endif %}
|
-
-
- {% if link.icons %}
- {{link.icons}} {{link.num_outputs}}
+ |
+
+
+ {{ link.url }}
+
+ |
+
+ {% if link.tags_str %}
+
+ {% for tag in link.tags_str|split:',' %}
+ {% if tag %}
+ {{ tag }}
+ {% endif %}
+ {% endfor %}
+
+ {% else %}
+ ...
+ {% endif %}
+ |
+
+ {{ link.status|default:'unknown' }}
+ |
+
+
+ {% if link.icons %}
+ {{ link.icons }}
{% else %}
-
- 📄
- {{link.num_outputs}}
-
+ ...
{% endif %}
|
-
-
- {{link.url}}
+ |
+
+ {% if link.archive_size %}
+ {{ link.archive_size|file_size }}
+ {% else %}
+ ...
+ {% endif %}
+ {{ link.num_outputs }} output{{ link.num_outputs|pluralize }}
|
diff --git a/archivebox/templates/core/public_index.html b/archivebox/templates/core/public_index.html
index 45535913..046ee20c 100644
--- a/archivebox/templates/core/public_index.html
+++ b/archivebox/templates/core/public_index.html
@@ -2,79 +2,444 @@
{% load static tz %}
{% load core_tags %}
-{% block body %}
-
-
-
-
-
- | Bookmarked |
- Snapshot ({{page_obj.paginator.count}}) |
- Files |
- Original URL |
-
-
-
- {% for link in object_list %}
- {% include 'index_row.html' with link=link %}
- {% endfor %}
-
-
-
-
-
- Showing {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} total
-
-
- {% if page_obj.has_previous %}
- « first
- previous
-
- {% endif %}
-
-
- Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
-
-
- {% if page_obj.has_next %}
-
- next
- last »
- {% endif %}
-
-
-
+{% block extra_head %}
+
+
+{% endblock %}
+
+{% block body %}
+
+
+
+
+
+
+ | Saved |
+ Preview |
+ Snapshot ({{ page_obj.paginator.count }}) |
+ Tags |
+ Status |
+ Files |
+ Size |
+
+
+
+ {% for link in object_list %}
+ {% include 'index_row.html' with link=link %}
+ {% endfor %}
+
+
+
+
+
{% endblock %}
|