Skip to content

Commit

Permalink
Merge pull request #417 from lavitto-private/master
Browse files Browse the repository at this point in the history
[FEATURE] Add option to override default user agent for boost mode crawler
  • Loading branch information
lochmueller authored Jun 20, 2024
2 parents 57c0d36 + cd43df9 commit c638b4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/Service/ClientService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
class ClientService extends AbstractService
{
protected const DEFAULT_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0';

public function __construct(protected EventDispatcherInterface $eventDispatcher) {}

/**
Expand Down Expand Up @@ -64,7 +66,7 @@ protected function getCallableClient(string $domain): Client
'max' => false,
],
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0',
'User-Agent' => GeneralUtility::makeInstance(ConfigurationService::class)->get('overrideClientUserAgent') ?? self::DEFAULT_USER_AGENT
],
];

Expand Down
3 changes: 3 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ boostMode = 0
# cat=basic; type=options[Current=current,Childs=childs,Both=both]; label=Backend display options: The backend module should display cache entries of the current page, only the direct children or both?
backendDisplayMode = both

# cat=basic; type=string; label=Client user agent: Overrides the default user agent of the boost mode crawler, if set.
overrideClientUserAgent =

# cat=basic; type=boolean; label=Debug headers: Send debug headers to get a information which component deliver the file (X-SFC-State).
debugHeaders = 0

Expand Down

0 comments on commit c638b4e

Please sign in to comment.