mirror of
https://github.com/blackmatrix7/ios_rule_script.git
synced 2025-12-18 09:34:44 +08:00
2022-12-03 02:10:49
This commit is contained in:
@@ -32,25 +32,28 @@ function getRegexp(re_str) {
|
||||
}
|
||||
}
|
||||
|
||||
let body;
|
||||
if (typeof $argument == "undefined") {
|
||||
$done({});
|
||||
console.log("requires $argument");
|
||||
} else {
|
||||
let body;
|
||||
if ($script.type === "http-response") {
|
||||
body = $response.body;
|
||||
} else if ($script.type === "http-request") {
|
||||
body = $request.body;
|
||||
} else {
|
||||
$done({});
|
||||
console.log("script type error");
|
||||
}
|
||||
if (!body) {
|
||||
$done({})
|
||||
}
|
||||
}
|
||||
|
||||
if (body) {
|
||||
$argument.split("&").forEach((item) => {
|
||||
let [match, replace] = item.split("->");
|
||||
let re = getRegexp(match);
|
||||
body = body.replace(re, replace);
|
||||
});
|
||||
|
||||
$done({ body });
|
||||
} else {
|
||||
console.log("Not Modify");
|
||||
$done({});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user