ep_webrtc 2.5.55 → 2.5.56

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.
@@ -30,7 +30,7 @@ jobs:
30
30
  name: Install Node.js
31
31
  with:
32
32
  node-version: 25
33
- - uses: pnpm/action-setup@v6.1.0
33
+ - uses: pnpm/action-setup@v6.1.1
34
34
  name: Install pnpm
35
35
  with:
36
36
  package_json_file: ./etherpad-lite/package.json
@@ -20,7 +20,7 @@ jobs:
20
20
  name: Install Node.js
21
21
  with:
22
22
  node-version: 25
23
- - uses: pnpm/action-setup@v6.1.0
23
+ - uses: pnpm/action-setup@v6.1.1
24
24
  name: Install pnpm
25
25
  with:
26
26
  package_json_file: ./etherpad-lite/package.json
@@ -18,7 +18,7 @@ jobs:
18
18
  name: Install Node.js
19
19
  with:
20
20
  node-version: 25
21
- - uses: pnpm/action-setup@v6.1.0
21
+ - uses: pnpm/action-setup@v6.1.1
22
22
  name: Install pnpm
23
23
  with:
24
24
  version: 10
@@ -35,7 +35,7 @@ jobs:
35
35
  uses: actions/checkout@v7
36
36
  with:
37
37
  repository: ether/etherpad-lite
38
- - uses: pnpm/action-setup@v6.1.0
38
+ - uses: pnpm/action-setup@v6.1.1
39
39
  name: Install pnpm
40
40
  with:
41
41
  run_install: false
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "@metadata": {
3
3
  "authors": [
4
- "Saraiki"
4
+ "Saraiki",
5
+ "Tauqeerkhansurani"
5
6
  ]
6
7
  },
7
8
  "ep_webrtc_settings_enablertc": "آڈیو/وڈیو ڳالھ مہاڑ فعال کرو",
9
+ "ep_webrtc_error_ssl": "ویب آر ٹی سی ورتݨ کیتے TLS (https) ضروری ہے",
10
+ "ep_webrtc_error_permission_cam": "تہاݙے کیمرے تائیں رسائی دی اجازت نئیں مل سڳی",
11
+ "ep_webrtc_error_permission_mic": "تہاݙے مائیکرو فون تائیں رسائی دی اجازت نئیں مل سڳی",
12
+ "ep_webrtc_error_permission_cammic": "تہاݙے کیمرے تے مائیکرو فون تائیں رسائی دی اجازت نئیں مل سڳی",
13
+ "ep_webrtc_error_permission_screen": "تہاݙی سکرین تائیں رسائی دی اجازت نئیں مل سڳی",
8
14
  "ep_webrtc_error_notFound_cam": "تہاݙے کیمرے دی رسائی وچ ناکامی تھئی۔",
9
15
  "ep_webrtc_error_notFound_mic": "تہاݙے مائیکروفون دی رسائی وچ ناکامی تھئی۔",
10
16
  "ep_webrtc_error_notFound_cammic": "تہاݙے کیمرا تے مائیکروفون دی رسائی وچ ناکامی تھئی۔",
11
17
  "ep_webrtc_error_notFound_screen": "تہاݙی سکرین دی رسائی وچ ناکامی تھئی۔",
18
+ "ep_webrtc_error_notReadable": "معذرت، ہک ہارڈ ویئر نقص پیش آیا جیندی وجہ توں تہاݙے کیمرے تے/یا مائیکرو فون تائیں رسائی رک ڳئی",
19
+ "ep_webrtc_error_otherCantAccess": "معذرت، براؤزر تہاݙے کیمرے تے/یا مائیکرو فون تائیں رسائی نئیں رکھدا۔ برائے مہربانی اپݨے براؤزر دیاں ترتیباں وچ اجازتاں ݙیکھو۔ ایہ غالباً ہارڈ ویئر نقص نئیں",
12
20
  "ep_webrtc_settings_audioenabledonstart": "شروع وچ آڈیو چالو",
