uView Plus Ad Bypass (VIP Simulation)

Bypass uView Plus documentation ad verification by intercepting ad requests and simulating VIP responses to prevent QR code popups.

目前為 2025-05-11 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         uView Plus Ad Bypass (VIP Simulation)
// @namespace    https://uiadmin.net/
// @version      1.0.0
// @description  Bypass uView Plus documentation ad verification by intercepting ad requests and simulating VIP responses to prevent QR code popups.
// @description:zh-CN  拦截 uView Plus 文档广告验证请求,模拟 VIP 响应,跳过二维码弹窗。
// @author       WanliZHong
// @license      MIT
// @homepage     https://uiadmin.net/
// @supportURL   https://uiadmin.net/uview-plus/cooperation/about.html
// @match        https://uiadmin.net/*
// @match        https://*.uiadmin.net/*
// @icon         https://uiadmin.net/favicon.ico
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
  const OriginalXHR = window.XMLHttpRequest;

  // Custom XMLHttpRequest class to intercept and override ad verification
  class InterceptedXHR extends OriginalXHR {
    open(method, url, ...rest) {
      this._isAdRequest = typeof url === 'string' && url.includes('/api/v1/wxapp/ad/add');
      this._adUrl = url;
      return super.open(method, url, ...rest);
    }

    send(body) {
      if (this._isAdRequest) {
        console.log('[AdBypass] 🚫 Intercepting uView Plus ad request:', this._adUrl);

        // Extract the 'id' parameter from the URL
        let id = 'fake-id';
        try {
          const u = new URL(this._adUrl, location.origin);
          id = u.searchParams.get('id') || id;
        } catch (e) {
          console.warn('[AdBypass] ⚠️ Failed to parse ad URL:', e);
        }

        // Simulate a successful VIP response
        const fakeData = {
          code: 200,
          data: {
            isVip: true,
            id: id
          },
          msg: '成功',
          env: 'prod'
        };

        // Create a fake event with the spoofed response
        const fakeEvent = {
          target: {
            status: 200,
            readyState: 4,
            responseText: JSON.stringify(fakeData),
            response: JSON.stringify(fakeData)
          }
        };

        // Trigger callbacks to simulate a normal response
        setTimeout(() => {
          if (typeof this.onload === 'function') this.onload(fakeEvent);
          if (typeof this.onreadystatechange === 'function') {
            this.readyState = 4;
            this.status = 200;
            this.responseText = fakeEvent.target.responseText;
            this.onreadystatechange(fakeEvent);
          }
        }, 100);

        return; // Prevent the actual request
      }

      return super.send(body);
    }
  }

  // Replace the global XMLHttpRequest with the intercepting version
  window.XMLHttpRequest = InterceptedXHR;
})();