Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not supported browser exception #17258

Merged
merged 17 commits into from Mar 28, 2021
Merged

Conversation

flamisz
Copy link
Contributor

@flamisz flamisz commented Feb 24, 2021

Description:

fixes #16776

Review

  • Functional review done
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@flamisz flamisz marked this pull request as draft February 24, 2021 03:02
@flamisz flamisz marked this pull request as ready for review February 24, 2021 03:33
@flamisz flamisz added the Needs Review PRs that need a code review label Feb 24, 2021
@sgiehl
Copy link
Member

sgiehl commented Feb 24, 2021

Looks good so far. We could maybe add a UI test to make sure this will keep working. @flamisz it's possible to manipulate the useragent used in UI tests (see https://github.com/matomo-org/matomo/blob/4.x-dev/tests/UI/specs/OptOutForm_spec.js)

@Findus23
Copy link
Member

Do I understand it correctly that this runs the users user-agent through device-detector on any single request?

I can imagine that there are quite a few slow servers out there (or ones without regex-caching) where this could add more than just a few milliseconds to every request.

Maybe just adding it to the login should be enough (unless that's what the code already does).

@tsteur
Copy link
Member

tsteur commented Feb 24, 2021

BTW only running it on login could work for regular requests but for widgets it would always need to run (eg when Piwik::getModule()===Widgetize), it would also need to always run for anonymous users, and for API module/plugin we wouldn't want it to run (for performance etc since it wouldn't be "rendered" in the browser)

@flamisz
Copy link
Contributor Author

flamisz commented Feb 24, 2021

@tsteur I modified the logic: only checks the browser if the user is anonymous and the module is not API. This way even the widgets won't be checked if you are in the same browser, and of course before you log in, it will be checked.

@flamisz flamisz self-assigned this Feb 25, 2021
core/FrontController.php Outdated Show resolved Hide resolved
core/SupportedBrowser.php Outdated Show resolved Hide resolved
@flamisz flamisz added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. and removed not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Mar 1, 2021
@flamisz
Copy link
Contributor Author

flamisz commented Mar 1, 2021

Hey @tsteur I modified the PR according to your comments. Please view it again when you have some time.

Thanks

@flamisz flamisz added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Mar 1, 2021
@tsteur
Copy link
Member

tsteur commented Mar 2, 2021

@flamisz overall looks good from my perspective 👍 but didn't test it

@flamisz
Copy link
Contributor Author

flamisz commented Mar 8, 2021

@tsteur I did my best to test on a couple of browsers and a couple of use cases with BrowserStack.
And of course, we have some test cases as well.

@tsteur
Copy link
Member

tsteur commented Mar 8, 2021

👍 feel free to merge if the tests pass (didn't check)

@flamisz flamisz added this to the 4.4.0 milestone Mar 9, 2021
@tsteur tsteur modified the milestones: 4.4.0, 4.3.0 Mar 16, 2021
@flamisz flamisz merged commit bdf47ae into 4.x-dev Mar 28, 2021
@flamisz flamisz deleted the 16776-unsupported-browser-warning branch March 28, 2021 19:07
@mpdude
Copy link

mpdude commented Jul 14, 2021

This leads to HTTP 500 errors that alert my server monitoring; additionally, 5xx is not the right kind of status code for such conditions.

Maybe 400 Bad Request would be more appropriate, although it's not a perfect match either.

@sgiehl
Copy link
Member

sgiehl commented Jul 14, 2021

@mpdude thanks for your suggestion. Would you mind creating a new issue for that referencing this PR. We likely might forget about that if there is no separate issue we can plan to work on.

@sgiehl
Copy link
Member

sgiehl commented Jul 14, 2021

@mpdude just saw your comment on #17738. guess that should be enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When accessing UI with unsupported browser throw error and suggest to use other browser
5 participants