From 33cc4bab1fd21332c22febdb81b3af0411977246 Mon Sep 17 00:00:00 2001 From: Ashley //// Date: Fri, 9 Feb 2024 20:37:04 +0000 Subject: [PATCH] add dnt for nojs matomo --- src/libpoketube/init/pages-video.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libpoketube/init/pages-video.js b/src/libpoketube/init/pages-video.js index 693ae640..0405b431 100644 --- a/src/libpoketube/init/pages-video.js +++ b/src/libpoketube/init/pages-video.js @@ -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) { for (var i = 0; i < array.length; i++) { if (array[i].id === id) return true; @@ -249,10 +254,13 @@ module.exports = function (app, config, renderTemplate) { var isSchoolProxy = ""; } + // unused let badges = ""; let comments = ""; let nnn = ""; + const dnt_val = isDntEnabled(req) + if ( inv_vid?.error === "The uploader has not made this video available in your country" || @@ -301,6 +309,7 @@ module.exports = function (app, config, renderTemplate) { discord, turntomins, twitch, + dnt_val, reddit, channel_uploads, secure,