update fp.js

master
Aevann 2023-07-23 00:36:02 +03:00
parent d0c7524154
commit 795320307a
4 changed files with 9 additions and 16 deletions

View File

@ -1,5 +1,3 @@
const fp_token = document.getElementById('fp_token').value
function fp(fp) {
const xhr = new XMLHttpRequest();
xhr.open("POST", '/fp/'+fp);
@ -9,16 +7,12 @@ function fp(fp) {
xhr.send(form);
};
const fpPromise = new Promise((resolve, reject) => {
const script = document.createElement('script');
script.onload = resolve;
script.onerror = reject;
script.async = true;
script.src = "/assets/js/vendor/fp.js?x=6";
document.head.appendChild(script);
})
.then(() => FingerprintJS.load({token: fp_token}));
const fpPromise = import('/assets/js/vendor/fp.js?x=7')
.then(FingerprintJS => FingerprintJS.load())
fpPromise
.then(fp => fp.get())
.then(result => {fp(result.visitorId);})
.then(fp => fp.get())
.then(result => {
console.log(result.requestId, result.visitorId);
fp(result.visitorId);
})

File diff suppressed because one or more lines are too long

View File

@ -169,7 +169,6 @@
{% endif %}
{% if FP and request.path == '/' and v and not v.fp %}
<input hidden id="fp_token" value="{{FP}}">
<script defer src="{{'js/fp.js' | asset}}"></script>
{% endif %}

View File

@ -2,5 +2,5 @@ add_header Referrer-Policy "same-origin";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header X-Frame-Options "deny";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; form-action 'self'; manifest-src 'self'; worker-src 'self'; base-uri 'self'; font-src 'self'; style-src-elem 'self'; style-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; script-src-elem 'self' challenges.cloudflare.com; script-src-attr 'none'; script-src 'self' challenges.cloudflare.com; media-src 'self' https:; img-src 'self' https: data:; frame-src challenges.cloudflare.com www.youtube-nocookie.com platform.twitter.com rumble.com player.twitch.tv; connect-src 'self' tls-use1.fpapi.io api.fpjs.io;";
add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; form-action 'self'; manifest-src 'self'; worker-src 'self'; base-uri 'self'; font-src 'self'; style-src-elem 'self'; style-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; script-src-elem 'self' challenges.cloudflare.com; script-src-attr 'none'; script-src 'self' challenges.cloudflare.com; media-src 'self' https:; img-src 'self' https: data:; frame-src challenges.cloudflare.com www.youtube-nocookie.com platform.twitter.com rumble.com player.twitch.tv; connect-src 'self' use1.fptls.com use1.fptls3.com api.fpjs.io;";
add_header Cross-Origin-Opener-Policy "same-origin";