Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
d930201d
Commit
d930201d
authored
Jul 20, 2022
by
Dominik Hebeler
Browse files
directly skip inline bv for some browsers
parent
b0b24f59
Changes
1
Hide whitespace changes
Inline
Side-by-side
metager/app/Http/Middleware/BrowserVerification.php
View file @
d930201d
...
...
@@ -91,7 +91,7 @@ class BrowserVerification
echo
(
view
(
'layouts.resultpage.verificationHeader'
)
->
with
(
'key'
,
$key
)
->
render
());
flush
();
if
(
$this
->
waitForBV
(
$key
))
{
if
(
$this
->
supportsInlineVerification
()
&&
$this
->
waitForBV
(
$key
))
{
echo
(
view
(
'layouts.resultpage.resources'
)
->
render
());
flush
();
\
app
()
->
make
(
QueryTimer
::
class
)
->
observeEnd
(
self
::
class
);
...
...
@@ -149,6 +149,37 @@ class BrowserVerification
return
false
;
}
private
function
supportsInlineVerification
()
{
$agent
=
new
Agent
();
$agent
->
setUserAgent
(
$_SERVER
[
"AGENT"
]);
$browser
=
$agent
->
browser
();
$version
=
$agent
->
version
(
$browser
);
// IE and Opera doesn't work at all
if
(
$browser
===
"IE"
)
{
return
false
;
}
// Edge Browser up to and including version 16 doesn't support it
if
(
$browser
===
"Edge"
&&
\
version_compare
(
$version
,
17
)
===
-
1
)
{
return
false
;
}
// Safari Browser up to and including version 7 doesn't support it
if
(
$browser
===
"Safari"
&&
\
version_compare
(
$version
,
8
)
===
-
1
)
{
return
false
;
}
$unsupported_browsers
=
[
"IE"
,
];
if
(
\
in_array
(
$browser
,
$unsupported_browsers
))
{
return
false
;
}
return
true
;
}
public
static
function
logBrowserverification
(
Request
$request
)
{
$fail2banEnabled
=
config
(
"metager.metager.fail2ban.enabled"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment