uView Plus Ad Bypass (VIP Simulation)

拦截 uView Plus 文档广告验证请求,模拟 VIP 响应,跳过二维码弹窗。

当前为 2025-05-11 提交的版本,查看 最新版本

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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;
})();