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
150b2561
Commit
150b2561
authored
Feb 17, 2021
by
Davide Aprea
Browse files
add associator parameter for protective middleware
parent
9a732734
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Middleware/BrowserVerification.php
View file @
150b2561
...
...
@@ -17,7 +17,7 @@ class BrowserVerification
* @param \Closure $next
* @return mixed
*/
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
,
$isAsso
=
false
)
{
$bvEnabled
=
config
(
"metager.metager.browserverification_enabled"
);
...
...
@@ -42,8 +42,11 @@ class BrowserVerification
}
header
(
'X-Accel-Buffering: no'
);
if
((
$request
->
filled
(
"loadMore"
)
&&
Cache
::
has
(
$request
->
input
(
"loadMore"
)))
||
app
(
'App\Models\Key'
)
->
getStatus
())
{
return
$next
(
$request
);
//use parameter for middleware to skip this when using associator
if
(
!
$isAsso
){
if
((
$request
->
filled
(
"loadMore"
)
&&
Cache
::
has
(
$request
->
input
(
"loadMore"
)))
||
app
(
'App\Models\Key'
)
->
getStatus
())
{
return
$next
(
$request
);
}
}
ini_set
(
'zlib.output_compression'
,
'Off'
);
...
...
app/Http/Middleware/HumanVerification.php
View file @
150b2561
...
...
@@ -17,7 +17,7 @@ class HumanVerification
* @param \Closure $next
* @return mixed
*/
public
function
handle
(
$request
,
Closure
$next
)
public
function
handle
(
$request
,
Closure
$next
,
$isAsso
=
false
)
{
if
(
$request
->
filled
(
"loadMore"
)
&&
Cache
::
has
(
$request
->
input
(
"loadMore"
)))
{
return
$next
(
$request
);
...
...
@@ -46,9 +46,13 @@ class HumanVerification
* If someone that uses a bot finds this out we
* might have to change it at some point.
*/
if
(
!
env
(
'BOT_PROTECTION'
,
false
)
||
app
(
'App\Models\Key'
)
->
getStatus
())
{
$update
=
false
;
return
$next
(
$request
);
//use parameter for middleware to skip this when using associator
if
(
!
$isAsso
){
if
(
!
env
(
'BOT_PROTECTION'
,
false
)
||
app
(
'App\Models\Key'
)
->
getStatus
())
{
$update
=
false
;
return
$next
(
$request
);
}
}
# Get all Users of this IP
...
...
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