Browse Source
Merge pull request #133 from PietroCarrara/api-unique-ips
Add unique_ips field to the API
pull/40/head
towards-a-new-leftypol
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
inc/api.php
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|