@eeacms/volto-cca-policy 0.3.122 → 0.3.124
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [0.3.124](https://github.com/eea/volto-cca-policy/compare/0.3.123...0.3.124) - 12 May 2026
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fixes
|
|
10
|
+
|
|
11
|
+
- fix: remove error logging from RSS middleware [kreafox - [`eae5722`](https://github.com/eea/volto-cca-policy/commit/eae5722a3c438542156a69344fa88e826e01c58a)]
|
|
12
|
+
- fix: remove localhost fallback from RSS middleware [kreafox - [`6a3eba6`](https://github.com/eea/volto-cca-policy/commit/6a3eba614ba7158a9ccb95d43456b3555ec95c6d)]
|
|
13
|
+
- fix: redo some changes, cleanup, improve image generation, use addHeadersFactory from volto [kreafox - [`94784a5`](https://github.com/eea/volto-cca-policy/commit/94784a5ab00a9e97b713ee4d9cd8d1ccc2adaec2)]
|
|
14
|
+
- fix: normalize API path handling in RSS middleware [kreafox - [`f8ba94c`](https://github.com/eea/volto-cca-policy/commit/f8ba94c500ebabd7938547620dad3b673b8f1d5f)]
|
|
15
|
+
- fix: normalize API path handling in RSS middleware [kreafox - [`4ce5633`](https://github.com/eea/volto-cca-policy/commit/4ce5633ec048132c07fc461d08d4ea3a8c6caa00)]
|
|
16
|
+
|
|
17
|
+
### [0.3.123](https://github.com/eea/volto-cca-policy/compare/0.3.122...0.3.123) - 11 May 2026
|
|
18
|
+
|
|
19
|
+
#### :bug: Bug Fixes
|
|
20
|
+
|
|
21
|
+
- fix: improve error logging [kreafox - [`58bfd70`](https://github.com/eea/volto-cca-policy/commit/58bfd70ce2155de6f8a773b8bcf9482ceb704211)]
|
|
22
|
+
- fix: add error logging in RSS middleware [kreafox - [`048d715`](https://github.com/eea/volto-cca-policy/commit/048d7154a118367a1ce4c6660c71517f8f049d55)]
|
|
23
|
+
- fix: improve image URL resolution [kreafox - [`f3e2e32`](https://github.com/eea/volto-cca-policy/commit/f3e2e323b8d9c9a77e1656c1f2f8a09592733b86)]
|
|
24
|
+
|
|
7
25
|
### [0.3.122](https://github.com/eea/volto-cca-policy/compare/0.3.121...0.3.122) - 8 May 2026
|
|
8
26
|
|
|
9
27
|
#### :bug: Bug Fixes
|
|
@@ -298,7 +316,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
298
316
|
|
|
299
317
|
#### :house: Internal changes
|
|
300
318
|
|
|
301
|
-
- chore: [JENKINSFILE] add package version in sonarqube [valentinab25 - [`e901251`](https://github.com/eea/volto-cca-policy/commit/e901251592eb54609fbc7eb8fcf7bd452c2da9cd)]
|
|
302
319
|
|
|
303
320
|
### [0.3.102](https://github.com/eea/volto-cca-policy/compare/0.3.101...0.3.102) - 24 February 2026
|
|
304
321
|
|
|
@@ -308,7 +325,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
308
325
|
|
|
309
326
|
#### :house: Internal changes
|
|
310
327
|
|
|
311
|
-
- chore: [JENKINSFILE] use sonarqube branches [EEA Jenkins - [`8b3699a`](https://github.com/eea/volto-cca-policy/commit/8b3699a6cbaef662b5e80884ac2c1f7dc9c6591e)]
|
|
312
328
|
|
|
313
329
|
### [0.3.101](https://github.com/eea/volto-cca-policy/compare/0.3.100...0.3.101) - 28 January 2026
|
|
314
330
|
|
|
@@ -596,7 +612,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
596
612
|
- style: fix item spacing [kreafox - [`7d4535d`](https://github.com/eea/volto-cca-policy/commit/7d4535dbc486e6cb80fc55d6ac8c7c01d9cf48af)]
|
|
597
613
|
- chore: code cleanup [kreafox - [`842419b`](https://github.com/eea/volto-cca-policy/commit/842419b1bce3dc624755c81c9dea672198cab9e2)]
|
|
598
614
|
- style: update teaser block styling [kreafox - [`1e0cad8`](https://github.com/eea/volto-cca-policy/commit/1e0cad8e1ed3ae827ee868dce8ad50b292a937ba)]
|
|
599
|
-
- chore: update Makefile, run yarn i18n [kreafox - [`61e6962`](https://github.com/eea/volto-cca-policy/commit/61e6962901068ae6512265417a730bd9befd65fe)]
|
|
600
615
|
- chore: move styling to theme folder [kreafox - [`8cf6a1b`](https://github.com/eea/volto-cca-policy/commit/8cf6a1b8b14abf472a9c61b28db574f6d9e0bd3b)]
|
|
601
616
|
- chore: remove ArrayWidget customization [kreafox - [`249bf93`](https://github.com/eea/volto-cca-policy/commit/249bf93054f7726c3d57a8b8ca01b75cd0d30522)]
|
|
602
617
|
- chore: remove Footer customization [kreafox - [`7038af3`](https://github.com/eea/volto-cca-policy/commit/7038af37d48a328dfc31746f3fa84973e2f840ab)]
|
|
@@ -3359,13 +3374,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
3359
3374
|
- Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
|
|
3360
3375
|
- Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
|
|
3361
3376
|
- Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
|
|
3362
|
-
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
|
|
3363
|
-
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
|
|
3364
3377
|
### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
|
|
3365
3378
|
|
|
3366
3379
|
#### :house: Internal changes
|
|
3367
3380
|
|
|
3368
|
-
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
|
|
3369
3381
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
|
|
3370
3382
|
|
|
3371
3383
|
#### :hammer_and_wrench: Others
|
|
@@ -3382,9 +3394,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
3382
3394
|
- Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
|
|
3383
3395
|
- Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
|
|
3384
3396
|
- Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
|
|
3385
|
-
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
|
|
3386
|
-
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
|
|
3387
|
-
- test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
|
|
3388
3397
|
- Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
|
|
3389
3398
|
- Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
|
|
3390
3399
|
- Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
|
|
@@ -3601,7 +3610,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
3601
3610
|
|
|
3602
3611
|
#### :house: Internal changes
|
|
3603
3612
|
|
|
3604
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`ad1ced0`](https://github.com/eea/volto-cca-policy/commit/ad1ced0971ba116c13a3b5fcc039172cc915c919)]
|
|
3605
3613
|
|
|
3606
3614
|
#### :hammer_and_wrench: Others
|
|
3607
3615
|
|
|
@@ -4082,7 +4090,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
4082
4090
|
#### :hammer_and_wrench: Others
|
|
4083
4091
|
|
|
4084
4092
|
- Refs #158294 - Update supported languages list. [GhitaB - [`0a4f91f`](https://github.com/eea/volto-cca-policy/commit/0a4f91f39b7edc367bd4c127d6a8f273c7788361)]
|
|
4085
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`8f1f9ce`](https://github.com/eea/volto-cca-policy/commit/8f1f9ce6c22805670cc0800d3c779b6d619d0f31)]
|
|
4086
4093
|
### [0.1.1](https://github.com/eea/volto-cca-policy/compare/0.1.0...0.1.1) - 13 December 2022
|
|
4087
4094
|
|
|
4088
4095
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import superagent from 'superagent';
|
|
3
3
|
import RSS from 'rss';
|
|
4
|
-
import { findBlocks } from '@plone/volto/helpers';
|
|
4
|
+
import { findBlocks, toPublicURL } from '@plone/volto/helpers';
|
|
5
5
|
import config from '@plone/volto/registry';
|
|
6
|
+
import { addHeadersFactory } from '@plone/volto/helpers/Proxy/Proxy';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Retrieves the query data (search criteria) used by the listing block of the rss_feed content type
|
|
@@ -33,75 +34,68 @@ import config from '@plone/volto/registry';
|
|
|
33
34
|
* @throws Will throw an error if no query data is found in the listing block or if the request fails.
|
|
34
35
|
*/
|
|
35
36
|
async function getRssFeedData(apiPath, APISUFFIX, req, settings) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (authToken) {
|
|
47
|
-
request.set('Authorization', `Bearer ${authToken}`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const response = await request;
|
|
51
|
-
const json = response.body;
|
|
52
|
-
const listingBlocks = findBlocks(json.blocks, 'listing');
|
|
53
|
-
const listingBlockId = Array.isArray(listingBlocks)
|
|
54
|
-
? listingBlocks[0]
|
|
55
|
-
: listingBlocks;
|
|
56
|
-
|
|
57
|
-
const queryData = listingBlockId
|
|
58
|
-
? json.blocks?.[listingBlockId]?.querystring
|
|
59
|
-
: null;
|
|
60
|
-
const language = json.language?.token ?? 'en';
|
|
61
|
-
const description = json.description ?? 'A Volto RSS Feed';
|
|
62
|
-
const title = json.title;
|
|
63
|
-
const subjects = json.subjects;
|
|
64
|
-
const date = json.effective;
|
|
65
|
-
const max_description_length = json.max_description_length;
|
|
66
|
-
const max_title_length = json.max_title_length;
|
|
67
|
-
if (!queryData) {
|
|
68
|
-
throw new Error('No query data found in listing block');
|
|
69
|
-
}
|
|
37
|
+
try {
|
|
38
|
+
const request = superagent
|
|
39
|
+
.get(
|
|
40
|
+
`${apiPath}${__DEVELOPMENT__ ? '' : APISUFFIX}${req.path.replace(
|
|
41
|
+
'/rss.xml',
|
|
42
|
+
'',
|
|
43
|
+
)}`,
|
|
44
|
+
)
|
|
45
|
+
.accept('json')
|
|
46
|
+
.use(addHeadersFactory(req));
|
|
70
47
|
|
|
71
|
-
|
|
48
|
+
const authToken = req.universalCookies?.get?.('auth_token');
|
|
49
|
+
if (authToken) {
|
|
50
|
+
request.set('Authorization', `Bearer ${authToken}`);
|
|
51
|
+
}
|
|
72
52
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
53
|
+
const response = await request;
|
|
54
|
+
const json = JSON.parse(JSON.stringify(response.body));
|
|
55
|
+
const listingBlock = findBlocks(json.blocks, 'listing');
|
|
56
|
+
const queryData = json.blocks?.[listingBlock]?.querystring;
|
|
57
|
+
const language = json.language?.token ?? 'en';
|
|
58
|
+
const description = json.description ?? 'A Volto RSS Feed';
|
|
59
|
+
const title = json.title;
|
|
60
|
+
const subjects = json.subjects;
|
|
61
|
+
const date = json.effective;
|
|
62
|
+
const max_description_length = json.max_description_length;
|
|
63
|
+
const max_title_length = json.max_title_length;
|
|
64
|
+
if (!queryData) {
|
|
65
|
+
throw new Error('No query data found in listing block');
|
|
78
66
|
}
|
|
79
67
|
|
|
80
|
-
if (
|
|
81
|
-
|
|
68
|
+
if (queryData?.sort_order != null) {
|
|
69
|
+
if (typeof queryData.sort_order === 'boolean') {
|
|
70
|
+
queryData.sort_order = queryData.sort_order
|
|
71
|
+
? 'descending'
|
|
72
|
+
: 'ascending';
|
|
73
|
+
}
|
|
82
74
|
}
|
|
83
|
-
}
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
const query = {
|
|
77
|
+
...queryData,
|
|
78
|
+
...(!queryData.b_size && {
|
|
79
|
+
b_size: settings.defaultPageSize,
|
|
80
|
+
}),
|
|
81
|
+
query: queryData?.query,
|
|
82
|
+
metadata_fields: '_all',
|
|
83
|
+
b_start: 0,
|
|
84
|
+
};
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
return {
|
|
87
|
+
query,
|
|
88
|
+
language,
|
|
89
|
+
description,
|
|
90
|
+
title,
|
|
91
|
+
subjects,
|
|
92
|
+
date,
|
|
93
|
+
max_description_length,
|
|
94
|
+
max_title_length,
|
|
95
|
+
};
|
|
96
|
+
} catch (err) {
|
|
97
|
+
throw err;
|
|
98
|
+
}
|
|
105
99
|
}
|
|
106
100
|
|
|
107
101
|
/**
|
|
@@ -119,39 +113,22 @@ async function getRssFeedData(apiPath, APISUFFIX, req, settings) {
|
|
|
119
113
|
* @return {Array} An array of items that match the query criteria.
|
|
120
114
|
* @throws Will throw an error if the request fails.
|
|
121
115
|
*/
|
|
122
|
-
async function fetchListingItems(query, apiPath, APISUFFIX, authToken) {
|
|
123
|
-
const request = superagent
|
|
124
|
-
.post(`${apiPath}${__DEVELOPMENT__ ? '' : APISUFFIX}/@querystring-search`)
|
|
125
|
-
.send(query)
|
|
126
|
-
.accept('json');
|
|
127
|
-
|
|
128
|
-
if (authToken) {
|
|
129
|
-
request.set('Authorization', `Bearer ${authToken}`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const response = await request;
|
|
133
|
-
return response.body.items || [];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function normalizeFeedURL(url, publicURL, apiPath) {
|
|
137
|
-
if (!url) return publicURL;
|
|
138
|
-
|
|
116
|
+
async function fetchListingItems(query, apiPath, APISUFFIX, authToken, req) {
|
|
139
117
|
try {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
const request = superagent
|
|
119
|
+
.post(`${apiPath}${__DEVELOPMENT__ ? '' : APISUFFIX}/@querystring-search`)
|
|
120
|
+
.send(query)
|
|
121
|
+
.accept('json')
|
|
122
|
+
.use(addHeadersFactory(req));
|
|
145
123
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
parsedUrl.host = new URL(publicOrigin).host;
|
|
149
|
-
}
|
|
124
|
+
if (authToken) {
|
|
125
|
+
request.set('Authorization', `Bearer ${authToken}`);
|
|
150
126
|
}
|
|
151
127
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
128
|
+
const response = await request;
|
|
129
|
+
return response.body?.items || [];
|
|
130
|
+
} catch (err) {
|
|
131
|
+
throw err;
|
|
155
132
|
}
|
|
156
133
|
}
|
|
157
134
|
|
|
@@ -167,13 +144,6 @@ function truncateText(text = '', maxLength) {
|
|
|
167
144
|
return text.length > maxLength ? `${text.substring(0, maxLength)}...` : text;
|
|
168
145
|
}
|
|
169
146
|
|
|
170
|
-
function safeDate(value) {
|
|
171
|
-
if (!value) return undefined;
|
|
172
|
-
const d = new Date(value);
|
|
173
|
-
if (Number.isNaN(d.getTime()) || d.getTime() <= 0) return undefined;
|
|
174
|
-
return d;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
147
|
/**
|
|
178
148
|
* Creates an Express middleware for generating an RSS feed using the listing block of the
|
|
179
149
|
* rss_feed content type.
|
|
@@ -188,9 +158,6 @@ function make_rssMiddleware() {
|
|
|
188
158
|
const { settings } = config;
|
|
189
159
|
const APISUFFIX = settings.legacyTraverse ? '' : '/++api++';
|
|
190
160
|
let apiPath = '';
|
|
191
|
-
const host = process.env.HOST || 'localhost';
|
|
192
|
-
const port = process.env.PORT || '3000';
|
|
193
|
-
const ProdapiPath = `http://${host}:${port}`;
|
|
194
161
|
if (settings.internalApiPath && __SERVER__) {
|
|
195
162
|
apiPath = settings.internalApiPath;
|
|
196
163
|
} else if (__DEVELOPMENT__ && settings.devProxyToApiPath) {
|
|
@@ -198,9 +165,6 @@ function make_rssMiddleware() {
|
|
|
198
165
|
} else {
|
|
199
166
|
apiPath = settings.apiPath;
|
|
200
167
|
}
|
|
201
|
-
if (apiPath === '') {
|
|
202
|
-
apiPath = ProdapiPath;
|
|
203
|
-
}
|
|
204
168
|
|
|
205
169
|
async function rssMiddleware(req, res, next) {
|
|
206
170
|
try {
|
|
@@ -218,40 +182,50 @@ function make_rssMiddleware() {
|
|
|
218
182
|
query,
|
|
219
183
|
apiPath,
|
|
220
184
|
APISUFFIX,
|
|
221
|
-
req.universalCookies
|
|
185
|
+
req.universalCookies?.get?.('auth_token'),
|
|
186
|
+
req,
|
|
222
187
|
);
|
|
223
188
|
const feedOptions = {
|
|
224
189
|
title: truncateText(title, max_title_length),
|
|
225
190
|
description: truncateText(description, max_description_length),
|
|
226
|
-
feed_url:
|
|
191
|
+
feed_url: `${settings.publicURL}${req.path}`,
|
|
227
192
|
site_url: settings.publicURL,
|
|
228
193
|
generator: 'RSS Feed Generator',
|
|
229
194
|
language: language,
|
|
230
|
-
pubDate:
|
|
195
|
+
pubDate: new Date(date),
|
|
231
196
|
categories: subjects || [],
|
|
232
197
|
};
|
|
233
198
|
|
|
234
199
|
const feed = new RSS(feedOptions);
|
|
235
200
|
|
|
236
201
|
items.forEach((item) => {
|
|
237
|
-
|
|
202
|
+
let link = toPublicURL(item['getURL']);
|
|
238
203
|
let enclosure = undefined;
|
|
204
|
+
if (
|
|
205
|
+
item.image_field &&
|
|
206
|
+
item.image_scales &&
|
|
207
|
+
item.image_scales[item.image_field] &&
|
|
208
|
+
item.image_scales[item.image_field].length > 0
|
|
209
|
+
) {
|
|
210
|
+
const imageData = item.image_scales[item.image_field][0];
|
|
211
|
+
const scales = imageData.scales || {};
|
|
212
|
+
const scale =
|
|
213
|
+
scales.preview ||
|
|
214
|
+
scales.large ||
|
|
215
|
+
scales.teaser ||
|
|
216
|
+
Object.values(scales)[0];
|
|
239
217
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
type: imageData['content-type'],
|
|
251
|
-
size: imageData.size,
|
|
252
|
-
};
|
|
218
|
+
if (scale && scale.download) {
|
|
219
|
+
const imageUrl = `${link}/${scale.download}`;
|
|
220
|
+
const mimeType = item['content-type'];
|
|
221
|
+
const originalSize = imageData.size;
|
|
222
|
+
enclosure = {
|
|
223
|
+
url: imageUrl,
|
|
224
|
+
type: mimeType,
|
|
225
|
+
size: originalSize,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
253
228
|
}
|
|
254
|
-
|
|
255
229
|
feed.item({
|
|
256
230
|
title: truncateText(item.title, max_title_length),
|
|
257
231
|
description: truncateText(
|
|
@@ -260,7 +234,7 @@ function make_rssMiddleware() {
|
|
|
260
234
|
),
|
|
261
235
|
url: link,
|
|
262
236
|
guid: item.UID,
|
|
263
|
-
date:
|
|
237
|
+
date: new Date(item.effective),
|
|
264
238
|
author: item.listCreators?.join(', '),
|
|
265
239
|
categories: item.Subject ? item.Subject : [],
|
|
266
240
|
enclosure: enclosure || undefined,
|
|
@@ -303,7 +277,7 @@ function make_rssMiddleware() {
|
|
|
303
277
|
export default function makeMiddlewares() {
|
|
304
278
|
const middleware = express.Router();
|
|
305
279
|
middleware.use(express.urlencoded({ extended: true }));
|
|
306
|
-
middleware.
|
|
280
|
+
middleware.all('**/rss.xml', make_rssMiddleware());
|
|
307
281
|
|
|
308
282
|
middleware.id = 'rss-middleware';
|
|
309
283
|
|