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
e4a1e858
Commit
e4a1e858
authored
Jul 20, 2022
by
Dominik Hebeler
Browse files
wrong url redirecting to startpage
parent
39e4d650
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
metager/app/Http/Middleware/BrowserVerification.php
View file @
e4a1e858
...
...
@@ -75,11 +75,8 @@ class BrowserVerification
\
app
()
->
make
(
QueryTimer
::
class
)
->
observeEnd
(
self
::
class
);
return
$next
(
$request
);
}
else
{
# We are serving that request but after solving a captcha
self
::
logBrowserverification
(
$request
);
\
app
()
->
make
(
HumanVerification
::
class
)
->
lockUser
();
\
app
()
->
make
(
QueryTimer
::
class
)
->
observeEnd
(
self
::
class
);
return
$next
(
$request
);
return
redirect
(
url
(
"/"
));
}
}
...
...
@@ -177,25 +174,19 @@ class BrowserVerification
public
static
function
logBrowserverification
(
Request
$request
)
{
$fail2banEnabled
=
config
(
"metager.metager.fail2ban.enabled"
);
if
(
empty
(
$fail2banEnabled
)
||
!
$fail2banEnabled
||
!
config
(
"metager.metager.fail2ban.url"
)
||
!
config
(
"metager.metager.fail2ban.user"
)
||
!
config
(
"metager.metager.fail2ban.password"
))
{
return
;
}
$log
=
[
now
()
->
format
(
"Y-m-d H:i:s"
),
$request
->
input
(
"eingabe"
),
"js="
.
\
app
()
->
make
(
SearchSettings
::
class
)
->
javascript_enabled
,
"picasso="
.
\
app
()
->
make
(
SearchSettings
::
class
)
->
javascript_picasso
,
// Submit fetch job to worker
$mission
=
[
"resulthash"
=>
"captcha"
,
"url"
=>
config
(
"metager.metager.fail2ban.url"
)
.
"/browserverification/"
,
"useragent"
=>
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0"
,
"username"
=>
config
(
"metager.metager.fail2ban.user"
),
"password"
=>
config
(
"metager.metager.fail2ban.password"
),
"headers"
=>
[
"ip"
=>
$request
->
ip
()
],
"cacheDuration"
=>
0
,
"name"
=>
"Captcha"
,
];
$mission
=
json_encode
(
$mission
);
Redis
::
rpush
(
\
App\MetaGer
::
FETCHQUEUE_KEY
,
$mission
);
$file_path
=
\
storage_path
(
"logs/metager/bv_fail.csv"
);
$fh
=
fopen
(
$file_path
,
"a"
);
try
{
\
fputcsv
(
$fh
,
$log
);
}
finally
{
fclose
(
$fh
);
}
}
}
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