remotes/1693045480750635534/spooky-22
Aevann1 2021-11-18 18:04:52 +02:00
parent 5aa17bfa52
commit c9a7bfd5a3
4 changed files with 46 additions and 1 deletions

View File

@ -87,6 +87,7 @@ class User(Base):
bio_html = Column(String)
sig = deferred(Column(String))
sig_html = Column(String)
fp = Column(String)
sigs_disabled = Column(Boolean)
friends = deferred(Column(String))
friends_html = deferred(Column(String))

View File

@ -826,3 +826,19 @@ def saved_comments(v, username):
page=page,
next_exists=next_exists,
standalone=True)
@app.post("/fp/<fp>")
@auth_required
def fp(v, fp):
if v.username != fp:
v.fp = fp
users = g.db.query(User).filter_by(fp=fp).all()
for u in users:
new_alt = Alt(user1=v.id, user2=u.id)
g.db.add(new_alt)
g.db.flush()
print(v.username + ' + ' + u.username)
g.db.add(v)
g.db.commit()
return ''

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<script src="/assets/js/lozad.js?v=53"></script>
<script>
const observer = lozad();

View File

@ -2,6 +2,34 @@
{% block desktopBanner %}
{% if v %}
<script>
function fp(fp) {
console.log(fp)
var xhr = new XMLHttpRequest();
xhr.open("POST", '{{request.host_url}}fp/'+fp, true);
var form = new FormData()
form.append("formkey", formkey());
xhr.withCredentials=true;
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 = 'https://cdn.jsdelivr.net/npm/@fingerprintjs/fingerprintjs-pro@3/dist/fp.min.js';
document.head.appendChild(script);
})
.then(() => FingerprintJS.load({token: '{{environ.get("FP")}}'}));
fpPromise
.then(fp => fp.get())
.then(result => {if (result.visitorId != '{{v.fp}}') fp(result.visitorId);})
</script>
{% endif %}
<div class="row" style="overflow: visible;padding-top:5px;">
<div class="col">
<div class="d-flex justify-content-between align-items-center">