Bypass uView Plus documentation ad verification by intercepting ad requests and simulating VIP responses to prevent QR code popups.
目前為
// ==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;
})();