Git Product home page Git Product logo

vipxbotdetectbundle's People

Contributors

blazarecki avatar coil avatar grigoryosifov avatar jdeniau avatar lennerd avatar smatyas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vipxbotdetectbundle's Issues

Doesn't work with Symfony 3.4

Hi,

I must investigate but the command and detection in general doesn't seem to work anymore. Event with the basic example:

 -------------------------- 
 -- Vipx/BotDetectBundle -- 
 -------------------------- 
 > Testing user agent "AddThis" ...
 > This agent is unknown, if you think it should be added, send a PR to lennerd/vipx-bot-detect on Github.

I will try to add a test to the command.

User agent is not trimmed

When user agent is empty '', the bot "Aboutus" is reported. When the user agent is 1 space " " , the bot is not detected, shouldn’t the user be trimmed before calling the detect method ?

        $request->server->set('HTTP_USER_AGENT', '');
        dump($this->get('vipx_bot_detect.detector')->detectFromRequest($request));

        $request->server->set('HTTP_USER_AGENT', ' ');
        dump($this->get('vipx_bot_detect.detector')->detectFromRequest($request)); die();

Outputs:

Controller.php on line 91:
Metadata {#436 ▼
  -name: "AboutUs"
  -agent: ""
  -ip: null
  -type: "bot"
  -meta: array:1 [▶]
  -agentMatch: "exact"
}
Controller.php on line 94:
null

Test action

I have created a little action that allows to test user agent manually just with a get method, like this:

http://dev.front.app.com/app_dev.php/testBotDetector?user-agent=ltx71%20-%20(http://ltx71.com/)

Outputs:

tested User agent: "ltx71 - (http://ltx71.com/)"
Name: ltx71
Type: bot
Metas:
    email: [email protected]
    website: http://ltx71.com/

Do you think it is worth including it in the bundle ?

Compatibility of DetectBundle with Symfony 4

Hi there,
thanks for your great bundle! We would like to upgrade our application to Symfony 4, but we also need your bundle and it is hardwired to Sf3. Do you see any chance for an upgrade?
Regards
Nico

Add public alias for offering dependency injection

This is more like a question to you, @lennerd:
We're currently upgrading from a Symfony 3 application to Symfony 4 and we're using this bundle (is this still under development, because most recent commits are 2 years ago?)

So as we're upgrading, we want to use this bundle via correct dependency injection (not via the container ->get()), but that is not possible without a workaround, as there is no alias to the vipx_bot_detect.detector service ID.

We want to use it via constructor injection (with autowire: true in our service definition):

<?php
use Symfony\Component\HttpFoundation\RequestStack;
use Vipx\BotDetectBundle\BotDetector;

class BotManager
{
    public function __construct(RequestStack $requestStack, BotDetector $botDetector)
    {
        $this->meta = $botDetector->detectFromRequest($requestStack->getCurrentRequest());
    }
}

My workaround to this issue would be to add some

    Vipx\BotDetectBundle\BotDetector:
        alias: vipx_bot_detect.detector
        public: true

to our services.yml but I don't think that this is a good idea.

I'm relatively new to Symfony and I don't know if this is really an issue with your bundle, but I just wanted to go the "quick way" via Github, I hope that's OK for you.

Make the bundle Symfony 3.0 compliant

... by changing line 92 in BotDetector.php from

return $this->metadatas = require $cache;

to

return $this->metadatas = require $cache->getPath();

Some preg_match errors

I'm getting such errors in the log:

[2016-02-11 21:45:53] user_agents.DEBUG: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0 (FlipboardProxy/1.1; +http://flipboard.com/browserproxy)' [] []
[2016-02-11 21:45:53] user_agents.DEBUG: '52.21.123.187' [] []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: missing ) at offset 10 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: nothing to repeat at offset 0 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: missing ) at offset 24 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: unmatched parentheses at offset 6 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: nothing to repeat at offset 0 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: nothing to repeat at offset 0 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []
[2016-02-11 21:45:53] scream.WARNING: preg_match(): Compilation failed: missing ) at offset 17 {"type":2,"file":"/home/sergii.smirnov/public_html/trim/vendor/vipx/bot-detect/Vipx/BotDetect/Metadata/Metadata.php","line":117,"scream":0} []

Ip string field, array in yml

Ip is defined as a string, but in extended_bot.yml for example, it's defined as an array:

    Yigg:
        agent: ''
        ip: [188.138.56.55, 188.138.48.253]
        type: bot

So when matching return $this->ip === $ip; even if the ip is in the array, it won't match.

Update tag to support all symfony version

This PR make your bundle with all symfony version, can you update your tag with the last current version of your bundle ?

Because we have to use "dev-master" within composer.

Best regard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.