Private
Public Access
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd68400822 | ||
|
|
90837b339c | ||
|
|
dc8b9ff83b |
No files matched your search
+28
-1
@@ -1 +1,28 @@
|
|||||||
# Register your models here.
|
from django.contrib import admin
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from .models import SiteSettings
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(SiteSettings)
|
||||||
|
class SiteSettingsAdmin(admin.ModelAdmin):
|
||||||
|
"""A true singleton, not a collection — browsing a changelist to pick
|
||||||
|
the one row and click into it is an extra, pointless step, so
|
||||||
|
"Core > Site settings" in the sidebar goes straight to the (only)
|
||||||
|
change form instead, creating the row first if this is a fresh
|
||||||
|
install. No changelist/add/delete views exist at all here.
|
||||||
|
"""
|
||||||
|
|
||||||
|
fields = ["fetch_interval_minutes"]
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def has_delete_permission(self, request, obj=None):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def changelist_view(self, request, extra_context=None):
|
||||||
|
settings_row = SiteSettings.load()
|
||||||
|
url = reverse("admin:core_sitesettings_change", args=[settings_row.pk])
|
||||||
|
return redirect(url)
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated by Django 5.2.18 on 2026-10-31 18:56
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="SiteSettings",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.PositiveSmallIntegerField(default=1, primary_key=True, serialize=False),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"fetch_interval_minutes",
|
||||||
|
models.PositiveIntegerField(
|
||||||
|
default=60,
|
||||||
|
help_text="How often, in minutes, every feed is polled for new articles. Can't be set lower than EVECTION_MIN_FETCH_INTERVAL_MINUTES (see .env).",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Site settings",
|
||||||
|
"verbose_name_plural": "Site settings",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
+35
-1
@@ -1 +1,35 @@
|
|||||||
# Create your models here.
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class SiteSettings(models.Model):
|
||||||
|
"""Singleton row (pk=1, same pattern as accounts.SetupLock) holding
|
||||||
|
instance-wide configuration an operator reasonably wants to change
|
||||||
|
without touching the server or .env — editable via Django admin.
|
||||||
|
Currently just the feed-poll interval, which used to be a per-feed
|
||||||
|
field; it's site-wide now (see apps.feeds.tasks.poll_due_feeds).
|
||||||
|
"""
|
||||||
|
|
||||||
|
id = models.PositiveSmallIntegerField(primary_key=True, default=1)
|
||||||
|
fetch_interval_minutes = models.PositiveIntegerField(
|
||||||
|
default=60,
|
||||||
|
help_text=(
|
||||||
|
"How often, in minutes, every feed is polled for new articles. "
|
||||||
|
"Can't be set lower than EVECTION_MIN_FETCH_INTERVAL_MINUTES (see .env)."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Site settings"
|
||||||
|
verbose_name_plural = "Site settings"
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "Site settings"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def load(cls):
|
||||||
|
"""Returns the singleton row, creating it with defaults on first
|
||||||
|
use so callers never need to special-case "no row exists yet"
|
||||||
|
(e.g. a fresh install whose first poll_due_feeds run hasn't
|
||||||
|
created it, and whose admin hasn't visited the settings page)."""
|
||||||
|
obj, _ = cls.objects.get_or_create(pk=1)
|
||||||
|
return obj
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
from datetime import timedelta
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from apps.feeds.models import Feed
|
||||||
|
from apps.feeds.tasks import poll_due_feeds
|
||||||
|
|
||||||
|
from .models import SiteSettings
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_load_creates_the_singleton_row_with_defaults():
|
||||||
|
assert not SiteSettings.objects.exists()
|
||||||
|
settings_row = SiteSettings.load()
|
||||||
|
assert settings_row.fetch_interval_minutes == 60
|
||||||
|
assert SiteSettings.objects.count() == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_load_returns_the_existing_row_without_creating_a_second_one():
|
||||||
|
SiteSettings.objects.create(fetch_interval_minutes=30)
|
||||||
|
settings_row = SiteSettings.load()
|
||||||
|
assert settings_row.fetch_interval_minutes == 30
|
||||||
|
assert SiteSettings.objects.count() == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_poll_due_feeds_uses_the_site_wide_interval_for_every_feed():
|
||||||
|
SiteSettings.objects.create(fetch_interval_minutes=120)
|
||||||
|
due = Feed.objects.create(
|
||||||
|
feed_url="https://a.example.com/feed.xml",
|
||||||
|
last_fetched_at=timezone.now() - timedelta(minutes=150),
|
||||||
|
)
|
||||||
|
not_due = Feed.objects.create(
|
||||||
|
feed_url="https://b.example.com/feed.xml",
|
||||||
|
last_fetched_at=timezone.now() - timedelta(minutes=90),
|
||||||
|
)
|
||||||
|
|
||||||
|
with patch("apps.feeds.tasks.fetch_feed.delay") as mock_delay:
|
||||||
|
poll_due_feeds()
|
||||||
|
|
||||||
|
dispatched_ids = {call.args[0] for call in mock_delay.call_args_list}
|
||||||
|
assert dispatched_ids == {due.id}
|
||||||
|
assert not_due.id not in dispatched_ids
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_admin_changelist_redirects_straight_to_the_change_form(client):
|
||||||
|
assert not SiteSettings.objects.exists()
|
||||||
|
User.objects.create_superuser("admin", password="pw-admin-123")
|
||||||
|
client.login(username="admin", password="pw-admin-123")
|
||||||
|
|
||||||
|
changelist_url = reverse("admin:core_sitesettings_changelist")
|
||||||
|
response = client.get(changelist_url)
|
||||||
|
|
||||||
|
settings_row = SiteSettings.objects.get() # created by the redirect itself
|
||||||
|
assert response.status_code == 302
|
||||||
|
assert response.url == reverse("admin:core_sitesettings_change", args=[settings_row.pk])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_admin_never_offers_add_or_delete(client):
|
||||||
|
# ModelAdmin.has_add_permission/has_delete_permission returning False
|
||||||
|
# makes Django raise PermissionDenied rather than build a 403 response
|
||||||
|
# directly — the test client's default behavior re-raises that for
|
||||||
|
# debugging convenience instead of returning it as a response.
|
||||||
|
client.raise_request_exception = False
|
||||||
|
|
||||||
|
User.objects.create_superuser("admin", password="pw-admin-123")
|
||||||
|
client.login(username="admin", password="pw-admin-123")
|
||||||
|
|
||||||
|
response = client.get(reverse("admin:core_sitesettings_add"))
|
||||||
|
assert response.status_code == 403
|
||||||
|
|
||||||
|
settings_row = SiteSettings.load()
|
||||||
|
delete_url = reverse("admin:core_sitesettings_delete", args=[settings_row.pk])
|
||||||
|
response = client.get(delete_url)
|
||||||
|
assert response.status_code == 403
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 5.2.18 on 2026-10-31 18:56
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("feeds", "0003_feed_claimed_at"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="feed",
|
||||||
|
name="fetch_interval_minutes",
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -35,8 +35,10 @@ class Feed(models.Model):
|
|||||||
)
|
)
|
||||||
last_error_message = models.TextField(blank=True)
|
last_error_message = models.TextField(blank=True)
|
||||||
|
|
||||||
# Instance-wide, not a per-user preference — see class docstring.
|
# The poll interval itself is site-wide now (apps.core.models.
|
||||||
fetch_interval_minutes = models.PositiveIntegerField(default=60)
|
# SiteSettings), not per-feed — only the error-driven backoff on top
|
||||||
|
# of it still varies per feed (see apps.feeds.services.fetcher.
|
||||||
|
# effective_interval_minutes).
|
||||||
fetch_error_count = models.PositiveIntegerField(default=0)
|
fetch_error_count = models.PositiveIntegerField(default=0)
|
||||||
is_active = models.BooleanField(default=True)
|
is_active = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
|||||||
@@ -124,14 +124,17 @@ def _entry_content_html(entry) -> str:
|
|||||||
return getattr(entry, "summary", "") or ""
|
return getattr(entry, "summary", "") or ""
|
||||||
|
|
||||||
|
|
||||||
def effective_interval_minutes(feed: Feed) -> int:
|
def effective_interval_minutes(feed: Feed, configured_interval_minutes: int) -> int:
|
||||||
"""The actual polling interval to use, applying exponential backoff on
|
"""The actual polling interval to use for `feed`, applying exponential
|
||||||
top of the admin-configured ``fetch_interval_minutes`` for feeds that
|
backoff on top of the site-wide `configured_interval_minutes` (see
|
||||||
are currently erroring. ``fetch_interval_minutes`` itself is never
|
apps.core.models.SiteSettings) for a feed that's currently erroring.
|
||||||
mutated by the fetcher — it's the admin's chosen baseline.
|
Takes the configured value as a parameter rather than querying
|
||||||
|
SiteSettings itself, since this runs once per feed (apps.feeds.tasks
|
||||||
|
calls it from a list comprehension over every active feed) and the
|
||||||
|
site-wide value doesn't vary by feed.
|
||||||
"""
|
"""
|
||||||
floor = getattr(settings, "EVECTION_MIN_FETCH_INTERVAL_MINUTES", 15)
|
floor = getattr(settings, "EVECTION_MIN_FETCH_INTERVAL_MINUTES", 15)
|
||||||
base = max(feed.fetch_interval_minutes, floor)
|
base = max(configured_interval_minutes, floor)
|
||||||
if feed.fetch_error_count <= 0:
|
if feed.fetch_error_count <= 0:
|
||||||
return base
|
return base
|
||||||
backoff = base * (2**feed.fetch_error_count)
|
backoff = base * (2**feed.fetch_error_count)
|
||||||
|
|||||||
+8
-4
@@ -8,6 +8,7 @@ from django.db.models import Q
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from apps.articles.tasks import apply_filter_rules_for_feed
|
from apps.articles.tasks import apply_filter_rules_for_feed
|
||||||
|
from apps.core.models import SiteSettings
|
||||||
|
|
||||||
from .models import Feed
|
from .models import Feed
|
||||||
from .opml import import_opml
|
from .opml import import_opml
|
||||||
@@ -32,12 +33,15 @@ def poll_due_feeds():
|
|||||||
"""
|
"""
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
claim_stale_before = now - timedelta(minutes=CLAIM_STALE_MINUTES)
|
claim_stale_before = now - timedelta(minutes=CLAIM_STALE_MINUTES)
|
||||||
|
# Loaded once per call, not per feed — the interval is site-wide
|
||||||
|
# (apps.core.models.SiteSettings), so every feed below shares it.
|
||||||
|
configured_interval = SiteSettings.load().fetch_interval_minutes
|
||||||
due_feed_ids = [
|
due_feed_ids = [
|
||||||
feed.id
|
feed.id
|
||||||
for feed in Feed.objects.filter(is_active=True).only(
|
for feed in Feed.objects.filter(is_active=True).only(
|
||||||
"id", "last_fetched_at", "fetch_interval_minutes", "fetch_error_count"
|
"id", "last_fetched_at", "fetch_error_count"
|
||||||
)
|
)
|
||||||
if _is_due(feed)
|
if _is_due(feed, configured_interval)
|
||||||
]
|
]
|
||||||
claimed_ids = []
|
claimed_ids = []
|
||||||
for feed_id in due_feed_ids:
|
for feed_id in due_feed_ids:
|
||||||
@@ -57,10 +61,10 @@ def poll_due_feeds():
|
|||||||
return len(claimed_ids)
|
return len(claimed_ids)
|
||||||
|
|
||||||
|
|
||||||
def _is_due(feed: Feed) -> bool:
|
def _is_due(feed: Feed, configured_interval_minutes: int) -> bool:
|
||||||
if feed.last_fetched_at is None:
|
if feed.last_fetched_at is None:
|
||||||
return True
|
return True
|
||||||
interval = effective_interval_minutes(feed)
|
interval = effective_interval_minutes(feed, configured_interval_minutes)
|
||||||
return feed.last_fetched_at <= timezone.now() - timedelta(minutes=interval)
|
return feed.last_fetched_at <= timezone.now() - timedelta(minutes=interval)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ def test_unparseable_feed_records_error_and_backs_off(feed):
|
|||||||
|
|
||||||
assert result.status == Feed.STATUS_ERROR
|
assert result.status == Feed.STATUS_ERROR
|
||||||
assert feed.fetch_error_count == 1
|
assert feed.fetch_error_count == 1
|
||||||
assert effective_interval_minutes(feed) > feed.fetch_interval_minutes
|
assert effective_interval_minutes(feed, 60) > 60
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
@@ -16,17 +16,14 @@ def test_poll_due_feeds_dispatches_only_due_feeds():
|
|||||||
recently_fetched = Feed.objects.create(
|
recently_fetched = Feed.objects.create(
|
||||||
feed_url="https://b.example.com/feed.xml",
|
feed_url="https://b.example.com/feed.xml",
|
||||||
last_fetched_at=timezone.now(),
|
last_fetched_at=timezone.now(),
|
||||||
fetch_interval_minutes=60,
|
|
||||||
)
|
)
|
||||||
overdue = Feed.objects.create(
|
overdue = Feed.objects.create(
|
||||||
feed_url="https://c.example.com/feed.xml",
|
feed_url="https://c.example.com/feed.xml",
|
||||||
last_fetched_at=timezone.now() - timedelta(hours=2),
|
last_fetched_at=timezone.now() - timedelta(hours=2),
|
||||||
fetch_interval_minutes=60,
|
|
||||||
)
|
)
|
||||||
inactive_but_overdue = Feed.objects.create(
|
inactive_but_overdue = Feed.objects.create(
|
||||||
feed_url="https://d.example.com/feed.xml",
|
feed_url="https://d.example.com/feed.xml",
|
||||||
last_fetched_at=timezone.now() - timedelta(hours=2),
|
last_fetched_at=timezone.now() - timedelta(hours=2),
|
||||||
fetch_interval_minutes=60,
|
|
||||||
is_active=False,
|
is_active=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -48,7 +45,6 @@ def test_poll_due_feeds_does_not_reclaim_a_feed_it_just_claimed():
|
|||||||
overdue = Feed.objects.create(
|
overdue = Feed.objects.create(
|
||||||
feed_url="https://c.example.com/feed.xml",
|
feed_url="https://c.example.com/feed.xml",
|
||||||
last_fetched_at=timezone.now() - timedelta(hours=2),
|
last_fetched_at=timezone.now() - timedelta(hours=2),
|
||||||
fetch_interval_minutes=60,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch("apps.feeds.tasks.fetch_feed.delay") as mock_delay:
|
with patch("apps.feeds.tasks.fetch_feed.delay") as mock_delay:
|
||||||
@@ -69,7 +65,6 @@ def test_poll_due_feeds_reclaims_a_stale_claim():
|
|||||||
overdue = Feed.objects.create(
|
overdue = Feed.objects.create(
|
||||||
feed_url="https://c.example.com/feed.xml",
|
feed_url="https://c.example.com/feed.xml",
|
||||||
last_fetched_at=timezone.now() - timedelta(hours=2),
|
last_fetched_at=timezone.now() - timedelta(hours=2),
|
||||||
fetch_interval_minutes=60,
|
|
||||||
claimed_at=timezone.now() - timedelta(minutes=CLAIM_STALE_MINUTES + 1),
|
claimed_at=timezone.now() - timedelta(minutes=CLAIM_STALE_MINUTES + 1),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ At minimum, set the following in `.env`:
|
|||||||
- `EVECTION_GUNICORN_BIND` — the `address:port` gunicorn listens on; see
|
- `EVECTION_GUNICORN_BIND` — the `address:port` gunicorn listens on; see
|
||||||
"Reverse proxy" below for how to pick this
|
"Reverse proxy" below for how to pick this
|
||||||
|
|
||||||
|
How often every feed is polled is a site-wide setting (Django admin → Site
|
||||||
|
settings), not a `.env` value — `EVECTION_MIN_FETCH_INTERVAL_MINUTES` only sets
|
||||||
|
a floor under it, so it can't be configured lower than that without editing `.env`.
|
||||||
|
|
||||||
Evection reads `config.settings.prod` when run via the commands below (see each
|
Evection reads `config.settings.prod` when run via the commands below (see each
|
||||||
systemd unit's `DJANGO_SETTINGS_MODULE`). That module turns on HTTPS-only cookies,
|
systemd unit's `DJANGO_SETTINGS_MODULE`). That module turns on HTTPS-only cookies,
|
||||||
HSTS, and a Content-Security-Policy header on top of the base settings, and
|
HSTS, and a Content-Security-Policy header on top of the base settings, and
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
(function () {
|
||||||
|
// Everything is stored and server-rendered in UTC (config.settings.base
|
||||||
|
// TIME_ZONE) — these <time datetime="..."> elements carry that UTC
|
||||||
|
// instant plus a UTC-formatted fallback as their initial text, and this
|
||||||
|
// reformats them using the browser's own timezone, client-side, so the
|
||||||
|
// server never needs to know (or guess) where the viewer actually is.
|
||||||
|
var SHORT_OPTIONS = { hour: "numeric", minute: "2-digit" };
|
||||||
|
var LONG_OPTIONS = {
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
};
|
||||||
|
|
||||||
|
function localizeTimesWithin(root) {
|
||||||
|
if (!root || typeof root.querySelectorAll !== "function") return;
|
||||||
|
root.querySelectorAll("time[data-local-format]").forEach(function (el) {
|
||||||
|
var iso = el.getAttribute("datetime");
|
||||||
|
if (!iso) return;
|
||||||
|
var date = new Date(iso);
|
||||||
|
if (isNaN(date.getTime())) return;
|
||||||
|
var options = el.dataset.localFormat === "short" ? SHORT_OPTIONS : LONG_OPTIONS;
|
||||||
|
try {
|
||||||
|
el.textContent = date.toLocaleString(undefined, options);
|
||||||
|
} catch (e) {
|
||||||
|
/* Intl unavailable or threw — leave the server-rendered UTC text as-is */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
localizeTimesWithin(document);
|
||||||
|
|
||||||
|
// Article rows/content are frequently swapped in by htmx (pagination,
|
||||||
|
// the inline expand-article view, the dashboard's retry action) without
|
||||||
|
// a full page load, so every swap needs the same pass over just the
|
||||||
|
// new content.
|
||||||
|
document.body.addEventListener("htmx:afterSwap", function (event) {
|
||||||
|
localizeTimesWithin(event.target);
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="{% static 'js/stream.js' %}" defer></script>
|
<script src="{% static 'js/stream.js' %}" defer></script>
|
||||||
|
<script src="{% static 'js/localize-times.js' %}" defer></script>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<script src="{% static 'js/theme.js' %}" defer></script>
|
<script src="{% static 'js/theme.js' %}" defer></script>
|
||||||
<script src="{% static 'js/sidebar-state.js' %}" defer></script>
|
<script src="{% static 'js/sidebar-state.js' %}" defer></script>
|
||||||
|
|||||||
@@ -31,7 +31,13 @@
|
|||||||
<td>{{ feed.subscriber_count }}</td>
|
<td>{{ feed.subscriber_count }}</td>
|
||||||
<td>{{ feed.get_last_fetch_status_display }}</td>
|
<td>{{ feed.get_last_fetch_status_display }}</td>
|
||||||
<td>{{ feed.fetch_error_count }}</td>
|
<td>{{ feed.fetch_error_count }}</td>
|
||||||
<td>{{ feed.last_fetched_at|default:"never" }}</td>
|
<td>
|
||||||
|
{% if feed.last_fetched_at %}
|
||||||
|
<time datetime="{{ feed.last_fetched_at|date:"c" }}" data-local-format="long">{{ feed.last_fetched_at|date:"M j, Y H:i" }}</time>
|
||||||
|
{% else %}
|
||||||
|
never
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td>{{ feed.last_error_message|default:"—" }}</td>
|
<td>{{ feed.last_error_message|default:"—" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post" action="{% url 'core:retry_feed' feed.id %}">
|
<form method="post" action="{% url 'core:retry_feed' feed.id %}">
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
<h2 class="article-content-title">{{ article.title|default:"(untitled)" }}</h2>
|
<h2 class="article-content-title">{{ article.title|default:"(untitled)" }}</h2>
|
||||||
<p class="article-meta">
|
<p class="article-meta">
|
||||||
{% if article.feed.favicon_url %}<img src="{{ article.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
|
{% if article.feed.favicon_url %}<img src="{{ article.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
|
||||||
{{ article.feed.title }} · {{ article.published_at|date:"M j, Y H:i" }}
|
{{ article.feed.title }}
|
||||||
|
{% if article.published_at %}
|
||||||
|
· <time datetime="{{ article.published_at|date:"c" }}" data-local-format="long">{{ article.published_at|date:"M j, Y H:i" }}</time>
|
||||||
|
{% endif %}
|
||||||
{% if article.author %} · {{ article.author }}{% endif %}
|
{% if article.author %} · {{ article.author }}{% endif %}
|
||||||
{% if article.link %} · <a href="{{ article.link }}" target="_blank" rel="noopener noreferrer">Original ↗</a>{% endif %}
|
{% if article.link %} · <a href="{{ article.link }}" target="_blank" rel="noopener noreferrer">Original ↗</a>{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
<a href="{% url 'reader:article_detail' article.pk %}" class="article-title"
|
<a href="{% url 'reader:article_detail' article.pk %}" class="article-title"
|
||||||
data-inline-url="{% url 'reader:article_inline' article.pk %}"
|
data-inline-url="{% url 'reader:article_inline' article.pk %}"
|
||||||
onclick="return toggleArticle(event, {{ article.pk }})">{{ article.title|default:"(untitled)" }}</a>
|
onclick="return toggleArticle(event, {{ article.pk }})">{{ article.title|default:"(untitled)" }}</a>
|
||||||
<span class="article-time">{{ article.published_at|date:"g:i A" }}</span>
|
{% if article.published_at %}
|
||||||
|
<time class="article-time" datetime="{{ article.published_at|date:"c" }}" data-local-format="short">{{ article.published_at|date:"g:i A" }}</time>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div id="article-body-{{ article.pk }}" class="article-inline-body" hidden></div>
|
<div id="article-body-{{ article.pk }}" class="article-inline-body" hidden></div>
|
||||||
</li>
|
</li>
|
||||||
Reference in new issue
Block a user