Kill unsafe require
This commit is contained in:
parent
98cfa090d4
commit
7e526e4172
@ -27,14 +27,5 @@ export default {
|
|||||||
assertEventAllowed(event);
|
assertEventAllowed(event);
|
||||||
return ipcRenderer.invoke(event, ...args);
|
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);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,6 @@ import { mergeDefaults } from '../utils/misc';
|
|||||||
|
|
||||||
interface Settings {
|
interface Settings {
|
||||||
notifyAboutUpdates: boolean;
|
notifyAboutUpdates: boolean;
|
||||||
unsafeRequire: boolean;
|
|
||||||
useQuickCss: boolean;
|
useQuickCss: boolean;
|
||||||
plugins: {
|
plugins: {
|
||||||
[plugin: string]: {
|
[plugin: string]: {
|
||||||
@ -17,7 +16,6 @@ interface Settings {
|
|||||||
|
|
||||||
const DefaultSettings: Settings = {
|
const DefaultSettings: Settings = {
|
||||||
notifyAboutUpdates: true,
|
notifyAboutUpdates: true,
|
||||||
unsafeRequire: false,
|
|
||||||
useQuickCss: true,
|
useQuickCss: true,
|
||||||
plugins: {}
|
plugins: {}
|
||||||
};
|
};
|
||||||
|
@ -111,13 +111,6 @@ export default ErrorBoundary.wrap(function Settings() {
|
|||||||
>
|
>
|
||||||
Get notified about new Updates
|
Get notified about new Updates
|
||||||
</Switch>}
|
</Switch>}
|
||||||
{!IS_WEB && <Switch
|
|
||||||
value={settings.unsafeRequire}
|
|
||||||
onChange={(v: boolean) => settings.unsafeRequire = v}
|
|
||||||
note="Enables VencordNative.require. Useful for testing, very bad for security. Leave this off unless you need it."
|
|
||||||
>
|
|
||||||
Enable Unsafe Require
|
|
||||||
</Switch>}
|
|
||||||
|
|
||||||
<Forms.FormDivider />
|
<Forms.FormDivider />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user