Improve Accessibility

This commit is contained in:
Leo Herzog
2020-11-11 21:44:28 -05:00
parent f09514e8d5
commit 8e12c1b6b4
5 changed files with 145 additions and 118 deletions

191
bundle.js
View File

@@ -2123,9 +2123,7 @@ function fromByteArray (uint8) {
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
))
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
}
// pad the end with zeros, but make sure to not forget the extra bytes
@@ -27514,18 +27512,18 @@ simpleGet.concat = (opts, cb) => {
}).call(this)}).call(this,require("buffer").Buffer)
},{"buffer":60,"decompress-response":55,"http":264,"https":116,"once":183,"querystring":192,"simple-concat":221,"url":299}],223:[function(require,module,exports){
(function (Buffer){(function (){
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var debug = require('debug')('simple-peer')
var getBrowserRTC = require('get-browser-rtc')
var randombytes = require('randombytes')
var stream = require('readable-stream')
var queueMicrotask = require('queue-microtask') // TODO: remove when Node 10 is not supported
var errCode = require('err-code')
const debug = require('debug')('simple-peer')
const getBrowserRTC = require('get-browser-rtc')
const randombytes = require('randombytes')
const stream = require('readable-stream')
const queueMicrotask = require('queue-microtask') // TODO: remove when Node 10 is not supported
const errCode = require('err-code')
const { Buffer } = require('buffer')
var MAX_BUFFERED_AMOUNT = 64 * 1024
var ICECOMPLETE_TIMEOUT = 5 * 1000
var CHANNEL_CLOSING_TIMEOUT = 5 * 1000
const MAX_BUFFERED_AMOUNT = 64 * 1024
const ICECOMPLETE_TIMEOUT = 5 * 1000
const CHANNEL_CLOSING_TIMEOUT = 5 * 1000
// HACK: Filter trickle lines when trickle is disabled #354
function filterTrickle (sdp) {
@@ -27569,6 +27567,7 @@ class Peer extends stream.Duplex {
this.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT
this.destroyed = false
this.destroying = false
this._connected = false
this.remoteAddress = undefined
@@ -27735,7 +27734,7 @@ class Peer extends stream.Duplex {
}
_addIceCandidate (candidate) {
var iceCandidateObj = new this._wrtc.RTCIceCandidate(candidate)
const iceCandidateObj = new this._wrtc.RTCIceCandidate(candidate)
this._pc.addIceCandidate(iceCandidateObj)
.catch(err => {
if (!iceCandidateObj.address || iceCandidateObj.address.endsWith('.local')) {
@@ -27771,6 +27770,7 @@ class Peer extends stream.Duplex {
}
} else {
this.emit('signal', { // request initiator to renegotiate
type: 'transceiverRequest',
transceiverRequest: { kind, init }
})
}
@@ -27796,8 +27796,8 @@ class Peer extends stream.Duplex {
addTrack (track, stream) {
this._debug('addTrack()')
var submap = this._senderMap.get(track) || new Map() // nested Maps map [track, stream] to sender
var sender = submap.get(stream)
const submap = this._senderMap.get(track) || new Map() // nested Maps map [track, stream] to sender
let sender = submap.get(stream)
if (!sender) {
sender = this._pc.addTrack(track, stream)
submap.set(stream, sender)
@@ -27819,8 +27819,8 @@ class Peer extends stream.Duplex {
replaceTrack (oldTrack, newTrack, stream) {
this._debug('replaceTrack()')
var submap = this._senderMap.get(oldTrack)
var sender = submap ? submap.get(stream) : null
const submap = this._senderMap.get(oldTrack)
const sender = submap ? submap.get(stream) : null
if (!sender) {
throw errCode(new Error('Cannot replace track that was never added.'), 'ERR_TRACK_NOT_ADDED')
}
@@ -27841,8 +27841,8 @@ class Peer extends stream.Duplex {
removeTrack (track, stream) {
this._debug('removeSender()')
var submap = this._senderMap.get(track)
var sender = submap ? submap.get(stream) : null
const submap = this._senderMap.get(track)
const sender = submap ? submap.get(stream) : null
if (!sender) {
throw errCode(new Error('Cannot remove track that was never added.'), 'ERR_TRACK_NOT_ADDED')
}
@@ -27905,6 +27905,7 @@ class Peer extends stream.Duplex {
} else {
this._debug('requesting negotiation from initiator')
this.emit('signal', { // request initiator to renegotiate
type: 'renegotiate',
renegotiate: true
})
}
@@ -27920,62 +27921,71 @@ class Peer extends stream.Duplex {
}
_destroy (err, cb) {
if (this.destroyed) return
if (this.destroyed || this.destroying) return
this.destroying = true
this._debug('destroy (error: %s)', err && (err.message || err))
this._debug('destroying (error: %s)', err && (err.message || err))
this.readable = this.writable = false
queueMicrotask(() => { // allow events concurrent with the call to _destroy() to fire (see #692)
this.destroyed = true
this.destroying = false
if (!this._readableState.ended) this.push(null)
if (!this._writableState.finished) this.end()
this._debug('destroy (error: %s)', err && (err.message || err))
this.destroyed = true
this._connected = false
this._pcReady = false
this._channelReady = false
this._remoteTracks = null
this._remoteStreams = null
this._senderMap = null
this.readable = this.writable = false
clearInterval(this._closingInterval)
this._closingInterval = null
if (!this._readableState.ended) this.push(null)
if (!this._writableState.finished) this.end()
clearInterval(this._interval)
this._interval = null
this._chunk = null
this._cb = null
this._connected = false
this._pcReady = false
this._channelReady = false
this._remoteTracks = null
this._remoteStreams = null
this._senderMap = null
if (this._onFinishBound) this.removeListener('finish', this._onFinishBound)
this._onFinishBound = null
clearInterval(this._closingInterval)
this._closingInterval = null
if (this._channel) {
try {
this._channel.close()
} catch (err) {}
clearInterval(this._interval)
this._interval = null
this._chunk = null
this._cb = null
this._channel.onmessage = null
this._channel.onopen = null
this._channel.onclose = null
this._channel.onerror = null
}
if (this._pc) {
try {
this._pc.close()
} catch (err) {}
if (this._onFinishBound) this.removeListener('finish', this._onFinishBound)
this._onFinishBound = null
this._pc.oniceconnectionstatechange = null
this._pc.onicegatheringstatechange = null
this._pc.onsignalingstatechange = null
this._pc.onicecandidate = null
this._pc.ontrack = null
this._pc.ondatachannel = null
}
this._pc = null
this._channel = null
if (this._channel) {
try {
this._channel.close()
} catch (err) {}
if (err) this.emit('error', err)
this.emit('close')
cb()
// allow events concurrent with destruction to be handled
this._channel.onmessage = null
this._channel.onopen = null
this._channel.onclose = null
this._channel.onerror = null
}
if (this._pc) {
try {
this._pc.close()
} catch (err) {}
// allow events concurrent with destruction to be handled
this._pc.oniceconnectionstatechange = null
this._pc.onicegatheringstatechange = null
this._pc.onsignalingstatechange = null
this._pc.onicecandidate = null
this._pc.ontrack = null
this._pc.ondatachannel = null
}
this._pc = null
this._channel = null
if (err) this.emit('error', err)
this.emit('close')
cb()
})
}
_setupData (event) {
@@ -28013,7 +28023,7 @@ class Peer extends stream.Duplex {
// HACK: Chrome will sometimes get stuck in readyState "closing", let's check for this condition
// https://bugs.chromium.org/p/chromium/issues/detail?id=882743
var isClosing = false
let isClosing = false
this._closingInterval = setInterval(() => { // No "onclosing" event
if (this._channel && this._channel.readyState === 'closing') {
if (isClosing) this._onChannelClose() // closing timed out: equivalent to onclose firing
@@ -28091,7 +28101,7 @@ class Peer extends stream.Duplex {
const sendOffer = () => {
if (this.destroyed) return
var signal = this._pc.localDescription || offer
const signal = this._pc.localDescription || offer
this._debug('signal')
this.emit('signal', {
type: signal.type,
@@ -28141,7 +28151,7 @@ class Peer extends stream.Duplex {
const sendAnswer = () => {
if (this.destroyed) return
var signal = this._pc.localDescription || answer
const signal = this._pc.localDescription || answer
this._debug('signal')
this.emit('signal', {
type: signal.type,
@@ -28178,8 +28188,8 @@ class Peer extends stream.Duplex {
_onIceStateChange () {
if (this.destroyed) return
var iceConnectionState = this._pc.iceConnectionState
var iceGatheringState = this._pc.iceGatheringState
const iceConnectionState = this._pc.iceConnectionState
const iceGatheringState = this._pc.iceGatheringState
this._debug(
'iceStateChange (connection: %s) (gathering: %s)',
@@ -28215,7 +28225,7 @@ class Peer extends stream.Duplex {
if (this._pc.getStats.length === 0 || this._isReactNativeWebrtc) {
this._pc.getStats()
.then(res => {
var reports = []
const reports = []
res.forEach(report => {
reports.push(flattenValues(report))
})
@@ -28228,9 +28238,9 @@ class Peer extends stream.Duplex {
// If we destroy connection in `connect` callback this code might happen to run when actual connection is already closed
if (this.destroyed) return
var reports = []
const reports = []
res.result().forEach(result => {
var report = {}
const report = {}
result.names().forEach(name => {
report[name] = result.stat(name)
})
@@ -28265,10 +28275,10 @@ class Peer extends stream.Duplex {
// Treat getStats error as non-fatal. It's not essential.
if (err) items = []
var remoteCandidates = {}
var localCandidates = {}
var candidatePairs = {}
var foundSelectedCandidatePair = false
const remoteCandidates = {}
const localCandidates = {}
const candidatePairs = {}
let foundSelectedCandidatePair = false
items.forEach(item => {
// TODO: Once all browsers support the hyphenated stats report types, remove
@@ -28287,7 +28297,7 @@ class Peer extends stream.Duplex {
const setSelectedCandidatePair = selectedCandidatePair => {
foundSelectedCandidatePair = true
var local = localCandidates[selectedCandidatePair.localCandidateId]
let local = localCandidates[selectedCandidatePair.localCandidateId]
if (local && (local.ip || local.address)) {
// Spec
@@ -28307,7 +28317,7 @@ class Peer extends stream.Duplex {
this.localFamily = this.localAddress.includes(':') ? 'IPv6' : 'IPv4'
}
var remote = remoteCandidates[selectedCandidatePair.remoteCandidateId]
let remote = remoteCandidates[selectedCandidatePair.remoteCandidateId]
if (remote && (remote.ip || remote.address)) {
// Spec
@@ -28329,7 +28339,10 @@ class Peer extends stream.Duplex {
this._debug(
'connect local: %s:%s remote: %s:%s',
this.localAddress, this.localPort, this.remoteAddress, this.remotePort
this.localAddress,
this.localPort,
this.remoteAddress,
this.remotePort
)
}
@@ -28367,7 +28380,7 @@ class Peer extends stream.Duplex {
this._chunk = null
this._debug('sent chunk from "write before connect"')
var cb = this._cb
const cb = this._cb
this._cb = null
cb(null)
}
@@ -28412,8 +28425,8 @@ class Peer extends stream.Duplex {
this._queuedNegotiation = false
this._needsNegotiation() // negotiate again
} else {
this._debug('negotiate')
this.emit('negotiate')
this._debug('negotiated')
this.emit('negotiated')
}
}
@@ -28425,6 +28438,7 @@ class Peer extends stream.Duplex {
if (this.destroyed) return
if (event.candidate && this.trickle) {
this.emit('signal', {
type: 'candidate',
candidate: {
candidate: event.candidate.candidate,
sdpMLineIndex: event.candidate.sdpMLineIndex,
@@ -28443,7 +28457,7 @@ class Peer extends stream.Duplex {
_onChannelMessage (event) {
if (this.destroyed) return
var data = event.data
let data = event.data
if (data instanceof ArrayBuffer) data = Buffer.from(data)
this.push(data)
}
@@ -28451,7 +28465,7 @@ class Peer extends stream.Duplex {
_onChannelBufferedAmountLow () {
if (this.destroyed || !this._cb) return
this._debug('ending backpressure: bufferedAmount %d', this._channel.bufferedAmount)
var cb = this._cb
const cb = this._cb
this._cb = null
cb(null)
}
@@ -28487,13 +28501,14 @@ class Peer extends stream.Duplex {
this._remoteStreams.push(eventStream)
queueMicrotask(() => {
this._debug('on stream')
this.emit('stream', eventStream) // ensure all tracks have been added
})
})
}
_debug () {
var args = [].slice.call(arguments)
const args = [].slice.call(arguments)
args[0] = '[' + this._id + '] ' + args[0]
debug.apply(null, args)
}
@@ -28522,7 +28537,6 @@ Peer.channelConfig = {}
module.exports = Peer
}).call(this)}).call(this,require("buffer").Buffer)
},{"buffer":60,"debug":224,"err-code":97,"get-browser-rtc":115,"queue-microtask":193,"randombytes":195,"readable-stream":241}],224:[function(require,module,exports){
arguments[4][13][0].apply(exports,arguments)
},{"./common":225,"_process":187,"dup":13}],225:[function(require,module,exports){
@@ -37970,7 +37984,8 @@ function start() {
getFiles.addEventListener('click', getFilesFromPeers);
tippy('[data-tippy-content]', {"theme": "torrent-parts", "animation": "shift-away-subtle"}); // all element-defined tooltips
source.disable();
if (window.location.hash) {
originalSourceIcon.innerHTML = '<span class="fad fa-link fa-fw"></span>';
source.setContent("Currently loaded information sourced from shared torrent.parts link");