mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 13:53:37 -07:00
fix: don't expose is_seed in /torrents/info
This commit is contained in:
parent
2d4b4af86b
commit
a1dd47c8b7
1 changed files with 13 additions and 8 deletions
|
@ -299,6 +299,8 @@ namespace
|
||||||
const BitTorrent::TorrentInfo info = torrent->info();
|
const BitTorrent::TorrentInfo info = torrent->info();
|
||||||
for (const int index : asConst(fileIndexes))
|
for (const int index : asConst(fileIndexes))
|
||||||
{
|
{
|
||||||
|
const BitTorrent::TorrentInfo::PieceRange idx = info.filePieces(index);
|
||||||
|
|
||||||
QJsonObject fileDict =
|
QJsonObject fileDict =
|
||||||
{
|
{
|
||||||
{KEY_FILE_INDEX, index},
|
{KEY_FILE_INDEX, index},
|
||||||
|
@ -307,15 +309,10 @@ namespace
|
||||||
{KEY_FILE_SIZE, torrent->fileSize(index)},
|
{KEY_FILE_SIZE, torrent->fileSize(index)},
|
||||||
{KEY_FILE_AVAILABILITY, fileAvailability[index]},
|
{KEY_FILE_AVAILABILITY, fileAvailability[index]},
|
||||||
// need to provide paths using a platform-independent separator format
|
// need to provide paths using a platform-independent separator format
|
||||||
{KEY_FILE_NAME, torrent->filePath(index).data()}
|
{KEY_FILE_NAME, torrent->filePath(index).data()},
|
||||||
|
{KEY_FILE_PIECE_RANGE, QJsonArray {idx.first(), idx.last()}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const BitTorrent::TorrentInfo::PieceRange idx = info.filePieces(index);
|
|
||||||
fileDict[KEY_FILE_PIECE_RANGE] = QJsonArray {idx.first(), idx.last()};
|
|
||||||
|
|
||||||
if (index == 0)
|
|
||||||
fileDict[KEY_FILE_IS_SEED] = torrent->isFinished();
|
|
||||||
|
|
||||||
fileList.append(fileDict);
|
fileList.append(fileDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +765,15 @@ void TorrentsController::filesAction()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setResult(getFiles(torrent, fileIndexes));
|
QJsonArray fileList = getFiles(torrent, fileIndexes);
|
||||||
|
if (!fileList.isEmpty())
|
||||||
|
{
|
||||||
|
QJsonObject firstFile = fileList[0].toObject();
|
||||||
|
firstFile[KEY_FILE_IS_SEED] = torrent->isFinished();
|
||||||
|
fileList[0] = firstFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
setResult(fileList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array of hashes (of each pieces respectively) for a torrent in JSON format.
|
// Returns an array of hashes (of each pieces respectively) for a torrent in JSON format.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue