跳转到主要内容

安装 Installation

安装rev-utils库,为您的 Electron 应用添加完整的广告支持。我们可能会不定期更新该包。 Install the rev-utils library to augment your Electron setup with full compatibility for ads. We may occassionally update the package.
npm i -D rev-utils@https://r2.reviq.app/rev-utils-v1.0.3.tgz

使用方法 Usage

使用new BrowserWindow创建新窗口后,将窗口对象和electron全局变量传入 setupRevUtils。 After creating window with new BrowserWindow, pass in the window and electron global into setupRevUtils
main.js
const { setupRevUtils } = require("rev-utils");

// 注意:此处引用的是electron全局变量! Note the import of the global electron here!
const electron = require("electron");
// 您可以从该模块对象中解构所需的引用 You can destructure your imports from this module object
const { BrowserWindow } = electron;

const myWindow = new BrowserWindow();

setupRevUtils(myWindow, electron);
setupRevUtils在底层调用了窗口的两个函数: -setupLinkHandler:用于打开广告(同时拦截恶意行为!) -setUserAgent:用于移除User Agent字符串中的非标准部分,这些非标准内容可能触发无效流量(IVT)检测。 Under the hood, setupRevUtils calls two functions on the window - setupLinkHandler to open ads (and block malicious behavior!) - setUserAgent, which removes non-standard portions of the User Agent string which may trigger IVT (invalid traffic).