mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Added logic for new tracking options
This commit is contained in:
@@ -6,6 +6,7 @@ namespace Shlinkio\Shlink\Core\Model;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Shlinkio\Shlink\Common\Middleware\IpAddressMiddlewareFactory;
|
||||
use Shlinkio\Shlink\Core\Options\TrackingOptions;
|
||||
|
||||
use function substr;
|
||||
|
||||
@@ -68,4 +69,16 @@ final class Visitor
|
||||
{
|
||||
return $this->visitedUrl;
|
||||
}
|
||||
|
||||
public function normalizeForTrackingOptions(TrackingOptions $options): self
|
||||
{
|
||||
$instance = self::emptyInstance();
|
||||
|
||||
$instance->userAgent = $options->disableUaTracking() ? '' : $this->userAgent;
|
||||
$instance->referer = $options->disableReferrerTracking() ? '' : $this->referer;
|
||||
$instance->remoteAddress = $options->disableIpTracking() ? null : $this->remoteAddress;
|
||||
$instance->visitedUrl = $this->visitedUrl;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user