From 5ad5d7181f5b139314171a7a0a99b315941da952 Mon Sep 17 00:00:00 2001 From: creations Date: Wed, 7 May 2025 15:21:39 -0400 Subject: [PATCH] add option for users to opt out --- README.md | 1 + public/js/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 42d9f64..eddbc04 100644 --- a/README.md +++ b/README.md @@ -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`) | --- diff --git a/public/js/index.js b/public/js/index.js index 3a83592..a32bbd8 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -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 = ` +
+

This user has opted out of sharing their presence.

+
+ `; + loadingOverlay.style.opacity = "1"; + } + return; + } + const cssLink = kv.css; if (cssLink) { try {