@rmdes/indiekit-endpoint-blogroll 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,17 @@ async function list(request, response) {
20
20
  const { application } = request.app.locals;
21
21
 
22
22
  try {
23
- const sources = await getSources(application);
23
+ const rawSources = await getSources(application);
24
+
25
+ // Convert Date objects to ISO strings for template date filter compatibility
26
+ const sources = rawSources.map((source) => ({
27
+ ...source,
28
+ lastSyncAt: source.lastSyncAt
29
+ ? (source.lastSyncAt instanceof Date
30
+ ? source.lastSyncAt.toISOString()
31
+ : source.lastSyncAt)
32
+ : null,
33
+ }));
24
34
 
25
35
  response.render("blogroll-sources", {
26
36
  title: request.__("blogroll.sources.title"),
@@ -83,25 +93,19 @@ async function create(request, response) {
83
93
  });
84
94
 
85
95
  // Trigger initial sync for OPML sources
86
- if (source.type === "opml_url" || source.type === "opml_file") {
87
- try {
88
- await syncOpmlSource(application, source);
89
- request.session.messages = [
90
- { type: "success", content: request.__("blogroll.sources.created_synced") },
91
- ];
92
- } catch (syncError) {
93
- request.session.messages = [
94
- {
95
- type: "warning",
96
- content: request.__("blogroll.sources.created_sync_failed", {
97
- error: syncError.message,
98
- }),
99
- },
100
- ];
101
- }
102
- } else {
96
+ try {
97
+ await syncOpmlSource(application, source);
98
+ request.session.messages = [
99
+ { type: "success", content: request.__("blogroll.sources.created_synced") },
100
+ ];
101
+ } catch (syncError) {
103
102
  request.session.messages = [
104
- { type: "success", content: request.__("blogroll.sources.created") },
103
+ {
104
+ type: "warning",
105
+ content: request.__("blogroll.sources.created_sync_failed", {
106
+ error: syncError.message,
107
+ }),
108
+ },
105
109
  ];
106
110
  }
107
111
 
package/locales/en.json CHANGED
@@ -32,30 +32,30 @@
32
32
  },
33
33
 
34
34
  "sources": {
35
- "title": "Sources",
36
- "manage": "Manage Sources",
37
- "add": "Add Source",
38
- "new": "New Source",
39
- "edit": "Edit Source",
40
- "create": "Create Source",
41
- "save": "Save Source",
42
- "empty": "No sources configured yet.",
43
- "recent": "Recent Sources",
35
+ "title": "OPML Sync",
36
+ "manage": "OPML Sync",
37
+ "add": "Add OPML Source",
38
+ "new": "New OPML Source",
39
+ "edit": "Edit OPML Source",
40
+ "create": "Create",
41
+ "save": "Save",
42
+ "empty": "No OPML sources configured. Use this to bulk-import blogs from FreshRSS or other feed readers.",
43
+ "recent": "OPML Sources",
44
44
  "interval": "Every %{minutes} min",
45
45
  "lastSync": "Last synced",
46
- "deleteConfirm": "Delete this source? Blogs imported from it will remain.",
47
- "created": "Source created successfully.",
48
- "created_synced": "Source created and synced successfully.",
49
- "created_sync_failed": "Source created, but sync failed: %{error}",
50
- "updated": "Source updated successfully.",
51
- "deleted": "Source deleted successfully.",
46
+ "deleteConfirm": "Delete this OPML source? Blogs imported from it will remain.",
47
+ "created": "OPML source created successfully.",
48
+ "created_synced": "OPML source created and synced successfully.",
49
+ "created_sync_failed": "OPML source created, but sync failed: %{error}",
50
+ "updated": "OPML source updated successfully.",
51
+ "deleted": "OPML source deleted successfully.",
52
52
  "synced": "Synced successfully. Added: %{added}, Updated: %{updated}",
53
53
  "form": {
54
54
  "name": "Name",
55
- "type": "Type",
56
- "typeHint": "How to import blogs from this source",
55
+ "type": "Import Type",
56
+ "typeHint": "URL syncs periodically, File is a one-time import",
57
57
  "url": "OPML URL",
58
- "urlHint": "URL of the OPML file to import",
58
+ "urlHint": "URL to your OPML file (e.g., FreshRSS export URL)",
59
59
  "opmlContent": "OPML Content",
60
60
  "opmlContentHint": "Paste the full OPML XML content here",
61
61
  "syncInterval": "Sync Interval",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-blogroll",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Blogroll endpoint for Indiekit. Aggregates blog feeds from OPML, JSON feeds, or manual entry.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -78,9 +78,8 @@
78
78
  <div class="br-field">
79
79
  <label for="type">{{ __("blogroll.sources.form.type") }}</label>
80
80
  <select id="type" name="type" required onchange="toggleTypeFields()">
81
- <option value="opml_url" {% if source.type == 'opml_url' %}selected{% endif %}>OPML URL</option>
82
- <option value="opml_file" {% if source.type == 'opml_file' %}selected{% endif %}>OPML File (paste content)</option>
83
- <option value="manual" {% if source.type == 'manual' %}selected{% endif %}>Manual (add blogs individually)</option>
81
+ <option value="opml_url" {% if source.type == 'opml_url' %}selected{% endif %}>OPML URL (auto-sync)</option>
82
+ <option value="opml_file" {% if source.type == 'opml_file' %}selected{% endif %}>OPML File (one-time import)</option>
84
83
  </select>
85
84
  <span class="br-field-hint">{{ __("blogroll.sources.form.typeHint") }}</span>
86
85
  </div>
@@ -134,9 +133,6 @@ function toggleTypeFields() {
134
133
  } else if (type === 'opml_file') {
135
134
  urlField.style.display = 'none';
136
135
  opmlContentField.style.display = 'flex';
137
- } else {
138
- urlField.style.display = 'none';
139
- opmlContentField.style.display = 'none';
140
136
  }
141
137
  }
142
138