文档更新

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

View File

@ -45,6 +45,11 @@
</select>
</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 class="bottom">