fix(downloading): always show downloading on list even if download not started
This commit is contained in:
parent
c321286d6c
commit
6bd4d69e4c
@ -45,8 +45,9 @@ export default class TopPage extends Page {
|
|||||||
}} />
|
}} />
|
||||||
<List style={{paddingBottom: '70px', minWidth: '60%'}} className='animated recent-torrents'>
|
<List style={{paddingBottom: '70px', minWidth: '60%'}} className='animated recent-torrents'>
|
||||||
{
|
{
|
||||||
this.downloads.map((download, index) => {
|
this.downloads.map((torrentDownload, index) => {
|
||||||
return <TorrentLine key={index} torrent={download.torrentObject} download={download} />
|
const {torrentObject: torrent, ...download} = torrentDownload
|
||||||
|
return <TorrentLine key={index} torrent={torrent} download={download} />
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</List>
|
</List>
|
||||||
|
@ -171,6 +171,7 @@ export default class Torrent extends Component {
|
|||||||
this.state.downloadProgress = {
|
this.state.downloadProgress = {
|
||||||
progress, downloaded, downloadSpeed
|
progress, downloaded, downloadSpeed
|
||||||
}
|
}
|
||||||
|
this.state.downloading = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidMount()
|
componentDidMount()
|
||||||
|
@ -585,11 +585,14 @@ module.exports = async ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
torrentClient.add(magnet, {path: config.client.downloadPath}, (torrent) =>{
|
const torrent = torrentClient.add(magnet, {path: config.client.downloadPath})
|
||||||
torrentClientHashMap[torrent.infoHash] = magnet
|
torrentClientHashMap[torrent.infoHash] = magnet
|
||||||
torrent.torrentObject = torrentObject
|
torrent.torrentObject = torrentObject
|
||||||
|
|
||||||
|
torrent.on('torrent', () => {
|
||||||
console.log('start downloading', torrent.infoHash)
|
console.log('start downloading', torrent.infoHash)
|
||||||
send('downloading', torrent.infoHash)
|
send('downloading', torrent.infoHash)
|
||||||
|
})
|
||||||
|
|
||||||
torrent.on('done', () => {
|
torrent.on('done', () => {
|
||||||
console.log('download done', torrent.infoHash)
|
console.log('download done', torrent.infoHash)
|
||||||
@ -611,7 +614,6 @@ module.exports = async ({
|
|||||||
timeRemaining: torrent.timeRemaining
|
timeRemaining: torrent.timeRemaining
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
recive('downloadCancel', (hash, callback) =>
|
recive('downloadCancel', (hash, callback) =>
|
||||||
|
Loading…
Reference in New Issue
Block a user