resolve ip
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from ._shared import *
|
||||
from ..services import torrent_creator
|
||||
from ..services.reverse_dns import attach_reverse_dns
|
||||
|
||||
@bp.get("/torrents")
|
||||
def torrents():
|
||||
@@ -386,6 +387,10 @@ def torrent_peers(torrent_hash: str):
|
||||
peers = rtorrent.torrent_peers(profile, torrent_hash)
|
||||
for peer in peers:
|
||||
peer.update(lookup_ip(peer.get("ip", "")))
|
||||
prefs = preferences.get_preferences(profile_id=profile.get("id"))
|
||||
if int(prefs.get("reverse_dns_enabled") or 0):
|
||||
# Note: PTR hostnames are attached only when the user enables the lightweight cached resolver.
|
||||
attach_reverse_dns(peers)
|
||||
return ok({"peers": peers})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user