mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-30 19:22:12 +00:00
Merge 189e8f6857
into bed6d09ef2
This commit is contained in:
commit
8897eb66fa
4 changed files with 16 additions and 6 deletions
|
@ -28,6 +28,8 @@ parameters:
|
||||||
|
|
||||||
mailer_dsn: smtp://127.0.0.1
|
mailer_dsn: smtp://127.0.0.1
|
||||||
|
|
||||||
|
wallabag_user_agent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.92 Safari/535.2"
|
||||||
|
|
||||||
locale: en
|
locale: en
|
||||||
|
|
||||||
# A secret key that's used to generate certain security-related tokens
|
# A secret key that's used to generate certain security-related tokens
|
||||||
|
|
|
@ -31,6 +31,7 @@ services:
|
||||||
$supportUrl: '@=service(''craue_config'').get(''wallabag_support_url'')'
|
$supportUrl: '@=service(''craue_config'').get(''wallabag_support_url'')'
|
||||||
$fonts: '%wallabag.fonts%'
|
$fonts: '%wallabag.fonts%'
|
||||||
$defaultIgnoreOriginInstanceRules: '%wallabag.default_ignore_origin_instance_rules%'
|
$defaultIgnoreOriginInstanceRules: '%wallabag.default_ignore_origin_instance_rules%'
|
||||||
|
$defaultUserAgent: "%wallabag_user_agent%"
|
||||||
|
|
||||||
Wallabag\:
|
Wallabag\:
|
||||||
resource: '../../src/*'
|
resource: '../../src/*'
|
||||||
|
@ -206,6 +207,8 @@ services:
|
||||||
$config:
|
$config:
|
||||||
error_message: '%wallabag.fetching_error_message%'
|
error_message: '%wallabag.fetching_error_message%'
|
||||||
error_message_title: '%wallabag.fetching_error_message_title%'
|
error_message_title: '%wallabag.fetching_error_message_title%'
|
||||||
|
http_client:
|
||||||
|
ua_browser: "%wallabag_user_agent%"
|
||||||
$client: '@psr18.wallabag.client'
|
$client: '@psr18.wallabag.client'
|
||||||
calls:
|
calls:
|
||||||
- [ setLogger, [ "@logger" ] ]
|
- [ setLogger, [ "@logger" ] ]
|
||||||
|
|
|
@ -14,6 +14,7 @@ class LoginFormAuthenticator
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly HttpBrowser $browser,
|
private readonly HttpBrowser $browser,
|
||||||
AuthenticatorProvider $authenticatorProvider,
|
AuthenticatorProvider $authenticatorProvider,
|
||||||
|
private readonly string $defaultUserAgent,
|
||||||
) {
|
) {
|
||||||
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
|
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +85,10 @@ class LoginFormAuthenticator
|
||||||
$headers["HTTP_$headerName"] = $headerValue;
|
$headers["HTTP_$headerName"] = $headerValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($headers['HTTP_user-agent'])) {
|
||||||
|
$headers['HTTP_user-agent'] = $this->defaultUserAgent;
|
||||||
|
}
|
||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$res = $auth->login($siteConfig);
|
$res = $auth->login($siteConfig);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$res = $auth->login($siteConfig);
|
$res = $auth->login($siteConfig);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
;
|
;
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$res = $auth->login($siteConfig);
|
$res = $auth->login($siteConfig);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$loginRequired = $auth->isLoginRequired($siteConfig, file_get_contents(__DIR__ . '/../fixtures/nextinpact-login.html'));
|
$loginRequired = $auth->isLoginRequired($siteConfig, file_get_contents(__DIR__ . '/../fixtures/nextinpact-login.html'));
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
$requestHtmlFunctionClient = new MockHttpClient([$requestHtmlFunctionResponse]);
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$loginRequired = $auth->isLoginRequired($siteConfig, file_get_contents(__DIR__ . '/../fixtures/nextinpact-article.html'));
|
$loginRequired = $auth->isLoginRequired($siteConfig, file_get_contents(__DIR__ . '/../fixtures/nextinpact-article.html'));
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class LoginFormAuthenticatorTest extends TestCase
|
||||||
;
|
;
|
||||||
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
$authenticatorProvider = new AuthenticatorProvider($requestHtmlFunctionClient);
|
||||||
|
|
||||||
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider);
|
$auth = new LoginFormAuthenticator($browser, $authenticatorProvider, 'Wallabag (Symfony HttpClient/5)');
|
||||||
|
|
||||||
$res = $auth->login($siteConfig);
|
$res = $auth->login($siteConfig);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue