mirror of
https://github.com/DanielSiepmann/tracking.git
synced 2024-12-22 00:16:08 +01:00
parent
cd9cb3f2a8
commit
20070cf531
4 changed files with 56 additions and 2 deletions
|
@ -64,7 +64,7 @@ services:
|
|||
and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/")
|
||||
and not (request.getHeader("User-Agent")[0] matches "/Googlebot|Bingbot|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Sogou|Exabot|NextCloud-News|Feedly|XING FeedReader|CCBot|SemrushBot|SEOkicks|Twitterbot|Seekport Crawler|SemanticScholarBot|ia_archiver|PaperLiBot|TrendsmapResolver|AhrefsBot|Nuzzel/")
|
||||
and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/")
|
||||
and not (request.getHeader("User-Agent")[0] matches "/UptimeRobot|Pingdom/")
|
||||
and not (request.getHeader("User-Agent")[0] matches "/UptimeRobot|Pingdom|Uptime-Kuma/")
|
||||
|
||||
DanielSiepmann\Tracking\Middleware\Recordview:
|
||||
public: true
|
||||
|
|
29
Documentation/Changelog/2.5.0.rst
Normal file
29
Documentation/Changelog/2.5.0.rst
Normal file
|
@ -0,0 +1,29 @@
|
|||
2.5.0
|
||||
=====
|
||||
|
||||
Breaking
|
||||
--------
|
||||
|
||||
Nothing
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Ignore Uptime-Kuma bot by default.
|
||||
Thanks to `Kay Strobach <https://github.com/kaystrobach>`_.
|
||||
Add tests to cover default ignores.
|
||||
|
||||
Fixes
|
||||
-----
|
||||
|
||||
Nothing
|
||||
|
||||
Tasks
|
||||
-----
|
||||
|
||||
Nothing
|
||||
|
||||
Deprecation
|
||||
-----------
|
||||
|
||||
Nothing
|
|
@ -91,4 +91,29 @@ class PageviewTest extends TestCase
|
|||
$records = $this->getAllRecords('tx_tracking_pageview');
|
||||
self::assertCount(0, $records);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider possibleDeniedUserAgents
|
||||
*/
|
||||
public function preventsTrackingOfUserAgents(string $userAgent): void
|
||||
{
|
||||
$request = new InternalRequest();
|
||||
$request = $request->withPageId(1);
|
||||
$request = $request->withHeader('User-Agent', $userAgent);
|
||||
$response = $this->executeFrontendRequest($request);
|
||||
|
||||
self::assertSame(200, $response->getStatusCode());
|
||||
self::assertCount(0, $this->getAllRecords('tx_tracking_pageview'));
|
||||
}
|
||||
|
||||
public static function possibleDeniedUserAgents(): array
|
||||
{
|
||||
return [
|
||||
'Uptime-Kuma' => [
|
||||
'userAgent' => 'Uptime-Kuma/1.21.2',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ $EM_CONF[$_EXTKEY] = [
|
|||
'author' => 'Daniel Siepmann',
|
||||
'author_email' => 'coding@daniel-siepmann.de',
|
||||
'author_company' => '',
|
||||
'version' => '2.4.0',
|
||||
'version' => '2.5.0',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'core' => '',
|
||||
|
|
Loading…
Reference in a new issue