import { useAwaiter } from "../utils/misc"; import Plugins from 'plugins'; import { useSettings } from "../api/settings"; import IpcEvents from "../utils/IpcEvents"; import { Button, ButtonProps, Flex, Switch, Forms } from "../webpack/common"; import ErrorBoundary from "./ErrorBoundary"; import { startPlugin } from "../plugins"; import { stopPlugin } from '../plugins/index'; export default ErrorBoundary.wrap(function Settings(props) { const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke(IpcEvents.GET_SETTINGS_DIR), "Loading..."); const settings = useSettings(); return ( SettingsDir: {settingsDir} Settings settings.unsafeRequire = v} note="Enables VencordNative.require. Useful for testing, very bad for security. Leave this off unless you need it." > Enable Ensafe Require Plugins {Object.values(Plugins).map(p => ( { settings.plugins[p.name].enabled = v; if (v) { p.dependencies?.forEach(d => { settings.plugins[d].enabled = true; if (!Plugins[d].started && !stopPlugin) { // TODO show notification settings.plugins[p.name].enabled = false; } }); if (!p.started && !startPlugin(p)) { // TODO show notification } } else { if (p.started && !stopPlugin(p)) { // TODO show notification } } if (p.patches) { // TODO show notification } }} note={p.description} tooltipNote={p.required ? "This plugin is required. Thus you cannot disable it." : undefined} > {p.name} )) } ); });