Remove Google Analytics and Update Dependencies

This commit is contained in:
Leo authored and GitHub committed 2022-04-25 20:46:57 +00:00
1 parent 7a9aa3bb10
commit 2c728a61c2
4 files changed
+29 -78

No files matched your search

+27 -45
View File
@@ -1,7 +1,7 @@
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (process){(function (){
/**
* @popperjs/core v2.11.4 - MIT License
* @popperjs/core v2.11.5 - MIT License
*/
'use strict';
@@ -7967,9 +7967,9 @@ var BitField = /** @class */ (function () {
var j = i >> 3;
if (value) {
if (this.buffer.length < j + 1) {
var length_1 = Math.max(j + 1, Math.min(2 * this.buffer.length, this.grow));
if (length_1 <= this.grow) {
var newBuffer = new Uint8Array(length_1);
var length = Math.max(j + 1, Math.min(2 * this.buffer.length, this.grow));
if (length <= this.grow) {
var newBuffer = new Uint8Array(length);
newBuffer.set(this.buffer);
this.buffer = newBuffer;
}
@@ -8395,10 +8395,13 @@ class Wire extends stream.Duplex {
if (this.hasFast) {
// BEP6: If a peer sends a choke, it MUST reject all requests from the peer to whom the choke
// was sent except it SHOULD NOT reject requests for pieces that are in the allowed fast set.
while (this.peerRequests.length) {
const request = this.peerRequests[0]
if (!this.allowedFastSet.includes(request.piece)) {
this.reject(request.piece, request.offset, request.length)
let allowedCount = 0
while (this.peerRequests.length > allowedCount) { // until only allowed requests are left
const request = this.peerRequests[allowedCount] // first non-allowed request
if (this.allowedFastSet.includes(request.piece)) {
++allowedCount // count request as allowed
} else {
this.reject(request.piece, request.offset, request.length) // removes from this.peerRequests
}
}
} else {
@@ -13107,6 +13110,7 @@ class WebSocketTracker extends Tracker {
clearTimeout(peer.trackerTimeout)
peer.trackerTimeout = null
delete this.peers[offerId]
peer.destroy()
} else {
debug(`got unexpected answer: ${JSON.stringify(data.answer)}`)
}
@@ -59372,7 +59376,7 @@ class WebTorrent extends EventEmitter {
}
port.postMessage(chunk)
if (!chunk) cleanup()
if (!this.workerKeepAliveInterval) this.workerKeepAliveInterval = setInterval(() => fetch(`${this.serviceWorker.scriptURL.substr(0, this.serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)}webtorrent/keepalive/`), keepAliveTime)
if (!this.workerKeepAliveInterval) this.workerKeepAliveInterval = setInterval(() => fetch(`${this.serviceWorker.scriptURL.slice(0, this.serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)}webtorrent/keepalive/`), keepAliveTime)
} else {
cleanup()
}
@@ -60040,7 +60044,7 @@ class File extends EventEmitter {
if (typeof window === 'undefined') throw new Error('browser-only method')
if (!this._serviceWorker) throw new Error('No worker registered')
if (this._serviceWorker.state !== 'activated') throw new Error('Worker isn\'t activated')
const workerPath = this._serviceWorker.scriptURL.substr(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
const workerPath = this._serviceWorker.scriptURL.slice(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
const url = `${workerPath}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`
cb(null, url)
}
@@ -60049,7 +60053,7 @@ class File extends EventEmitter {
if (typeof window === 'undefined') throw new Error('browser-only method')
if (!this._serviceWorker) throw new Error('No worker registered')
if (this._serviceWorker.state !== 'activated') throw new Error('Worker isn\'t activated')
const workerPath = this._serviceWorker.scriptURL.substr(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
const workerPath = this._serviceWorker.scriptURL.slice(0, this._serviceWorker.scriptURL.lastIndexOf('/') + 1).slice(window.location.origin.length)
elem.src = `${workerPath}webtorrent/${this._torrent.infoHash}/${encodeURI(this.path)}`
cb(null, elem)
}
@@ -61104,14 +61108,6 @@ class Torrent extends EventEmitter {
this.bitfield = new BitField(this.pieces.length)
this.wires.forEach(wire => {
// If we didn't have the metadata at the time ut_metadata was initialized for this
// wire, we still want to make it available to the peer in case they request it.
if (wire.ut_metadata) wire.ut_metadata.setMetadata(this.metadata)
this._onWireWithMetadata(wire)
})
// Emit 'metadata' before 'ready' and 'done'
this.emit('metadata')
@@ -61265,6 +61261,15 @@ class Torrent extends EventEmitter {
// In case any selections were made before torrent was ready
this._updateSelections()
// Start requesting pieces after we have initially verified them
this.wires.forEach(wire => {
// If we didn't have the metadata at the time ut_metadata was initialized for this
// wire, we still want to make it available to the peer in case they request it.
if (wire.ut_metadata) wire.ut_metadata.setMetadata(this.metadata)
this._onWireWithMetadata(wire)
})
}
destroy (opts, cb) {
@@ -61684,7 +61689,7 @@ class Torrent extends EventEmitter {
// More info: https://github.com/webtorrent/bittorrent-protocol#extension-api
this.emit('wire', wire, addr)
if (this.metadata) {
if (this.ready) {
queueMicrotask(() => {
// This allows wire.handshake() to be called (by Peer.onHandshake) before any
// messages get sent on the wire
@@ -62632,7 +62637,7 @@ class WebConn extends Wire {
const fileEnd = requestedFile.offset + requestedFile.length - 1
const url = this.url +
(this.url[this.url.length - 1] === '/' ? '' : '/') +
requestedFile.path
requestedFile.path.replace(this._torrent.path, '')
return {
url,
fileOffsetInRange: Math.max(requestedFile.offset - rangeStart, 0),
@@ -62749,7 +62754,7 @@ module.exports = WebConn
}).call(this)}).call(this,require("buffer").Buffer)
},{"../package.json":494,"bitfield":26,"bittorrent-protocol":27,"buffer":109,"debug":160,"lt_donthave":255,"simple-get":393,"simple-sha1":410}],494:[function(require,module,exports){
module.exports={
"version": "1.8.6"
"version": "1.8.14"
}
},{}],495:[function(require,module,exports){
// Returns a wrapper function that returns a wrapped callback
@@ -62962,10 +62967,6 @@ function start() {
copyurl.on('success', function(e) {
notyf.success('Copied site URL to clipboard!');
console.info(e);
gtag('event', 'share', {
"method": "Copy URL",
"content_id": e.text,
});
});
copyurl.on('failure', function(e) {
notyf.error('Problem copying to clipboard');
@@ -62975,10 +62976,6 @@ function start() {
let copymagnet = new clipboard('#copyMagnet');
copymagnet.on('success', function(e) {
notyf.success('Copied Magnet URL to clipboard!');
gtag('event', 'share', {
"method": "Copy Magnet",
"content_id": e.text,
});
});
copymagnet.on('failure', function(e) {
notyf.error('Problem copying to clipboard');
@@ -63168,14 +63165,6 @@ function display() {
sourceTooltip.enable();
gtag('event', 'view_item', {
items: [{
"item_id": parsed.infoHash,
"item_name": parsed.name,
"item_category": source
}]
});
}
function createFileRow(icon, name, size) {
@@ -63262,7 +63251,6 @@ function resetProperties() {
copyMagnet.setAttribute('data-clipboard-text', '');
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
sourceTooltip.disable();
gtag('event', 'reset');
}
async function addCurrentTrackers() {
@@ -63285,7 +63273,6 @@ async function addCurrentTrackers() {
addTrackers.className = '';
addTrackers.innerHTML = 'Add Known Working Trackers';
display();
gtag('event', 'add_trackers');
}
function addRow() {
@@ -63336,7 +63323,6 @@ function getFilesFromPeers() {
torrent.destroy();
});
display();
gtag('event', 'attempt_webtorrent_fetch');
}
// https://stackoverflow.com/a/36899900/2700296
@@ -63353,10 +63339,6 @@ function saveTorrent() {
a.click();
window.URL.revokeObjectURL(url);
a.remove();
gtag('event', 'share', {
"method": "Torrent Download",
"content_id": parsed.name
});
}
}).call(this)}).call(this,require("buffer").Buffer)
},{"buffer":109,"bytes":115,"clipboard":134,"mime-types":279,"parse-torrent":331,"tippy.js":474,"webtorrent":487}]},{},[497]);
+2 -2
View File
@@ -1,6 +1,6 @@
!function e(t,i,n){function r(a,o){if(!i[a]){if(!t[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=i[a]={exports:{}};t[a][0].call(u.exports,(function(e){return r(t[a][1][e]||e)}),u,u.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(e,t,i){(function(e){(function(){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function s(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}Object.defineProperty(i,"__esModule",{value:!0});var a=Math.max,o=Math.min,c=Math.round;function l(e,t){void 0===t&&(t=!1);var i=e.getBoundingClientRect(),n=1,s=1;if(r(e)&&t){var a=e.offsetHeight,o=e.offsetWidth;o>0&&(n=c(i.width)/o||1),a>0&&(s=c(i.height)/a||1)}return{width:i.width/n,height:i.height/s,top:i.top/s,right:i.right/n,bottom:i.bottom/s,left:i.left/n,x:i.left/n,y:i.top/s}}function u(e){var i=t(e);return{scrollLeft:i.pageXOffset,scrollTop:i.pageYOffset}}function p(e){return e?(e.nodeName||"").toLowerCase():null}function d(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function f(e){return l(d(e)).left+u(e).scrollLeft}function h(e){return t(e).getComputedStyle(e)}function m(e){var t=h(e),i=t.overflow,n=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+r+n)}function b(e,i,n){void 0===n&&(n=!1);var s,a,o=r(i),h=r(i)&&function(e){var t=e.getBoundingClientRect(),i=c(t.width)/e.offsetWidth||1,n=c(t.height)/e.offsetHeight||1;return 1!==i||1!==n}(i),b=d(i),v=l(e,h),g={scrollLeft:0,scrollTop:0},y={x:0,y:0};return(o||!o&&!n)&&(("body"!==p(i)||m(b))&&(g=(s=i)!==t(s)&&r(s)?{scrollLeft:(a=s).scrollLeft,scrollTop:a.scrollTop}:u(s)),r(i)?((y=l(i,!0)).x+=i.clientLeft,y.y+=i.clientTop):b&&(y.x=f(b))),{x:v.left+g.scrollLeft-y.x,y:v.top+g.scrollTop-y.y,width:v.width,height:v.height}}function v(e){var t=l(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:n}}function g(e){return"html"===p(e)?e:e.assignedSlot||e.parentNode||(s(e)?e.host:null)||d(e)}function y(e){return["html","body","#document"].indexOf(p(e))>=0?e.ownerDocument.body:r(e)&&m(e)?e:y(g(e))}function _(e,i){var n;void 0===i&&(i=[]);var r=y(e),s=r===(null==(n=e.ownerDocument)?void 0:n.body),a=t(r),o=s?[a].concat(a.visualViewport||[],m(r)?r:[]):r,c=i.concat(o);return s?c:c.concat(_(g(o)))}function x(e){return["table","td","th"].indexOf(p(e))>=0}function w(e){return r(e)&&"fixed"!==h(e).position?e.offsetParent:null}function k(e){for(var i=t(e),n=w(e);n&&x(n)&&"static"===h(n).position;)n=w(n);return n&&("html"===p(n)||"body"===p(n)&&"static"===h(n).position)?i:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&r(e)&&"fixed"===h(e).position)return null;var i=g(e);for(s(i)&&(i=i.host);r(i)&&["html","body"].indexOf(p(i))<0;){var n=h(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(e)||i}var E="top",S="bottom",M="right",A="left",j="auto",I=[E,S,M,A],T="start",C="end",B="viewport",R="popper",L=I.reduce((function(e,t){return e.concat([t+"-"+T,t+"-"+C])}),[]),O=[].concat(I,[j]).reduce((function(e,t){return e.concat([t,t+"-"+T,t+"-"+C])}),[]),P=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function U(e){var t=new Map,i=new Set,n=[];function r(e){i.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!i.has(e)){var n=t.get(e);n&&r(n)}})),n.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){i.has(e.name)||r(e)})),n}function q(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return[].concat(i).reduce((function(e,t){return e.replace(/%s/,t)}),e)}var N='Popper: modifier "%s" provided an invalid %s property, expected %s but got %s',D=["name","enabled","phase","fn","effect","requires","options"];function z(e){return e.split("-")[0]}function H(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&s(i)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function F(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function W(e,i){return i===B?F(function(e){var i=t(e),n=d(e),r=i.visualViewport,s=n.clientWidth,a=n.clientHeight,o=0,c=0;return r&&(s=r.width,a=r.height,/^((?!cLine truncated
/*! bittorrent-protocol. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
const n=e("unordered-array-remove"),r=e("bencode"),s=e("bitfield").default,a=e("crypto"),o=e("debug")("bittorrent-protocol"),c=e("randombytes"),l=e("simple-sha1"),u=e("speedometer"),p=e("readable-stream"),d=e("rc4"),f=i.from("BitTorrent protocol"),h=i.from([0,0,0,0]),m=i.from([0,0,0,1,0]),b=i.from([0,0,0,1,1]),v=i.from([0,0,0,1,2]),g=i.from([0,0,0,1,3]),y=[0,0,0,0,0,0,0,0],_=[0,0,0,3,9,0,0],x=i.from([0,0,0,1,14]),w=i.from([0,0,0,1,15]),k=i.from([0,0,0,0,0,0,0,0]),E=i.from([0,0,1,2]),S=i.from([0,0,0,2]);function M(e,t){for(let i=e.length;i--;)e[i]^=t[i];return e}class A{constructor(e,t,i,n){this.piece=e,this.offset=t,this.length=i,this.callback=n}}class j{constructor(){this.buffer=new Uint8Array}get(e){return!0}set(e){}}class I extends p.Duplex{constructor(e=null,t=0,i=!1){super(),this._debugId=c(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new s(0,{grow:4e5}),this.extensions={},this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this.hasFast=!1,this.allowedFastSet=[],this.peerAllowedFastSet=[],this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=u(),this.downloadSpeed=u(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=i,i?(this._dh=a.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",(()=>this._onFinish())),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end(),this}end(...e){return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const i=this._nextExt,n=new e(this);function r(){}"function"!=typeof n.onHandshake&&(n.onHandshake=r),"function"!=typeof n.onExtendedHandshake&&(n.onExtendedHandshake=r),"function"!=typeof n.onMessage&&(n.onMessage=r),this.extendedMapping[i]=t,this._ext[t]=n,this[t]=n,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(h)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=c(e);this._push(i.concat([i.from(this._myPubKey,"hex"),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=c(e);this._push(i.concat([i.from(this._myPubKey,"hex"),t]))}sendPe3(e){this.setEncrypt(this._sharedSecret,e);const t=i.from(l.sync(i.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),n=M(i.from(l.sync(i.from(this._utfToHex("req2")+e,"hex")),"hex"),i.from(l.sync(i.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),r=c(2).readUInt16BE(0)%512,s=c(r);let a=i.alloc(14+r+2);k.copy(a),E.copy(a,8),a.writeInt16BE(r,12),s.copy(a,14),a.writeInt16BE(0,14+r),a=this._encryptHandshake(a),this._push(i.concat([t,n,a]))}sendPe4(e){this.setEncrypt(this._sharedSecret,e);const t=c(2).readUInt16BE(0)%512,n=c(t);let r=i.alloc(14+t);k.copy(r),S.copy(r,8),r.writeInt16BE(t,12),n.copy(r,14),r=this._encryptHandshake(r),this._push(r),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,n){let r,s;if("string"==typeof e?(e=e.toLowerCase(),r=i.from(e,"hex")):(r=e,e=r.toString("hex")),"string"==typeof t?s=i.from(t,"hex"):(s=t,t=s.toString("hex")),this._infoHash=r,20!==r.length||20!==s.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,n);const a=i.from(y);this.extensions={extended:!0,dht:!(!n||!n.dht),fast:!(!n||!n.fast)},a[5]|=16,this.extensions.dht&&(a[7]|=1),this.extensions.fast&&(a[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),thiLine truncated
const n=e("unordered-array-remove"),r=e("bencode"),s=e("bitfield").default,a=e("crypto"),o=e("debug")("bittorrent-protocol"),c=e("randombytes"),l=e("simple-sha1"),u=e("speedometer"),p=e("readable-stream"),d=e("rc4"),f=i.from("BitTorrent protocol"),h=i.from([0,0,0,0]),m=i.from([0,0,0,1,0]),b=i.from([0,0,0,1,1]),v=i.from([0,0,0,1,2]),g=i.from([0,0,0,1,3]),y=[0,0,0,0,0,0,0,0],_=[0,0,0,3,9,0,0],x=i.from([0,0,0,1,14]),w=i.from([0,0,0,1,15]),k=i.from([0,0,0,0,0,0,0,0]),E=i.from([0,0,1,2]),S=i.from([0,0,0,2]);function M(e,t){for(let i=e.length;i--;)e[i]^=t[i];return e}class A{constructor(e,t,i,n){this.piece=e,this.offset=t,this.length=i,this.callback=n}}class j{constructor(){this.buffer=new Uint8Array}get(e){return!0}set(e){}}class I extends p.Duplex{constructor(e=null,t=0,i=!1){super(),this._debugId=c(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new s(0,{grow:4e5}),this.extensions={},this.peerExtensions={},this.requests=[],this.peerRequests=[],this.extendedMapping={},this.peerExtendedMapping={},this.extendedHandshake={},this.peerExtendedHandshake={},this.hasFast=!1,this.allowedFastSet=[],this.peerAllowedFastSet=[],this._ext={},this._nextExt=1,this.uploaded=0,this.downloaded=0,this.uploadSpeed=u(),this.downloadSpeed=u(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=i,i?(this._dh=a.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",(()=>this._onFinish())),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){if(!this.destroyed)return this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end(),this}end(...e){return this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const i=this._nextExt,n=new e(this);function r(){}"function"!=typeof n.onHandshake&&(n.onHandshake=r),"function"!=typeof n.onExtendedHandshake&&(n.onExtendedHandshake=r),"function"!=typeof n.onMessage&&(n.onMessage=r),this.extendedMapping[i]=t,this._ext[t]=n,this[t]=n,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(h)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=c(e);this._push(i.concat([i.from(this._myPubKey,"hex"),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=c(e);this._push(i.concat([i.from(this._myPubKey,"hex"),t]))}sendPe3(e){this.setEncrypt(this._sharedSecret,e);const t=i.from(l.sync(i.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),n=M(i.from(l.sync(i.from(this._utfToHex("req2")+e,"hex")),"hex"),i.from(l.sync(i.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),r=c(2).readUInt16BE(0)%512,s=c(r);let a=i.alloc(14+r+2);k.copy(a),E.copy(a,8),a.writeInt16BE(r,12),s.copy(a,14),a.writeInt16BE(0,14+r),a=this._encryptHandshake(a),this._push(i.concat([t,n,a]))}sendPe4(e){this.setEncrypt(this._sharedSecret,e);const t=c(2).readUInt16BE(0)%512,n=c(t);let r=i.alloc(14+t);k.copy(r),S.copy(r,8),r.writeInt16BE(t,12),n.copy(r,14),r=this._encryptHandshake(r),this._push(r),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,n){let r,s;if("string"==typeof e?(e=e.toLowerCase(),r=i.from(e,"hex")):(r=e,e=r.toString("hex")),"string"==typeof t?s=i.from(t,"hex"):(s=t,t=s.toString("hex")),this._infoHash=r,20!==r.length||20!==s.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,n);const a=i.from(y);this.extensions={extended:!0,dht:!(!n||!n.dht),fast:!(!n||!n.fast)},a[5]|=16,this.extensions.dht&&(a[7]|=1),this.extensions.fast&&(a[7]|=4),this.extensions.fast&&this.peerExtensions.fast&&(this._debug("fast extension is enabled"),thiLine truncated
/*! blob-to-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
t.exports=function(t,i){if("undefined"==typeof Blob||!(t instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof i)throw new Error("second argument must be a function");const n=new FileReader;n.addEventListener("loadend",(function t(r){n.removeEventListener("loadend",t,!1),r.error?i(r.error):i(null,e.from(n.result))}),!1),n.readAsArrayBuffer(t)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:109}],48:[function(e,t,i){(function(i){(function(){const{Transform:n}=e("readable-stream");t.exports=class extends n{constructor(e,t={}){super(t),"object"==typeof e&&(e=(t=e).size),this.size=e||512;const{nopad:i,zeroPadding:n=!0}=t;this._zeroPadding=!i&&!!n,this._buffered=[],this._bufferedBytes=0}_transform(e,t,n){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const e=[];let t=0;for(;t<this.size;){const i=this._buffered.shift();if(t+i.length<=this.size)e.push(i),t+=i.length;else{const n=this.size-t;e.push(i.slice(0,n)),t+=n,this._buffered.unshift(i.slice(n))}}this.push(i.concat(e,this.size))}n()}_flush(){if(this._bufferedBytes&&this._zeroPadding){const e=i.alloc(this.size-this._bufferedBytes);this._buffered.push(e),this.push(i.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(i.concat(this._buffered)),this._buffered=null);this.push(null)}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:109,"readable-stream":63}],49:[function(e,t,i){arguments[4][28][0].apply(i,arguments)},{dup:28}],50:[function(e,t,i){arguments[4][29][0].apply(i,arguments)},{"./_stream_readable":52,"./_stream_writable":54,_process:340,dup:29,inherits:245}],51:[function(e,t,i){arguments[4][30][0].apply(i,arguments)},{"./_stream_transform":53,dup:30,inherits:245}],52:[function(e,t,i){arguments[4][31][0].apply(i,arguments)},{"../errors":49,"./_stream_duplex":50,"./internal/streams/async_iterator":55,"./internal/streams/buffer_list":56,"./internal/streams/destroy":57,"./internal/streams/from":59,"./internal/streams/state":61,"./internal/streams/stream":62,_process:340,buffer:109,dup:31,events:192,inherits:245,"string_decoder/":471,util:66}],53:[function(e,t,i){arguments[4][32][0].apply(i,arguments)},{"../errors":49,"./_stream_duplex":50,dup:32,inherits:245}],54:[function(e,t,i){arguments[4][33][0].apply(i,arguments)},{"../errors":49,"./_stream_duplex":50,"./internal/streams/destroy":57,"./internal/streams/state":61,"./internal/streams/stream":62,_process:340,buffer:109,dup:33,inherits:245,"util-deprecate":484}],55:[function(e,t,i){arguments[4][34][0].apply(i,arguments)},{"./end-of-stream":58,_process:340,dup:34}],56:[function(e,t,i){arguments[4][35][0].apply(i,arguments)},{buffer:109,dup:35,util:66}],57:[function(e,t,i){arguments[4][36][0].apply(i,arguments)},{_process:340,dup:36}],58:[function(e,t,i){arguments[4][37][0].apply(i,arguments)},{"../../../errors":49,dup:37}],59:[function(e,t,i){arguments[4][38][0].apply(i,arguments)},{dup:38}],60:[function(e,t,i){arguments[4][39][0].apply(i,arguments)},{"../../../errors":49,"./end-of-stream":58,dup:39}],61:[function(e,t,i){arguments[4][40][0].apply(i,arguments)},{"../../../errors":49,dup:40}],62:[function(e,t,i){arguments[4][41][0].apply(i,arguments)},{dup:41,events:192}],63:[function(e,t,i){arguments[4][42][0].apply(i,arguments)},{"./lib/_stream_duplex.js":50,"./lib/_stream_passthrough.js":51,"./lib/_stream_readable.js":52,"./lib/_stream_transform.js":53,"./lib/_stream_writable.js":54,"./lib/internal/streams/end-of-stream.js":58,"./lib/internal/streams/pipeline.js":60,dup:42}],64:[function(e,t,i){!function(t,i){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function s(e,t,i){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(i=t,t=10),this._init(e||0,t||10,i||"be"))}var a;"object"==typeof t?t.exports=s:i.BN=s,s.BN=s,s.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function o(e,t){var i=e.charCodeAt(t);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void n(!1,"Invalid character in "+e)}function c(e,t,i){var n=o(e,i);return i-1>=t&&(n|=o(e,i-1)<<4),n}function l(e,t,i,r){for(var s=0,a=0,o=Math.min(e.length,i),c=t;c<o;c++){var l=e.charCodeAt(c)-48;s*=r,a=l>=49?l-49+10:l>=17?l-17+10:l,n(l>=0&&a<r,"Invalid character"),s+=a}return s}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),n(t=Line truncated
/*!
@@ -107,4 +107,4 @@ const i=16384;class n{constructor(e){this.length=e,this.missing=e,this.sources=n
/*! ut_metadata. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
const{EventEmitter:n}=e("events"),r=e("bencode"),s=e("bitfield").default,a=e("debug")("ut_metadata"),o=e("simple-sha1"),c=16384;t.exports=e=>{class t extends n{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new s(0,{grow:1e3}),i.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,i){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/c),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,i;try{const n=e.toString(),s=n.indexOf("ee")+2;t=r.decode(n.substring(0,s)),i=e.slice(s)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,i,t.total_size);break;case 2:this._onReject(t.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;a("set metadata");try{const t=r.decode(e).info;t&&(e=r.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===o.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)}_send(e,t){let n=r.encode(e);i.isBuffer(t)&&(n=i.concat([n,t])),this._wire.extended("ut_metadata",n)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,i){const n={msg_type:1,piece:e};"number"==typeof i&&(n.total_size=i),this._send(n,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let i=t+c;i>this._metadataSize&&(i=this._metadataSize);const n=this.metadata.slice(t,i);this._data(e,n,this._metadataSize)}_onData(e,t,i){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=i.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(!e)return;this.setMetadata(this.metadata)||this._failedMetadata()}_failedMetadata(){this._bitfield=new s(0,{grow:1e3}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:22,bitfield:26,buffer:109,debug:160,events:192,"simple-sha1":410}],484:[function(e,t,i){(function(e){(function(){function i(t){try{if(!e.localStorage)return!1}catch(e){return!1}var i=e.localStorage[t];return null!=i&&"true"===String(i).toLowerCase()}t.exports=function(e,t){if(i("noDeprecation"))return e;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],485:[function(e,t,i){(function(i){(function(){const n=e("binary-search"),r=e("events"),s=e("mp4-stream"),a=e("mp4-box-encoding"),o=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}const l=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const i=this._file.createReadStream({start:e});i.pipe(this._decoder);const n=r=>{"moov"===r.type?(this._decoder.removeListener("box",n),this._decoder.decode((e=>{i.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",n),t+=r.length,i.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",n)}_processMoov(e){const t=e.traks;this._tracks=[],this._hasVideo=!1,this._hasAudio=!1;for(let i=0;i<t.length;i++){const r=t[i],s=r.mdia.minf.stbl,a=s.stsd.entries[0],o=r.mdia.hdlr.handlerType;let l,u;if("vide"===o&&"avc1"===a.type){if(this._hasVideo)contiLine truncated
/*! webtorrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
const n=e("events"),r=e("path"),s=e("simple-concat"),a=e("create-torrent"),o=e("debug"),c=e("bittorrent-dht/client"),l=e("load-ip-set"),u=e("run-parallel"),p=e("parse-torrent"),d=e("simple-peer"),f=e("queue-microtask"),h=e("randombytes"),m=e("simple-sha1"),b=e("speedometer"),{ThrottleGroup:v}=e("speed-limiter"),g=e("./lib/conn-pool.js"),y=e("./lib/torrent.js"),{version:_}=e("./package.json"),x=o("webtorrent"),w=_.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),k=`-WW${w}-`;class E extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:i.isBuffer(t.peerId)?this.peerId=t.peerId.toString("hex"):this.peerId=i.from(k+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),"string"==typeof t.nodeId?this.nodeId=t.nodeId:i.isBuffer(t.nodeId)?this.nodeId=t.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=E.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===t.secure&&e("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new v({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new v({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):f((()=>{this._onListening()})),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==t.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const n=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof l&&null!=t.blocklist?l(t.blocklist,{headers:{"user-agent":`WebTorrent/${_} (https://webtorrent.io)`}},((e,t)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=t,n()})):f(n)}loadWorker(e,t=(()=>{})){if(!(e instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==e.state)throw new Error("Worker isn't activated");this.serviceWorker=e,navigator.serviceWorker.addEventListener("message",(e=>{const{data:t}=e;if(!t.type||"webtorrent"===!t.type||!t.url)return null;let[i,...n]=t.url.slice(t.url.indexOf(t.scope+"webtorrent/")+11+t.scope.length).split("/");if(n=decodeURI(n.join("/")),!i||!n)return null;const[r]=e.ports,s=this.get(i)&&this.get(i).files.find((e=>e.path===n));if(!s)return null;const[a,o,c]=s._serve(t),l=o&&o[Symbol.asyncIterator](),u=()=>{r.onmessage=null,o&&o.destroy(),c&&c.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async e=>{if(e.data){let e;try{e=(await l.next()).value}catch(e){}r.postMessage(e),e||u(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.serviceWorker.scriptURL.substr(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`)),2e4))}else u()},this.workerPortCount++,r.postMessage(a)})),t(this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof y){if(this.torrents.includes(e))return e}else{let t;try{t=p(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},i=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,i]=[{},t]);const n=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(i(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new y(e,this,t);return this.torrents.push(s),s.once("_infoHash",n),s.once("ready",r),s.onceLine truncated
const n=e("events"),r=e("path"),s=e("simple-concat"),a=e("create-torrent"),o=e("debug"),c=e("bittorrent-dht/client"),l=e("load-ip-set"),u=e("run-parallel"),p=e("parse-torrent"),d=e("simple-peer"),f=e("queue-microtask"),h=e("randombytes"),m=e("simple-sha1"),b=e("speedometer"),{ThrottleGroup:v}=e("speed-limiter"),g=e("./lib/conn-pool.js"),y=e("./lib/torrent.js"),{version:_}=e("./package.json"),x=o("webtorrent"),w=_.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),k=`-WW${w}-`;class E extends n{constructor(t={}){super(),"string"==typeof t.peerId?this.peerId=t.peerId:i.isBuffer(t.peerId)?this.peerId=t.peerId.toString("hex"):this.peerId=i.from(k+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),"string"==typeof t.nodeId?this.nodeId=t.nodeId:i.isBuffer(t.nodeId)?this.nodeId=t.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=t.torrentPort||0,this.dhtPort=t.dhtPort||0,this.tracker=void 0!==t.tracker?t.tracker:{},this.lsd=!1!==t.lsd,this.torrents=[],this.maxConns=Number(t.maxConns)||55,this.utp=E.UTP_SUPPORT&&!1!==t.utp,this._downloadLimit=Math.max("number"==typeof t.downloadLimit?t.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof t.uploadLimit?t.uploadLimit:-1,-1),this.serviceWorker=null,this.workerKeepAliveInterval=null,this.workerPortCount=0,!0===t.secure&&e("./lib/peer").enableSecure(),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new v({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new v({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):f((()=>{this._onListening()})),this._downloadSpeed=b(),this._uploadSpeed=b(),!1!==t.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},t.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==t.webSeeds;const n=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof l&&null!=t.blocklist?l(t.blocklist,{headers:{"user-agent":`WebTorrent/${_} (https://webtorrent.io)`}},((e,t)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=t,n()})):f(n)}loadWorker(e,t=(()=>{})){if(!(e instanceof ServiceWorker))throw new Error("Invalid worker registration");if("activated"!==e.state)throw new Error("Worker isn't activated");this.serviceWorker=e,navigator.serviceWorker.addEventListener("message",(e=>{const{data:t}=e;if(!t.type||"webtorrent"===!t.type||!t.url)return null;let[i,...n]=t.url.slice(t.url.indexOf(t.scope+"webtorrent/")+11+t.scope.length).split("/");if(n=decodeURI(n.join("/")),!i||!n)return null;const[r]=e.ports,s=this.get(i)&&this.get(i).files.find((e=>e.path===n));if(!s)return null;const[a,o,c]=s._serve(t),l=o&&o[Symbol.asyncIterator](),u=()=>{r.onmessage=null,o&&o.destroy(),c&&c.destroy(),this.workerPortCount--,this.workerPortCount||(clearInterval(this.workerKeepAliveInterval),this.workerKeepAliveInterval=null)};r.onmessage=async e=>{if(e.data){let e;try{e=(await l.next()).value}catch(e){}r.postMessage(e),e||u(),this.workerKeepAliveInterval||(this.workerKeepAliveInterval=setInterval((()=>fetch(`${this.serviceWorker.scriptURL.slice(0,this.serviceWorker.scriptURL.lastIndexOf("/")+1).slice(window.location.origin.length)}webtorrent/keepalive/`)),2e4))}else u()},this.workerPortCount++,r.postMessage(a)})),t(this.serviceWorker)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof y){if(this.torrents.includes(e))return e}else{let t;try{t=p(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},i=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,i]=[{},t]);const n=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(i(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new y(e,this,t);return this.torrents.push(s),s.once("_infoHash",n),s.once("ready",r),s.once(Line truncated
-8
View File
@@ -43,14 +43,6 @@
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="/ext/notyf.min.js"></script>
<script async defer src="https://www.googletagmanager.com/gtag/js?id=G-VT4953Z89H"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-VT4953Z89H');
</script>
<script async defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "6f97f49b4c384ee197a2f319cebec274"}'></script>
</head>
-23
View File
@@ -151,10 +151,6 @@ function start() {
copyurl.on('success', function(e) {
notyf.success('Copied site URL to clipboard!');
console.info(e);
gtag('event', 'share', {
"method": "Copy URL",
"content_id": e.text,
});
});
copyurl.on('failure', function(e) {
notyf.error('Problem copying to clipboard');
@@ -164,10 +160,6 @@ function start() {
let copymagnet = new clipboard('#copyMagnet');
copymagnet.on('success', function(e) {
notyf.success('Copied Magnet URL to clipboard!');
gtag('event', 'share', {
"method": "Copy Magnet",
"content_id": e.text,
});
});
copymagnet.on('failure', function(e) {
notyf.error('Problem copying to clipboard');
@@ -357,14 +349,6 @@ function display() {
sourceTooltip.enable();
gtag('event', 'view_item', {
items: [{
"item_id": parsed.infoHash,
"item_name": parsed.name,
"item_category": source
}]
});
}
function createFileRow(icon, name, size) {
@@ -451,7 +435,6 @@ function resetProperties() {
copyMagnet.setAttribute('data-clipboard-text', '');
document.title = 'Torrent Parts | Inspect and edit what\'s in your Torrent file or Magnet link';
sourceTooltip.disable();
gtag('event', 'reset');
}
async function addCurrentTrackers() {
@@ -474,7 +457,6 @@ async function addCurrentTrackers() {
addTrackers.className = '';
addTrackers.innerHTML = 'Add Known Working Trackers';
display();
gtag('event', 'add_trackers');
}
function addRow() {
@@ -525,7 +507,6 @@ function getFilesFromPeers() {
torrent.destroy();
});
display();
gtag('event', 'attempt_webtorrent_fetch');
}
// https://stackoverflow.com/a/36899900/2700296
@@ -542,8 +523,4 @@ function saveTorrent() {
a.click();
window.URL.revokeObjectURL(url);
a.remove();
gtag('event', 'share', {
"method": "Torrent Download",
"content_id": parsed.name
});
}