ep_rss 11.0.23 → 11.0.25
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.
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
# OIDC trusted publishing needs npm >= 11.5.1, which requires
|
|
24
24
|
# Node >= 20.17.0. setup-node's `20` resolves to the latest
|
|
25
25
|
# 20.x, which satisfies that.
|
|
26
|
-
node-version:
|
|
26
|
+
node-version: 25
|
|
27
27
|
registry-url: https://registry.npmjs.org/
|
|
28
28
|
- name: Upgrade npm to >=11.5.1 (required for trusted publishing)
|
|
29
29
|
run: npm install -g npm@latest
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const API = require('ep_etherpad-lite/node/db/API
|
|
3
|
+
const API = require('ep_etherpad-lite/node/db/API');
|
|
4
4
|
const padManager = require('ep_etherpad-lite/node/db/PadManager');
|
|
5
5
|
const settings = require('ep_etherpad-lite/node/utils/Settings');
|
|
6
6
|
|
|
@@ -20,33 +20,16 @@ exports.eejsBlock_htmlHead = (hookName, args, cb) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
exports.registerRoute = (hookName, args, cb) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
args.app.get('/p
|
|
31
|
-
/* Sanity is in the crack of time*/
|
|
32
|
-
const path = req.url.split('/');
|
|
33
|
-
const padId = path[2];
|
|
34
|
-
res.redirect(`/p/${padId}/feed`);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
args.app.get('/p/*/atom.xml', (req, res) => {
|
|
39
|
-
/* Sanity is in the crack of time*/
|
|
40
|
-
const path = req.url.split('/');
|
|
41
|
-
const padId = path[2];
|
|
42
|
-
res.redirect(`/p/${padId}/feed`);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
args.app.get('/p/*/feed', async (req, res) => {
|
|
46
|
-
/* Sanity is in the cracks of lime*/
|
|
23
|
+
const redirectToFeed = (req, res) => {
|
|
24
|
+
res.redirect(`/p/${encodeURIComponent(req.params.padId)}/feed`);
|
|
25
|
+
};
|
|
26
|
+
args.app.get('/p/:padId/rss', redirectToFeed);
|
|
27
|
+
args.app.get('/p/:padId/feed.rss', redirectToFeed);
|
|
28
|
+
args.app.get('/p/:padId/atom.xml', redirectToFeed);
|
|
29
|
+
|
|
30
|
+
args.app.get('/p/:padId/feed', async (req, res) => {
|
|
47
31
|
const fullURL = `${req.protocol}://${req.get('host')}${req.url}`;
|
|
48
|
-
const
|
|
49
|
-
const padId = path[2];
|
|
32
|
+
const padId = req.params.padId;
|
|
50
33
|
const padURL = `${req.protocol}://${req.get('host')}/p/${padId}`;
|
|
51
34
|
const dateString = new Date();
|
|
52
35
|
let isPublished = false; // is this item already published?
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {expect, test} from '@playwright/test';
|
|
2
|
+
import {goToNewPad, writeToPad} from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
|
|
3
|
+
|
|
4
|
+
const BASE_URL = 'http://localhost:9001';
|
|
5
|
+
|
|
6
|
+
const padIdFromUrl = (url: string) => url.split('/p/')[1].split('?')[0];
|
|
7
|
+
|
|
8
|
+
test.describe('ep_rss feed', () => {
|
|
9
|
+
test('declares the RSS alternate link in the pad page head', async ({page}) => {
|
|
10
|
+
await goToNewPad(page);
|
|
11
|
+
const link = page.locator('head link[rel="alternate"][type="application/rss+xml"]');
|
|
12
|
+
await expect(link).toHaveAttribute('href', 'feed');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('serves an RSS document at /p/<pad>/feed containing the pad text', async ({page, request}) => {
|
|
16
|
+
await goToNewPad(page);
|
|
17
|
+
const padId = padIdFromUrl(page.url());
|
|
18
|
+
const marker = `ep-rss-marker-${Date.now()}`;
|
|
19
|
+
await writeToPad(page, marker);
|
|
20
|
+
// Give the socket time to flush the change to the pad store before the
|
|
21
|
+
// route reads it back via API.getLastEdited / padManager.getPad.
|
|
22
|
+
await page.waitForTimeout(1200);
|
|
23
|
+
|
|
24
|
+
const res = await request.get(`${BASE_URL}/p/${padId}/feed`);
|
|
25
|
+
expect(res.status()).toBe(200);
|
|
26
|
+
expect(res.headers()['content-type']).toContain('application/rss+xml');
|
|
27
|
+
const body = await res.text();
|
|
28
|
+
expect(body).toMatch(/^<rss /);
|
|
29
|
+
expect(body).toContain(`<title>${padId}</title>`);
|
|
30
|
+
expect(body).toContain(marker);
|
|
31
|
+
expect(body.trim().endsWith('</rss>')).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('escapes HTML special characters in the description', async ({page, request}) => {
|
|
35
|
+
await goToNewPad(page);
|
|
36
|
+
const padId = padIdFromUrl(page.url());
|
|
37
|
+
await writeToPad(page, 'tags <b>&</b>');
|
|
38
|
+
await page.waitForTimeout(1200);
|
|
39
|
+
|
|
40
|
+
const body = await (await request.get(`${BASE_URL}/p/${padId}/feed`)).text();
|
|
41
|
+
expect(body).toContain('<b>&</b>');
|
|
42
|
+
expect(body).not.toContain('<b>&</b>');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
for (const alias of ['rss', 'feed.rss', 'atom.xml']) {
|
|
46
|
+
test(`/p/<pad>/${alias} redirects to /p/<pad>/feed`, async ({page, request}) => {
|
|
47
|
+
await goToNewPad(page);
|
|
48
|
+
const padId = padIdFromUrl(page.url());
|
|
49
|
+
const res = await request.get(`${BASE_URL}/p/${padId}/${alias}`, {maxRedirects: 0});
|
|
50
|
+
expect(res.status()).toBe(302);
|
|
51
|
+
expect(res.headers()['location']).toBe(`/p/${padId}/feed`);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|