add option for users to opt out
All checks were successful
Code quality checks / biome (push) Successful in 7s

This commit is contained in:
creations 2025-05-07 15:21:39 -04:00
parent ba67ba55e3
commit 5ad5d7181f
Signed by: creations
GPG key ID: 8F553AA4320FC711
2 changed files with 14 additions and 0 deletions

View file

@ -76,6 +76,7 @@ These can be defined in Lanyard's KV store to customize the page:
| `badges` | Enables badge fetching (`true` / `false`) |
| `readme` | URL to a README displayed on the profile (`.md` or `.html`) |
| `css` | URL to a css to change styles on the page, no import or require allowed |
| `optout` | Allows users to stop sharing there profile on the website (`true` / `false`) |
---

View file

@ -382,6 +382,19 @@ async function updatePresence(initialData) {
const kv = data.kv || {};
if (kv.optout === "true") {
const loadingOverlay = document.getElementById("loading-overlay");
if (loadingOverlay) {
loadingOverlay.innerHTML = `
<div class="error-message">
<p>This user has opted out of sharing their presence.</p>
</div>
`;
loadingOverlay.style.opacity = "1";
}
return;
}
const cssLink = kv.css;
if (cssLink) {
try {