mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 06:03:03 -04:00
Reporter: Revert everything but args
This commit is contained in:
parent
c350aab84b
commit
2f6700192f
1 changed files with 102 additions and 105 deletions
|
@ -43,7 +43,6 @@ const browser = await pup.launch({
|
||||||
'--shm-size=4gb'
|
'--shm-size=4gb'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36");
|
await page.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36");
|
||||||
await page.setBypassCSP(true);
|
await page.setBypassCSP(true);
|
||||||
|
@ -184,126 +183,124 @@ async function printReport() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Promise.all([
|
|
||||||
page.on("console", async e => {
|
|
||||||
const level = e.type();
|
|
||||||
const rawArgs = e.args();
|
|
||||||
|
|
||||||
async function getText() {
|
page.on("console", async e => {
|
||||||
try {
|
const level = e.type();
|
||||||
return await Promise.all(
|
const rawArgs = e.args();
|
||||||
e.args().map(async a => {
|
|
||||||
return await maybeGetError(a) || await a.jsonValue();
|
async function getText() {
|
||||||
})
|
try {
|
||||||
).then(a => a.join(" ").trim());
|
return await Promise.all(
|
||||||
} catch {
|
e.args().map(async a => {
|
||||||
return e.text();
|
return await maybeGetError(a) || await a.jsonValue();
|
||||||
}
|
})
|
||||||
|
).then(a => a.join(" ").trim());
|
||||||
|
} catch {
|
||||||
|
return e.text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstArg = await rawArgs[0]?.jsonValue();
|
||||||
|
|
||||||
|
const isEquicord = firstArg === "[Equicord]";
|
||||||
|
const isDebug = firstArg === "[PUP_DEBUG]";
|
||||||
|
|
||||||
|
outer:
|
||||||
|
if (isEquicord) {
|
||||||
|
try {
|
||||||
|
var args = await Promise.all(e.args().map(a => a.jsonValue()));
|
||||||
|
} catch {
|
||||||
|
break outer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const firstArg = await rawArgs[0]?.jsonValue();
|
const [, tag, message, otherMessage] = args as Array<string>;
|
||||||
|
|
||||||
const isEquicord = firstArg === "[Equicord]";
|
switch (tag) {
|
||||||
const isDebug = firstArg === "[PUP_DEBUG]";
|
case "WebpackInterceptor:":
|
||||||
|
const patchFailMatch = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/)!;
|
||||||
|
if (!patchFailMatch) break;
|
||||||
|
|
||||||
outer:
|
console.error(await getText());
|
||||||
if (isEquicord) {
|
process.exitCode = 1;
|
||||||
try {
|
|
||||||
var args = await Promise.all(e.args().map(a => a.jsonValue()));
|
|
||||||
} catch {
|
|
||||||
break outer;
|
|
||||||
}
|
|
||||||
|
|
||||||
const [, tag, message, otherMessage] = args as Array<string>;
|
const [, plugin, type, id, regex] = patchFailMatch;
|
||||||
|
report.badPatches.push({
|
||||||
|
plugin,
|
||||||
|
type,
|
||||||
|
id,
|
||||||
|
match: regex.replace(/\[A-Za-z_\$\]\[\\w\$\]\*/g, "\\i"),
|
||||||
|
error: await maybeGetError(e.args()[3])
|
||||||
|
});
|
||||||
|
|
||||||
switch (tag) {
|
break;
|
||||||
case "WebpackInterceptor:":
|
case "PluginManager:":
|
||||||
const patchFailMatch = message.match(/Patch by (.+?) (had no effect|errored|found no module) \(Module id is (.+?)\): (.+)/)!;
|
const failedToStartMatch = message.match(/Failed to start (.+)/);
|
||||||
if (!patchFailMatch) break;
|
if (!failedToStartMatch) break;
|
||||||
|
|
||||||
console.error(await getText());
|
console.error(await getText());
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
|
|
||||||
const [, plugin, type, id, regex] = patchFailMatch;
|
const [, name] = failedToStartMatch;
|
||||||
report.badPatches.push({
|
report.badStarts.push({
|
||||||
plugin,
|
plugin: name,
|
||||||
type,
|
error: await maybeGetError(e.args()[3]) ?? "Unknown error"
|
||||||
id,
|
});
|
||||||
match: regex.replace(/\[A-Za-z_\$\]\[\\w\$\]\*/g, "\\i"),
|
|
||||||
error: await maybeGetError(e.args()[3])
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "PluginManager:":
|
case "LazyChunkLoader:":
|
||||||
const failedToStartMatch = message.match(/Failed to start (.+)/);
|
console.error(await getText());
|
||||||
if (!failedToStartMatch) break;
|
|
||||||
|
|
||||||
console.error(await getText());
|
switch (message) {
|
||||||
process.exitCode = 1;
|
case "A fatal error occurred:":
|
||||||
|
process.exit(1);
|
||||||
const [, name] = failedToStartMatch;
|
|
||||||
report.badStarts.push({
|
|
||||||
plugin: name,
|
|
||||||
error: await maybeGetError(e.args()[3]) ?? "Unknown error"
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "LazyChunkLoader:":
|
|
||||||
console.error(await getText());
|
|
||||||
|
|
||||||
switch (message) {
|
|
||||||
case "A fatal error occurred:":
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "Reporter:":
|
|
||||||
console.error(await getText());
|
|
||||||
|
|
||||||
switch (message) {
|
|
||||||
case "A fatal error occurred:":
|
|
||||||
process.exit(1);
|
|
||||||
case "Webpack Find Fail:":
|
|
||||||
process.exitCode = 1;
|
|
||||||
report.badWebpackFinds.push(otherMessage);
|
|
||||||
break;
|
|
||||||
case "Finished test":
|
|
||||||
await browser.close();
|
|
||||||
await printReport();
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDebug) {
|
|
||||||
console.error(await getText());
|
|
||||||
} else if (level === "error") {
|
|
||||||
const text = await getText();
|
|
||||||
|
|
||||||
if (text.length && !text.startsWith("Failed to load resource: the server responded with a status of") && !text.includes("Webpack")) {
|
|
||||||
if (IGNORED_DISCORD_ERRORS.some(regex => text.match(regex))) {
|
|
||||||
report.ignoredErrors.push(text);
|
|
||||||
} else {
|
|
||||||
console.error("[Unexpected Error]", text);
|
|
||||||
report.otherErrors.push(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "Reporter:":
|
||||||
|
console.error(await getText());
|
||||||
|
|
||||||
|
switch (message) {
|
||||||
|
case "A fatal error occurred:":
|
||||||
|
process.exit(1);
|
||||||
|
case "Webpack Find Fail:":
|
||||||
|
process.exitCode = 1;
|
||||||
|
report.badWebpackFinds.push(otherMessage);
|
||||||
|
break;
|
||||||
|
case "Finished test":
|
||||||
|
await browser.close();
|
||||||
|
await printReport();
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDebug) {
|
||||||
|
console.error(await getText());
|
||||||
|
} else if (level === "error") {
|
||||||
|
const text = await getText();
|
||||||
|
|
||||||
|
if (text.length && !text.startsWith("Failed to load resource: the server responded with a status of") && !text.includes("Webpack")) {
|
||||||
|
if (IGNORED_DISCORD_ERRORS.some(regex => text.match(regex))) {
|
||||||
|
report.ignoredErrors.push(text);
|
||||||
|
} else {
|
||||||
|
console.error("[Unexpected Error]", text);
|
||||||
|
report.otherErrors.push(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}
|
||||||
|
});
|
||||||
|
|
||||||
page.on("error", e => console.error("[Error]", e.message)),
|
page.on("error", e => console.error("[Error]", e.message));
|
||||||
|
page.on("pageerror", e => {
|
||||||
|
if (e.message.includes("Sentry successfully disabled")) return;
|
||||||
|
|
||||||
page.on("pageerror", e => {
|
if (!e.message.startsWith("Object") && !e.message.includes("Cannot find module")) {
|
||||||
if (e.message.includes("Sentry successfully disabled")) return;
|
console.error("[Page Error]", e.message);
|
||||||
|
report.otherErrors.push(e.message);
|
||||||
if (!e.message.startsWith("Object") && !e.message.includes("Cannot find module")) {
|
} else {
|
||||||
console.error("[Page Error]", e.message);
|
report.ignoredErrors.push(e.message);
|
||||||
report.otherErrors.push(e.message);
|
}
|
||||||
} else {
|
});
|
||||||
report.ignoredErrors.push(e.message);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
|
|
||||||
async function reporterRuntime(token: string) {
|
async function reporterRuntime(token: string) {
|
||||||
Vencord.Webpack.waitFor(
|
Vencord.Webpack.waitFor(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue