From 7e526e4172412eba720ffd1fa34511046ef47e6b Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 5 Oct 2022 14:20:34 +0200 Subject: [PATCH] Kill unsafe require --- src/VencordNative.ts | 9 --------- src/api/settings.ts | 2 -- src/components/Settings.tsx | 7 ------- 3 files changed, 18 deletions(-) diff --git a/src/VencordNative.ts b/src/VencordNative.ts index 33bb869d..494e9ffc 100644 --- a/src/VencordNative.ts +++ b/src/VencordNative.ts @@ -27,14 +27,5 @@ export default { assertEventAllowed(event); return ipcRenderer.invoke(event, ...args); } - }, - require(mod: string) { - const settings = ipcRenderer.sendSync(IPC_EVENTS.GET_SETTINGS); - try { - if (!JSON.parse(settings).unsafeRequire) throw "no"; - } catch { - throw new Error("Unsafe require is not allowed. Enable it in settings and try again."); - } - return require(mod); } }; diff --git a/src/api/settings.ts b/src/api/settings.ts index 17f3f129..3328323a 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -5,7 +5,6 @@ import { mergeDefaults } from '../utils/misc'; interface Settings { notifyAboutUpdates: boolean; - unsafeRequire: boolean; useQuickCss: boolean; plugins: { [plugin: string]: { @@ -17,7 +16,6 @@ interface Settings { const DefaultSettings: Settings = { notifyAboutUpdates: true, - unsafeRequire: false, useQuickCss: true, plugins: {} }; diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 007767ec..4e0196fb 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -111,13 +111,6 @@ export default ErrorBoundary.wrap(function Settings() { > Get notified about new Updates } - {!IS_WEB && settings.unsafeRequire = v} - note="Enables VencordNative.require. Useful for testing, very bad for security. Leave this off unless you need it." - > - Enable Unsafe Require - }