25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
// 列出预设里所有正则脚本的开关(判断是否影响请求体)
|
||
import { readFileSync } from "node:fs";
|
||
const preset = JSON.parse(readFileSync(process.argv[2], "utf8"));
|
||
const rows = [];
|
||
for (const r of preset.extensions?.regex_scripts || []) rows.push({ from: "regex_scripts", ...r });
|
||
for (const r of preset.extensions?.SPreset?.RegexBinding?.regexes || []) rows.push({ from: "SPreset.RegexBinding", ...r });
|
||
console.log("共 " + rows.length + " 条");
|
||
for (const r of rows) {
|
||
console.log(
|
||
[
|
||
r.from,
|
||
(r.scriptName || r.id || "").slice(0, 24),
|
||
"promptOnly=" + r.promptOnly,
|
||
"markdownOnly=" + r.markdownOnly,
|
||
"disabled=" + r.disabled,
|
||
"depth=" + r.minDepth + "/" + r.maxDepth,
|
||
"repl=" + String(r.replaceString || "").length,
|
||
].join(" "),
|
||
);
|
||
}
|
||
const send = rows.filter((r) => r.promptOnly === true && r.disabled !== true);
|
||
const display = rows.filter((r) => r.markdownOnly === true);
|
||
console.log("\n影响请求体(promptOnly=true 且未禁用): " + send.length + " 条");
|
||
console.log("纯显示(markdownOnly=true): " + display.length + " 条");
|