add dnt for nojs matomo

This commit is contained in:
Ashley //// 2024-02-09 20:37:04 +00:00
parent 6b34a91587
commit 33cc4bab1f

View file

@ -139,6 +139,11 @@ function lightOrDark(color) {
} }
} }
function isDntEnabled(req) {
const dntHeader = req.header('DNT');
return dntHeader && (dntHeader === '1' || dntHeader === 'true');
}
function IsInArray(array, id) { function IsInArray(array, id) {
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if (array[i].id === id) return true; if (array[i].id === id) return true;
@ -249,10 +254,13 @@ module.exports = function (app, config, renderTemplate) {
var isSchoolProxy = ""; var isSchoolProxy = "";
} }
// unused
let badges = ""; let badges = "";
let comments = ""; let comments = "";
let nnn = ""; let nnn = "";
const dnt_val = isDntEnabled(req)
if ( if (
inv_vid?.error === inv_vid?.error ===
"The uploader has not made this video available in your country" || "The uploader has not made this video available in your country" ||
@ -301,6 +309,7 @@ module.exports = function (app, config, renderTemplate) {
discord, discord,
turntomins, turntomins,
twitch, twitch,
dnt_val,
reddit, reddit,
channel_uploads, channel_uploads,
secure, secure,