Add proxy IP headers to Telegram notifications
All checks were successful
Tests / Laravel tests (pull_request) Successful in 12m3s
All checks were successful
Tests / Laravel tests (pull_request) Successful in 12m3s
This commit is contained in:
@@ -25,8 +25,18 @@ class NotifyTelegramAboutContactMessage implements ShouldQueue
|
||||
|
||||
protected ?string $phone;
|
||||
|
||||
public function __construct(string $name, string $message, string $ip, string $userAgent, ?string $email = null, ?string $phone = null)
|
||||
{
|
||||
/**
|
||||
* @param array<string, string|null> $ipHeaders
|
||||
*/
|
||||
public function __construct(
|
||||
string $name,
|
||||
string $message,
|
||||
string $ip,
|
||||
string $userAgent,
|
||||
?string $email = null,
|
||||
?string $phone = null,
|
||||
protected array $ipHeaders = []
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->message = $message;
|
||||
$this->ip = $ip;
|
||||
@@ -43,7 +53,8 @@ class NotifyTelegramAboutContactMessage implements ShouldQueue
|
||||
$this->ip,
|
||||
$this->userAgent,
|
||||
$this->email,
|
||||
$this->phone
|
||||
$this->phone,
|
||||
$this->ipHeaders
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,18 @@ class NotifyTelegramAboutPageVisit implements ShouldQueue
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $visit
|
||||
* @param array<string, string|null> $ipHeaders
|
||||
*/
|
||||
public function __construct(
|
||||
protected array $visit,
|
||||
protected ?string $ip,
|
||||
protected ?string $userAgent,
|
||||
protected ?string $acceptLanguage
|
||||
protected ?string $acceptLanguage,
|
||||
protected array $ipHeaders = []
|
||||
) {}
|
||||
|
||||
public function handle(TelegramNotificationService $telegram): void
|
||||
{
|
||||
$telegram->notifyPageVisit($this->visit, $this->ip, $this->userAgent, $this->acceptLanguage);
|
||||
$telegram->notifyPageVisit($this->visit, $this->ip, $this->userAgent, $this->acceptLanguage, $this->ipHeaders);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,10 @@ class NotifyTelegramAboutPersonaliaClick implements ShouldQueue
|
||||
|
||||
protected ?string $userAgent;
|
||||
|
||||
public function __construct(Personalia $personalia, ?string $ip, ?string $userAgent)
|
||||
/**
|
||||
* @param array<string, string|null> $ipHeaders
|
||||
*/
|
||||
public function __construct(Personalia $personalia, ?string $ip, ?string $userAgent, protected array $ipHeaders = [])
|
||||
{
|
||||
$this->personalia = $personalia;
|
||||
$this->ip = $ip;
|
||||
@@ -29,6 +32,6 @@ class NotifyTelegramAboutPersonaliaClick implements ShouldQueue
|
||||
|
||||
public function handle(TelegramNotificationService $telegram): void
|
||||
{
|
||||
$telegram->notifyPersonaliaClick($this->personalia, $this->ip, $this->userAgent);
|
||||
$telegram->notifyPersonaliaClick($this->personalia, $this->ip, $this->userAgent, $this->ipHeaders);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user