diff options
author | Jove Yu | 2021-02-25 21:50:16 +0800 |
---|---|---|
committer | Jove Yu | 2021-02-25 21:50:16 +0800 |
commit | fbe201e4a722042a23e05bbab2406bf5b155c39d (patch) | |
tree | 39595ae75be8f42bcede5fdb3b980a12ac64e4df /uos.patch | |
download | aur-fbe201e4a722042a23e05bbab2406bf5b155c39d.tar.gz |
first commit
Diffstat (limited to 'uos.patch')
-rw-r--r-- | uos.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/uos.patch b/uos.patch new file mode 100644 index 000000000000..b3d5c9f114ab --- /dev/null +++ b/uos.patch @@ -0,0 +1,47 @@ +diff --git a/src/controller/main-controller.js b/src/controller/main-controller.js +index 51c6169..b5d2101 100644 +--- a/src/controller/main-controller.js ++++ b/src/controller/main-controller.js +@@ -7,6 +7,7 @@ const { + } = require('electron'); + const path = require('path'); + const CssInjector = require('../js/css-injector'); ++const { execSync } = require('child_process'); + + class MainController { + constructor() { +@@ -28,7 +29,7 @@ class MainController { + } + }) + +- this.window.loadURL('https://wx.qq.com/?lang=zh_CN') ++ this.window.loadURL('https://wx.qq.com/?lang=zh_CN&target=t') + + this.window.webContents.on('dom-ready', () => { + this.window.webContents.insertCSS(CssInjector.login) +@@ -62,6 +63,25 @@ class MainController { + (details) => this.handleRequest(details) + ) + ++ session.defaultSession.webRequest.onBeforeSendHeaders({urls: [ ++ "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage*", ++ "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage*", ++ ]}, ++ (details, callback) => { ++ let token = execSync('/opt/wechat-uos-token/wechat-uos-token.sh').toString('ascii'); ++ if (details.url.indexOf("/cgi-bin/mmwebwx-bin/webwxnewloginpage") > -1) { ++ details.requestHeaders["extspam"] = token ++ details.requestHeaders["client-version"] = "2.0.0" ++ callback({ ++ requestHeaders: details.requestHeaders, ++ }) ++ } else { ++ callback({}); ++ } ++ } ++ ) ++ ++ + ipcMain.on('resizeWindow', (event, value) => { + if (value === 'desktop') { + this.window.setSize(1000, this.window.getSize()[1], true) |