13
21
  "ep_webrtc_settings_videoenabledonstart": "شروع وچ وڈیو چالو"
14
22
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git@github.com:ether/ep_webrtc.git",
6
6
  "type": "git"
7
7
  },
8
- "version": "2.5.55",
8
+ "version": "2.5.56",
9
9
  "description": "WebRTC based audio/video chat to Etherpad",
10
10
  "author": "John McLear <john@mclear.co.uk>",
11
11
  "contributors": [],
@@ -9,21 +9,23 @@
9
9
  /*
10
10
  * The "Failed to access camera/microphone" gritter notifications spawned by
11
11
  * showUserMediaError() are sticky and span the top of the editor. Without
12
- * this rule, the gritter's container/items intercept pointer events on the
13
- * editor underneath (Playwright's stability check fails with "subtree
14
- * intercepts pointer events"), making the pad unusable until the user
15
- * dismisses each toast. Pass clicks through everything except the close
16
- * button so the toast stays visible and dismissible without blocking
17
- * the editor.
12
+ * these rules, the toast intercepts pointer events on the editor underneath
13
+ * (Playwright's stability check fails with "subtree intercepts pointer
14
+ * events"), making the pad unusable until the user dismisses each toast.
15
+ * Pass clicks through ep_webrtc's own toasts except the close button and
16
+ * links so they stay visible and dismissible without blocking the editor.
17
+ *
18
+ * Scoped to .ep_webrtc-gritter: core's own toasts (pad retention notice,
19
+ * privacy banner with its "Learn more" link, chat messages, ...) must keep
20
+ * normal pointer events so they can be hovered, read and clicked.
18
21
  */
19
- #gritter-container,
20
- #gritter-container .gritter-item-wrapper,
21
- #gritter-container .gritter-item,
22
- #gritter-container .popup-content,
23
- #gritter-container .gritter-content,
24
- #gritter-container .gritter-title,
25
- #gritter-container .gritter-image { pointer-events: none; }
26
- #gritter-container .gritter-close { pointer-events: auto; }
22
+ #gritter-container { pointer-events: none; }
23
+ #gritter-container .gritter-item { pointer-events: auto; }
24
+ #gritter-container .gritter-item.ep_webrtc-gritter,
25
+ #gritter-container .gritter-item.ep_webrtc-gritter * { pointer-events: none; }
26
+ #gritter-container .gritter-item.ep_webrtc-gritter .gritter-close,
27
+ #gritter-container .gritter-item.ep_webrtc-gritter .gritter-close *,
28
+ #gritter-container .gritter-item.ep_webrtc-gritter a { pointer-events: auto; }
27
29
 
28
30
  #rtcbox {
29
31
  align-items: start;
@@ -44,6 +44,12 @@ const sessionId = Date.now();
44
44
  // Incremented each time a new RTCPeerConnection is created.
45
45
  let nextInstanceId = 0;
46
46
 
