|
|
@@ -1,15 +1,14 @@
|
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
|
- openWindow: (msg) => ipcRenderer.send('openWindow', msg),
|
|
|
- closeAllWindow: (msg) => ipcRenderer.send('window-all-closed', msg),
|
|
|
+ openWindow: (msg) => ipcRenderer.invoke('openWindow', msg),
|
|
|
+ closeAllWindow: (msg) => ipcRenderer.send('closeAllWindow', msg),
|
|
|
getData: (msg) => ipcRenderer.send('getData', msg),
|
|
|
postData: (msg) => ipcRenderer.send('postData', msg),
|
|
|
setProxy: (msg) => ipcRenderer.send('setProxy', msg),
|
|
|
addPreLoadCode: (msg) => ipcRenderer.send('addPreLoadCode', msg),
|
|
|
setStoData: (msg) => ipcRenderer.send('setStoData', msg),
|
|
|
getStoData: (msg) => ipcRenderer.send('getStoData', msg),
|
|
|
- openWindow: (msg) => ipcRenderer.send('openWindow', msg),
|
|
|
closeWindow: (msg) => ipcRenderer.send('closeWindow', msg),
|
|
|
changeProxy: (msg) => ipcRenderer.send('changeProxy', msg),
|
|
|
readConfig: (msg) => ipcRenderer.send('readConfig', msg),
|
|
|
@@ -22,135 +21,28 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|
|
});
|
|
|
|
|
|
|
|
|
-document.addEventListener('click', function (e) {
|
|
|
- if (e.target.tagName === 'A' && e.target.href) {
|
|
|
- e.preventDefault();
|
|
|
- window.location.href = e.target.href;
|
|
|
- }
|
|
|
-});
|
|
|
|
|
|
-setInterval(() => {
|
|
|
- document.querySelectorAll('a[target]').forEach((el) => {
|
|
|
- el.removeAttribute('target')
|
|
|
- })
|
|
|
-}, 2000);
|
|
|
+function randomNum(minNum,maxNum){
|
|
|
+ switch(arguments.length){
|
|
|
+ case 1:
|
|
|
+ return parseInt(Math.random()*minNum+1,10);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
-// window.open = (url)=>{console.log(url)}
|
|
|
-window.lastText = ''
|
|
|
-setInterval(() => {
|
|
|
- // 快手
|
|
|
- if (document.querySelectorAll('.virt-list__client .comment-cell')[0]) {
|
|
|
- let nowMessage = document.querySelectorAll('.virt-list__client .comment-cell')[document.querySelectorAll('.virt-list__client .comment-cell').length - 1]
|
|
|
- let nowText = nowMessage.querySelector('.comment').innerText
|
|
|
- if (window.lastText !== nowText) {
|
|
|
- window.lastText = nowText
|
|
|
- console.log(nowText)
|
|
|
- ipcRenderer.send('broadcast-message', nowText)
|
|
|
- }
|
|
|
+setTimeout(() => {
|
|
|
+ if (document.querySelector('.row .row-item')) {
|
|
|
+ let clickList = document.querySelectorAll('.row .row-item-content')[2].querySelectorAll('a')
|
|
|
+ clickList[randomNum(0, clickList.length - 1)].click()
|
|
|
}
|
|
|
- // 抖音
|
|
|
- if (document.querySelectorAll('.TNg5meqw')[0]) {
|
|
|
- let nowMessage = document.querySelectorAll('.TNg5meqw')[document.querySelectorAll('.TNg5meqw').length - 1]
|
|
|
- let nowText = nowMessage.innerText
|
|
|
- if (window.lastText !== nowText) {
|
|
|
- window.lastText = nowText
|
|
|
- console.log(nowText)
|
|
|
- ipcRenderer.send('broadcast-message', nowText)
|
|
|
- }
|
|
|
+ if (document.querySelectorAll('.thumbnail-group li a').length > 0) {
|
|
|
+ let clickList = document.querySelectorAll('.thumbnail-group li a')
|
|
|
+ clickList[randomNum(0, clickList.length - 1)].click()
|
|
|
}
|
|
|
-}, 1000);
|
|
|
-
|
|
|
-// 拦截请求
|
|
|
-// (function(xhr) {
|
|
|
-
|
|
|
-// var XHR = XMLHttpRequest.prototype;
|
|
|
-
|
|
|
-// var open = XHR.open;
|
|
|
-// var send = XHR.send;
|
|
|
-// var setRequestHeader = XHR.setRequestHeader;
|
|
|
-
|
|
|
-// XHR.open = function(method, url) {
|
|
|
-// this._method = method;
|
|
|
-// this._url = url;
|
|
|
-// this._requestHeaders = {};
|
|
|
-// this._startTime = (new Date()).toISOString();
|
|
|
-
|
|
|
-// return open.apply(this, arguments);
|
|
|
-// };
|
|
|
-
|
|
|
-// XHR.setRequestHeader = function(header, value) {
|
|
|
-// this._requestHeaders[header] = value;
|
|
|
-// return setRequestHeader.apply(this, arguments);
|
|
|
-// };
|
|
|
-
|
|
|
-// XHR.send = function(postData) {
|
|
|
-// this.addEventListener('load', function() {
|
|
|
-// var endTime = (new Date()).toISOString();
|
|
|
-
|
|
|
-// var myUrl = this._url ? this._url.toLowerCase() : this._url;
|
|
|
-// if(myUrl) {
|
|
|
-
|
|
|
-// if (postData) {
|
|
|
-// if (typeof postData === 'string') {
|
|
|
-// try {
|
|
|
-// // here you get the REQUEST HEADERS, in JSON format, so you can also use JSON.parse
|
|
|
-// this._requestHeaders = postData;
|
|
|
-// } catch(err) {
|
|
|
-// console.log('Request Header JSON decode failed, transfer_encoding field could be base64');
|
|
|
-// console.log(err);
|
|
|
-// }
|
|
|
-// } else if (typeof postData === 'object' || typeof postData === 'array' || typeof postData === 'number' || typeof postData === 'boolean') {
|
|
|
-// // do something if you need
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// // here you get the RESPONSE HEADERS
|
|
|
-// var responseHeaders = this.getAllResponseHeaders();
|
|
|
-
|
|
|
-// if ( this.responseType != 'blob' && this.responseText) {
|
|
|
-// // responseText is string or null
|
|
|
-// try {
|
|
|
-
|
|
|
-// // here you get RESPONSE TEXT (BODY), in JSON format, so you can use JSON.parse
|
|
|
-// var arr = this.responseText;
|
|
|
-
|
|
|
-// // printing url, request headers, response headers, response body, to console
|
|
|
-
|
|
|
-// // console.log(this._url);
|
|
|
-// // console.log(JSON.parse(this._requestHeaders));
|
|
|
-// // console.log(responseHeaders);
|
|
|
-// // console.log(myUrl);
|
|
|
-// if (window.owoHackUrl) {
|
|
|
-// for (const key in window.owoHackUrl) {
|
|
|
-// if (Object.hasOwnProperty.call(window.owoHackUrl, key)) {
|
|
|
-// const element = window.owoHackUrl[key];
|
|
|
-// if (myUrl.includes(key)) {
|
|
|
-// if (element) element(arr)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (window.owoHackUrlSend) {
|
|
|
-// for (const key in window.owoHackUrlSend) {
|
|
|
-// if (Object.hasOwnProperty.call(window.owoHackUrlSend, key)) {
|
|
|
-// const element = window.owoHackUrlSend[key];
|
|
|
-// if (myUrl.includes(key)) {
|
|
|
-// if (element) element(postData, myUrl)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } catch(err) {
|
|
|
-// console.log("Error in responseType try catch");
|
|
|
-// console.log(err);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// }
|
|
|
-// });
|
|
|
-
|
|
|
-// return send.apply(this, arguments);
|
|
|
-// };
|
|
|
-
|
|
|
-// })(XMLHttpRequest);
|
|
|
-
|
|
|
+}, 5000);
|