mirror of
https://github.com/SophiaAtkinson/steamwidgets-web.git
synced 2025-06-27 01:57:40 -07:00
Filter assumed localhost addresses
This commit is contained in:
@ -101,6 +101,12 @@ class HitsModel extends \Asatru\Database\Model
|
||||
|
||||
foreach ($items as $item) {
|
||||
if (!static::referrer_exists($item->get('referrer'), $result)) {
|
||||
if (env('APP_STATSFILTERLOCAL', false)) {
|
||||
if (static::assumed_localhost($item->get('referrer'))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$entry['ref'] = $item->get('referrer');
|
||||
$entry['count'] = $item->get('count');
|
||||
$result[] = $entry;
|
||||
@ -131,6 +137,19 @@ class HitsModel extends \Asatru\Database\Model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given referrer is a local address
|
||||
*
|
||||
* @param $referrer
|
||||
* @return bool
|
||||
*/
|
||||
private static function assumed_localhost($referrer)
|
||||
{
|
||||
$localhosts = config('localhosts');
|
||||
|
||||
return in_array($referrer, $localhosts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get initial start date
|
||||
*
|
||||
|
Reference in New Issue
Block a user