ep_rss 11.0.25 → 11.0.27

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/AGENTS.md CHANGED
@@ -17,13 +17,14 @@ ep_rss/
17
17
  ├── client.js
18
18
  ├── ep.json
19
19
  ├── index.js
20
+ ├── locales/
21
+ │ └── en.json
20
22
  ├── package.json
21
23
  ├── static/
22
- │ ├── img/
23
- ├── tests/
24
+ │ ├── css/exportColumn.css
25
+ └── tests/
24
26
  ├── templates/
25
- ├── embedFrame.ejs
26
- │ ├── embedFrame.html
27
+ └── exportColumn.ejs
27
28
  ```
28
29
 
29
30
  ## Helpers used
@@ -59,6 +60,6 @@ pnpm --filter ep_etherpad-lite run test-ui
59
60
 
60
61
  ## Quick reference: hooks declared in `ep.json`
61
62
 
62
- * Server: `eejsBlock_htmlHead`, `expressCreateServer`, `eejsBlock_embedPopup`
63
+ * Server: `eejsBlock_htmlHead`, `expressCreateServer`, `eejsBlock_exportColumn`, `eejsBlock_styles`
63
64
 
64
65
  When adding a hook, register it in both `ep.json` *and* the matching `exports.<hook> = ...` in the JS file.
package/README.md CHANGED
@@ -1,18 +1,51 @@
1
- # RSS Feeds of Pad Changes for Etherpad
1
+ # RSS feeds for Etherpad pads
2
2
 
3
- ![Publish Status](https://github.com/ether/ep_rss/workflows/Node.js%20Package/badge.svg) [![Backend Tests Status](https://github.com/ether/ep_rss/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_rss/actions/workflows/test-and-release.yml)
3
+ [![npm](https://img.shields.io/npm/v/ep_rss.svg)](https://www.npmjs.com/package/ep_rss)
4
+ [![Backend Tests](https://github.com/ether/ep_rss/actions/workflows/backend-tests.yml/badge.svg?branch=main)](https://github.com/ether/ep_rss/actions/workflows/backend-tests.yml)
5
+ [![Frontend Tests](https://github.com/ether/ep_rss/actions/workflows/frontend-tests.yml/badge.svg?branch=main)](https://github.com/ether/ep_rss/actions/workflows/frontend-tests.yml)
4
6
 
5
- Exposes an RSS feed for each pad at `/p/{padId}/feed`.
7
+ Adds an RSS 2.0 feed for every pad so readers can subscribe to changes
8
+ in any feed reader.
6
9
 
7
10
  ## Install
8
11
 
9
- ```
12
+ From your Etherpad root, install the plugin via the Etherpad plugin
13
+ manager:
14
+
15
+ ```sh
10
16
  pnpm run plugins i ep_rss
11
17
  ```
12
18
 
19
+ Or install from the admin UI: **Admin → Manage Plugins**, search for
20
+ `ep_rss`, click *Install*. Restart Etherpad after installing.
21
+
22
+ > ⚠️ Don't run `npm i` / `pnpm add` against this plugin from inside
23
+ > the Etherpad source tree — Etherpad tracks installed plugins
24
+ > through its own plugin manager, and hand-editing `package.json`
25
+ > can leave the server unable to start.
26
+
27
+ ## Endpoints
28
+
29
+ Once installed, each pad exposes:
30
+
31
+ | Path | Behavior |
32
+ |---|---|
33
+ | `/p/<pad>/feed` | 200 with `Content-Type: application/rss+xml` and the current pad text as a single `<item>` |
34
+ | `/p/<pad>/rss` | 302 → `/p/<pad>/feed` |
35
+ | `/p/<pad>/feed.rss` | 302 → `/p/<pad>/feed` |
36
+ | `/p/<pad>/atom.xml` | 302 → `/p/<pad>/feed` |
37
+
38
+ The pad page itself also advertises the feed in `<head>` so feed
39
+ readers auto-discover it:
40
+
41
+ ```html
42
+ <link rel="alternate" type="application/rss+xml" title="Pad RSS Feed" href="feed" />
43
+ ```
44
+
13
45
  ## Settings
