Uhmegle Fixes

Bypass face detection in Uhmegle, removes afk timeouts.

当前为 2024-12-16 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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');
})();