ep_webrtc 2.5.55 → 2.5.57
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/.github/workflows/backend-tests.yml +1 -1
- package/.github/workflows/frontend-tests.yml +1 -1
- package/.github/workflows/lint.yml +1 -1
- package/.github/workflows/npmpublish.yml +1 -1
- package/locales/skr-arab.json +9 -1
- package/package.json +1 -1
- package/static/css/styles.css +27 -16
- package/static/js/index.js +64 -6
- package/static/tests/backend/specs/inlined_font.js +25 -0
- package/static/tests/frontend-new/specs/errors.spec.ts +28 -0
- package/static/tests/frontend-new/specs/ice_candidate_batching.spec.ts +57 -0
- package/static/tests/frontend-new/specs/screenshare.spec.ts +46 -0
package/locales/skr-arab.json
CHANGED
|
@@ -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
package/static/css/styles.css
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "fontawesome-ep_webrtc";
|
|
3
|
-
/* License: ../fonts/fontello/LICENSE.txt
|
|
4
|
-
|
|
3
|
+
/* License: ../fonts/fontello/LICENSE.txt
|
|
4
|
+
*
|
|
5
|
+
* Inlined copy of ../fonts/fontello/font/fontawesome-custom.woff2 (~3 KB).
|
|
6
|
+
* A relative url() here breaks in production: Etherpad's CSS minifier
|
|
7
|
+
* (3.3.12+) rebased it through the plugin_packages/.versions symlink to
|
|
8
|
+
* /static/plugins/.versions/ep_webrtc@x.y.z/..., which 404s, so the
|
|
9
|
+
* screen-share, warning and resize glyphs rendered blank. A data URI has
|
|
10
|
+
* no path to rewrite. Regenerate with:
|
|
11
|
+
* base64 -w0 static/fonts/fontello/font/fontawesome-custom.woff2
|
|
12
|
+
*/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fLz0kt9pSmbYtJi0zxuoiXaYyfmB8rTRBvpw2jDNy4iSssKCtQ0SrETFIPRUVm+ranxcVFJ0Ulltp2UH6hzC7hsXCFsBs+WkPG0VpPVWym9E630oMKXnuakJCclxEaFez0utqltCvsMKBEqRxNCSZxoVSyWMX1uAVFIyCUKbZQO2WIsy0zaYoy1E8tYg0JFeYm/MC87MyN965bNqaTIJmHvhQACV1/4M21nVP3vDlH6K4D3rYMds+U7N/LRigCPUNnU1qNfGvPJBrSZDmYoA0dRs7Qll6jkFA0WVehrK2Ip4x4wHxm+wwh/IAcq+IqE5VdMVrjoZDp/gAzyd022COMw2cg/N9lLPg/uH0YcL6IR4wFWeQ8mCxlSNVkRKbOkkb9CBvn3JlskyjrZyH9jspcJ+fagMLJU838Zd1tznd/9u+zpeP6ytAi8ERxfmsCnbBHc4Imlp2NV4dOp/Evbt9Dawg5/FneMkiL/kU3enjfwyPFQ6dGjy8/KBjvyDnxrD38ubBOdXptWDnCQUxxmhRC7OYpDDq3k4lCKP28vwWF+k5xDFoWJuv0E2auDHDssdx+kI2gP4LA8ov2EljZpb6+LWCjD+w7pICe4PLKrlygM6dhIHq3RiE0hHPNeghym3nacJgR1kyt0596hhCL8XKxT7ueUQWtCi34wN+l4oEs5KnLZYnkYRnPosH25w8HDtCq0oGSRh+koObpaiin2VULRXwAvT2GJEi1GLLGJCx1eOVj45Hyw8N8pHXxgf3Bvyj//igf3vdQhC78CqXN/aO9S4bMZQdfzBMGImSHPtDd4ZDfQ+zxvjoR1kfvTa3IPY+2D67ha1iEvm9N78AtAWO2OL6ChbT1Dbg5PrQVuTm3CYk7OiufdVAbQNp26nl27yYvui4gJ3FwY24v9y68Tmfe8bMDcW1fzgU9ZizZtbQA=") format("woff2");
|
|
5
14
|
font-weight: normal;
|
|
6
15
|
font-style: normal;
|
|
7
16
|
}
|
|
@@ -9,21 +18,23 @@
|
|
|
9
18
|
/*
|
|
10
19
|
* The "Failed to access camera/microphone" gritter notifications spawned by
|
|
11
20
|
* showUserMediaError() are sticky and span the top of the editor. Without
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
21
|
+
* these rules, the toast intercepts pointer events on the editor underneath
|
|
22
|
+
* (Playwright's stability check fails with "subtree intercepts pointer
|
|
23
|
+
* events"), making the pad unusable until the user dismisses each toast.
|
|
24
|
+
* Pass clicks through ep_webrtc's own toasts except the close button and
|
|
25
|
+
* links so they stay visible and dismissible without blocking the editor.
|
|
26
|
+
*
|
|
27
|
+
* Scoped to .ep_webrtc-gritter: core's own toasts (pad retention notice,
|
|
28
|
+
* privacy banner with its "Learn more" link, chat messages, ...) must keep
|
|
29
|
+
* normal pointer events so they can be hovered, read and clicked.
|
|
18
30
|
*/
|
|
19
|
-
#gritter-container
|
|
20
|
-
#gritter-container .gritter-item-
|
|
21
|
-
#gritter-container .gritter-item,
|
|
22
|
-
#gritter-container .
|
|
23
|
-
#gritter-container .gritter-
|
|
24
|
-
#gritter-container .gritter-
|
|
25
|
-
#gritter-container .gritter-
|
|
26
|
-
#gritter-container .gritter-close { pointer-events: auto; }
|
|
31
|
+
#gritter-container { pointer-events: none; }
|
|
32
|
+
#gritter-container .gritter-item { pointer-events: auto; }
|
|
33
|
+
#gritter-container .gritter-item.ep_webrtc-gritter,
|
|
34
|
+
#gritter-container .gritter-item.ep_webrtc-gritter * { pointer-events: none; }
|
|
35
|
+
#gritter-container .gritter-item.ep_webrtc-gritter .gritter-close,
|
|
36
|
+
#gritter-container .gritter-item.ep_webrtc-gritter .gritter-close *,
|
|
37
|
+
#gritter-container .gritter-item.ep_webrtc-gritter a { pointer-events: auto; }
|
|
27
38
|
|
|
28
39
|
#rtcbox {
|
|
29
40
|
align-items: start;
|
package/static/js/index.js
CHANGED
|
@@ -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.
|
|
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}) =>
|
|
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
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// styles.css inlines fontawesome-custom.woff2 as a data URI (a relative url()
|
|
4
|
+
// broke under Etherpad's production CSS minifier). Keep the inlined copy in
|
|
5
|
+
// sync with the source font so regenerating the icon set can't leave the
|
|
6
|
+
// stylesheet serving a stale glyph set.
|
|
7
|
+
|
|
8
|
+
const assert = require('assert').strict;
|
|
9
|
+
const fsp = require('fs').promises;
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
const root = path.join(__dirname, '../../../..');
|
|
13
|
+
|
|
14
|
+
describe(__filename, function () {
|
|
15
|
+
it('inlined @font-face matches fontawesome-custom.woff2', async function () {
|
|
16
|
+
const css = await fsp.readFile(path.join(root, 'static/css/styles.css'), 'utf8');
|
|
17
|
+
const m = /url\("data:font\/woff2;base64,([A-Za-z0-9+/=]+)"\)/.exec(css);
|
|
18
|
+
assert(m, 'expected an inlined woff2 data URI in static/css/styles.css');
|
|
19
|
+
const font = await fsp.readFile(
|
|
20
|
+
path.join(root, 'static/fonts/fontello/font/fontawesome-custom.woff2'));
|
|
21
|
+
assert(Buffer.from(m[1], 'base64').equals(font),
|
|
22
|
+
'inlined font differs from fontawesome-custom.woff2; regenerate with ' +
|
|
23
|
+
'`base64 -w0 static/fonts/fontello/font/fontawesome-custom.woff2`');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -103,4 +103,50 @@ test.describe('screen share button', () => {
|
|
|
103
103
|
});
|
|
104
104
|
expect(after).toEqual({videoOff: true, screenshareOff: true});
|
|
105
105
|
});
|
|
106
|
+
|
|
107
|
+
test('renders a visible icon glyph', async ({page}) => {
|
|
108
|
+
// Regression: in production mode Etherpad's CSS minifier rewrote the
|
|
109
|
+
// icon font's relative url() to /static/plugins/.versions/..., which
|
|
110
|
+
// 404s. The button kept its size but its glyph rendered blank.
|
|
111
|
+
const btn = page.locator('#rtcbox .screenshare-btn');
|
|
112
|
+
await expect(btn).toBeVisible();
|
|
113
|
+
const glyph = await btn.evaluate(async (el) => {
|
|
114
|
+
const before = getComputedStyle(el, '::before');
|
|
115
|
+
// Rejects with a NetworkError when the font 404s; the status check below reports it.
|
|
116
|
+
await document.fonts.load(`${before.fontSize} fontawesome-ep_webrtc`, '\uf109')
|
|
117
|
+
.catch(() => {});
|
|
118
|
+
const faces = [...document.fonts].filter((f) => f.family.replace(/"/g, '') === 'fontawesome-ep_webrtc');
|
|
119
|
+
return {
|
|
120
|
+
content: before.content,
|
|
121
|
+
fontFamily: before.fontFamily,
|
|
122
|
+
faceStatuses: faces.map((f) => f.status),
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
expect(glyph.content).toBe('"\uf109"');
|
|
126
|
+
expect(glyph.fontFamily).toContain('fontawesome-ep_webrtc');
|
|
127
|
+
expect(glyph.faceStatuses).toContain('loaded');
|
|
128
|
+
expect(glyph.faceStatuses).not.toContain('error');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('icon font does not depend on a rewritable relative URL', async ({page}) => {
|
|
132
|
+
// CI serves CSS unminified, where a relative url() still works, so also
|
|
133
|
+
// pin that the @font-face source is self-contained (a data: URI) and
|
|
134
|
+
// cannot be broken by the host's minifier or a symlinked install path.
|
|
135
|
+
const srcs = await page.evaluate(() => {
|
|
136
|
+
const out: string[] = [];
|
|
137
|
+
for (const sheet of [...document.styleSheets]) {
|
|
138
|
+
let rules: CSSRuleList;
|
|
139
|
+
try { rules = sheet.cssRules; } catch { continue; }
|
|
140
|
+
for (const r of [...rules]) {
|
|
141
|
+
if (r instanceof CSSFontFaceRule &&
|
|
142
|
+
r.style.getPropertyValue('font-family').replace(/"/g, '') === 'fontawesome-ep_webrtc') {
|
|
143
|
+
out.push(r.style.getPropertyValue('src'));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
});
|
|
149
|
+
expect(srcs.length).toBeGreaterThan(0);
|
|
150
|
+
for (const src of srcs) expect(src).toMatch(/^url\("data:font\/woff2;base64,/);
|
|
151
|
+
});
|
|
106
152
|
});
|