Uhmegle Fixes

Bypass face detection in Uhmegle, removes afk timeouts.

目前為 2024-12-16 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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');
})();