47
+ // How long to collect trickled ICE candidates before sending them to the peer in one message.
48
+ const CANDIDATE_BATCH_MS = 50;
49
+ // Upper bound on candidates per message, both sent and accepted. A browser rarely gathers more than
50
+ // a handful; the cap stops a peer from making us do unbounded work with one oversized message.
51
+ const MAX_CANDIDATES_PER_MESSAGE = 32;
52
+
47
53
  const logErrorToServer = async (err, delay = 10000) => {
48
54
  // Sleep to avoid logging benign errors caused by the user leaving the page (e.g., audio/video
49
55
  // stream ended unexpectedly). If the user navigates away during this sleep the error will not
@@ -148,7 +154,18 @@ class PeerState extends EventTargetPolyfill {
148
154
  super();
149
155
  this._pcConfig = pcConfig;
150
156
  this._caller = caller;
151
- this._sendMessage = (msg) => sendMessage(Object.assign({ids: this._ids}, msg));
157
+ this._sendMessageNow = (msg) => sendMessage(Object.assign({ids: this._ids}, msg));
158
+ // Trickle ICE fires one icecandidate event per local candidate, often several within a few
159
+ // milliseconds. Sending each as its own pad message multiplies the signalling traffic by the
160
+ // number of candidates and can trip Etherpad's commitRateLimiting, which disconnects the user.
161
+ // Candidates are therefore collected for a short window and sent as one message. Any other
162
+ // message flushes the pending candidates first so the peer sees them in order.
163
+ this._pendingCandidates = [];
164
+ this._candidateTimer = null;
165
+ this._sendMessage = (msg) => {
166
+ this._flushCandidates();
167
+ this._sendMessageNow(msg);
168
+ };
152
169
  this._localTracks = localTracks;
153
170
  this._failedSLDAttempts = 0;
154
171
  this._debug = debug;
@@ -190,6 +207,32 @@ class PeerState extends EventTargetPolyfill {
190
207
  }
191
208
  }
192
209
 
210
+ _flushCandidates() {
211
+ if (this._candidateTimer != null) clearTimeout(this._candidateTimer);
212
+ this._candidateTimer = null;
213
+ if (this._pendingCandidates.length === 0) return;
214
+ const candidates = this._pendingCandidates;
215
+ this._pendingCandidates = [];
216
+ this._sendMessageNow({candidates});
217
+ }
218
+
219
+ _queueCandidate(candidate) {
220
+ // A null candidate marks the end of gathering: nothing more is coming, so send now.
221
+ if (candidate == null) return this._flushCandidates();
222
+ this._pendingCandidates.push(candidate);
223
+ const full = this._pendingCandidates.length >= MAX_CANDIDATES_PER_MESSAGE;
224
+ if (full) return this._flushCandidates();
225
+ if (this._candidateTimer == null) {
226
+ this._candidateTimer = setTimeout(() => this._flushCandidates(), CANDIDATE_BATCH_MS);
227
+ }
228
+ }
229
+
230
+ _dropPendingCandidates() {
231
+ if (this._candidateTimer != null) clearTimeout(this._candidateTimer);
232
+ this._candidateTimer = null;
233
+ this._pendingCandidates = [];
234
+ }
235
+
193
236
  _setRemoteStream(stream) {
194
237
  if (stream === this._remoteStream) return;
195
238
  if (this._remoteStream != null) {
@@ -215,6 +258,9 @@ class PeerState extends EventTargetPolyfill {
215
258
  this._debug('creating RTCPeerConnection with config', this._pcConfig);
216
259
  this._debug('peer IDs:', peerIds);
217
260
  this._setRemoteStream(null);
261
+ // Candidates gathered by the old RTCPeerConnection are useless to the new one, and sending them
262
+ // later would tag them with the new instance ID.
263
+ this._dropPendingCandidates();
218
264
  this._ids.from.instance = ++nextInstanceId;
219
265
  this._ids.to = peerIds;
220
266
  const pc = new RTCPeerConnection(this._pcConfig);
@@ -229,7 +275,10 @@ class PeerState extends EventTargetPolyfill {
229
275
  await this._sendLocalTrack(track.kind, this._localTracks.getTracks(track.kind)[0]);
230
276
  }
231
277
  });
232
- pc.addEventListener('icecandidate', ({candidate}) => this._sendMessage({candidate}));
278
+ pc.addEventListener('icecandidate', ({candidate}) => {
279
+ if (pc !== this._pc) return;
280
+ this._queueCandidate(candidate);
281
+ });
233
282
  pc.addEventListener('negotiationneeded', async () => {
234
283
  try {
235
284
  await pc.setLocalDescription();
@@ -318,7 +367,7 @@ class PeerState extends EventTargetPolyfill {
318
367
 
319
368
  async receiveMessage(msg) {
320
369
  if (this._closed) return this._debug('Ignoring message because PeerState is closed');
321
- const {ids, candidate, description, hangup} = msg;
370
+ const {ids, candidate, candidates, description, hangup} = msg;
322
371
  if (hangup != null) {
323
372
  this.close(true);
324
373
  return;
@@ -356,7 +405,15 @@ class PeerState extends EventTargetPolyfill {
356
405
  this._sendMessage({description: this._pc.localDescription});
357
406
  }
358
407
  }
408
+ // `candidate` is the single-candidate format sent by older versions of this plugin.
359
409
  if (candidate != null) await this._pc.addIceCandidate(candidate);
410
+ const batch = Array.isArray(candidates) ? candidates : [];
411
+ if (batch.length > MAX_CANDIDATES_PER_MESSAGE) {
412
+ this._debug(`ignoring ${batch.length - MAX_CANDIDATES_PER_MESSAGE} excess ICE candidates`);
413
+ }
414
+ for (const c of batch.slice(0, MAX_CANDIDATES_PER_MESSAGE)) {
415
+ if (c != null) await this._pc.addIceCandidate(c);
416
+ }
360
417
  } catch (err) {
361
418
  err.peerMessage = msg;
362
419
  console.error('Error processing message from peer:', err);
@@ -368,6 +425,7 @@ class PeerState extends EventTargetPolyfill {
368
425
  close(emitClosedEvent = false) {
369
426
  if (this._closed) return;
370
427
  this._closed = true;
428
+ this._dropPendingCandidates();
371
429
  this._localTracks.removeEventListener('trackchanged', this._ontrackchanged);
372
430
  if (this._pc != null) this._pc.close();
373
431
  this._pc = null;
@@ -452,7 +510,7 @@ exports.rtc = new class {
452
510
  text: 'Ep_webrtc: There is an error with the configuration of this plugin. Please ' +
453
511
  'inform the administrators of this site. They will see the details in their logs.',
454
512
  sticky: true,
455
- class_name: 'error',
513
+ class_name: 'error ep_webrtc-gritter',
456
514
  });
457
515
  return;
458
516
  }
@@ -462,7 +520,7 @@ exports.rtc = new class {
462
520
  title: 'Error',
463
521
  text: 'Ep_webrtc: Please upgrade to etherpad 1.8.3 for this plugin to work correctly',
464
522
  sticky: true,
465
- class_name: 'error',
523
+ class_name: 'error ep_webrtc-gritter',
466
524
  });
467
525
  }
468
526
  const $rtcbox = $('<div>')
@@ -673,7 +731,7 @@ exports.rtc = new class {
673
731
  .append($('<p>').text(html10n.get(`ep_webrtc_${msgId}`)))
674
732
  .append(extraInfo),
675
733
  sticky: true,
676
- class_name: 'error',
734
+ class_name: 'error ep_webrtc-gritter',
677
735
  });
678
736
  logErrorToServer(err);
679
737
  }
@@ -162,4 +162,32 @@ test.describe('error handling', () => {
162
162
  if (!innerFrame) throw new Error('ace_inner frame missing');
163
163
  await innerFrame.locator('#innerdocbody').first().click({timeout: 5000});
164
164
  });
165
+
166
+ test('click-through is scoped to ep_webrtc toasts', async () => {
167
+ // Regression: the click-through rule used to match every gritter on the
168
+ // page, so core toasts (pad retention notice, privacy banner "Learn
169
+ // more" link, ...) could not be hovered or clicked with ep_webrtc
170
+ // installed, and clicks fell through to the editor underneath.
171
+ await sharedPage.evaluate(() => {
172
+ const w = window as any;
173
+ w.$.gritter.add({
174
+ title: 'Core notice',
175
+ text: w.$('<p>').append(w.$('<a>').attr('href', '#').text('Learn more')),
176
+ sticky: true,
177
+ position: 'bottom',
178
+ class_name: 'core-test-notice',
179
+ });
180
+ });
181
+ const notice = sharedPage.locator('#gritter-container .gritter-item.core-test-notice');
182
+ await expect(notice).toHaveCount(1);
183
+ const pointerEvents = await notice.evaluate((el) => ({
184
+ item: getComputedStyle(el).pointerEvents,
185
+ content: getComputedStyle(el.querySelector('.gritter-content')!).pointerEvents,
186
+ link: getComputedStyle(el.querySelector('a')!).pointerEvents,
187
+ }));
188
+ expect(pointerEvents).toMatchObject({item: 'auto', content: 'auto', link: 'auto'});
189
+ await notice.hover({timeout: 5000});
190
+ await notice.locator('.gritter-close').click({timeout: 5000});
191
+ await expect(notice).toHaveCount(0);
192
+ });
165
193
  });
@@ -0,0 +1,57 @@
1
+ import {Browser, Page, expect, test} from '@playwright/test';
2
+ import {installFakeGetUserMedia} from '../helper/utils';
3
+
4
+ // Regression test: every trickled ICE candidate used to go out as its own pad message. A peer
5
+ // joining a video pad then sent a burst of messages that tripped Etherpad's commitRateLimiting and
6
+ // got the user disconnected. Candidates must now be sent in batches ({candidates: [...]}), and the
7
+ // peers must still connect using them.
8
+
9
+ const openPeer = async (browser: Browser, padId: string) => {
10
+ const context = await browser.newContext();
11
+ const page = await context.newPage();
12
+ await page.goto(`http://localhost:9001/p/${padId}?av=false`);
13
+ await page.waitForSelector('#editorcontainer.initialized');
14
+ await installFakeGetUserMedia(page);
15
+ // Record the shape of every outgoing WebRTC signalling message.
16
+ await page.evaluate(() => {
17
+ const w = window as any;
18
+ w.__rtcSent = [];
19
+ const cc = w.pad.collabClient;
20
+ const orig = cc.sendMessage.bind(cc);
21
+ cc.sendMessage = (msg: any) => {
22
+ if (msg && msg.type === 'RTC_MESSAGE') w.__rtcSent.push(msg.payload.data);
23
+ return orig(msg);
24
+ };
25
+ });
26
+ await page.locator('#options-enablertc').evaluate((el) => (window as any).$(el).click());
27
+ await page.waitForFunction(() => (window as any).$('#rtcbox').data('initialized'));
28
+ return page;
29
+ };
30
+
31
+ const remoteVideoLive = (page: Page) => page.waitForFunction(() => {
32
+ const w = window as any;
33
+ const ownId = `video_${w.ep_webrtc.getUserId().replace(/\./g, '_')}`;
34
+ return [...document.querySelectorAll('#rtcbox video')].some(
35
+ (v: any) => v.id !== ownId && v.readyState >= 2 && v.srcObject != null);
36
+ }, null, {timeout: 30_000});
37
+
38
+ test('ICE candidates are batched and peers still connect', async ({browser}) => {
39
+ test.setTimeout(90_000);
40
+ const {randomUUID} = await import('node:crypto');
41
+ const padId = `FRONTEND_TESTS${randomUUID()}`;
42
+ const a = await openPeer(browser, padId);
43
+ const b = await openPeer(browser, padId);
44
+ await Promise.all([remoteVideoLive(a), remoteVideoLive(b)]);
45
+ for (const page of [a, b]) {
46
+ const sent: any[] = await page.evaluate(() => (window as any).__rtcSent);
47
+ expect(sent.filter((d) => d.candidate !== undefined), 'single-candidate messages').toEqual([]);
48
+ const batches = sent.filter((d) => Array.isArray(d.candidates));
49
+ expect(batches.length).toBeGreaterThan(0);
50
+ for (const {candidates} of batches) {
51
+ expect(candidates.length).toBeGreaterThan(0);
52
+ expect(candidates.length).toBeLessThanOrEqual(32);
53
+ }
54
+ }
55
+ await a.context().close();
56
+ await b.context().close();
57
+ });