reporter: fix bad logic
This commit is contained in:
parent
539e538d87
commit
a9568bc055
1 changed files with 11 additions and 9 deletions
|
@ -335,15 +335,15 @@ function runTime(token: string) {
|
||||||
await (wreq as any).el(sym);
|
await (wreq as any).el(sym);
|
||||||
delete Object.prototype[sym];
|
delete Object.prototype[sym];
|
||||||
|
|
||||||
const validChunksEntryPoints = [] as string[];
|
const validChunksEntryPoints = new Set<string>();
|
||||||
const validChunks = [] as string[];
|
const validChunks = new Set<string>();
|
||||||
const invalidChunks = [] as string[];
|
const invalidChunks = new Set<string>();
|
||||||
|
|
||||||
if (!chunks) throw new Error("Failed to get chunks");
|
if (!chunks) throw new Error("Failed to get chunks");
|
||||||
|
|
||||||
chunksLoop:
|
|
||||||
for (const entryPoint in chunks) {
|
for (const entryPoint in chunks) {
|
||||||
const chunkIds = chunks[entryPoint];
|
const chunkIds = chunks[entryPoint];
|
||||||
|
let invalidEntryPoint = false;
|
||||||
|
|
||||||
for (const id of chunkIds) {
|
for (const id of chunkIds) {
|
||||||
if (!wreq.u(id)) continue;
|
if (!wreq.u(id)) continue;
|
||||||
|
@ -353,14 +353,16 @@ function runTime(token: string) {
|
||||||
.then(t => t.includes(".module.wasm") || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
|
.then(t => t.includes(".module.wasm") || !t.includes("(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push"));
|
||||||
|
|
||||||
if (isWasm) {
|
if (isWasm) {
|
||||||
invalidChunks.push(id);
|
invalidChunks.add(id);
|
||||||
continue chunksLoop;
|
invalidEntryPoint = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
validChunks.push(id);
|
validChunks.add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
validChunksEntryPoints.push(entryPoint);
|
if (!invalidEntryPoint)
|
||||||
|
validChunksEntryPoints.add(entryPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const entryPoint of validChunksEntryPoints) {
|
for (const entryPoint of validChunksEntryPoints) {
|
||||||
|
@ -373,7 +375,7 @@ function runTime(token: string) {
|
||||||
const allChunks = Function("return " + (wreq.u.toString().match(/(?<=\()\{.+?\}/s)?.[0] ?? "null"))() as Record<string | number, string[]> | null;
|
const allChunks = Function("return " + (wreq.u.toString().match(/(?<=\()\{.+?\}/s)?.[0] ?? "null"))() as Record<string | number, string[]> | null;
|
||||||
if (!allChunks) throw new Error("Failed to get all chunks");
|
if (!allChunks) throw new Error("Failed to get all chunks");
|
||||||
const chunksLeft = Object.keys(allChunks).filter(id => {
|
const chunksLeft = Object.keys(allChunks).filter(id => {
|
||||||
return !(validChunks.includes(id) || invalidChunks.includes(id));
|
return !(validChunks.has(id) || invalidChunks.has(id));
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const id of chunksLeft) {
|
for (const id of chunksLeft) {
|
||||||
|
|
Loading…
Reference in a new issue