Bypass face detection in Uhmegle, removes afk timeouts.
当前为
// ==UserScript==
// @name Uhmegle Fixes
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Bypass face detection in Uhmegle, removes afk timeouts.
// @author Fizi
// @match https://uhmegle.com/video*
// @license MIT
// @grant none
// ==/UserScript==
(function () {
'use strict';
console.log('Violentmonkey Script Loaded: Bypassing Face Detection');
// Override the calculateVariance function
if (typeof window.calculateVariance === 'function') {
console.log('Overriding calculateVariance...');
window.calculateVariance = () => {
console.log('Spoofing variance: Returning 1000');
return 1000; // High variance to simulate a valid frame
};
}
if (typeof window.isModerator !== 'undefined') {
Object.defineProperty(window, 'isModerator', {
get: () => true, // Always return true
set: (value) => console.log('isModerator set to:', value),
});
console.log('isModerator spoofed: true');
}
// Override the Web Worker used for face detection
const OriginalWorker = window.Worker;
window.Worker = function (scriptUrl) {
console.log('Worker Intercepted:', scriptUrl);
const worker = new OriginalWorker(scriptUrl);
// Spoof onmessage handler
worker.onmessage = function (event) {
console.log('Original Worker Message:', event);
worker.onmessage({
data: { action: 'faceDetections', faces: 1 }, // Simulating a face detected
});
};
return worker;
};
// Override captureLocalVideoFrames
if (typeof window.captureLocalVideoFrames === 'function') {
console.log('Overriding captureLocalVideoFrames...');
window.captureLocalVideoFrames = () => {
console.log('Spoofing video frame capture...');
const fakeCanvas = document.createElement('canvas');
fakeCanvas.width = 224;
fakeCanvas.height = 224;
const ctx = fakeCanvas.getContext('2d');
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, 224, 224); // Solid white frame
return fakeCanvas;
};
}
// Disable blocking logic
Object.defineProperty(window, 'blockNext', {
get: () => false, // Always return false
set: (value) => console.log('blockNext set to:', value),
});
// Override the socket behavior -- will use soon.
const OriginalWebSocket = window.WebSocket;
window.WebSocket = function (url, protocols) {
console.log('Intercepted WebSocket:', url);
const socket = new OriginalWebSocket(url, protocols);
socket.send = function (data) {
console.log('Intercepted WebSocket message:', data);
OriginalWebSocket.prototype.send.call(socket, data);
};
return socket;
};
// Prevent AFK timer disconnections
console.log('Disabling AFK timer...');
clearTimeout(window.afkTimer);
window.setAfkTimer = () => console.log('AFK Timer Override: No-op');
})();