diff --git a/NewPluginsModal.css b/NewPluginsModal.css new file mode 100644 index 0000000..c941823 --- /dev/null +++ b/NewPluginsModal.css @@ -0,0 +1,11 @@ +.vc-newPluginsManager-restart-tooltip { + max-width: 280px; +} + +.vc-newPluginsManager-restart-list { + padding-left: 1.25em; +} + +.vc-newPluginsManager-restart-list li { + list-style: disc; +} diff --git a/NewPluginsModal.tsx b/NewPluginsModal.tsx index 7de5641..e9fbf64 100644 --- a/NewPluginsModal.tsx +++ b/NewPluginsModal.tsx @@ -10,7 +10,7 @@ import { PluginCard } from "@components/PluginSettings"; import { ChangeList } from "@utils/ChangeList"; import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { useForceUpdater } from "@utils/react"; -import { Button, Flex, Forms, Parser, React, Text, Tooltip, useMemo } from "@webpack/common"; +import { Button, Flex, Forms, React, Text, Tooltip, useMemo } from "@webpack/common"; import { JSX } from "react"; import Plugins from "~plugins"; @@ -19,6 +19,10 @@ import { getNewPlugins, getNewSettings, KnownPluginSettingsMap, writeKnownSettin const cl = classNameFactory("vc-plugins-"); +import "./NewPluginsModal.css"; + +import { Margins } from "@utils/index"; + let hasSeen = false; // Most of this was stolen from PluginSettings directly. @@ -133,14 +137,13 @@ function ContinueButton(props: { callback: (update: () => void) => void; changes const update = useForceUpdater(); props.callback(update); return The following plugins require a restart: -
{props.changes.map((s, i) => ( - <> - {i > 0 && ", "} - {Parser.parse("`" + s + "`")} - - ))}
+
+ } shouldShow={props.changes.hasChanges} > diff --git a/knownPlugins.ts b/knownPlugins.ts deleted file mode 100644 index 2a9dea6..0000000 --- a/knownPlugins.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { DataStore } from "@api/index"; - -import plugins from "~plugins"; - -export const KNOWN_PLUGINS_DATA_KEY = "NewPluginsManager_KnownPlugins"; - -export async function getKnownPlugins(): Promise> { - let knownPlugins = await DataStore.get(KNOWN_PLUGINS_DATA_KEY) as string[]; - if (knownPlugins === undefined) { - knownPlugins = Object.keys(plugins); - DataStore.set(KNOWN_PLUGINS_DATA_KEY, knownPlugins); - } - return new Set(knownPlugins); -} - -export async function getNewPlugins(): Promise> { - const currentPlugins = Object.keys(plugins); - const knownPlugins = await getKnownPlugins(); - return new Set(currentPlugins.filter(p => !knownPlugins.has(p))); -} - -export async function writeKnownPlugins(): Promise { - const currentPlugins = Object.keys(plugins); - const knownPlugins = await getKnownPlugins(); - DataStore.set(KNOWN_PLUGINS_DATA_KEY, [...new Set([...currentPlugins, ...knownPlugins])]); -} diff --git a/knownSettings.ts b/knownSettings.ts index 179c9e4..c4d1a90 100644 --- a/knownSettings.ts +++ b/knownSettings.ts @@ -83,3 +83,11 @@ export async function debugWipeSomeData() { }); await DataStore.set(KNOWN_SETTINGS_DATA_KEY, settings); } + +export async function editRawData(patcher: (data: KnownPluginSettingsMap) => (Promise | KnownPluginSettingsMap)) { + if (!patcher) return; + const map = await DataStore.get(KNOWN_SETTINGS_DATA_KEY) as KnownPluginSettingsMap; + const newMap = new Map(map); + await patcher(newMap); + await DataStore.set(KNOWN_SETTINGS_DATA_KEY, newMap ?? map); +}