@rmdes/indiekit-endpoint-blogroll 1.0.4 → 1.0.6
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/lib/controllers/sources.js +23 -19
- package/locales/en.json +18 -18
- package/package.json +1 -1
- package/views/blogroll-blog-edit.njk +2 -0
- package/views/blogroll-source-edit.njk +4 -6
|
@@ -20,7 +20,17 @@ async function list(request, response) {
|
|
|
20
20
|
const { application } = request.app.locals;
|
|
21
21
|
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
request.
|
|
90
|
-
|
|
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
|
-
{
|
|
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": "
|
|
36
|
-
"manage": "
|
|
37
|
-
"add": "Add Source",
|
|
38
|
-
"new": "New Source",
|
|
39
|
-
"edit": "Edit Source",
|
|
40
|
-
"create": "Create
|
|
41
|
-
"save": "Save
|
|
42
|
-
"empty": "No sources configured
|
|
43
|
-
"recent": "
|
|
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": "
|
|
48
|
-
"created_synced": "
|
|
49
|
-
"created_sync_failed": "
|
|
50
|
-
"updated": "
|
|
51
|
-
"deleted": "
|
|
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": "
|
|
55
|
+
"type": "Import Type",
|
|
56
|
+
"typeHint": "URL syncs periodically, File is a one-time import",
|
|
57
57
|
"url": "OPML URL",
|
|
58
|
-
"urlHint": "URL
|
|
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
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.br-field-inline input[type="checkbox"] {
|
|
57
|
+
appearance: auto;
|
|
57
58
|
width: auto;
|
|
59
|
+
cursor: pointer;
|
|
58
60
|
}
|
|
59
61
|
</style>
|
|
60
62
|
|
|
@@ -78,9 +80,8 @@
|
|
|
78
80
|
<div class="br-field">
|
|
79
81
|
<label for="type">{{ __("blogroll.sources.form.type") }}</label>
|
|
80
82
|
<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 (
|
|
83
|
-
<option value="manual" {% if source.type == 'manual' %}selected{% endif %}>Manual (add blogs individually)</option>
|
|
83
|
+
<option value="opml_url" {% if source.type == 'opml_url' %}selected{% endif %}>OPML URL (auto-sync)</option>
|
|
84
|
+
<option value="opml_file" {% if source.type == 'opml_file' %}selected{% endif %}>OPML File (one-time import)</option>
|
|
84
85
|
</select>
|
|
85
86
|
<span class="br-field-hint">{{ __("blogroll.sources.form.typeHint") }}</span>
|
|
86
87
|
</div>
|
|
@@ -134,9 +135,6 @@ function toggleTypeFields() {
|
|
|
134
135
|
} else if (type === 'opml_file') {
|
|
135
136
|
urlField.style.display = 'none';
|
|
136
137
|
opmlContentField.style.display = 'flex';
|
|
137
|
-
} else {
|
|
138
|
-
urlField.style.display = 'none';
|
|
139
|
-
opmlContentField.style.display = 'none';
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
|