@rmdes/indiekit-endpoint-blogroll 1.0.1 → 1.0.3

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.
@@ -38,7 +38,7 @@ async function list(request, response) {
38
38
  // Get unique categories for filter dropdown
39
39
  const categories = [...new Set(blogs.map((b) => b.category).filter(Boolean))];
40
40
 
41
- response.render("blogs", {
41
+ response.render("blogroll-blogs", {
42
42
  title: request.__("blogroll.blogs.title"),
43
43
  blogs: filteredBlogs,
44
44
  categories,
@@ -60,7 +60,7 @@ async function list(request, response) {
60
60
  * GET /blogs/new
61
61
  */
62
62
  function newForm(request, response) {
63
- response.render("blog-edit", {
63
+ response.render("blogroll-blog-edit", {
64
64
  title: request.__("blogroll.blogs.new"),
65
65
  blog: null,
66
66
  isNew: true,
@@ -159,7 +159,7 @@ async function edit(request, response) {
159
159
 
160
160
  const items = await getItemsForBlog(application, blog._id, 10);
161
161
 
162
- response.render("blog-edit", {
162
+ response.render("blogroll-blog-edit", {
163
163
  title: request.__("blogroll.blogs.edit"),
164
164
  blog,
165
165
  items,
@@ -16,7 +16,7 @@ async function get(request, response) {
16
16
  const { application } = request.app.locals;
17
17
 
18
18
  try {
19
- const [sources, blogs, blogCount, itemCount, syncStatus] = await Promise.all([
19
+ const [rawSources, blogs, blogCount, itemCount, syncStatus] = await Promise.all([
20
20
  getSources(application),
21
21
  getBlogs(application, { limit: 10 }),
22
22
  countBlogs(application),
@@ -24,11 +24,21 @@ async function get(request, response) {
24
24
  getSyncStatus(application),
25
25
  ]);
26
26
 
27
+ // Convert Date objects to ISO strings for template date filter compatibility
28
+ const sources = rawSources.map((source) => ({
29
+ ...source,
30
+ lastSyncAt: source.lastSyncAt
31
+ ? (source.lastSyncAt instanceof Date
32
+ ? source.lastSyncAt.toISOString()
33
+ : source.lastSyncAt)
34
+ : null,
35
+ }));
36
+
27
37
  // Get blogs with errors
28
38
  const errorBlogs = await getBlogs(application, { includeHidden: true, limit: 100 });
29
39
  const blogsWithErrors = errorBlogs.filter((b) => b.status === "error");
30
40
 
31
- response.render("dashboard", {
41
+ response.render("blogroll-dashboard", {
32
42
  title: request.__("blogroll.title"),
33
43
  sources,
34
44
  recentBlogs: blogs,
@@ -22,7 +22,7 @@ async function list(request, response) {
22
22
  try {
23
23
  const sources = await getSources(application);
24
24
 
25
- response.render("sources", {
25
+ response.render("blogroll-sources", {
26
26
  title: request.__("blogroll.sources.title"),
27
27
  sources,
28
28
  baseUrl: request.baseUrl,
@@ -41,7 +41,7 @@ async function list(request, response) {
41
41
  * GET /sources/new
42
42
  */
43
43
  function newForm(request, response) {
44
- response.render("source-edit", {
44
+ response.render("blogroll-source-edit", {
45
45
  title: request.__("blogroll.sources.new"),
46
46
  source: null,
47
47
  isNew: true,
@@ -130,7 +130,7 @@ async function edit(request, response) {
130
130
  return response.status(404).render("404");
131
131
  }
132
132
 
133
- response.render("source-edit", {
133
+ response.render("blogroll-source-edit", {
134
134
  title: request.__("blogroll.sources.edit"),
135
135
  source,
136
136
  isNew: false,
@@ -150,12 +150,19 @@ export async function getSyncStatus(application) {
150
150
  db.collection("blogrollMeta").findOne({ key: "syncStats" }),
151
151
  ]);
152
152
 
153
+ // Convert Date to ISO string for template date filter compatibility
154
+ const lastSync = syncStats?.lastFullSync
155
+ ? (syncStats.lastFullSync instanceof Date
156
+ ? syncStats.lastFullSync.toISOString()
157
+ : syncStats.lastFullSync)
158
+ : null;
159
+
153
160
  return {
154
161
  status: "ok",
155
162
  isRunning,
156
163
  blogs: { count: blogCount },
157
164
  items: { count: itemCount },
158
- lastSync: syncStats?.lastFullSync || null,
165
+ lastSync,
159
166
  lastSyncStats: syncStats || null,
160
167
  };
161
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-blogroll",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Blogroll endpoint for Indiekit. Aggregates blog feeds from OPML, JSON feeds, or manual entry.",
5
5
  "keywords": [
6
6
  "indiekit",
File without changes
File without changes
File without changes
File without changes