diff --git a/package.json b/package.json index 2e1878f1b..d8962f08a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "equicord", "private": "true", - "version": "1.14.5.1", + "version": "1.14.6.0", "description": "The other cutest Discord client mod", "homepage": "https://github.com/Equicord/Equicord#readme", "bugs": { @@ -82,6 +82,7 @@ "highlight.js": "11.11.1", "html-minifier-terser": "^7.2.0", "moment": "^2.22.2", + "p-limit": "^7.3.0", "puppeteer-core": "^24.30.0", "standalone-electron-types": "^34.2.0", "stylelint": "^16.25.0", @@ -95,7 +96,7 @@ "typescript-transform-paths": "^3.5.5", "zip-local": "^0.3.5" }, - "packageManager": "pnpm@10.30.3", + "packageManager": "pnpm@10.32.1", "pnpm": { "patchedDependencies": { "@types/less@3.0.8": "patches/@types__less@3.0.8.patch" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c59fd41ef..300150feb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -140,6 +140,9 @@ importers: moment: specifier: ^2.22.2 version: 2.30.1 + p-limit: + specifier: ^7.3.0 + version: 7.3.0 puppeteer-core: specifier: ^24.30.0 version: 24.30.0 @@ -1038,6 +1041,7 @@ packages: basic-ftp@5.0.5: resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==} engines: {node: '>=10.0.0'} + deprecated: Security vulnerability fixed in 5.2.0, please upgrade brace-expansion@1.1.12: resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==} @@ -2069,6 +2073,10 @@ packages: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} + p-limit@7.3.0: + resolution: {integrity: sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==} + engines: {node: '>=20'} + p-locate@5.0.0: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} @@ -2684,6 +2692,10 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + yocto-queue@1.2.2: + resolution: {integrity: sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==} + engines: {node: '>=12.20'} + zip-local@0.3.5: resolution: {integrity: sha512-GRV3D5TJY+/PqyeRm5CYBs7xVrKTKzljBoEXvocZu0HJ7tPEcgpSOYa2zFIsCZWgKWMuc4U3yMFgFkERGFIB9w==} @@ -4669,6 +4681,10 @@ snapshots: dependencies: yocto-queue: 0.1.0 + p-limit@7.3.0: + dependencies: + yocto-queue: 1.2.2 + p-locate@5.0.0: dependencies: p-limit: 3.1.0 @@ -5429,6 +5445,8 @@ snapshots: yocto-queue@0.1.0: {} + yocto-queue@1.2.2: {} + zip-local@0.3.5: dependencies: async: 1.5.2 diff --git a/src/components/settings/tabs/updater/Components.tsx b/src/components/settings/tabs/updater/Components.tsx index 8d9f34afb..d6f38bf4f 100644 --- a/src/components/settings/tabs/updater/Components.tsx +++ b/src/components/settings/tabs/updater/Components.tsx @@ -81,7 +81,6 @@ export function Updatable(props: CommonProps) { <> + + + )} + + ); +} + function Updater() { const settings = useSettings(["autoUpdate", "autoUpdateNotification"]); @@ -54,6 +85,7 @@ function Updater() { return ( + Update Preferences Control how Equicord keeps itself up to date. You can choose to update automatically in the background or be notified when new updates are available. diff --git a/src/debug/loadLazyChunks.ts b/src/debug/loadLazyChunks.ts index 78eeaa6f9..a1accee03 100644 --- a/src/debug/loadLazyChunks.ts +++ b/src/debug/loadLazyChunks.ts @@ -9,6 +9,7 @@ import { canonicalizeMatch } from "@utils/patches"; import { ModuleFactory } from "@vencord/discord-types/webpack"; import * as Webpack from "@webpack"; import { wreq } from "@webpack"; +import pLimit from "p-limit"; import { AnyModuleFactory } from "webpack"; function getWebpackChunkMap() { @@ -43,6 +44,7 @@ async function promiseAllSettledBatched(tasks: (() => Promise)[], batchSiz export async function loadLazyChunks() { const LazyChunkLoaderLogger = new Logger("LazyChunkLoader"); + const queue = pLimit(50); try { LazyChunkLoaderLogger.log("Loading all chunks..."); @@ -72,10 +74,14 @@ export async function loadLazyChunks() { const shouldForceDefer = false; await promiseAllSettledBatched(Array.from(lazyChunks).map(([, rawChunkIds, entryPoint]) => async () => { - const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => { - const numChunkId = Number(m[1]); - return Number.isNaN(numChunkId) ? m[1] : numChunkId; - }) : []; + const chunkIds = rawChunkIds + ?.matchAll(Webpack.ChunkIdsRegex) + .map(m => { + const numChunkId = Number(m[1]); + return Number.isNaN(numChunkId) ? m[1] : numChunkId; + }) + .toArray() + ?? []; if (chunkIds.length === 0) { return; @@ -96,18 +102,11 @@ export async function loadLazyChunks() { if (wreq.u(id) == null || wreq.u(id) === "undefined.js") continue; - let isWorkerAsset = false; - for (let attempt = 0; attempt < 3; attempt++) { - try { - isWorkerAsset = await fetch(wreq.p + wreq.u(id)) - .then(r => r.text()) - .then(t => /importScripts\(|self\.postMessage/.test(t)); - break; - } catch (err) { - if (attempt === 2) throw err; - await new Promise(resolve => setTimeout(resolve, 500 * (attempt + 1))); - } - } + const isWorkerAsset = await queue(() => + fetch(wreq.p + wreq.u(id)) + .then(r => r.text()) + .then(t => /importScripts\(|self\.postMessage/.test(t)) + ); if (isWorkerAsset) { invalidChunks.add(id); @@ -203,25 +202,16 @@ export async function loadLazyChunks() { return !(validChunks.has(id) || invalidChunks.has(id)); }); - await promiseAllSettledBatched(chunksLeft.map(id => async () => { - let isWorkerAsset = false; - for (let attempt = 0; attempt < 3; attempt++) { - try { - isWorkerAsset = await fetch(wreq.p + wreq.u(id)) - .then(r => r.text()) - .then(t => /importScripts\(|self\.postMessage/.test(t)); - break; - } catch (err) { - if (attempt === 2) throw err; - await new Promise(resolve => setTimeout(resolve, 500 * (attempt + 1))); - } - } + await promiseAllSettledBatched(chunksLeft.map(id => queue(async () => { + const isWorkerAsset = await fetch(wreq.p + wreq.u(id)) + .then(r => r.text()) + .then(t => /importScripts\(|self\.postMessage/.test(t)); // Loads the chunk. Currently this only happens with the language packs which are loaded differently if (!isWorkerAsset) { await wreq.e(id); } - })); + }))); LazyChunkLoaderLogger.log("Finished loading all chunks!"); } catch (e) {