-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve GDPR implementation * Improve GDPR implementation * Protect against smol usernames
- Loading branch information
Showing
4 changed files
with
48 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{% comment %} | ||
Hides sensitive user info after 5 seconds. | ||
This code is inlined to ensure that the page can never load without it. | ||
The JS removes the text outright from the page. | ||
The CSS visually hides the text, and also makes the whole thing look nice. | ||
If JS or CSS is disabled/broken, the other solution can still remove the information, | ||
which means this setup is much more likely to work even in weird browsers. | ||
{% endcomment %} | ||
<style> | ||
.username, | ||
.remainingbalance { | ||
display: inline-block; | ||
padding: 0; | ||
transform-origin: 50% 60%; | ||
transition: width 0.3s ease; | ||
animation: gdpr-blur 0.3s ease 4.7s forwards; | ||
} | ||
@keyframes gdpr-blur { | ||
0% { | ||
min-width: 0px; | ||
} | ||
100% { | ||
background-color: currentcolor; | ||
-webkit-user-select: none; | ||
user-select: none; | ||
filter: blur(0.3em); | ||
opacity: 0.4; | ||
transform: scaleY(0.7); | ||
border-radius: 0.5em; | ||
min-width: 35px; | ||
} | ||
} | ||
</style> | ||
<script type="module"> | ||
setTimeout(() => { | ||
for (const element of document.querySelectorAll( | ||
".username, .remainingbalance", | ||
)) { | ||
const { width } = element.getBoundingClientRect(); | ||
element.style.width = `${width}px`; | ||
element.innerText = "_"; | ||
} | ||
}, 5000); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters