@rmdes/indiekit-endpoint-rss 1.0.9 → 1.0.11

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.
package/assets/styles.css CHANGED
@@ -75,28 +75,6 @@
75
75
  to { transform: rotate(360deg); }
76
76
  }
77
77
 
78
- /* Add feed form */
79
- .rss-add-form {
80
- display: flex;
81
- gap: var(--space-xs);
82
- }
83
-
84
- .rss-add-form input {
85
- appearance: none;
86
- background-color: var(--color-background);
87
- border: 1px solid var(--color-border);
88
- border-radius: var(--radius-s);
89
- flex: 1;
90
- font-size: var(--step--1);
91
- padding: var(--space-2xs) var(--space-s);
92
- }
93
-
94
- .rss-add-form input:focus {
95
- border-color: var(--color-accent);
96
- outline: 2px solid var(--color-accent);
97
- outline-offset: 1px;
98
- }
99
-
100
78
  /* Feed list */
101
79
  .rss-feed-list {
102
80
  list-style: none;
@@ -68,7 +68,7 @@ export const dashboardController = {
68
68
  totalItems,
69
69
  syncState: {
70
70
  syncing: syncState.syncing,
71
- lastSync: syncState.lastSync?.toISOString(),
71
+ lastSync: syncState.lastSync,
72
72
  lastError: syncState.lastError,
73
73
  },
74
74
  mountPath: request.baseUrl,
package/lib/sync.js CHANGED
@@ -93,7 +93,7 @@ export async function runSync(dbOrIndiekit, options) {
93
93
  const feeds = await feedsCollection.find({ enabled: true }).toArray();
94
94
 
95
95
  if (feeds.length === 0) {
96
- syncState.lastSync = new Date();
96
+ syncState.lastSync = new Date().toISOString();
97
97
  syncState.syncing = false;
98
98
  return { feedsProcessed: 0, itemsAdded: 0 };
99
99
  }
@@ -124,7 +124,7 @@ export async function runSync(dbOrIndiekit, options) {
124
124
  retentionDays,
125
125
  );
126
126
 
127
- syncState.lastSync = new Date();
127
+ syncState.lastSync = new Date().toISOString();
128
128
  syncState.syncing = false;
129
129
 
130
130
  console.log(
@@ -176,7 +176,7 @@ async function syncFeed(
176
176
  siteUrl: feedMeta.siteUrl,
177
177
  description: feedMeta.description,
178
178
  imageUrl: feedMeta.imageUrl,
179
- lastFetchedAt: new Date(),
179
+ lastFetchedAt: new Date().toISOString(),
180
180
  lastError: null,
181
181
  },
182
182
  }
@@ -196,7 +196,7 @@ async function syncFeed(
196
196
  feedId: feed._id,
197
197
  feedTitle: feedMeta.title,
198
198
  ...item,
199
- fetchedAt: new Date(),
199
+ fetchedAt: new Date().toISOString(),
200
200
  },
201
201
  },
202
202
  { upsert: true }
@@ -230,7 +230,7 @@ async function syncFeed(
230
230
  { _id: feed._id },
231
231
  {
232
232
  $set: {
233
- lastFetchedAt: new Date(),
233
+ lastFetchedAt: new Date().toISOString(),
234
234
  lastError: lastError,
235
235
  },
236
236
  }
package/lib/utils.js CHANGED
@@ -1,5 +1,18 @@
1
1
  import sanitizeHtmlLib from "sanitize-html";
2
2
 
3
+ /**
4
+ * Ensure a value is an ISO 8601 date string.
5
+ * Handles both Date objects (old MongoDB data) and strings (new data).
6
+ * @param {*} value - Date object, ISO string, or null
7
+ * @returns {string|null} ISO string or null
8
+ */
9
+ function toISO(value) {
10
+ if (!value) return null;
11
+ if (value instanceof Date) return value.toISOString();
12
+ if (typeof value === "string") return value;
13
+ return null;
14
+ }
15
+
3
16
  /**
4
17
  * Sanitize HTML content - strip dangerous tags, keep basic formatting
5
18
  * @param {string} html - Raw HTML
@@ -116,10 +129,10 @@ export function formatItem(item, options = {}) {
116
129
  link: item.link,
117
130
  description: description || "",
118
131
  author: item.author,
119
- pubDate: item.pubDate?.toISOString(),
132
+ pubDate: toISO(item.pubDate),
120
133
  imageUrl: item.imageUrl,
121
134
  categories: item.categories || [],
122
- fetchedAt: item.fetchedAt?.toISOString(),
135
+ fetchedAt: toISO(item.fetchedAt),
123
136
  // Source info for aggregators (like FreshRSS) - represents the original feed
124
137
  sourceTitle: item.sourceTitle || null,
125
138
  sourceUrl: item.sourceUrl || null,
@@ -155,8 +168,8 @@ export function formatFeed(feed) {
155
168
  description: feed.description,
156
169
  imageUrl: feed.imageUrl,
157
170
  enabled: feed.enabled,
158
- addedAt: feed.addedAt?.toISOString(),
159
- lastFetchedAt: feed.lastFetchedAt?.toISOString(),
171
+ addedAt: toISO(feed.addedAt),
172
+ lastFetchedAt: toISO(feed.lastFetchedAt),
160
173
  lastError: feed.lastError,
161
174
  itemCount: feed.itemCount || 0,
162
175
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-rss",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "RSS feed reader endpoint for Indiekit. Aggregates multiple feeds, caches in MongoDB, displays on frontend.",
5
5
  "keywords": [
6
6
  "indiekit",
package/views/rss.njk CHANGED
@@ -63,8 +63,9 @@
63
63
 
64
64
  {# Add Feed Form #}
65
65
  {% call section({ title: __("rss.addFeed") }) %}
66
- <form class="rss-add-form" action="{{ mountPath }}/api/feeds" method="post" id="add-feed-form">
66
+ <form class="input-button-group" action="{{ mountPath }}/api/feeds" method="post" id="add-feed-form">
67
67
  <input
68
+ class="input"
68
69
  type="url"
69
70
  name="url"
70
71
  placeholder="{{ __("rss.feedUrlPlaceholder") }}"