14
46
 
15
- Optional stale time (milliseconds before a new RSS item is generated) can be set in `settings.json`:
47
+ Optional. Add to `settings.json` to control how long a generated feed
48
+ is cached in memory before being regenerated:
16
49
 
17
50
  ```json
18
51
  "rss": {
@@ -20,7 +53,19 @@ Optional stale time (milliseconds before a new RSS item is generated) can be set
20
53
  }
21
54
  ```
22
55
 
23
- Defaults to 5 minutes if not configured.
56
+ `staleTime` is in milliseconds. Defaults to 5 minutes
57
+ (`300000`) when unset.
58
+
59
+ ## Development
60
+
61
+ ```sh
62
+ pnpm install
63
+ pnpm run lint
64
+ ```
65
+
66
+ Backend and frontend tests live under `static/tests/` and run inside
67
+ an Etherpad checkout — the CI workflows install this plugin into a
68
+ fresh Etherpad and exercise it end-to-end.
24
69
 
25
70
  ## License
26
71
 
package/client.js CHANGED
@@ -2,8 +2,14 @@
2
2
 
3
3
  const eejs = require('ep_etherpad-lite/node/eejs');
4
4
 
5
- exports.eejsBlock_embedPopup = (hookName, args, cb) => {
5
+ exports.eejsBlock_exportColumn = (hookName, args, cb) => {
6
6
  const feedURL = `..${args.renderContext.req.url}/feed`;
7
- args.content += eejs.require('ep_rss/templates/embedFrame.ejs', {feed: feedURL});
7
+ args.content += eejs.require('ep_rss/templates/exportColumn.ejs', {feed: feedURL});
8
+ return cb();
9
+ };
10
+
11
+ exports.eejsBlock_styles = (hookName, args, cb) => {
12
+ args.content +=
13
+ '<link rel="stylesheet" href="/static/plugins/ep_rss/static/css/exportColumn.css">';
8
14
  return cb();
9
15
  };
package/ep.json CHANGED
@@ -5,7 +5,8 @@
5
5
  "hooks": {
6
6
  "eejsBlock_htmlHead": "ep_rss/index",
7
7
  "expressCreateServer" : "ep_rss/index:registerRoute",
8
- "eejsBlock_embedPopup": "ep_rss/client:eejsBlock_embedPopup"
8
+ "eejsBlock_exportColumn": "ep_rss/client:eejsBlock_exportColumn",
9
+ "eejsBlock_styles": "ep_rss/client:eejsBlock_styles"
9
10
  }
10
11
  }
11
12
  ]
