mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 08:31:58 +00:00
fix torrent propagation in w2g
This commit is contained in:
parent
7030b5516e
commit
26da1a4c3b
3 changed files with 10 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Miru",
|
"name": "Miru",
|
||||||
"version": "2.0.3",
|
"version": "2.0.4",
|
||||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
client.on('torrent', ({ detail }) => {
|
client.on('magnet', ({ detail }) => {
|
||||||
if (!detail.every((v, i) => v === playerState.file[i])) {
|
if (detail.hash !== playerState.hash) {
|
||||||
playerState.file = detail
|
playerState.hash = detail.hash
|
||||||
emit('torrent', { file: detail })
|
emit('torrent', detail)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
const playerState = {
|
const playerState = {
|
||||||
paused: null,
|
paused: null,
|
||||||
time: null,
|
time: null,
|
||||||
file: []
|
hash: null
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
|
|
@ -153,9 +153,9 @@
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'torrent': {
|
case 'torrent': {
|
||||||
if (!data.file.every((v, i) => v === playerState.file[i])) {
|
if (data.hash !== playerState.hash) {
|
||||||
playerState.file = data.file
|
playerState.hash = data.hash
|
||||||
add(data.file)
|
add(data.magnet)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ class TorrentClient extends WebTorrent {
|
||||||
})
|
})
|
||||||
this.dispatch('files', files)
|
this.dispatch('files', files)
|
||||||
this.dispatch('pieces', torrent.pieces.length)
|
this.dispatch('pieces', torrent.pieces.length)
|
||||||
|
this.dispatch('magnet', { magnet: torrent.magnetURI, hash: torrent.infoHash })
|
||||||
this.dispatch('torrent', Array.from(torrent.torrentFile))
|
this.dispatch('torrent', Array.from(torrent.torrentFile))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue