mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
fix: Peer country flag not shown in peers list
This commit is contained in:
parent
90ece5c762
commit
92b29ab597
2 changed files with 2 additions and 1 deletions
|
@ -466,7 +466,7 @@ if ($tor_reged && $tor_info) {
|
||||||
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_peer_country')) {
|
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_peer_country')) {
|
||||||
if ($infoByIP = infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])) {
|
if ($infoByIP = infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])) {
|
||||||
if (!empty($infoByIP['countryCode'])) {
|
if (!empty($infoByIP['countryCode'])) {
|
||||||
$peerCountry = render_flag($infoByIP['countryCode']);
|
$peerCountry = render_flag($infoByIP['countryCode'], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2189,6 +2189,7 @@ function readUpdaterFile(): array|bool
|
||||||
*/
|
*/
|
||||||
function infoByIP(string $ipAddress, int $port = 0): array
|
function infoByIP(string $ipAddress, int $port = 0): array
|
||||||
{
|
{
|
||||||
|
$ipAddress = \TorrentPier\Helpers\IPHelper::long2ip_extended($ipAddress);
|
||||||
if (!$data = CACHE('bb_ip2countries')->get($ipAddress . '_' . $port)) {
|
if (!$data = CACHE('bb_ip2countries')->get($ipAddress . '_' . $port)) {
|
||||||
$data = [];
|
$data = [];
|
||||||
$response = file_get_contents(API_IP_URL . $ipAddress);
|
$response = file_get_contents(API_IP_URL . $ipAddress);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue