This commit is contained in:
anikey 2025-08-18 13:50:41 +00:00 committed by GitHub
commit fc74fa47b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 5 deletions

View file

@ -10,6 +10,9 @@
* `torrents/editTracker` endpoint now supports setting a tracker's tier via `tier` parameter
* `torrents/editTracker` endpoint always responds with a 204 when successful
* `torrents/editTracker` endpoint `origUrl` parameter renamed to `url`
* [#23061](https://github.com/qbittorrent/qBittorrent/pull/23061)
* `sync/torrentPeers` returns one new field: `i2p_dest`, only when the peer is from I2P
* In this case, the fields `ip` and `port` are not returned
## 2.12.1
* [#23031](https://github.com/qbittorrent/qBittorrent/pull/23031)

View file

@ -72,6 +72,7 @@ namespace
const QString KEY_PEER_FLAGS = u"flags"_s;
const QString KEY_PEER_FLAGS_DESCRIPTION = u"flags_desc"_s;
const QString KEY_PEER_IP = u"ip"_s;
const QString KEY_PEER_I2P_DEST = u"i2p_dest"_s;
const QString KEY_PEER_PORT = u"port"_s;
const QString KEY_PEER_PROGRESS = u"progress"_s;
const QString KEY_PEER_RELEVANCE = u"relevance"_s;
@ -847,12 +848,11 @@ void SyncController::torrentPeersAction()
for (const BitTorrent::PeerInfo &pi : peersList)
{
if (pi.address().ip.isNull()) continue;
const bool useI2PSocket = pi.useI2PSocket();
if (pi.address().ip.isNull() && !useI2PSocket) continue;
QVariantMap peer =
{
{KEY_PEER_IP, pi.address().ip.toString()},
{KEY_PEER_PORT, pi.address().port},
{KEY_PEER_CLIENT, pi.client()},
{KEY_PEER_ID_CLIENT, pi.peerIdClient()},
{KEY_PEER_PROGRESS, pi.progress()},
@ -876,14 +876,24 @@ void SyncController::torrentPeersAction()
peer.insert(KEY_PEER_FILES, filesForPiece.join(u'\n'));
}
if (resolvePeerCountries)
if (resolvePeerCountries && !useI2PSocket)
{
peer[KEY_PEER_COUNTRY_CODE] = pi.country().toLower();
peer[KEY_PEER_COUNTRY] = Net::GeoIPManager::CountryName(pi.country());
}
if (useI2PSocket)
{
peer[KEY_PEER_I2P_DEST] = pi.I2PAddress();
peers[pi.I2PAddress()] = peer;
}
else
{
peer[KEY_PEER_IP] = pi.address().ip.toString();
peer[KEY_PEER_PORT] = pi.address().port;
peers[pi.address().toString()] = peer;
}
}
data[u"peers"_s] = peers;
const int acceptedResponseId = params()[u"rid"_s].toInt();