Skip to content
GitLab
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
ddb68893
Commit
ddb68893
authored
Jun 11, 2019
by
Dominik Hebeler
Browse files
removed the temp spam removal
parent
9fae7df8
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/HumanVerification.php
View file @
ddb68893
...
@@ -26,16 +26,6 @@ class HumanVerification extends Controller
...
@@ -26,16 +26,6 @@ class HumanVerification extends Controller
}
}
if
(
$request
->
getMethod
()
==
'POST'
)
{
if
(
$request
->
getMethod
()
==
'POST'
)
{
$dowCheck
=
true
;
# Temp remove later
# Check for recent Spams
if
(
\
preg_match
(
"/eingabe=[
\\
d]
{
3
}
\s*chan.*$/si"
,
$url
))
{
# Sleep a random time
$rand
=
rand
(
0
,
15
);
sleep
(
$rand
);
$dowCheck
=
false
;
}
$user
=
$redis
->
hgetall
(
HumanVerification
::
PREFIX
.
"."
.
$id
);
$user
=
$redis
->
hgetall
(
HumanVerification
::
PREFIX
.
"."
.
$id
);
$user
=
[
'uid'
=>
$user
[
"uid"
],
$user
=
[
'uid'
=>
$user
[
"uid"
],
'id'
=>
$user
[
"id"
],
'id'
=>
$user
[
"id"
],
...
@@ -49,7 +39,7 @@ class HumanVerification extends Controller
...
@@ -49,7 +39,7 @@ class HumanVerification extends Controller
$key
=
$request
->
input
(
'captcha'
);
$key
=
$request
->
input
(
'captcha'
);
$key
=
strtolower
(
$key
);
$key
=
strtolower
(
$key
);
if
(
!
$dowCheck
||
!
$hasher
->
check
(
$key
,
$lockedKey
))
{
if
(
!
$hasher
->
check
(
$key
,
$lockedKey
))
{
$captcha
=
Captcha
::
create
(
"default"
,
true
);
$captcha
=
Captcha
::
create
(
"default"
,
true
);
$pipeline
=
$redis
->
pipeline
();
$pipeline
=
$redis
->
pipeline
();
$pipeline
->
hset
(
HumanVerification
::
PREFIX
.
"."
.
$id
,
'lockedKey'
,
$captcha
[
"key"
]);
$pipeline
->
hset
(
HumanVerification
::
PREFIX
.
"."
.
$id
,
'lockedKey'
,
$captcha
[
"key"
]);
...
@@ -200,6 +190,9 @@ class HumanVerification extends Controller
...
@@ -200,6 +190,9 @@ class HumanVerification extends Controller
public
static
function
couldBeSpammer
(
$ip
)
public
static
function
couldBeSpammer
(
$ip
)
{
{
if
(
!
env
(
"REMOVE_SPAM_IN_TOR"
))
{
return
false
;
}
$serverAddress
=
empty
(
$_SERVER
[
'SERVER_ADDR'
])
?
"144.76.88.77"
:
$_SERVER
[
'SERVER_ADDR'
];
$serverAddress
=
empty
(
$_SERVER
[
'SERVER_ADDR'
])
?
"144.76.88.77"
:
$_SERVER
[
'SERVER_ADDR'
];
$queryUrl
=
"https://tor.metager.org?password="
.
urlencode
(
env
(
"TOR_PASSWORD"
))
.
"&ra="
.
urlencode
(
$ip
)
.
"&sa="
.
urlencode
(
$serverAddress
)
.
"&sp=443"
;
$queryUrl
=
"https://tor.metager.org?password="
.
urlencode
(
env
(
"TOR_PASSWORD"
))
.
"&ra="
.
urlencode
(
$ip
)
.
"&sa="
.
urlencode
(
$serverAddress
)
.
"&sp=443"
;
...
...
app/Http/Middleware/HumanVerification.php
View file @
ddb68893
...
@@ -101,15 +101,6 @@ class HumanVerification
...
@@ -101,15 +101,6 @@ class HumanVerification
"lockedKey"
=>
""
,
"lockedKey"
=>
""
,
];
];
}
}
# Temp remove later
# Check for recent Spams
$eingabe
=
\
Request
::
input
(
'eingabe'
);
if
(
\
preg_match
(
"/^[
\\
d]
{
3
}
\s*chan.*$/si"
,
$eingabe
))
{
# Sleep a random time between 1 and 5 seconds
$rand
=
rand
(
0
,
5
);
sleep
(
$rand
);
$user
[
"locked"
]
=
true
;
}
# A lot of automated requests are from websites that redirect users to our result page.
# A lot of automated requests are from websites that redirect users to our result page.
# We will detect those requests and put a captcha
# We will detect those requests and put a captcha
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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