文档更新

This commit is contained in:
技术老胡 2024-12-07 17:16:17 +08:00
parent 8f1d6ce013
commit 6c3106a6aa
2 changed files with 12 additions and 12 deletions

View File

@ -22,9 +22,9 @@ const logins = [
function extractLoginInfo(request, logins) { function extractLoginInfo(request, logins) {
logins.forEach((login) => { logins.forEach((login) => {
const urlObj = isHttp(request.url, login.host); const urlObj = isHttp(request.url, login.host);
if (login.host.toLowerCase() === urlObj.hostname.toLowerCase() if (login.host.toLowerCase() === urlObj.hostname.toLowerCase() &&
&& login.orderQuery.toLowerCase() === urlObj.pathname.toLowerCase() login.orderQuery.toLowerCase() === urlObj.pathname.toLowerCase() &&
&& login.method.toLowerCase() === request.method.toLowerCase()) { login.method.toLowerCase() === request.method.toLowerCase()) {
const jsonData = JSON.parse(request.request); const jsonData = JSON.parse(request.request);
const acc = eval(`jsonData.${login.accPath}`); const acc = eval(`jsonData.${login.accPath}`);
const psw = eval(`jsonData.${login.pswPath}`); const psw = eval(`jsonData.${login.pswPath}`);
@ -32,13 +32,12 @@ function extractLoginInfo(request, logins) {
'账号': acc, '账号': acc,
'密码': psw '密码': psw
}; };
console.log('-----' + login.name + '-----'); console.log('----- ' + login.name + ' -----');
console.table(data); console.table(data);
} }
}) })
} }
// 检查网址是否为http或https开头的字符串
function isHttp(url, host) { function isHttp(url, host) {
if (url.startsWith('http') || url.startsWith('https')) { if (url.startsWith('http') || url.startsWith('https')) {
return new URL(url); return new URL(url);
@ -47,8 +46,6 @@ function isHttp(url, host) {
return new URL(url); return new URL(url);
} }
} }
// XHR 重写
var oldOpen = XMLHttpRequest.prototype.open; var oldOpen = XMLHttpRequest.prototype.open;
var oldSend = XMLHttpRequest.prototype.send; var oldSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.open = function (method, url) { XMLHttpRequest.prototype.open = function (method, url) {
@ -62,21 +59,19 @@ XMLHttpRequest.prototype.send = function (body) {
url: this._url, url: this._url,
method: this._method, method: this._method,
request: this._body request: this._body
} };
extractLoginInfo(res, logins); extractLoginInfo(res, logins);
return oldSend.apply(this, arguments); return oldSend.apply(this, arguments);
}; };
// fetch 重写
window.au_fetch = window.fetch; window.au_fetch = window.fetch;
window.fetch = function (url, options) { window.fetch = function (url, options) {
const res = { const res = {
url: url, url: url,
method: options.method, method: options.method,
request: options.body request: options.body
} };
extractLoginInfo(res, logins); extractLoginInfo(res, logins);
return window.au_fetch.apply(window, [url, options]).then((response) => { return window.au_fetch.apply(window, [url, options]).then((response) => {
return response; return response;
}); })
}; };

View File

@ -45,6 +45,11 @@
</select> </select>
</div> </div>
</div> </div>
</div>
<div class="main-container">
<div class="layui-text">
<p>部分平台的账户密码填写比较特殊,<strong><a href="https://f0bmwzqjtq2.feishu.cn/docx/HBVrdrsACo36bzxUCSPcjOBNnyb?from=from_copylink" target="_blank"><strong>请查看文档</strong></a></p>
</div>
</div> </div>
</div> </div>
<div class="bottom"> <div class="bottom">