feat(web): show sequential download status in inspector

This commit is contained in:
Hendrik Luup 2024-03-10 14:18:54 +02:00
parent 6909ec0bad
commit d19b534c1d
2 changed files with 13 additions and 0 deletions

View File

@ -91,6 +91,7 @@ export class Inspector extends EventTarget {
['availability', 'Availability:'],
['uploaded', 'Uploaded:'],
['downloaded', 'Downloaded:'],
['sequential_download', 'Sequential download:'],
['state', 'State:'],
['running_time', 'Running time:'],
['remaining_time', 'Remaining:'],
@ -563,6 +564,14 @@ export class Inspector extends EventTarget {
const link = torrents[0].getMagnetLink();
e.info.magnetLink.innerHTML = `<a class="inspector-info-magnet" href="${link}"><button></button></a>`;
}
// Sequential Download
const isSequential = torrents.reduce((acc, cur) => {
cur = cur.isSequentialDownload() ? 'Yes' : 'No';
return acc !== none && acc !== cur ? mixed : cur;
}, none);
setTextContent(e.info.sequential_download, isSequential);
}
/// PEERS PAGE

View File

@ -255,6 +255,9 @@ export class Torrent extends EventTarget {
isSeeding() {
return this.getStatus() === Torrent._StatusSeed;
}
isSequentialDownload() {
return this.fields.sequentialDownload;
}
isStopped() {
return this.getStatus() === Torrent._StatusStopped;
}
@ -607,6 +610,7 @@ Torrent.Fields.Stats = [
'rateUpload',
'recheckProgress',
'seedRatioMode',
'sequentialDownload',
'seedRatioLimit',
'sizeWhenDone',
'status',