mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-14 05:20:22 +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",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"main": "src/index.js",
|
||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@
|
|||
})
|
||||
|
||||
queueMicrotask(() => {
|
||||
client.on('torrent', ({ detail }) => {
|
||||
if (!detail.every((v, i) => v === playerState.file[i])) {
|
||||
playerState.file = detail
|
||||
emit('torrent', { file: detail })
|
||||
client.on('magnet', ({ detail }) => {
|
||||
if (detail.hash !== playerState.hash) {
|
||||
playerState.hash = detail.hash
|
||||
emit('torrent', detail)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
const playerState = {
|
||||
paused: null,
|
||||
time: null,
|
||||
file: []
|
||||
hash: null
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
|
|
@ -153,9 +153,9 @@
|
|||
break
|
||||
}
|
||||
case 'torrent': {
|
||||
if (!data.file.every((v, i) => v === playerState.file[i])) {
|
||||
playerState.file = data.file
|
||||
add(data.file)
|
||||
if (data.hash !== playerState.hash) {
|
||||
playerState.hash = data.hash
|
||||
add(data.magnet)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class TorrentClient extends WebTorrent {
|
|||
})
|
||||
this.dispatch('files', files)
|
||||
this.dispatch('pieces', torrent.pieces.length)
|
||||
this.dispatch('magnet', { magnet: torrent.magnetURI, hash: torrent.infoHash })
|
||||
this.dispatch('torrent', Array.from(torrent.torrentFile))
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue