feat: display torrent errors in client

fix: w2g page not updating on clicklist
This commit is contained in:
ThaUnknown 2023-07-19 18:37:22 +02:00
parent 985af2a0df
commit a6b026d9b0
5 changed files with 20 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.2.4",
"version": "4.2.5",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
"main": "build/main.js",
@ -51,7 +51,7 @@
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webtorrent": "^2.1.12"
"webtorrent": "^2.1.13"
},
"dependencies": {
"utp-native": "^2.5.3"

View file

@ -122,8 +122,8 @@ devDependencies:
specifier: ^4.15.1
version: 4.15.1(webpack-cli@5.1.4)(webpack@5.88.2)
webtorrent:
specifier: ^2.1.12
version: 2.1.12
specifier: ^2.1.13
version: 2.1.13
packages:
@ -6550,8 +6550,8 @@ packages:
engines: {node: '>=0.8.0'}
dev: true
/webtorrent@2.1.12:
resolution: {integrity: sha512-9Z/AZy0rtBsKFVBM7lnvDp/dU8QyHoi5hBVVvyCV038MerjOfnRObb9ciEBcBmyLknWiSsau0qDSJePW0kQrWw==}
/webtorrent@2.1.13:
resolution: {integrity: sha512-cyf3hU+cU1RfIDg2lLaFAOqxgROxx24v2Ykug8WL72dMyxWcwJ+1yU6/nvsYkDYfiDEzmjvgL/TI25IE63SQ3g==}
engines: {node: '>=14'}
dependencies:
'@silentbot1/nat-api': 0.4.7

View file

@ -39,6 +39,10 @@ class TorrentClient extends WebTorrent {
this.trackers = {
cat: new HTTPTracker({}, atob('aHR0cDovL255YWEudHJhY2tlci53Zjo3Nzc3L2Fubm91bmNl'))
}
this.on('error', e => {
this.dispatch('error', e)
})
}
handleTorrent (torrent) {

View file

@ -1,6 +1,7 @@
import { set } from '../views/Settings.svelte'
import { files } from '../views/Player/MediaHandler.svelte'
import { page } from '@/App.svelte'
import { toast } from 'svelte-sonner'
import 'browser-event-target-emitter'
class TorrentWorker extends EventTarget {
@ -35,6 +36,11 @@ client.on('files', ({ detail }) => {
files.set(detail)
})
client.on('error', ({ detail }) => {
console.error(detail)
toast.error('Torrent Error', { description: detail.message || detail })
})
export async function add (torrentID, hide) {
if (torrentID) {
console.info('Torrent: adding torrent', { torrentID })

View file

@ -130,7 +130,10 @@
index: 0
}
window.IPC.on('w2glink', joinLobby)
window.IPC.on('w2glink', () => {
joinLobby()
page.set('watchtogether')
})
function cleanup () {
state.set(false)