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
608b2a3d
Commit
608b2a3d
authored
Jul 21, 2022
by
Dominik Hebeler
Browse files
fix pcs disable
parent
c1f112ee
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
metager/app/Http/Controllers/HumanVerification.php
View file @
608b2a3d
...
...
@@ -260,14 +260,19 @@ class HumanVerification extends Controller
if
(
!
preg_match
(
"/^[a-f0-9]
{
32
}
$/"
,
$key
)
||
!
$request
->
filled
(
"c"
))
{
abort
(
404
);
}
$picasso_hash
=
$request
->
input
(
'c'
);
$picasso_hash
=
null
;
if
(
$request
->
filled
(
"c"
))
{
$picasso_hash
=
$request
->
input
(
'c'
);
}
$bvData
=
Cache
::
get
(
$key
);
if
(
$bvData
===
null
)
{
$bvData
=
[];
}
$bvData
[
"js_loaded"
]
=
now
();
$bvData
[
"js_picasso"
]
=
$picasso_hash
;
if
(
!
empty
(
$picasso_hash
))
{
$bvData
[
"js_picasso"
]
=
$picasso_hash
;
}
Cache
::
put
(
$key
,
$bvData
,
now
()
->
addSeconds
(
30
));
return
response
()
->
file
(
\
public_path
(
"img/1px.png"
,
[
"Content-Type"
=>
"image/png"
]));
...
...
metager/resources/js/verify.js
View file @
608b2a3d
...
...
@@ -4,8 +4,9 @@ require('fetch-ie8');
import
picassoCanvas
from
'
./picasso
'
;
// This is the result of the picasso canvas fingerprint that we'll submit back to our server
let
canvasValue
=
null
;
if
(
document
.
location
.
href
.
match
(
/
\/\/
metager
\.
org/i
)
!==
null
)
{
const
canvasValue
=
picassoCanvas
();
canvasValue
=
picassoCanvas
();
}
// Find the key id for the browser-verification
...
...
@@ -16,7 +17,10 @@ document.querySelectorAll("link").forEach(element => {
return
true
;
}
let
key
=
matches
[
1
];
let
url
=
"
/img/logo.png?id=
"
+
key
+
"
&c=
"
+
canvasValue
;
let
url
=
"
/img/logo.png?id=
"
+
key
;
if
(
canvasValue
!==
null
)
{
url
+=
"
&c=
"
+
canvasValue
;
}
return
fetch
(
url
);
});
...
...
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