[blockbot] Update Composer dependency ahead of release

- Updating jaybizzle/crawler-detect (v1.2.80 => v1.2.116)
This commit is contained in:
Hypolite Petovan 2024-03-19 22:51:17 -04:00
parent b0ee9fdf2a
commit d838fc6421
20 changed files with 686 additions and 194 deletions

View file

@ -1,24 +1,24 @@
{ {
"name": "friendica-addons/blockbot", "name": "friendica-addons/blockbot",
"description": "Blocking bots based on detecting bots/crawlers/spiders via the user agent and http_from header.", "description": "Blocking bots based on detecting bots/crawlers/spiders via the user agent and http_from header.",
"type": "friendica-addon", "type": "friendica-addon",
"authors": [ "authors": [
{ {
"name": "Philipp Holzer", "name": "Philipp Holzer",
"email": "admin@philipp.info", "email": "admin@philipp.info",
"homepage": "https://friendica.philipp.info/profile/nupplaphil", "homepage": "https://friendica.philipp.info/profile/nupplaphil",
"role": "Developer" "role": "Developer"
} }
], ],
"require": { "require": {
"php": ">=5.6.0", "php": ">=5.6.0",
"jaybizzle/crawler-detect": "1.*" "jaybizzle/crawler-detect": "1.*"
}, },
"license": "3-clause BSD license", "license": "3-clause BSD license",
"minimum-stability": "stable", "minimum-stability": "stable",
"config": { "config": {
"optimize-autoloader": true, "optimize-autoloader": true,
"autoloader-suffix": "BlockBotAddon", "autoloader-suffix": "BlockBotAddon",
"preferred-install": "dist" "preferred-install": "dist"
} }
} }

16
blockbot/composer.lock generated
View file

@ -8,24 +8,23 @@
"packages": [ "packages": [
{ {
"name": "jaybizzle/crawler-detect", "name": "jaybizzle/crawler-detect",
"version": "v1.2.80", "version": "v1.2.116",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git", "url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847" "reference": "97e9fe30219e60092e107651abb379a38b342921"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847", "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/97e9fe30219e60092e107651abb379a38b342921",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847", "reference": "97e9fe30219e60092e107651abb379a38b342921",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5", "phpunit/phpunit": "^4.8|^5.5|^6.5|^9.4"
"satooshi/php-coveralls": "1.*"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -53,7 +52,7 @@
"crawlerdetect", "crawlerdetect",
"php crawler detect" "php crawler detect"
], ],
"time": "2019-04-05T19:52:02+00:00" "time": "2023-07-21T15:49:49+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
@ -65,5 +64,6 @@
"platform": { "platform": {
"php": ">=5.6.0" "php": ">=5.6.0"
}, },
"platform-dev": [] "platform-dev": [],
"plugin-api-version": "1.1.0"
} }

View file

