inject的GM API调用
Some checks failed
build / Build (push) Failing after 7s
test / Run tests (push) Failing after 8s

This commit is contained in:
2025-04-06 00:32:20 +08:00
parent 651384f12c
commit a8054451ac
13 changed files with 50 additions and 32 deletions

View File

@ -1,4 +1,4 @@
import { Group, MessageConnect } from "@Packages/message/server";
import { GetSender, Group, MessageConnect } from "@Packages/message/server";
export default class GMApi {
constructor(private group: Group) {}
@ -24,8 +24,9 @@ export default class GMApi {
return response;
}
xmlHttpRequest(details: GMSend.XHRDetails, con: MessageConnect | null) {
xmlHttpRequest(details: GMSend.XHRDetails, sender: GetSender) {
const xhr = new XMLHttpRequest();
const con = sender.getConnect();
xhr.open(details.method || "GET", details.url);
// 添加header
if (details.headers) {
@ -34,7 +35,7 @@ export default class GMApi {
}
}
xhr.onload = () => {
this.dealXhrResponse(con!, details, "onload", xhr);
this.dealXhrResponse(con, details, "onload", xhr);
};
xhr.onloadstart = () => {
this.dealXhrResponse(con!, details, "onloadstart", xhr);