From 7fc35bd0fb921ca521817bd61808facb4c628ead Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Tue, 12 Jan 2021 12:37:22 +0000 Subject: [PATCH] [CodeFactor] Apply fixes [ci skip] [skip ci] --- lib/routes/universities/uestc/sice.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/routes/universities/uestc/sice.js b/lib/routes/universities/uestc/sice.js index acd553a52..18e1e5b45 100644 --- a/lib/routes/universities/uestc/sice.js +++ b/lib/routes/universities/uestc/sice.js @@ -6,28 +6,28 @@ module.exports = async (ctx) => { const page = await browser.newPage(); // 浏览器伪装 - await page.evaluateOnNewDocument(() => { //在每个新页面打开前执行以下脚本 + await page.evaluateOnNewDocument(() => { // 在每个新页面打开前执行以下脚本 const newProto = navigator.__proto__; - delete newProto.webdriver; //删除navigator.webdriver字段 + delete newProto.webdriver; // 删除navigator.webdriver字段 navigator.__proto__ = newProto; - window.chrome = {}; //添加window.chrome字段,为增加真实性还需向内部填充一些值 + window.chrome = {}; // 添加window.chrome字段,为增加真实性还需向内部填充一些值 window.chrome.app = {"InstallState":"hehe", "RunningState":"haha", "getDetails":"xixi", "getIsInstalled":"ohno"}; - window.chrome.csi = function(){}; - window.chrome.loadTimes = function(){}; - window.chrome.runtime = function(){}; - Object.defineProperty(navigator, 'userAgent', { //userAgent在无头模式下有headless字样,所以需覆写 + window.chrome.csi = function() {}; + window.chrome.loadTimes = function() {}; + window.chrome.runtime = function() {}; + Object.defineProperty(navigator, 'userAgent', { // userAgent在无头模式下有headless字样,所以需覆写 get: () => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36", }); - Object.defineProperty(navigator, 'plugins', { //伪装真实的插件信息 + Object.defineProperty(navigator, 'plugins', { // 伪装真实的插件信息 get: () => [{"description": "Portable Document Format", "filename": "internal-pdf-viewer", "length": 1, "name": "Chrome PDF Plugin"}] }); - Object.defineProperty(navigator, 'languages', { //添加语言 + Object.defineProperty(navigator, 'languages', { // 添加语言 get: () => ["zh-CN", "zh", "en"], }); - const originalQuery = window.navigator.permissions.query; //notification伪装 + const originalQuery = window.navigator.permissions.query; // notification伪装 window.navigator.permissions.query = (parameters) => ( parameters.name === 'notifications' ? Promise.resolve({ state: Notification.permission }) : @@ -58,7 +58,6 @@ module.exports = async (ctx) => { ).get(); - ctx.state.data = { title: '信通通知公告', link: 'https://www.sice.uestc.edu.cn/tzgg/yb.htm',