mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Revert Reporter
This commit is contained in:
parent
92fccecdc2
commit
102352235c
1 changed files with 139 additions and 145 deletions
|
@ -35,6 +35,21 @@ for (const variable of ["DISCORD_TOKEN", "CHROMIUM_BIN"]) {
|
|||
|
||||
const CANARY = process.env.USE_CANARY === "true";
|
||||
|
||||
const browser = await pup.launch({
|
||||
headless: true,
|
||||
executablePath: process.env.CHROMIUM_BIN
|
||||
});
|
||||
|
||||
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.setBypassCSP(true);
|
||||
|
||||
async function maybeGetError(handle: JSHandle): Promise<string | undefined> {
|
||||
return await (handle as JSHandle<Error>)?.getProperty("message")
|
||||
.then(m => m?.jsonValue())
|
||||
.catch(() => undefined);
|
||||
}
|
||||
|
||||
const report = {
|
||||
badPatches: [] as {
|
||||
plugin: string;
|
||||
|
@ -166,31 +181,6 @@ async function printReport() {
|
|||
}
|
||||
}
|
||||
|
||||
async function maybeGetError(handle: JSHandle): Promise<string | undefined> {
|
||||
return await (handle as JSHandle<Error>)?.getProperty("message")
|
||||
.then(m => m?.jsonValue())
|
||||
.catch(() => undefined);
|
||||
}
|
||||
|
||||
async function reporterRuntime(token: string) {
|
||||
Vencord.Webpack.waitFor(
|
||||
"loginToken",
|
||||
m => {
|
||||
console.log("[PUP_DEBUG]", "Logging in with token...");
|
||||
m.loginToken(token);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const browser = await pup.launch({
|
||||
headless: true,
|
||||
executablePath: process.env.CHROMIUM_BIN
|
||||
});
|
||||
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.setBypassCSP(true);
|
||||
|
||||
page.on("console", async e => {
|
||||
const level = e.type();
|
||||
const rawArgs = e.args();
|
||||
|
@ -300,6 +290,7 @@ try {
|
|||
page.on("error", e => console.error("[Error]", e.message));
|
||||
page.on("pageerror", e => {
|
||||
if (e.message.includes("Sentry successfully disabled")) return;
|
||||
|
||||
if (!e.message.startsWith("Object") && !e.message.includes("Cannot find module")) {
|
||||
console.error("[Page Error]", e.message);
|
||||
report.otherErrors.push(e.message);
|
||||
|
@ -308,6 +299,16 @@ try {
|
|||
}
|
||||
});
|
||||
|
||||
async function reporterRuntime(token: string) {
|
||||
Vencord.Webpack.waitFor(
|
||||
"loginToken",
|
||||
m => {
|
||||
console.log("[PUP_DEBUG]", "Logging in with token...");
|
||||
m.loginToken(token);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
await page.evaluateOnNewDocument(`
|
||||
if (location.host.endsWith("discord.com")) {
|
||||
${readFileSync("./dist/browser/browser.js", "utf-8")};
|
||||
|
@ -316,10 +317,3 @@ try {
|
|||
`);
|
||||
|
||||
await page.goto(CANARY ? "https://canary.discord.com/login" : "https://discord.com/login");
|
||||
|
||||
await printReport();
|
||||
await browser.close();
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue