diff options
-rw-r--r-- | src/api/settings.ts | 20 | ||||
-rw-r--r-- | src/plugins/apiMenuItemDeobfuscator.ts | 4 | ||||
-rw-r--r-- | src/plugins/apiNotices.ts | 5 | ||||
-rw-r--r-- | src/plugins/clearURLs/index.ts | 6 | ||||
-rw-r--r-- | src/plugins/emoteCloner.tsx (renamed from src/plugins/emoteYoink.tsx) | 24 | ||||
-rw-r--r-- | src/plugins/fakeNitro.ts (renamed from src/plugins/nitroBypass.ts) | 19 | ||||
-rw-r--r-- | src/plugins/messageActions.ts | 7 | ||||
-rw-r--r-- | src/plugins/moreKaomoji.ts (renamed from src/plugins/moarKaomojis.ts) | 6 | ||||
-rw-r--r-- | src/plugins/noDevtoolsWarning.ts (renamed from src/plugins/STFU.ts) | 5 | ||||
-rw-r--r-- | src/plugins/quickReply.ts (renamed from src/plugins/interactionKeybinds.ts) | 5 | ||||
-rw-r--r-- | src/plugins/reverseImageSearch.tsx | 4 | ||||
-rw-r--r-- | src/plugins/spotifyControls/index.tsx | 2 | ||||
-rw-r--r-- | src/plugins/spotifyCrack.ts (renamed from src/plugins/ify.ts) | 10 | ||||
-rw-r--r-- | src/plugins/spotifyShareCommands.ts (renamed from src/plugins/sendify.ts) | 6 | ||||
-rw-r--r-- | src/plugins/vcDoubleClick.ts | 10 | ||||
-rw-r--r-- | src/plugins/viewIcons.tsx | 2 | ||||
-rw-r--r-- | src/webpack/common.tsx | 4 |
17 files changed, 94 insertions, 45 deletions
diff --git a/src/api/settings.ts b/src/api/settings.ts index 9e518c6..dd8692a 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -19,10 +19,12 @@ import plugins from "~plugins"; import IpcEvents from "../utils/IpcEvents"; +import Logger from "../utils/Logger"; import { mergeDefaults } from "../utils/misc"; import { OptionType } from "../utils/types"; import { React } from "../webpack/common"; +const logger = new Logger("Settings"); export interface Settings { notifyAboutUpdates: boolean; useQuickCss: boolean; @@ -169,3 +171,21 @@ export function addSettingsListener(path: string, onUpdate: (newValue: any, path (onUpdate as SubscriptionCallback)._path = path; subscriptions.add(onUpdate); } + +export function migratePluginSettings(name: string, ...oldNames: string[]) { + const { plugins } = settings; + if (name in plugins) return; + + for (const oldName of oldNames) { + if (oldName in plugins) { + logger.info(`Migrating settings from old name ${oldName} to ${name}`); + plugins[name] = plugins[oldName]; + delete plugins[oldName]; + VencordNative.ipc.invoke( + IpcEvents.SET_SETTINGS, + JSON.stringify(settings, null, 4) + ); + break; + } + } +} diff --git a/src/plugins/apiMenuItemDeobfuscator.ts b/src/plugins/apiMenuItemDeobfuscator.ts index 59d40cf..40d53f1 100644 --- a/src/plugins/apiMenuItemDeobfuscator.ts +++ b/src/plugins/apiMenuItemDeobfuscator.ts @@ -16,6 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; @@ -33,8 +34,9 @@ const nameMap = { customitem: "MenuItem", }; +migratePluginSettings("MenuItemDeobfuscatorAPI", "MenuItemDeobfuscatorApi"); export default definePlugin({ - name: "MenuItemDeobfuscatorApi", + name: "MenuItemDeobfuscatorAPI", description: "Deobfuscates Discord's Menu Item module", authors: [Devs.Ven], patches: [ diff --git a/src/plugins/apiNotices.ts b/src/plugins/apiNotices.ts index 1a1df4b..f53c535 100644 --- a/src/plugins/apiNotices.ts +++ b/src/plugins/apiNotices.ts @@ -16,11 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; +migratePluginSettings("NoticesAPI", "NoticesApi"); + export default definePlugin({ - name: "NoticesApi", + name: "NoticesAPI", description: "Fixes notices being automatically dismissed", authors: [Devs.Ven], required: true, diff --git a/src/plugins/clearURLs/index.ts b/src/plugins/clearURLs/index.ts index b01faed..f5b8909 100644 --- a/src/plugins/clearURLs/index.ts +++ b/src/plugins/clearURLs/index.ts @@ -21,8 +21,9 @@ import { addPreSendListener, MessageObject, removePreEditListener, - removePreSendListener, + removePreSendListener } from "../../api/MessageEvents"; +import { migratePluginSettings } from "../../api/settings"; import { Devs } from "../../utils/constants"; import definePlugin from "../../utils/types"; import { defaultRules } from "./defaultRules"; @@ -31,8 +32,9 @@ import { defaultRules } from "./defaultRules"; const reRegExpChar = /[\\^$.*+?()[\]{}|]/g; const reHasRegExpChar = RegExp(reRegExpChar.source); +migratePluginSettings("ClearURLs", "clearURLs"); export default definePlugin({ - name: "clearURLs", + name: "ClearURLs", description: "Removes tracking garbage from URLs", authors: [Devs.adryd], dependencies: ["MessageEventsAPI"], diff --git a/src/plugins/emoteYoink.tsx b/src/plugins/emoteCloner.tsx index becc6d1..0b1190b 100644 --- a/src/plugins/emoteYoink.tsx +++ b/src/plugins/emoteCloner.tsx @@ -16,9 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Settings } from "../api/settings"; +import { migratePluginSettings, Settings } from "../api/settings"; import { CheckedTextInput } from "../components/CheckedTextInput"; import { Devs } from "../utils/constants"; +import Logger from "../utils/Logger"; import { lazyWebpack, makeLazy } from "../utils/misc"; import { ModalContent, ModalHeader, ModalRoot, openModal } from "../utils/modal"; import definePlugin from "../utils/types"; @@ -60,12 +61,12 @@ async function doClone(guildId: string, id: string, name: string, isAnimated: bo image: reader.result }).then(() => { Toasts.show({ - message: `Successfully yoinked ${name}!`, + message: `Successfully cloned ${name}!`, type: Toasts.Type.SUCCESS, id: Toasts.genId() }); - }).catch(e => { - console.error("[EmoteYoink] Failed to upload emoji", e); + }).catch((e: any) => { + new Logger("EmoteCloner").error("Failed to upload emoji", e); Toasts.show({ message: "Oopsie something went wrong :( Check console!!!", type: Toasts.Type.FAILURE, @@ -174,18 +175,19 @@ function CloneModal({ id, name: emojiName, isAnimated }: { id: string; name: str ); } +migratePluginSettings("EmoteCloner", "EmoteYoink"); export default definePlugin({ - name: "EmoteYoink", - description: "Clone emotes to your own server", + name: "EmoteCloner", + description: "Adds a Clone context menu item to emotes to clone them your own server", authors: [Devs.Ven], - dependencies: ["MenuItemDeobfuscatorApi"], + dependencies: ["MenuItemDeobfuscatorAPI"], patches: [{ // Literally copy pasted from ReverseImageSearch lol find: "open-native-link", replacement: { match: /id:"open-native-link".{0,200}\(\{href:(.{0,3}),.{0,200}\},"open-native-link"\)/, - replace: "$&,Vencord.Plugins.plugins.EmoteYoink.makeMenu(arguments[2])" + replace: "$&,Vencord.Plugins.plugins.EmoteCloner.makeMenu(arguments[2])" }, }, @@ -214,9 +216,9 @@ export default definePlugin({ const isAnimated = new URL(htmlElement.src).pathname.endsWith(".gif"); return <Menu.MenuItem - id="yoink" - key="yoink" - label="Yoink" + id="emote-cloner" + key="emote-cloner" + label="Clone" action={() => openModal(modalProps => ( <ModalRoot {...modalProps}> diff --git a/src/plugins/nitroBypass.ts b/src/plugins/fakeNitro.ts index e455ab6..e7ef401 100644 --- a/src/plugins/nitroBypass.ts +++ b/src/plugins/fakeNitro.ts @@ -17,6 +17,7 @@ */ import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "../api/MessageEvents"; +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import { ApngDisposeOp, getGifEncoder, importApngJs } from "../utils/dependencies"; import { lazyWebpack } from "../utils/misc"; @@ -55,8 +56,10 @@ interface StickerPack { stickers: Sticker[]; } +migratePluginSettings("FakeNitro", "NitroBypass"); + export default definePlugin({ - name: "NitroBypass", + name: "FakeNitro", authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven], description: "Allows you to stream in nitro quality and send fake emojis/stickers.", dependencies: ["MessageEventsAPI"], @@ -64,7 +67,7 @@ export default definePlugin({ patches: [ { find: "canUseAnimatedEmojis:function", - predicate: () => Settings.plugins.NitroBypass.enableEmojiBypass === true, + predicate: () => Settings.plugins.FakeNitro.enableEmojiBypass === true, replacement: [ "canUseAnimatedEmojis", "canUseEmojisEverywhere" @@ -77,7 +80,7 @@ export default definePlugin({ }, { find: "canUseAnimatedEmojis:function", - predicate: () => Settings.plugins.NitroBypass.enableStickerBypass === true, + predicate: () => Settings.plugins.FakeNitro.enableStickerBypass === true, replacement: { match: /canUseStickersEverywhere:function\(.+?}/, replace: "canUseStickersEverywhere:function(e){return true;}" @@ -92,7 +95,7 @@ export default definePlugin({ }, { find: "canUseAnimatedEmojis:function", - predicate: () => Settings.plugins.NitroBypass.enableStreamQualityBypass === true, + predicate: () => Settings.plugins.FakeNitro.enableStreamQualityBypass === true, replacement: [ "canUseHighVideoUploadQuality", "canStreamHighQuality", @@ -106,7 +109,7 @@ export default definePlugin({ }, { find: "STREAM_FPS_OPTION.format", - predicate: () => Settings.plugins.NitroBypass.enableStreamQualityBypass === true, + predicate: () => Settings.plugins.FakeNitro.enableStreamQualityBypass === true, replacement: { match: /(userPremiumType|guildPremiumTier):.{0,10}TIER_\d,?/g, replace: "" @@ -154,7 +157,7 @@ export default definePlugin({ }, getStickerLink(stickerId: string) { - return `https://media.discordapp.net/stickers/${stickerId}.png?size=${Settings.plugins.NitroBypass.stickerSize}`; + return `https://media.discordapp.net/stickers/${stickerId}.png?size=${Settings.plugins.FakeNitro.stickerSize}`; }, async sendAnimatedSticker(stickerLink: string, stickerId: string, channelId: string) { @@ -167,7 +170,7 @@ export default definePlugin({ const { frames, width, height } = await parseURL(stickerLink); const gif = new GIFEncoder(); - const resolution = Settings.plugins.NitroBypass.stickerSize; + const resolution = Settings.plugins.FakeNitro.stickerSize; const canvas = document.createElement("canvas"); canvas.width = resolution; @@ -210,7 +213,7 @@ export default definePlugin({ }, start() { - const settings = Settings.plugins.NitroBypass; + const settings = Settings.plugins.FakeNitro; if (!settings.enableEmojiBypass && !settings.enableStickerBypass) { return; } diff --git a/src/plugins/messageActions.ts b/src/plugins/messageActions.ts index bb2ad17..05d792f 100644 --- a/src/plugins/messageActions.ts +++ b/src/plugins/messageActions.ts @@ -17,6 +17,7 @@ */ import { addClickListener, removeClickListener } from "../api/MessageEvents"; +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import { lazyWebpack } from "../utils/misc"; import definePlugin from "../utils/types"; @@ -27,9 +28,11 @@ let isDeletePressed = false; const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true); const keyup = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = false); +migratePluginSettings("MessageClickActions", "MessageQuickActions"); + export default definePlugin({ - name: "MessageQuickActions", - description: "Quick Delete, Quick edit", + name: "MessageClickActions", + description: "Hold Delete and click to delete, double click to edit", authors: [Devs.Ven], dependencies: ["MessageEventsAPI"], diff --git a/src/plugins/moarKaomojis.ts b/src/plugins/moreKaomoji.ts index 8b3c0c5..ef6dc0f 100644 --- a/src/plugins/moarKaomojis.ts +++ b/src/plugins/moreKaomoji.ts @@ -17,12 +17,14 @@ */ import { findOption, OptionalMessageOption } from "../api/Commands"; +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; +migratePluginSettings("MoreKaomoji", "moarKaomojis"); export default definePlugin({ - name: "moarKaomojis", - description: "Adds more Kaomojis to discord. ヽ(´▽`)/", + name: "MoreKaomoji", + description: "Adds more Kaomoji to discord. ヽ(´▽`)/", authors: [Devs.JacobTm], dependencies: ["CommandsAPI"], commands: [ diff --git a/src/plugins/STFU.ts b/src/plugins/noDevtoolsWarning.ts index 66392c8..2ceb0c3 100644 --- a/src/plugins/STFU.ts +++ b/src/plugins/noDevtoolsWarning.ts @@ -16,11 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; +migratePluginSettings("NoDevtoolsWarning", "STFU"); + export default definePlugin({ - name: "STFU", + name: "NoDevtoolsWarning", description: "Disables the 'HOLD UP' banner in the console", authors: [Devs.Ven], patches: [{ diff --git a/src/plugins/interactionKeybinds.ts b/src/plugins/quickReply.ts index 61af4ac..2903b39 100644 --- a/src/plugins/interactionKeybinds.ts +++ b/src/plugins/quickReply.ts @@ -18,6 +18,7 @@ import { Message } from "discord-types/general"; +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import { lazyWebpack } from "../utils/misc"; import definePlugin from "../utils/types"; @@ -30,8 +31,10 @@ const isMac = navigator.platform.includes("Mac"); // bruh let replyIdx = -1; let editIdx = -1; +migratePluginSettings("QuickReply", "InteractionKeybinds"); + export default definePlugin({ - name: "InteractionKeybinds", + name: "QuickReply", authors: [Devs.obscurity, Devs.Ven], description: "Reply to (ctrl + up/down) and edit (ctrl + shift + up/down) messages via keybinds", diff --git a/src/plugins/reverseImageSearch.tsx b/src/plugins/reverseImageSearch.tsx index 2d66636..804ac04 100644 --- a/src/plugins/reverseImageSearch.tsx +++ b/src/plugins/reverseImageSearch.tsx @@ -30,9 +30,9 @@ const Engines = { export default definePlugin({ name: "ReverseImageSearch", - description: "yes", + description: "Adds ImageSearch to image context menus", authors: [Devs.Ven], - dependencies: ["MenuItemDeobfuscatorApi"], + dependencies: ["MenuItemDeobfuscatorAPI"], patches: [{ find: "open-native-link", replacement: { diff --git a/src/plugins/spotifyControls/index.tsx b/src/plugins/spotifyControls/index.tsx index e8b5370..14c7a93 100644 --- a/src/plugins/spotifyControls/index.tsx +++ b/src/plugins/spotifyControls/index.tsx @@ -24,7 +24,7 @@ export default definePlugin({ name: "SpotifyControls", description: "Spotify Controls", authors: [Devs.Ven, Devs.afn, Devs.KraXen72], - dependencies: ["MenuItemDeobfuscatorApi"], + dependencies: ["MenuItemDeobfuscatorAPI"], patches: [ { find: "showTaglessAccountPanel:", diff --git a/src/plugins/ify.ts b/src/plugins/spotifyCrack.ts index 47d8371..b9f68ed 100644 --- a/src/plugins/ify.ts +++ b/src/plugins/spotifyCrack.ts @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin, { OptionType } from "../utils/types"; import { Settings } from "../Vencord"; +migratePluginSettings("SpotifyCrack", "Ify"); export default definePlugin({ - name: "Ify", - description: "Disables Spotify auto-pausing, allows activity to continue playing when idling and bypasses premium checks, allowing you to listen along with others.", + name: "SpotifyCrack", + description: "Free listen along, no auto-pausing in voice chat, and allows activity to continue playing when idling", authors: [ Devs.Cyn, Devs.Nuckyz @@ -36,14 +38,14 @@ export default definePlugin({ }], }, { find: '.displayName="SpotifyStore"', - predicate: () => Settings.plugins.Ify.noSpotifyAutoPause, + predicate: () => Settings.plugins.SpotifyCrack.noSpotifyAutoPause, replacement: { match: /function (.{1,2})\(\).{0,200}SPOTIFY_AUTO_PAUSED\);.{0,}}}}/, replace: "function $1(){}" } }, { find: '.displayName="SpotifyStore"', - predicate: () => Settings.plugins.Ify.keepSpotifyActivityOnIdle, + predicate: () => Settings.plugins.SpotifyCrack.keepSpotifyActivityOnIdle, replacement: { match: /(shouldShowActivity=function\(\){.{1,50})&&!.{1,6}\.isIdle\(\)(.{0,}?})/, replace: (_, functionDeclarationAndExpression, restOfFunction) => `${functionDeclarationAndExpression}${restOfFunction}` diff --git a/src/plugins/sendify.ts b/src/plugins/spotifyShareCommands.ts index b0fd52d..e5b247b 100644 --- a/src/plugins/sendify.ts +++ b/src/plugins/spotifyShareCommands.ts @@ -17,6 +17,7 @@ */ import { ApplicationCommandInputType, sendBotMessage } from "../api/Commands"; +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import { lazyWebpack } from "../utils/misc"; import definePlugin from "../utils/types"; @@ -74,9 +75,10 @@ function sendMessage(channelId, message) { }); } +migratePluginSettings("SpotifyShareCommands", "Sendify"); export default definePlugin({ - name: "Sendify", - description: "Send your current Spotify music to chat", + name: "SpotifyShareCommands", + description: "Share your current Spotify track, album or artist via slash command (/track, /album, /artist)", authors: [Devs.katlyn], dependencies: ["CommandsAPI"], commands: [ diff --git a/src/plugins/vcDoubleClick.ts b/src/plugins/vcDoubleClick.ts index b1a0558..68dc480 100644 --- a/src/plugins/vcDoubleClick.ts +++ b/src/plugins/vcDoubleClick.ts @@ -16,6 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { migratePluginSettings } from "../api/settings"; import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; import { SelectedChannelStore } from "../webpack/common"; @@ -25,9 +26,10 @@ const timers = {} as Record<string, { i: number; }>; +migratePluginSettings("VoiceChatDoubleClick", "vcDoubleClick"); export default definePlugin({ - name: "vcDoubleClick", - description: "Join VCs via DoubleClick instead of single click", + name: "VoiceChatDoubleClick", + description: "Join voice chats via double click instead of single click", authors: [Devs.Ven, Devs.D3SOX], patches: [ { @@ -40,12 +42,12 @@ export default definePlugin({ // voice channels { match: /onClick:(.*)function\(\)\{(e\.handleClick.+?)}/g, - replace: "onClick:$1function(){Vencord.Plugins.plugins.vcDoubleClick.schedule(()=>{$2}, e)}", + replace: "onClick:$1function(){Vencord.Plugins.plugins.VoiceChatDoubleClick.schedule(()=>{$2}, e)}", }, // stage channels { match: /onClick:(.{0,15})this\.handleClick,/g, - replace: "onClick:$1(...args)=>Vencord.Plugins.plugins.vcDoubleClick.schedule(()=>{this.handleClick(...args);}, args[0]),", + replace: "onClick:$1(...args)=>Vencord.Plugins.plugins.VoiceChatDoubleClick.schedule(()=>{this.handleClick(...args);}, args[0]),", } ], }, diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx index 671b197..a0d08a9 100644 --- a/src/plugins/viewIcons.tsx +++ b/src/plugins/viewIcons.tsx @@ -36,7 +36,7 @@ export default new class ViewIcons implements PluginDef { authors = [Devs.Ven]; description = "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon."; - dependencies = ["MenuItemDeobfuscatorApi"]; + dependencies = ["MenuItemDeobfuscatorAPI"]; openImage(url: string) { const u = new URL(url); diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx index 9a15011..1dbc836 100644 --- a/src/webpack/common.tsx +++ b/src/webpack/common.tsx @@ -216,10 +216,10 @@ interface Menu { /** * Discord's Context menu items. * To use anything but Menu.ContextMenu, your plugin HAS TO - * depend on MenuItemDeobfuscatorApi. Otherwise they will throw + * depend on MenuItemDeobfuscatorAPI. Otherwise they will throw */ export const Menu = proxyLazy(() => { - const hasDeobfuscator = Vencord.Settings.plugins.MenuItemDeobfuscatorApi.enabled; + const hasDeobfuscator = Vencord.Settings.plugins.MenuItemDeobfuscatorAPI.enabled; const menuItems = ["MenuSeparator", "MenuGroup", "MenuItem", "MenuCheckboxItem", "MenuRadioItem", "MenuControlItem"]; const map = mapMangledModule("♫ ⊂(。◕‿‿◕。⊂) ♪", { |