Less confusing plugin names (bulk plugin rename) (#214)
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
parent
a96f8a89f3
commit
82e444e196
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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: [
|
||||
|
@ -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,
|
||||
|
@ -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"],
|
||||
|
@ -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}>
|
@ -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;
|
||||
}
|
@ -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"],
|
||||
|
||||
|
@ -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: [
|
@ -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: [{
|
@ -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",
|
||||
|
@ -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: {
|
||||
|
@ -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:",
|
||||
|
@ -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}`
|
@ -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: [
|
@ -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]),",
|
||||
}
|
||||
],
|
||||
},
|
||||
|
@ -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);
|
||||
|
@ -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("♫ ⊂(。◕‿‿◕。⊂) ♪", {
|
||||
|
Loading…
x
Reference in New Issue
Block a user