Audit and fix inject

Closes #1132
Closes #916
Fixes #1293
Fixes #1069
This commit is contained in:
Zack Rauen 2022-06-25 02:59:23 -04:00
parent b42f61925d
commit 2b9e657b8a
8 changed files with 15214 additions and 5433 deletions

View File

@ -17,12 +17,10 @@
"curly": ["error", "multi-line", "consistent"],
"dot-location": ["error", "property"],
"dot-notation": "error",
// "eqeqeq": ["error", "smart"],
"func-call-spacing": "error",
"handle-callback-err": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"linebreak-style": ["error", "windows"],
"new-cap": ["error", {"newIsCap": true}],
"no-array-constructor": "error",
"no-caller": "error",
@ -54,7 +52,6 @@
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
// "no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unmodified-loop-condition": "error",

View File

@ -1,4 +1,4 @@
Copyright © 2019-2020, Zack Rauen
Copyright © 2019-2022, BetterDiscord Team
All rights reserved. Code may not be modified and redistributed, or otherwise
used for derivative works and redistributed without explicit permission.

2715
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,6 @@
"asar": "^3.0.3",
"eslint": "^7.12.0",
"eslint-plugin-react": "^7.21.5",
"mocha": "^8.2.0"
"mocha": "^10.0.0"
}
}

17919
renderer/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
"postcss": "^8.4.5",
"postcss-cli": "^9.1.0",
"postcss-csso": "^6.0.0",
"postcss-easy-import": "^3.0.0",
"postcss-easy-import": "^4.0.0",
"postcss-loader": "^6.2.1",
"stylelint": "^14.3.0",
"stylelint-config-standard": "^24.0.0",

View File

@ -96,7 +96,7 @@ export default new class PluginManager extends AddonManager {
const meta = Object.assign({}, addon);
delete meta.exports;
const thePlugin = isClass ? new PluginClass(meta) : addon.exports(meta);
if (!thePlugin.start || !thePlugin.stop) return new AddonError(addon.name || addon.filename, addon.filename, "Missing start or stop function.", {message: "Plugins must have both a start and stop function.", stack: ""}, this.prefix);;
if (!thePlugin.start || !thePlugin.stop) return new AddonError(addon.name || addon.filename, addon.filename, "Missing start or stop function.", {message: "Plugins must have both a start and stop function.", stack: ""}, this.prefix);
addon.instance = thePlugin;
addon.name = thePlugin.getName ? thePlugin.getName() : addon.name;

View File

@ -46,7 +46,7 @@ console.log(`Injecting into ${release}`);
if (!fs.existsSync(discordPath)) throw new Error(`Cannot find directory for ${release}`);
console.log(` ✅ Found ${release} in ${discordPath}`);
const appPath = path.join(discordPath, "app");
const appPath = process.platform === "win32" || process.platform === "darwin" ? path.join(discordPath, "app") : discordPath;
const packageJson = path.join(appPath, "package.json");
const indexJs = path.join(appPath, "index.js");