diff --git a/lib/controllers/sources.js b/lib/controllers/sources.js index 180f7e0..49a46e1 100644 --- a/lib/controllers/sources.js +++ b/lib/controllers/sources.js @@ -20,7 +20,17 @@ async function list(request, response) { const { application } = request.app.locals; try { - const sources = await getSources(application); + const rawSources = await getSources(application); + + // Convert Date objects to ISO strings for template date filter compatibility + const sources = rawSources.map((source) => ({ + ...source, + lastSyncAt: source.lastSyncAt + ? (source.lastSyncAt instanceof Date + ? source.lastSyncAt.toISOString() + : source.lastSyncAt) + : null, + })); response.render("blogroll-sources", { title: request.__("blogroll.sources.title"), @@ -83,25 +93,19 @@ async function create(request, response) { }); // Trigger initial sync for OPML sources - if (source.type === "opml_url" || source.type === "opml_file") { - try { - await syncOpmlSource(application, source); - request.session.messages = [ - { type: "success", content: request.__("blogroll.sources.created_synced") }, - ]; - } catch (syncError) { - request.session.messages = [ - { - type: "warning", - content: request.__("blogroll.sources.created_sync_failed", { - error: syncError.message, - }), - }, - ]; - } - } else { + try { + await syncOpmlSource(application, source); request.session.messages = [ - { type: "success", content: request.__("blogroll.sources.created") }, + { type: "success", content: request.__("blogroll.sources.created_synced") }, + ]; + } catch (syncError) { + request.session.messages = [ + { + type: "warning", + content: request.__("blogroll.sources.created_sync_failed", { + error: syncError.message, + }), + }, ]; } diff --git a/locales/en.json b/locales/en.json index f826078..95e5aac 100644 --- a/locales/en.json +++ b/locales/en.json @@ -32,30 +32,30 @@ }, "sources": { - "title": "Sources", - "manage": "Manage Sources", - "add": "Add Source", - "new": "New Source", - "edit": "Edit Source", - "create": "Create Source", - "save": "Save Source", - "empty": "No sources configured yet.", - "recent": "Recent Sources", + "title": "OPML Sync", + "manage": "OPML Sync", + "add": "Add OPML Source", + "new": "New OPML Source", + "edit": "Edit OPML Source", + "create": "Create", + "save": "Save", + "empty": "No OPML sources configured. Use this to bulk-import blogs from FreshRSS or other feed readers.", + "recent": "OPML Sources", "interval": "Every %{minutes} min", "lastSync": "Last synced", - "deleteConfirm": "Delete this source? Blogs imported from it will remain.", - "created": "Source created successfully.", - "created_synced": "Source created and synced successfully.", - "created_sync_failed": "Source created, but sync failed: %{error}", - "updated": "Source updated successfully.", - "deleted": "Source deleted successfully.", + "deleteConfirm": "Delete this OPML source? Blogs imported from it will remain.", + "created": "OPML source created successfully.", + "created_synced": "OPML source created and synced successfully.", + "created_sync_failed": "OPML source created, but sync failed: %{error}", + "updated": "OPML source updated successfully.", + "deleted": "OPML source deleted successfully.", "synced": "Synced successfully. Added: %{added}, Updated: %{updated}", "form": { "name": "Name", - "type": "Type", - "typeHint": "How to import blogs from this source", + "type": "Import Type", + "typeHint": "URL syncs periodically, File is a one-time import", "url": "OPML URL", - "urlHint": "URL of the OPML file to import", + "urlHint": "URL to your OPML file (e.g., FreshRSS export URL)", "opmlContent": "OPML Content", "opmlContentHint": "Paste the full OPML XML content here", "syncInterval": "Sync Interval", diff --git a/package.json b/package.json index f8280f4..6ed160e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-blogroll", - "version": "1.0.4", + "version": "1.0.5", "description": "Blogroll endpoint for Indiekit. Aggregates blog feeds from OPML, JSON feeds, or manual entry.", "keywords": [ "indiekit", diff --git a/views/blogroll-source-edit.njk b/views/blogroll-source-edit.njk index 595e697..4395191 100644 --- a/views/blogroll-source-edit.njk +++ b/views/blogroll-source-edit.njk @@ -78,9 +78,8 @@