@@ -0,0 +1,4 @@
1
+ {
2
+ "ep_rss.exportrssa.title": "RSS feed of this pad",
3
+ "ep_rss.exportrss": "RSS"
4
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_rss",
3
3
  "description": "Get an RSS feed of pad updates",
4
- "version": "11.0.25",
4
+ "version": "11.0.27",
5
5
  "author": {
6
6
  "name": "John McLear",
7
7
  "email": "john@mclear.co.uk",
@@ -0,0 +1,24 @@
1
+ /*
2
+ * SVG export-icon styling. The other export buttons render a Fontello
3
+ * glyph via the .exporttype:before / .buttonicon-* pseudo-element; we
4
+ * use an inline SVG instead so the icon survives without registering
5
+ * an extra font character. Sized at 22px to match the heuristic
6
+ * height of the buttonicon font row, kept orange so RSS readers still
7
+ * recognise it at a glance.
8
+ */
9
+ #exportrssa .ep_rss_export_icon {
10
+ display: inline-flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ width: 22px;
14
+ height: 22px;
15
+ margin-right: 10px;
16
+ color: #f26522;
17
+ vertical-align: middle;
18
+ }
19
+
20
+ #exportrssa .ep_rss_export_icon svg {
21
+ width: 100%;
22
+ height: 100%;
23
+ fill: currentColor;
24
+ }
@@ -0,0 +1,43 @@
1
+ import {expect, test} from '@playwright/test';
2
+ import {goToNewPad} from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
3
+
4
+ test.describe('ep_rss export-column link', () => {
5
+ test('renders the RSS link inside the Import/Export column', async ({page}) => {
6
+ await goToNewPad(page);
7
+ const link = page.locator('#exportColumn a#exportrssa');
8
+ await expect(link).toHaveCount(1);
9
+ await expect(link).toHaveAttribute('data-l10n-id', 'ep_rss.exportrssa.title');
10
+ await expect(link).toHaveAttribute('target', '_blank');
11
+ await expect(link).toHaveAttribute('rel', 'noopener');
12
+ const href = await link.getAttribute('href');
13
+ expect(href).toMatch(/\/feed$/);
14
+ await expect(link.locator('span#exportrss svg')).toHaveCount(1);
15
+ });
16
+
17
+ test('localized title attribute resolves via html10n', async ({page}) => {
18
+ await goToNewPad(page);
19
+ const link = page.locator('#exportrssa');
20
+ await expect.poll(
21
+ async () => link.getAttribute('title'),
22
+ {timeout: 5000},
23
+ ).toBe('RSS feed of this pad');
24
+ });
25
+
26
+ test('clicking the link reaches /p/<pad>/feed', async ({page, request}) => {
27
+ await goToNewPad(page);
28
+ const href = await page.locator('#exportrssa').getAttribute('href');
29
+ expect(href).toBeTruthy();
30
+ const resolved = new URL(href!, page.url()).toString();
31
+ const res = await request.get(resolved);
32
+ expect(res.status()).toBe(200);
33
+ expect(res.headers()['content-type']).toContain('application/rss+xml');
34
+ });
35
+
36
+ test('share/embed popup no longer carries an RSS block', async ({page}) => {
37
+ await goToNewPad(page);
38
+ // The legacy embedFrame.ejs put `<a class="rssfeed">` inside #embed.
39
+ // Verify nothing in #embed references the feed any more.
40
+ const stale = page.locator('#embed a.rssfeed, #embed a[href*="feed"]');
41
+ await expect(stale).toHaveCount(0);
42
+ });
43
+ });
@@ -0,0 +1,7 @@
1
+ <a id="exportrssa" data-l10n-id="ep_rss.exportrssa.title" target="_blank" rel="noopener" class="exportlink" href="<%= feed %>">
2
+ <span class="exporttype ep_rss_export_icon" id="exportrss" data-l10n-id="ep_rss.exportrss" aria-hidden="true">
3
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
4
+ <path d="M5 4.5a1.5 1.5 0 0 1 1.5-1.5C14.4 3 21 9.6 21 17.5a1.5 1.5 0 0 1-3 0C18 11.3 12.7 6 6.5 6A1.5 1.5 0 0 1 5 4.5Zm0 6a1.5 1.5 0 0 1 1.5-1.5C11.7 9 16 13.3 16 18.5a1.5 1.5 0 0 1-3 0C13 14.9 10.1 12 6.5 12A1.5 1.5 0 0 1 5 10.5ZM6.5 16a2 2 0 1 1 0 4 2 2 0 0 1 0-4Z"/>
5
+ </svg>
6
+ </span>
7
+ </a>
Binary file
@@ -1,8 +0,0 @@
1
- <br>
2
- <h2>Rss Feeds</h2>
3
- <p>
4
- <a class="rssfeed" href="<%= feed%>" title="Pad Feed">
5
- <img src="../static/plugins/ep_rss/static/img/rss.gif">
6
- </a>
7
-
8
- </p>
@@ -1 +0,0 @@
1
- <a class="rssfeed" href="feed">RSS Feed</a>