Add unique_ips field to the API

This commit is contained in:
Pietro Carrara 2021-01-11 15:46:57 -03:00
parent 0bdbe0f927
commit 20135fd1db

View file

@ -167,6 +167,13 @@ class Api {
$apiPosts['posts'][] = $this->translatePost($p, $threadsPage);
}
// Count unique IPs
$ips = array($thread->ip);
foreach ($thread->posts as $p) {
$ips[] = $p->ip;
}
$apiPosts['posts'][0]['unique_ips'] = count(array_unique($ips));
return $apiPosts;
}