Analytics included in devtools detection report

This commit is contained in:
Noah 2025-06-15 12:44:49 -07:00
parent 7044cc5888
commit fc546bf7ef

View File

@ -54,6 +54,7 @@ export default {
disconnect: false, // don't try to reconnect (e.g. kicked) disconnect: false, // don't try to reconnect (e.g. kicked)
windowFocused: true, // browser tab is active windowFocused: true, // browser tab is active
windowFocusedAt: new Date(), windowFocusedAt: new Date(),
appStartTime: new Date(),
// Disconnect spamming: don't retry too many times. // Disconnect spamming: don't retry too many times.
disconnectLimit: 2, disconnectLimit: 2,
@ -2168,15 +2169,32 @@ export default {
const after = new Date().getTime(); const after = new Date().getTime();
if (after - before > minimumTimeout) { if (after - before > minimumTimeout) {
this.ChatClient(`Dev tools detected!`);
clearInterval(inter); clearInterval(inter);
let uptime = (after - this.appStartTime.getTime()) / 1000,
uptimeStr = "",
vids = this.numVideosOpen,
ua = navigator.userAgent,
delta = after - before;
if (uptime > 3600) {
uptimeStr = `${(uptime / 3600).toFixed(2)}h`;
} else if (uptime > 60) {
uptimeStr = `${(uptime / 60).toFixed(2)}m`;
} else {
uptimeStr = `${uptime.toFixed(2)}s`;
}
this.doCustomReport({ this.doCustomReport({
message: { message: {
channel: 'n/a', channel: 'n/a',
username: this.username, username: this.username,
at: new Date(), at: new Date(),
message: 'User has opened their browser dev tools!', message: 'User has opened their browser dev tools!\n\n' +
`* Delta time in devtools check: ${delta}ms\n` +
`* Web page uptime: ${uptimeStr} (${parseInt(uptime)}s)\n` +
`* Our camera active: ${this.webcam.active ? 'YES' : 'NO'}\n` +
`* Videos open: ${vids}\n` +
`* User Agent: ${ua}`,
}, },
classification: 'Community Safety Violation', classification: 'Community Safety Violation',
comment: `The user ${this.username} has opened their browser dev tools on chat, ` + comment: `The user ${this.username} has opened their browser dev tools on chat, ` +