@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes() public function getPrefixes()
{ {
if (!empty($this->prefixesPsr0)) { if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0); return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
} }
return array(); return array();
@ -279,7 +279,7 @@ class ClassLoader
*/ */
public function setApcuPrefix($apcuPrefix) public function setApcuPrefix($apcuPrefix)
{ {
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
} }
/** /**

View file

@ -13,6 +13,9 @@ class ComposerAutoloaderInitBlockBotAddon
} }
} }
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader() public static function getLoader()
{ {
if (null !== self::$loader) { if (null !== self::$loader) {

View file

@ -1,27 +1,26 @@
[ [
{ {
"name": "jaybizzle/crawler-detect", "name": "jaybizzle/crawler-detect",
"version": "v1.2.80", "version": "v1.2.116",
"version_normalized": "1.2.80.0", "version_normalized": "1.2.116.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/JayBizzle/Crawler-Detect.git", "url": "https://github.com/JayBizzle/Crawler-Detect.git",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847" "reference": "97e9fe30219e60092e107651abb379a38b342921"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847", "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/97e9fe30219e60092e107651abb379a38b342921",
"reference": "af6a36e6d69670df3f0a3ed8e21d4b8cc67a7847", "reference": "97e9fe30219e60092e107651abb379a38b342921",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5", "phpunit/phpunit": "^4.8|^5.5|^6.5|^9.4"
"satooshi/php-coveralls": "1.*"
}, },
"time": "2019-04-05T19:52:02+00:00", "time": "2023-07-21T15:49:49+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View file

@ -0,0 +1,23 @@
name: Check & fix styling
on: [ push ]
jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga:2.18.6
with:
args: --config=.php_cs.dist --allow-risky=yes
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling

View file

@ -0,0 +1,56 @@
name: Test
on:
push:
branches:
- "master"
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2]
name: PHP:${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: xdebug
- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: dependencies-php-${{ matrix.php }}-composer-
- name: Install Composer dependencies
run: |
composer install --prefer-dist --no-interaction --no-suggest
- name: Run Unit tests
run: |
vendor/bin/phpunit --coverage-clover=tests/logs/clover.xml
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls "^1.0"
coveralls --coverage_clover=tests/logs/clover.xml -v

View file

@ -0,0 +1,33 @@
<?php
$finder = Symfony\Component\Finder\Finder::create()
->in([
__DIR__.'/src',
__DIR__.'/tests',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'long'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline_array' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
])
->setFinder($finder);

View file

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015-2018 Mark Beech Copyright (c) 2015-2020 Mark Beech
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -1,24 +1,23 @@
<p align="center"><a href="http://crawlerdetect.io/" target="_blank"><img src="https://cloud.githubusercontent.com/assets/340752/23082173/1bd1a396-f550-11e6-8aba-4d3c75edea2f.png" width="321" height="219" /></a><br><br> <p align="center"><a href="https://crawlerdetect.io/" target="_blank"><img src="https://cloud.githubusercontent.com/assets/340752/23082173/1bd1a396-f550-11e6-8aba-4d3c75edea2f.png" width="321" height="219" /></a><br><br>
<a href="http://crawlerdetect.io/" target="_blank">crawlerdetect.io</a> <a href="https://crawlerdetect.io/" target="_blank">crawlerdetect.io</a>
<br><br> <br><br>
</p> </p>
<p align="center"> <p align="center">
<a href="https://travis-ci.org/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/travis/JayBizzle/Crawler-Detect/master.svg?style=flat-square" /></a> <a href="https://github.com/JayBizzle/Crawler-Detect/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/JayBizzle/Crawler-Detect/test.yml?branch=master&style=flat-square"></a>
<a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/dm/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a> <a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/dm/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a>
<a href="https://scrutinizer-ci.com/g/JayBizzle/Crawler-Detect/?branch=master"><img src="https://img.shields.io/scrutinizer/g/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a>
<a href="https://github.com/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square" /></a> <a href="https://github.com/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square" /></a>
<a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/v/jaybizzle/Crawler-Detect.svg?style=flat-square" /></a> <a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/v/jaybizzle/Crawler-Detect.svg?style=flat-square" /></a>
<a href="https://styleci.io/repos/32755917"><img src="https://styleci.io/repos/32755917/shield" /></a>
<a href="https://coveralls.io/github/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/coveralls/JayBizzle/Crawler-Detect/master.svg?style=flat-square" /></a> <a href="https://coveralls.io/github/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/coveralls/JayBizzle/Crawler-Detect/master.svg?style=flat-square" /></a>
</p> </p>
## About CrawlerDetect ## About CrawlerDetect
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent and http_from header. Currently able to detect 1,000's of bots/spiders/crawlers. CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the `user agent` and `http_from` header. Currently able to detect 1,000's of bots/spiders/crawlers.
### Installation ### Installation
Run `composer require jaybizzle/crawler-detect 1.*` or add `"jaybizzle/crawler-detect" :"1.*"` to your `composer.json`. ```
composer require jaybizzle/crawler-detect
```
### Usage ### Usage
```PHP ```PHP
@ -46,7 +45,7 @@ If you find a bot/spider/crawler user agent that CrawlerDetect fails to detect,
Failing that, just create an issue with the user agent you have found, and we'll take it from there :) Failing that, just create an issue with the user agent you have found, and we'll take it from there :)
### Laravel Package ### Laravel Package
If you would like to use this with Laravel 4/5, please see [Laravel-Crawler-Detect](https://github.com/JayBizzle/Laravel-Crawler-Detect) If you would like to use this with Laravel, please see [Laravel-Crawler-Detect](https://github.com/JayBizzle/Laravel-Crawler-Detect)
### Symfony Bundle ### Symfony Bundle
To use this library with Symfony 2/3/4, check out the [CrawlerDetectBundle](https://github.com/nicolasmure/CrawlerDetectBundle). To use this library with Symfony 2/3/4, check out the [CrawlerDetectBundle](https://github.com/nicolasmure/CrawlerDetectBundle).
@ -57,16 +56,21 @@ To use this library with the YII2 framework, check out [yii2-crawler-detect](htt
### ES6 Library ### ES6 Library
To use this library with NodeJS or any ES6 application based, check out [es6-crawler-detect](https://github.com/JefferyHus/es6-crawler-detect). To use this library with NodeJS or any ES6 application based, check out [es6-crawler-detect](https://github.com/JefferyHus/es6-crawler-detect).
### Python Library
To use this library in a Python project, check out [crawlerdetect](https://github.com/moskrc/CrawlerDetect).
### JVM Library (written in Java)
To use this library in a JVM project (including Java, Scala, Kotlin, etc.), check out [CrawlerDetect](https://github.com/nekosoftllc/crawler-detect).
### .NET Library ### .NET Library
To use this library in a .net standard (including .net core) based project, check out [NetCrawlerDetect](https://github.com/gplumb/NetCrawlerDetect). To use this library in a .net standard (including .net core) based project, check out [NetCrawlerDetect](https://github.com/gplumb/NetCrawlerDetect).
### Nette Extension
To use this library with the Nette framework, checkout [NetteCrawlerDetect](https://github.com/JanGalek/Crawler-Detect).
### Ruby Gem ### Ruby Gem
To use this library with Ruby on Rails or any Ruby-based application, check out [crawler_detect](https://github.com/loadkpi/crawler_detect) gem. To use this library with Ruby on Rails or any Ruby-based application, check out [crawler_detect](https://github.com/loadkpi/crawler_detect) gem.
### Go Module
To use this library with Go, check out the [crawlerdetect](https://github.com/x-way/crawlerdetect) module.
_Parts of this class are based on the brilliant [MobileDetect](https://github.com/serbanghita/Mobile-Detect)_ _Parts of this class are based on the brilliant [MobileDetect](https://github.com/serbanghita/Mobile-Detect)_
[![Analytics](https://ga-beacon.appspot.com/UA-72430465-1/Crawler-Detect/readme?pixel)](https://github.com/JayBizzle/Crawler-Detect) [![Analytics](https://ga-beacon.appspot.com/UA-72430465-1/Crawler-Detect/readme?pixel)](https://github.com/JayBizzle/Crawler-Detect)

View file

@ -16,8 +16,7 @@
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.5|^6.5", "phpunit/phpunit": "^4.8|^5.5|^6.5|^9.4"
"satooshi/php-coveralls": "1.*"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View file

@ -37,5 +37,5 @@ function outputJson($object)
function outputTxt($object) function outputTxt($object)
{ {
$className = (new ReflectionClass($object))->getShortName(); $className = (new ReflectionClass($object))->getShortName();
file_put_contents("raw/$className.txt", implode($object->getAll(), PHP_EOL)); file_put_contents("raw/$className.txt", implode(PHP_EOL, $object->getAll()));
} }

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
["Safari.[\\d\\.]*","Firefox.[\\d\\.]*"," Chrome.[\\d\\.]*","Chromium.[\\d\\.]*","MSIE.[\\d\\.]","Opera\\\/[\\d\\.]*","Mozilla.[\\d\\.]*","AppleWebKit.[\\d\\.]*","Trident.[\\d\\.]*","Windows NT.[\\d\\.]*","Android [\\d\\.]*","Macintosh.","Ubuntu","Linux","[ ]Intel","Mac OS X [\\d_]*","(like )?Gecko(.[\\d\\.]*)?","KHTML,","CriOS.[\\d\\.]*","CPU iPhone OS ([0-9_])* like Mac OS X","CPU OS ([0-9_])* like Mac OS X","iPod","compatible","x86_..","i686","x64","X11","rv:[\\d\\.]*","Version.[\\d\\.]*","WOW64","Win64","Dalvik.[\\d\\.]*"," \\.NET CLR [\\d\\.]*","Presto.[\\d\\.]*","Media Center PC","BlackBerry","Build","Opera Mini\\\/\\d{1,2}\\.\\d{1,2}\\.[\\d\\.]*\\\/\\d{1,2}\\.","Opera"," \\.NET[\\d\\.]*","cubot","; M bot","; CRONO","; B bot","; IDbot","; ID bot","; POWER BOT",";"] ["Safari.[\\d\\.]*","Firefox.[\\d\\.]*"," Chrome.[\\d\\.]*","Chromium.[\\d\\.]*","MSIE.[\\d\\.]","Opera\\\/[\\d\\.]*","Mozilla.[\\d\\.]*","AppleWebKit.[\\d\\.]*","Trident.[\\d\\.]*","Windows NT.[\\d\\.]*","Android [\\d\\.]*","Macintosh.","Ubuntu","Linux","[ ]Intel","Mac OS X [\\d_]*","(like )?Gecko(.[\\d\\.]*)?","KHTML,","CriOS.[\\d\\.]*","CPU iPhone OS ([0-9_])* like Mac OS X","CPU OS ([0-9_])* like Mac OS X","iPod","compatible","x86_..","i686","x64","X11","rv:[\\d\\.]*","Version.[\\d\\.]*","WOW64","Win64","Dalvik.[\\d\\.]*"," \\.NET CLR [\\d\\.]*","Presto.[\\d\\.]*","Media Center PC","BlackBerry","Build","Opera Mini\\\/\\d{1,2}\\.\\d{1,2}\\.[\\d\\.]*\\\/\\d{1,2}\\.","Opera"," \\.NET[\\d\\.]*","cubot","; M bot","; CRONO","; B bot","; IDbot","; ID bot","; POWER BOT","OCTOPUS-CORE","htc_botdugls","super\\\/\\d+\\\/Android\\\/\\d+"]

View file

@ -45,4 +45,6 @@ cubot
; IDbot ; IDbot
; ID bot ; ID bot
; POWER BOT ; POWER BOT
; OCTOPUS-CORE
htc_botdugls
super\/\d+\/Android\/\d+

View file

@ -20,9 +20,9 @@ class CrawlerDetect
/** /**
* The user agent. * The user agent.
* *
* @var null * @var string|null
*/ */
protected $userAgent = null; protected $userAgent;
/** /**
* Headers that contain a user agent. * Headers that contain a user agent.
@ -93,7 +93,7 @@ class CrawlerDetect
* Compile the regex patterns into one regex string. * Compile the regex patterns into one regex string.
* *
* @param array * @param array
* *
* @return string * @return string
*/ */
public function compileRegex($patterns) public function compileRegex($patterns)
@ -138,7 +138,7 @@ class CrawlerDetect
/** /**
* Set the user agent. * Set the user agent.
* *
* @param string $userAgent * @param string|null $userAgent
*/ */
public function setUserAgent($userAgent) public function setUserAgent($userAgent)
{ {
@ -165,20 +165,14 @@ class CrawlerDetect
$agent = trim(preg_replace( $agent = trim(preg_replace(
"/{$this->compiledExclusions}/i", "/{$this->compiledExclusions}/i",
'', '',
$userAgent ?: $this->userAgent $userAgent ?: $this->userAgent ?: ''
)); ));
if ($agent == '') { if ($agent === '') {
return false; return false;
} }
$result = preg_match("/{$this->compiledRegex}/i", $agent, $matches); return (bool) preg_match("/{$this->compiledRegex}/i", $agent, $this->matches);
if ($matches) {
$this->matches = $matches;
}
return (bool) $result;
} }
/** /**
@ -190,4 +184,13 @@ class CrawlerDetect
{ {
return isset($this->matches[0]) ? $this->matches[0] : null; return isset($this->matches[0]) ? $this->matches[0] : null;
} }
/**
* @return string|null
*/
public function getUserAgent()
{
return $this->userAgent;
}
} }

View file

@ -15,14 +15,14 @@ abstract class AbstractProvider
{ {
/** /**
* The data set. * The data set.
* *
* @var array * @var array
*/ */
protected $data; protected $data;
/** /**
* Return the data set. * Return the data set.
* *
* @return array * @return array
*/ */
public function getAll() public function getAll()

File diff suppressed because it is too large Load diff

View file

@ -67,6 +67,8 @@ class Exclusions extends AbstractProvider
'; IDbot', '; IDbot',
'; ID bot', '; ID bot',
'; POWER BOT', '; POWER BOT',
';', // Remove the following characters ; 'OCTOPUS-CORE',
'htc_botdugls',
'super\/\d+\/Android\/\d+',
); );
} }