Add OPML import/export and a subscriptions management page

Implements OPML parsing with defusedxml (untrusted upload, XXE risk)
and export with the stdlib's plain ElementTree (trusted, app-generated
output). Nesting deeper than one level flattens into its nearest
enclosing folder, matching the app's flat-folder model. Import reuses
existing Feed/Subscription rows via get_or_create, so re-importing the
same file is idempotent and cross-user Feed dedup is preserved.

Large imports (>50 entries) dispatch to a Celery task instead of
blocking the request; newly imported feeds aren't fetched immediately
since they have no last_fetched_at, so the next poll_due_feeds beat
cycle picks them up naturally.

Adds a Subscriptions page (replacing the standalone "Add feed" link in
nav) listing current subscriptions with unsubscribe, plus Import/
Export OPML actions.

Verified live: imported a 2-feed/1-folder OPML file against the
running dev server (via an authenticated session, since this browser
tool has no file-picker automation), confirmed the resulting
subscriptions and folder in the UI, exported and inspected the
resulting OPML structure, and unsubscribed from one feed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-30 16:41:18 -06:00
1 parent 8653dbeaf9
commit ea214dd9ce
11 files changed
+533 -3

No files matched your search

+8
View File
@@ -6,4 +6,12 @@ app_name = "feeds"
urlpatterns = [
path("feeds/add/", views.add_feed, name="add_feed"),
path("subscriptions/", views.subscription_list, name="subscription_list"),
path(
"subscriptions/<int:subscription_id>/unsubscribe/",
views.unsubscribe,
name="unsubscribe",
),
path("subscriptions/import/", views.import_opml_view, name="import_opml"),
path("subscriptions/export/", views.export_opml_view, name="export_opml"),
]