Define a custom user-agent for wallabag

This commit is contained in:
Adrien ERAUD
2025-02-18 12:22:36 +01:00
parent e90bbaf540
commit 1aa67747bb
4 changed files with 15 additions and 6 deletions

View File

@ -14,6 +14,7 @@ class LoginFormAuthenticator
public function __construct(
private readonly HttpBrowser $browser,
AuthenticatorProvider $authenticatorProvider,
private readonly string $defaultUserAgent,
) {
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
}
@ -84,6 +85,10 @@ class LoginFormAuthenticator
$headers["HTTP_$headerName"] = $headerValue;
}
if (empty($headers['HTTP_user-agent'])) {
$headers['HTTP_user-agent'] = $this->defaultUserAgent;
}
return $headers;
}