fix: uTP, adding new torrents

This commit is contained in:
ThaUnknown 2023-06-05 17:40:39 +02:00
parent 8565c1a9ce
commit 6d4cbc7fb9
3 changed files with 9 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.0.0",
"version": "4.0.1",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "build/main.js",
@ -128,6 +128,6 @@
"simple-store-svelte": "^1.0.0",
"svelte-keybinds": "1.0.5",
"svelte-miniplayer": "1.0.3",
"webtorrent": "^2.0.29"
"webtorrent": "^2.0.30"
}
}

View file

@ -30,7 +30,7 @@ specifiers:
webpack: ^5.85.0
webpack-cli: ^5.1.3
webpack-dev-server: ^4.15.0
webtorrent: ^2.0.29
webtorrent: ^2.0.30
dependencies:
anitomyscript: github.com/ThaUnknown/anitomyscript/42290c4b3f256893be08a4e89051f448ff5e9d00
@ -48,7 +48,7 @@ dependencies:
simple-store-svelte: 1.0.0
svelte-keybinds: 1.0.5
svelte-miniplayer: 1.0.3
webtorrent: 2.0.29
webtorrent: 2.0.30
devDependencies:
concurrently: 7.6.0
@ -2677,6 +2677,7 @@ packages:
/ieee754/1.2.1:
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
requiresBuild: true
dev: true
optional: true
@ -4763,8 +4764,8 @@ packages:
engines: {node: '>=0.8.0'}
dev: true
/webtorrent/2.0.29:
resolution: {integrity: sha512-tLyWRIytC0COsZj/ErfsMcHkGkhkQrI5apeB1z7clz+PfSyi57AKgia0VHn8EBSjhOuWrGybG4R6siY0gAlF4Q==}
/webtorrent/2.0.30:
resolution: {integrity: sha512-ZhMyeuDqj6jvJN09MUpuF3kOXuL/Kqc1xcW3SsFFjrLlwAKYVdXF7Jz1LPAtkYbbJMq97LRyXi9IfU00zefZIw==}
engines: {node: '>=14'}
dependencies:
'@thaunknown/simple-peer': 9.12.0

View file

@ -77,14 +77,13 @@ class TorrentClient extends WebTorrent {
break
}
case 'torrent': {
const id = typeof data.data !== 'string' ? Buffer.from(data.data) : data.data
const id = typeof data.data !== 'string' ? new Uint8Array(data.data) : data.data
const existing = await this.get(id)
if (existing) {
if (existing.ready) return this.handleTorrent(existing)
existing.once('ready', this.handleTorrent.bind(this))
}
if (this.torrents.length) this.remove(this.torrents[0].infoHash)
if (this.torrents.length) await this.remove(this.torrents[0])
this.add(id, {
private: this.settings.torrentPeX,
path: this.settings.torrentPath,