Merge pull request #133 from PietroCarrara/api-unique-ips

Add unique_ips field to the API
This commit is contained in:
towards-a-new-leftypol 2021-01-11 23:53:41 +00:00 committed by GitHub
commit eb5dee5283

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;
}