fix(trackers): fix updating trackers on page open
This commit is contained in:
parent
1d76939e26
commit
34981c3609
@ -187,8 +187,8 @@ export default class TorrentPage extends Page {
|
|||||||
}
|
}
|
||||||
//this.forceUpdate(); // вызывается через searchingIndicator
|
//this.forceUpdate(); // вызывается через searchingIndicator
|
||||||
|
|
||||||
// Получаем более новую статистику пира
|
// Получаем более новую статистику пира
|
||||||
if((new Date).getTime() - this.torrent.trackersChecked > 10 * 60 * 1000) {
|
if((Date.now() / 1000) - this.torrent.trackersChecked > 10 * 60) {
|
||||||
window.torrentSocket.emit('checkTrackers', this.torrent.hash);
|
window.torrentSocket.emit('checkTrackers', this.torrent.hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ export default class TorrentPage extends Page {
|
|||||||
if(!this.torrent)
|
if(!this.torrent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Object.assign(this.torrent, info);
|
this.torrent = Object.assign(this.torrent, info);
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate);
|
window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate);
|
||||||
@ -358,7 +358,7 @@ export default class TorrentPage extends Page {
|
|||||||
<TorrentInformation torrent={this.torrent} parent={this} />
|
<TorrentInformation torrent={this.torrent} parent={this} />
|
||||||
</div>
|
</div>
|
||||||
<div style={{flexBasis: '40%'}} className='column center w100p'>
|
<div style={{flexBasis: '40%'}} className='column center w100p'>
|
||||||
<img src={NoImage} className='pad0-75' style={{height: '200px'}} />
|
<img src={(this.torrent && this.torrent.info && this.torrent.info.poster) ? this.torrent.info.poster : NoImage} className='pad0-75' style={{height: '200px'}} />
|
||||||
<RaisedButton
|
<RaisedButton
|
||||||
href={`magnet:?xt=urn:btih:${this.torrent.hash}`}
|
href={`magnet:?xt=urn:btih:${this.torrent.hash}`}
|
||||||
target="_self"
|
target="_self"
|
||||||
@ -509,6 +509,15 @@ export default class TorrentPage extends Page {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
this.torrent && this.torrent.info && this.torrent.info.description
|
||||||
|
?
|
||||||
|
<div />
|
||||||
|
:
|
||||||
|
null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab label={__('Files')} value="files" >
|
<Tab label={__('Files')} value="files" >
|
||||||
|
@ -25,6 +25,7 @@ module.exports = async ({
|
|||||||
setupTorrentRecord,
|
setupTorrentRecord,
|
||||||
p2pStore,
|
p2pStore,
|
||||||
feed,
|
feed,
|
||||||
|
updateTorrentTrackers,
|
||||||
remoteTrackers
|
remoteTrackers
|
||||||
}) => {
|
}) => {
|
||||||
let torrentClientHashMap = {}
|
let torrentClientHashMap = {}
|
||||||
@ -515,7 +516,9 @@ module.exports = async ({
|
|||||||
if(hash.length != 40)
|
if(hash.length != 40)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
logT('tracker', 'recheck trackers for', hash)
|
||||||
updateTorrentTrackers(hash);
|
updateTorrentTrackers(hash);
|
||||||
|
remoteTrackers.update({hash, name: hash})
|
||||||
});
|
});
|
||||||
|
|
||||||
const topTorrentsCall = (type, navigation = {}, callback) => {
|
const topTorrentsCall = (type, navigation = {}, callback) => {
|
||||||
|
@ -116,6 +116,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
return
|
return
|
||||||
|
|
||||||
logT('tracker', 'found', name, 'on', tracker)
|
logT('tracker', 'found', name, 'on', tracker)
|
||||||
|
let info;
|
||||||
this.sphinx.replaceValues('torrents', {hash, info: data}, {
|
this.sphinx.replaceValues('torrents', {hash, info: data}, {
|
||||||
particial: true,
|
particial: true,
|
||||||
key: 'hash',
|
key: 'hash',
|
||||||
@ -129,7 +130,14 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
obj.trackers = []
|
obj.trackers = []
|
||||||
obj.trackers.push(tracker)
|
obj.trackers.push(tracker)
|
||||||
obj.trackers = [...new Set(obj.trackers)]
|
obj.trackers = [...new Set(obj.trackers)]
|
||||||
} })
|
|
||||||
|
info = obj
|
||||||
|
} }).then(() => {
|
||||||
|
send('trackerTorrentUpdate', {
|
||||||
|
hash,
|
||||||
|
info
|
||||||
|
});
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,7 +159,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
seeders: row.seeders,
|
seeders: row.seeders,
|
||||||
completed: row.completed,
|
completed: row.completed,
|
||||||
leechers: row.leechers,
|
leechers: row.leechers,
|
||||||
trackersChecked: row.trackersChecked ? row.trackersChecked.getTime() : undefined,
|
trackersChecked: row.trackerschecked || row.trackersChecked,
|
||||||
good: row.good,
|
good: row.good,
|
||||||
bad: row.bad,
|
bad: row.bad,
|
||||||
info: typeof row.info == 'string' && row.info.length > 0 ? JSON.parse(row.info) : undefined
|
info: typeof row.info == 'string' && row.info.length > 0 ? JSON.parse(row.info) : undefined
|
||||||
@ -781,6 +789,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
|||||||
setupTorrentRecord,
|
setupTorrentRecord,
|
||||||
p2pStore,
|
p2pStore,
|
||||||
feed,
|
feed,
|
||||||
|
updateTorrentTrackers,
|
||||||
remoteTrackers
|
remoteTrackers
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user