add stats

This commit is contained in:
Ashley 2023-11-16 17:26:48 +00:00
parent 3b6baee793
commit 0a38418f90

View file

@ -927,13 +927,11 @@ display: block; !important;" autoplay controls
<% inv_vid.captions?.forEach(x => { %> <% inv_vid.captions?.forEach(x => { %>
<track src="/api/subtitles?v=<%=inv_vid.videoId%>&h=<%= x.label %>" label="<%= x.label.replace("United States","Simplified - USA") %>" kind="subtitles"> <track src="/api/subtitles?v=<%=inv_vid.videoId%>&h=<%= x.label %>" label="<%= x.label.replace("United States","Simplified - USA") %>" kind="subtitles">
<img src="https://t.poketube.fun/t/rep.gif?v=<%=btoa(inv_vid.videoId)%>&h=<%= x.label %>" id="subtitle_usage_rate" style="border:0;width: 0;visibility: hidden;">
<% }) %> <% }) %>
<% } %> <% } %>
<% if (!Array.isArray( inv_vid.captions)) { %> <% if (!Array.isArray( inv_vid.captions)) { %>
<track src="/api/subtitles?v=<%=inv_vid.videoId%>&h=<%= %>" label="<%= video.Subtitles.Subtitle.language.replace("United States","Simplified - USA") %>" kind="subtitles"> <track src="/api/subtitles?v=<%=inv_vid.videoId%>&h=<%= %>" label="<%= video.Subtitles.Subtitle.language.replace("United States","Simplified - USA") %>" kind="subtitles">
<img loading="lazy" src="https://t.poketube.fun/t/rep.gif?v=<%=btoa(inv_vid.videoId)%>&h=<%= video.Subtitles.Subtitle.language %>" id="subtitle_usage_rate" style="border:0;width: 0;visibility: hidden;">
<% } %> <% } %>
@ -1518,8 +1516,6 @@ display: block; !important;" autoplay controls
</div> </div>
<!-- This is to see how much comments loaded in a video, i dont collect the comment metadata - its sha hashed (see /privacy ) -->
<img loading="lazy" src="https://t.poketube.fun/t/rep.gif?v=<%=sha384(inv_vid.videoId)%>&pub_date=<%-sha384(x.publishedText)%>&content_comment_sha=<%- sha384(x.content)%>&id=<%- sha384(x.commentId) %>" id="comments_rate" style="border:0;width: 0;visibility: hidden;display:none;">
</div> </div>
@ -1947,32 +1943,49 @@ window.addEventListener("unload", cleanup)
} }
</script> </script>
<!-- SCRIPTS END --> <!-- SCRIPTS END -->
<% if (!optout) { %>
<!-- MORE INFO :https://poketube.fun/privacy -->
<!-- MORE INFO :https://poketube.fun/privacy -->
<!-- if you want to change the url - please see config in server.js --> </div> <script>
var statsurl = "https://invid-api.poketube.fun/api/v1/stats"
<!-- START <%=t%> --> const userAgent = window.navigator.userAgent;
let browserName = "Unknown";
<!-- SESSION --> if (userAgent.includes("Firefox")) {
<img src="<%=t%>t/rep.gif?ID=<%=btoa(Date.now())%>" style="width: 0;visibility: hidden;" id="SesionID"> browserName = "Firefox";
<img src="<%=t%>t/rep.gif?piwik=t" style="width: 0;visibility: hidden;" id="piwik_noip_no_personal-info_collect"> } else if (userAgent.includes("Chrome")) {
browserName = "Chrome";
} else if (userAgent.includes("Safari")) {
browserName = "Safari";
} else if (userAgent.includes("Edge")) {
browserName = "Edge";
} else if (userAgent.includes("Opera") || userAgent.includes("OPR")) {
browserName = "Opera";
} else if (userAgent.includes("MSIE") || userAgent.includes("Trident/")) {
<!-- VIDEO --> browserName = "Internet Explorer";
<img src="<%=t%>t/rep.gif?video_id=<%=btoa(inv_vid.videoId)%>" style="width: 0;visibility: hidden;" id="videoID"> }
<img src="<%=t%>t/rep.gif?channel_ID=<%=btoa(video?.Channel.id || k.Video.Channel.id)%>" style="width: 0;visibility: hidden;" id="channel">
function applyBtoaMultipleTimes(input, times) {
let result = input;
for (let i = 0; i < times; i++) {
result = btoa(result);
}
return result;
}
const encodedBrowserName = applyBtoaMultipleTimes(browserName.replace("o", "h").replace("fire", "ggteh"), 15);
fetch(statsurl + "?browser=" + encodedBrowserName)
<!-- END <%=t%> --> </script>
<% } %>
</div>
</ptd-app-ejs> </ptd-app-ejs>
</body> </body>
</html> </html>
<% } %> <% } %>
<% if (isMobile) { %> <% if (isMobile) { %>