Fix React DevTools

This commit is contained in:
Vendicated 2023-01-12 04:44:00 +01:00
parent bedb7b212b
commit a8678db78c
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -67,9 +67,18 @@ export async function installExt(id: string) {
try { try {
await access(extDir, fsConstants.F_OK); await access(extDir, fsConstants.F_OK);
} catch (err) { } catch (err) {
const url = `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`; const url = id === "fmkadmapgofadopljbjfkapdkoienihi"
const buf = await get(url); // React Devtools v4.25
await extract(crxToZip(buf), extDir); // v4.27 is broken in Electron, see https://github.com/facebook/react/issues/25843
// Unfortunately, Google does not serve old versions, so this is the only way
? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip"
: `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;
const buf = await get(url, {
headers: {
"User-Agent": "Vencord (https://github.com/Vendicated/Vencord)"
}
});
await extract(crxToZip(buf), extDir).catch(console.error);
} }
session.defaultSession.loadExtension(extDir); session.defaultSession.loadExtension(extDir);