stripSDP: use allowlist for a= lines instead of blocklist
All checks were successful
Pin to IPFS / pin (push) Successful in 13s
All checks were successful
Pin to IPFS / pin (push) Successful in 13s
This commit is contained in:
parent
654d79c58f
commit
13a2ca68f5
1 changed files with 9 additions and 2 deletions
11
crypto.js
11
crypto.js
|
|
@ -71,9 +71,16 @@ function hexToBuf(hex) {
|
|||
|
||||
/* ─── QR compression: deflate-raw + base45 ─── */
|
||||
|
||||
const SDP_ALLOW_A_PREFIXES = ['a=ice-ufrag:', 'a=ice-pwd:', 'a=fingerprint:', 'a=candidate:', 'a=end-of-candidates'];
|
||||
|
||||
function stripSDP(sdp) {
|
||||
return sdp.split(/\r?\n/).map(line => {
|
||||
if (line === '' || line.startsWith('a=max-message-size:') || line.startsWith('a=sctp-port:')) return null;
|
||||
return sdp.split(/\r?\n/).filter(line => {
|
||||
if (!line) return false;
|
||||
if (line.startsWith('a=')) {
|
||||
return SDP_ALLOW_A_PREFIXES.some(p => line.startsWith(p));
|
||||
}
|
||||
return true;
|
||||
}).map(line => {
|
||||
if (!line.startsWith('a=candidate:')) return line;
|
||||
const parts = line.split(' ');
|
||||
if (parts[2] === 'tcp') return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue