feat(p2p): show torrents number of other clients
This commit is contained in:
@ -87,21 +87,27 @@ window.isReady = () => {
|
||||
}
|
||||
|
||||
window.peers = 0;
|
||||
window.peersTorrents = 0;
|
||||
|
||||
class App extends Component {
|
||||
componentDidMount() {
|
||||
window.router()
|
||||
appReady = true;
|
||||
|
||||
window.torrentSocket.on('peer', (numOfPeers) => {
|
||||
window.peers = numOfPeers
|
||||
window.torrentSocket.on('peer', (peer) => {
|
||||
if(peer.size > window.peers)
|
||||
window.peersTorrents = (window.peersTorrents || 0) + peer.torrents
|
||||
else
|
||||
window.peersTorrents = (window.peersTorrents || 0) - peer.torrents
|
||||
window.peers = peer.size
|
||||
this.forceUpdate()
|
||||
})
|
||||
|
||||
window.torrentSocket.emit('peers', (numOfPeers) => {
|
||||
if(numOfPeers > 0)
|
||||
window.torrentSocket.emit('peers', (peers) => {
|
||||
if(peers.size > 0 || window.peers == 1)
|
||||
{
|
||||
window.peers = numOfPeers
|
||||
window.peers = peers.size
|
||||
window.peersTorrents = peers.torrents
|
||||
this.forceUpdate()
|
||||
}
|
||||
})
|
||||
|
@ -151,7 +151,7 @@ const Header = (props) => {
|
||||
!window.currentWindow.isModal()
|
||||
&&
|
||||
<div className='fs0-85 pad0-75 column peers-status' style={{marginLeft: 'auto', marginTop: '-10px', color: window.peers > 0 ? '#42f445' : 'white'}}>
|
||||
<div>rats peers: {window.peers} {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'}</div>
|
||||
<div>rats peers: {window.peers} [{window.peersTorrents} torrents] {window.peers > 0 ? ' (p2p rats search enabled)' : ' (p2p rats search not available at this moment)'}</div>
|
||||
{
|
||||
window.p2pStatus == 0
|
||||
&&
|
||||
|
Reference in New Issue
Block a user