@rmdes/indiekit-endpoint-podroll 1.0.0 → 1.0.2
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/sync.js +16 -1
- package/package.json +1 -1
package/lib/sync.js
CHANGED
|
@@ -106,6 +106,21 @@ async function fetchOpmlSources(url, timeout) {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Decode HTML entities in URLs (FreshRSS returns XML-encoded URLs)
|
|
111
|
+
* @param {string} str
|
|
112
|
+
* @returns {string}
|
|
113
|
+
*/
|
|
114
|
+
function decodeHtmlEntities(str) {
|
|
115
|
+
if (!str) return str;
|
|
116
|
+
return str
|
|
117
|
+
.replace(/&/g, "&")
|
|
118
|
+
.replace(/</g, "<")
|
|
119
|
+
.replace(/>/g, ">")
|
|
120
|
+
.replace(/"/g, '"')
|
|
121
|
+
.replace(/'/g, "'");
|
|
122
|
+
}
|
|
123
|
+
|
|
109
124
|
/**
|
|
110
125
|
* Transform FreshRSS episode to our schema
|
|
111
126
|
* @param {object} item - FreshRSS item
|
|
@@ -117,7 +132,7 @@ function transformEpisode(item) {
|
|
|
117
132
|
if (item.enclosure && item.enclosure.length > 0) {
|
|
118
133
|
const enc = item.enclosure[0];
|
|
119
134
|
enclosure = {
|
|
120
|
-
url: enc.href || enc.url,
|
|
135
|
+
url: decodeHtmlEntities(enc.href || enc.url),
|
|
121
136
|
type: enc.type || "audio/mpeg",
|
|
122
137
|
length: enc.length ? parseInt(enc.length, 10) : 0,
|
|
123
138
|
};
|
package/package.json
CHANGED