diff --git a/websites/I/Invidious/metadata.json b/websites/I/Invidious/metadata.json index 2a76168d3e84..6552775d8038 100644 --- a/websites/I/Invidious/metadata.json +++ b/websites/I/Invidious/metadata.json @@ -17,7 +17,7 @@ "vid.mint.lgbt", "yewtu.be" ], - "version": "1.0.23", + "version": "1.0.24", "logo": "https://cdn.rcd.gg/PreMiD/websites/I/Invidious/assets/logo.png", "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/I/Invidious/assets/thumbnail.jpg", "color": "#00B6F0", @@ -25,5 +25,13 @@ "tags": [ "video", "media" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fad fa-user-secret", + "value": false + } ] } \ No newline at end of file diff --git a/websites/I/Invidious/presence.ts b/websites/I/Invidious/presence.ts index fe3ad01b2ed6..53d89405b600 100644 --- a/websites/I/Invidious/presence.ts +++ b/websites/I/Invidious/presence.ts @@ -4,7 +4,7 @@ const presence = new Presence({ function getTime() { const time = document - .querySelectorAll(".vjs-current-time-display")[0] + .querySelector(".vjs-current-time-display") .textContent.split(":") .map(n => Number(n)); if (time.length === 3) @@ -21,6 +21,8 @@ presence.on("UpdateData", async () => { }; let clear = false; + const privacy = await presence.getSetting("privacy"); + switch (document.location.pathname.replace("/feed", "").split("/")[1]) { case "": case "popular": @@ -56,28 +58,33 @@ presence.on("UpdateData", async () => { break; case "watch": - presenceData.smallImageKey = document.querySelectorAll(".vjs-playing")[0] - ? Assets.Play - : Assets.Pause; - presenceData.details = document - .querySelectorAll("h1")[0] - .textContent.trim(); - presenceData.state = document.querySelector("#channel-name").textContent; - if (document.querySelectorAll(".vjs-playing")[0]) - presenceData.startTimestamp = getTime(); - + if (!privacy) { + presenceData.smallImageKey = document.querySelector(".vjs-playing") + ? Assets.Play + : Assets.Pause; + presenceData.details = document.querySelector("h1").textContent.trim(); + presenceData.state = + document.querySelector("#channel-name").textContent; + if (document.querySelector(".vjs-playing")) + presenceData.startTimestamp = getTime(); + } break; case "playlist": presenceData.details = "Viewing playlist"; - presenceData.state = document.querySelectorAll("h3")[0].textContent; + if (!privacy) + presenceData.state = document.querySelector("h3").textContent; break; case "channel": presenceData.details = "Viewing channel"; - presenceData.state = document - .querySelectorAll(".channel-profile")[0] - .textContent.trim(); + + if (!privacy) { + presenceData.state = document + .querySelector(".channel-profile") + .textContent.trim(); + } + break; default: