From 97e59d3869011cb6e807bcdc1dd629a6d7512eb1 Mon Sep 17 00:00:00 2001 From: thororen <78185467+thororen1234@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:02:49 -0400 Subject: [PATCH] Fixes --- .../constants/constants.ts | 31 -------- .../constants/index.ts | 19 ----- .../betterMicrophone.desktop/index.tsx | 42 ++++------- .../betterMicrophone.desktop/logger/index.ts | 4 +- .../betterMicrophone.desktop/modals/index.tsx | 5 +- .../patchers/microphone.ts | 3 +- .../stores/microphoneStore.ts | 3 +- .../components/ScreenshareSettingsModal.tsx | 12 +-- .../constants/constants.ts | 38 ---------- .../constants/index.ts | 19 ----- .../betterScreenshare.desktop/index.tsx | 75 ++++++++----------- .../betterScreenshare.desktop/logger/index.ts | 3 +- .../modals/index.tsx | 5 +- .../patchers/screenshare.ts | 3 +- .../patchers/screenshareAudio.ts | 3 +- .../patches/screenshareModal.tsx | 3 +- .../stores/screenshareAudioStore.ts | 3 +- .../stores/screenshareStore.ts | 3 +- .../philsPluginLibrary/constants/constants.ts | 30 -------- .../philsPluginLibrary/constants/index.ts | 19 ----- .../philsPluginLibrary/index.tsx | 39 ++++------ 21 files changed, 75 insertions(+), 287 deletions(-) delete mode 100644 src/equicordplugins/betterMicrophone.desktop/constants/constants.ts delete mode 100644 src/equicordplugins/betterMicrophone.desktop/constants/index.ts delete mode 100644 src/equicordplugins/betterScreenshare.desktop/constants/constants.ts delete mode 100644 src/equicordplugins/betterScreenshare.desktop/constants/index.ts delete mode 100644 src/equicordplugins/philsPluginLibrary/constants/constants.ts delete mode 100644 src/equicordplugins/philsPluginLibrary/constants/index.ts diff --git a/src/equicordplugins/betterMicrophone.desktop/constants/constants.ts b/src/equicordplugins/betterMicrophone.desktop/constants/constants.ts deleted file mode 100644 index 961c3d20..00000000 --- a/src/equicordplugins/betterMicrophone.desktop/constants/constants.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { Devs } from "@utils/constants"; - -import { types } from "../../philsPluginLibrary"; - -export const PluginInfo = { - PLUGIN_NAME: "BetterMicrophone", - DESCRIPTION: "This plugin allows you to further customize your microphone.", - AUTHOR: { - ...Devs.philhk, - github: "https://github.com/philhk" - }, - CONTRIBUTORS: {} -} as const satisfies types.PluginInfo; diff --git a/src/equicordplugins/betterMicrophone.desktop/constants/index.ts b/src/equicordplugins/betterMicrophone.desktop/constants/index.ts deleted file mode 100644 index c7b948ab..00000000 --- a/src/equicordplugins/betterMicrophone.desktop/constants/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -export * from "./constants"; diff --git a/src/equicordplugins/betterMicrophone.desktop/index.tsx b/src/equicordplugins/betterMicrophone.desktop/index.tsx index 070cdb5b..ea2a0e32 100644 --- a/src/equicordplugins/betterMicrophone.desktop/index.tsx +++ b/src/equicordplugins/betterMicrophone.desktop/index.tsx @@ -16,42 +16,32 @@ * along with this program. If not, see . */ -import { PluginAuthor, PluginDef } from "@utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; import { addSettingsPanelButton, Emitter, MicrophoneSettingsIcon, removeSettingsPanelButton } from "../philsPluginLibrary"; -import { PluginInfo } from "./constants"; import { openMicrophoneSettingsModal } from "./modals"; import { MicrophonePatcher } from "./patchers"; import { initMicrophoneStore } from "./stores"; -export default new class Plugin implements PluginDef { - readonly name: string; - readonly description: string; - readonly authors: PluginAuthor[]; - readonly dependencies: string[]; +let microphonePatcher; - public microphonePatcher?: MicrophonePatcher; - - constructor() { - this.name = PluginInfo.PLUGIN_NAME; - this.description = PluginInfo.DESCRIPTION; - this.authors = [PluginInfo.AUTHOR, ...Object.values(PluginInfo.CONTRIBUTORS)] as PluginAuthor[]; - this.dependencies = ["PhilsPluginLibrary"]; - } - - start(): void { +export default definePlugin({ + name: "BetterMicrophone", + description: "This plugin allows you to further customize your microphone.", + authors: [Devs.philhk], + dependencies: ["PhilsPluginLibrary"], + microphonePatcher, + start() { initMicrophoneStore(); - this.microphonePatcher = new MicrophonePatcher().patch(); - - addSettingsPanelButton({ name: PluginInfo.PLUGIN_NAME, icon: MicrophoneSettingsIcon, tooltipText: "Microphone Settings", onClick: openMicrophoneSettingsModal }); - } - - stop(): void { + addSettingsPanelButton({ name: "BetterMicrophone", icon: MicrophoneSettingsIcon, tooltipText: "Microphone Settings", onClick: openMicrophoneSettingsModal }); + }, + stop() { this.microphonePatcher?.unpatch(); - Emitter.removeAllListeners(PluginInfo.PLUGIN_NAME); + Emitter.removeAllListeners("BetterMicrophone"); - removeSettingsPanelButton(PluginInfo.PLUGIN_NAME); + removeSettingsPanelButton("BetterMicrophone"); } -}; +}); diff --git a/src/equicordplugins/betterMicrophone.desktop/logger/index.ts b/src/equicordplugins/betterMicrophone.desktop/logger/index.ts index 828c0f86..88f61465 100644 --- a/src/equicordplugins/betterMicrophone.desktop/logger/index.ts +++ b/src/equicordplugins/betterMicrophone.desktop/logger/index.ts @@ -18,6 +18,4 @@ import { Logger } from "@utils/Logger"; -import { PluginInfo } from "../constants"; - -export const logger = new Logger(PluginInfo.PLUGIN_NAME); +export const logger = new Logger("BetterMicrophone"); diff --git a/src/equicordplugins/betterMicrophone.desktop/modals/index.tsx b/src/equicordplugins/betterMicrophone.desktop/modals/index.tsx index 781f5d3c..e73c55d0 100644 --- a/src/equicordplugins/betterMicrophone.desktop/modals/index.tsx +++ b/src/equicordplugins/betterMicrophone.desktop/modals/index.tsx @@ -16,10 +16,10 @@ * along with this program. If not, see . */ +import { Devs } from "@utils/constants"; import { openModalLazy } from "@utils/modal"; import { MicrophoneSettingsModal } from "../components"; -import { PluginInfo } from "../constants"; import Plugin from "../index"; import { microphoneStore } from "../stores"; @@ -37,7 +37,6 @@ export const openMicrophoneSettingsModal = onDone={onMicrophoneModalDone} showInfo microphoneStore={microphoneStore} - author={PluginInfo.AUTHOR} - contributors={Object.values(PluginInfo.CONTRIBUTORS)} + author={Devs.philhk} {...props} />; }); diff --git a/src/equicordplugins/betterMicrophone.desktop/patchers/microphone.ts b/src/equicordplugins/betterMicrophone.desktop/patchers/microphone.ts index 2507f4f8..6b20f6bb 100644 --- a/src/equicordplugins/betterMicrophone.desktop/patchers/microphone.ts +++ b/src/equicordplugins/betterMicrophone.desktop/patchers/microphone.ts @@ -18,7 +18,6 @@ import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary"; import { patchConnectionAudioTransportOptions } from "../../philsPluginLibrary/patches/audio"; -import { PluginInfo } from "../constants"; import { logger } from "../logger"; import { microphoneStore } from "../stores"; @@ -59,7 +58,7 @@ export class MicrophonePatcher extends Patcher { "on", "connection", connectionEventFunction, - PluginInfo.PLUGIN_NAME + "BetterMicrophone" ); return this; diff --git a/src/equicordplugins/betterMicrophone.desktop/stores/microphoneStore.ts b/src/equicordplugins/betterMicrophone.desktop/stores/microphoneStore.ts index f0a16a26..7e9a0228 100644 --- a/src/equicordplugins/betterMicrophone.desktop/stores/microphoneStore.ts +++ b/src/equicordplugins/betterMicrophone.desktop/stores/microphoneStore.ts @@ -17,7 +17,6 @@ */ import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary"; -import { PluginInfo } from "../constants"; export interface MicrophoneProfile { @@ -84,7 +83,7 @@ export let microphoneStore: ProfilableStore; export const initMicrophoneStore = () => microphoneStore = createPluginStore( - PluginInfo.PLUGIN_NAME, + "BetterMicrophone", "MicrophoneStore", profileable( microphoneStoreDefault, diff --git a/src/equicordplugins/betterScreenshare.desktop/components/ScreenshareSettingsModal.tsx b/src/equicordplugins/betterScreenshare.desktop/components/ScreenshareSettingsModal.tsx index ac529445..fe643469 100644 --- a/src/equicordplugins/betterScreenshare.desktop/components/ScreenshareSettingsModal.tsx +++ b/src/equicordplugins/betterScreenshare.desktop/components/ScreenshareSettingsModal.tsx @@ -19,13 +19,12 @@ import { Flex } from "@components/Flex"; import { Switch } from "@components/Switch"; import { ModalSize, openModalLazy } from "@utils/modal"; -import { Button, Card, Forms, React, Select, Slider, TextInput, useEffect, useState } from "@webpack/common"; +import { Button, Forms, React, Select, Slider, TextInput, useEffect, useState } from "@webpack/common"; import { SelectOption } from "@webpack/types"; import { MicrophoneSettingsModal } from "../../betterMicrophone.desktop/components"; import { MediaEngineStore, - openURL, ProfilableStore, SettingsModal, SettingsModalCard, @@ -36,8 +35,6 @@ import { validateNumberInput, validateTextInputNumber } from "../../philsPluginLibrary"; -import { Styles } from "../../philsPluginLibrary/styles"; -import { PluginInfo } from "../constants"; import { ScreenshareAudioProfile, ScreenshareAudioStore, ScreenshareProfile, ScreenshareStore } from "../stores"; const simpleResolutions: readonly (SelectOption & { value: types.Resolution; })[] = [ @@ -403,12 +400,6 @@ export const ScreenshareSettingsModal = (props: ScreenshareSettingsModalProps) = onChange: status => setHdrEnabled(status) }} />; - const guideCard = - - How to use? - If you want to know more about the settings or possible issues, please read openURL(PluginInfo.README + "#better-screenshare-plugin")}>this. - ; - const settingsCardProfiles = setIsSaving(state)} profileableStore={screenshareStore} />; @@ -456,7 +447,6 @@ export const ScreenshareSettingsModal = (props: ScreenshareSettingsModalProps) = {screenshareAudioStore && settingsCardAudio} - {guideCard} {settingsCardHdr} {settingsCardProfiles} diff --git a/src/equicordplugins/betterScreenshare.desktop/constants/constants.ts b/src/equicordplugins/betterScreenshare.desktop/constants/constants.ts deleted file mode 100644 index 32d9d44c..00000000 --- a/src/equicordplugins/betterScreenshare.desktop/constants/constants.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { Devs } from "@utils/constants"; - -import { types } from "../../philsPluginLibrary"; - -export const PluginInfo = { - PLUGIN_NAME: "BetterScreenshare", - DESCRIPTION: "This plugin allows you to further customize your screen sharing.", - AUTHOR: { - ...Devs.philhk, - github: "https://github.com/philhk" - }, - CONTRIBUTORS: { - walrus: { - github: "https://github.com/philhk", - id: 305317288775778306n, - name: "walrus" - }, - }, - README: "https://github.com/Vendicated/Vencord/tree/main/src/plugins/betterScreenshare" -} as const satisfies types.PluginInfo; diff --git a/src/equicordplugins/betterScreenshare.desktop/constants/index.ts b/src/equicordplugins/betterScreenshare.desktop/constants/index.ts deleted file mode 100644 index c7b948ab..00000000 --- a/src/equicordplugins/betterScreenshare.desktop/constants/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -export * from "./constants"; diff --git a/src/equicordplugins/betterScreenshare.desktop/index.tsx b/src/equicordplugins/betterScreenshare.desktop/index.tsx index c274c512..a2027593 100644 --- a/src/equicordplugins/betterScreenshare.desktop/index.tsx +++ b/src/equicordplugins/betterScreenshare.desktop/index.tsx @@ -17,70 +17,55 @@ */ import { definePluginSettings } from "@api/Settings"; -import { DefinedSettings, OptionType, Patch, PluginAuthor, PluginDef, SettingsDefinition } from "@utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; import { addSettingsPanelButton, Emitter, removeSettingsPanelButton, ScreenshareSettingsIcon } from "../philsPluginLibrary"; -import { PluginInfo } from "./constants"; import { openScreenshareModal } from "./modals"; import { ScreenshareAudioPatcher, ScreensharePatcher } from "./patchers"; import { replacedScreenshareModalComponent } from "./patches"; import { initScreenshareAudioStore, initScreenshareStore } from "./stores"; -export default new class Plugin implements PluginDef { - readonly name: string; - readonly description: string; - readonly authors: PluginAuthor[]; - readonly patches: Omit[]; - readonly settings: DefinedSettings; - readonly dependencies: string[]; - - private readonly replacedScreenshareModalComponent: typeof replacedScreenshareModalComponent; - public screensharePatcher?: ScreensharePatcher; - public screenshareAudioPatcher?: ScreenshareAudioPatcher; - - constructor() { - this.name = PluginInfo.PLUGIN_NAME; - this.description = PluginInfo.DESCRIPTION; - this.authors = [PluginInfo.AUTHOR, ...Object.values(PluginInfo.CONTRIBUTORS)] as PluginAuthor[]; - this.patches = [ - { - find: "Messages.SCREENSHARE_RELAUNCH", - replacement: { - match: /(function .{1,2}\(.{1,2}\){)(.{1,40}(?=selectGuild).+?(?:]}\)}\)))(})/, - replace: "$1return $self.replacedScreenshareModalComponent(function(){$2}, this, arguments)$3" - } - } - ]; - this.settings = definePluginSettings({ - hideDefaultSettings: { - type: OptionType.BOOLEAN, - description: "Hide Discord screen sharing settings", - default: true, - } - }); - this.dependencies = ["PhilsPluginLibrary"]; - this.replacedScreenshareModalComponent = replacedScreenshareModalComponent; +const settings = definePluginSettings({ + hideDefaultSettings: { + type: OptionType.BOOLEAN, + description: "Hide Discord screen sharing settings", + default: true, } +}); +export default definePlugin({ + name: "BetterScreenshare", + description: "This plugin allows you to further customize your screen sharing.", + authors: [Devs.philhk], + dependencies: ["PhilsPluginLibrary"], + settings, + patches: [ + { + find: "Messages.SCREENSHARE_RELAUNCH", + replacement: { + match: /(function .{1,2}\(.{1,2}\){)(.{1,40}(?=selectGuild).+?(?:]}\)}\)))(})/, + replace: "$1return $self.replacedScreenshareModalComponent(function(){$2}, this, arguments)$3" + } + } + ], + replacedScreenshareModalComponent: replacedScreenshareModalComponent, start(): void { initScreenshareStore(); initScreenshareAudioStore(); this.screensharePatcher = new ScreensharePatcher().patch(); this.screenshareAudioPatcher = new ScreenshareAudioPatcher().patch(); - addSettingsPanelButton({ - name: PluginInfo.PLUGIN_NAME, + name: "BetterScreenshare", icon: ScreenshareSettingsIcon, tooltipText: "Screenshare Settings", onClick: openScreenshareModal }); - } - - stop(): void { + }, + stop() { this.screensharePatcher?.unpatch(); this.screenshareAudioPatcher?.unpatch(); - Emitter.removeAllListeners(PluginInfo.PLUGIN_NAME); - - removeSettingsPanelButton(PluginInfo.PLUGIN_NAME); + Emitter.removeAllListeners("BetterScreenshare"); + removeSettingsPanelButton("BetterScreenshare"); } -}; +}); diff --git a/src/equicordplugins/betterScreenshare.desktop/logger/index.ts b/src/equicordplugins/betterScreenshare.desktop/logger/index.ts index 828c0f86..f9ef8353 100644 --- a/src/equicordplugins/betterScreenshare.desktop/logger/index.ts +++ b/src/equicordplugins/betterScreenshare.desktop/logger/index.ts @@ -18,6 +18,5 @@ import { Logger } from "@utils/Logger"; -import { PluginInfo } from "../constants"; -export const logger = new Logger(PluginInfo.PLUGIN_NAME); +export const logger = new Logger("BetterScreenshare"); diff --git a/src/equicordplugins/betterScreenshare.desktop/modals/index.tsx b/src/equicordplugins/betterScreenshare.desktop/modals/index.tsx index 6650ed11..c9771058 100644 --- a/src/equicordplugins/betterScreenshare.desktop/modals/index.tsx +++ b/src/equicordplugins/betterScreenshare.desktop/modals/index.tsx @@ -16,11 +16,11 @@ * along with this program. If not, see . */ +import { Devs } from "@utils/constants"; import { openModalLazy } from "@utils/modal"; import Plugin from ".."; import { ScreenshareSettingsModal } from "../components"; -import { PluginInfo } from "../constants"; import { screenshareAudioStore, screenshareStore } from "../stores"; const onScreenshareModalDone = () => { @@ -49,7 +49,6 @@ export const openScreenshareModal = onDone={onScreenshareModalDone} screenshareStore={screenshareStore} screenshareAudioStore={screenshareAudioStore} - author={PluginInfo.AUTHOR} - contributors={Object.values(PluginInfo.CONTRIBUTORS)} + author={Devs.philhk} {...props} />; }); diff --git a/src/equicordplugins/betterScreenshare.desktop/patchers/screenshare.ts b/src/equicordplugins/betterScreenshare.desktop/patchers/screenshare.ts index 51aadbed..bd9a3b93 100644 --- a/src/equicordplugins/betterScreenshare.desktop/patchers/screenshare.ts +++ b/src/equicordplugins/betterScreenshare.desktop/patchers/screenshare.ts @@ -20,7 +20,6 @@ import { UserStore } from "@webpack/common"; import { Emitter, MediaEngineStore, Patcher, types } from "../../philsPluginLibrary"; import { patchConnectionVideoSetDesktopSourceWithOptions, patchConnectionVideoTransportOptions } from "../../philsPluginLibrary/patches/video"; -import { PluginInfo } from "../constants"; import { logger } from "../logger"; import { screenshareStore } from "../stores"; @@ -87,7 +86,7 @@ export class ScreensharePatcher extends Patcher { "on", "connection", connectionEventFunction, - PluginInfo.PLUGIN_NAME + "BetterScreenshare" ); return this; diff --git a/src/equicordplugins/betterScreenshare.desktop/patchers/screenshareAudio.ts b/src/equicordplugins/betterScreenshare.desktop/patchers/screenshareAudio.ts index 64205057..6dbdf598 100644 --- a/src/equicordplugins/betterScreenshare.desktop/patchers/screenshareAudio.ts +++ b/src/equicordplugins/betterScreenshare.desktop/patchers/screenshareAudio.ts @@ -19,7 +19,6 @@ import { UserStore } from "@webpack/common"; import { Emitter, MediaEngineStore, patchConnectionAudioTransportOptions, Patcher, types } from "../../philsPluginLibrary"; -import { PluginInfo } from "../constants"; import { logger } from "../logger"; import { screenshareAudioStore } from "../stores/screenshareAudioStore"; @@ -73,7 +72,7 @@ export class ScreenshareAudioPatcher extends Patcher { "on", "connection", connectionEventFunction, - PluginInfo.PLUGIN_NAME + "BetterScreenshare" ); return this; diff --git a/src/equicordplugins/betterScreenshare.desktop/patches/screenshareModal.tsx b/src/equicordplugins/betterScreenshare.desktop/patches/screenshareModal.tsx index 4b069df0..05b8fb17 100644 --- a/src/equicordplugins/betterScreenshare.desktop/patches/screenshareModal.tsx +++ b/src/equicordplugins/betterScreenshare.desktop/patches/screenshareModal.tsx @@ -23,7 +23,6 @@ import { Settings } from "Vencord"; import { SettingsModalCard, SettingsModalCardItem } from "../../philsPluginLibrary"; import Plugin from ".."; import { AudioSourceSelect, OpenScreenshareSettingsButton } from "../components"; -import { PluginInfo } from "../constants"; import { screenshareStore } from "../stores"; const ReplacedStreamSettings = () => { @@ -59,7 +58,7 @@ const ReplacedStreamSettings = () => { }; export function replacedScreenshareModalSettingsContentType(oldType: (...args: any[]) => any, thisContext: any, functionArguments: any) { - const { hideDefaultSettings } = Settings.plugins[PluginInfo.PLUGIN_NAME]; + const { hideDefaultSettings } = Settings.plugins.BetterScreenshare; const oldTypeResult = Reflect.apply(oldType, thisContext, functionArguments); if (hideDefaultSettings) diff --git a/src/equicordplugins/betterScreenshare.desktop/stores/screenshareAudioStore.ts b/src/equicordplugins/betterScreenshare.desktop/stores/screenshareAudioStore.ts index 685ad6b7..d05483df 100644 --- a/src/equicordplugins/betterScreenshare.desktop/stores/screenshareAudioStore.ts +++ b/src/equicordplugins/betterScreenshare.desktop/stores/screenshareAudioStore.ts @@ -23,13 +23,12 @@ import { microphoneStoreDefault as screenshareAudioStoreDefault } from "../../betterMicrophone.desktop/stores"; import { createPluginStore, ProfilableStore, profileable } from "../../philsPluginLibrary"; -import { PluginInfo } from "../constants"; export let screenshareAudioStore: ProfilableStore; export const initScreenshareAudioStore = () => screenshareAudioStore = createPluginStore( - PluginInfo.PLUGIN_NAME, + "BetterScreenshare", "ScreenshareAudioStore", profileable( screenshareAudioStoreDefault, diff --git a/src/equicordplugins/betterScreenshare.desktop/stores/screenshareStore.ts b/src/equicordplugins/betterScreenshare.desktop/stores/screenshareStore.ts index 7b9d0ed0..94461e68 100644 --- a/src/equicordplugins/betterScreenshare.desktop/stores/screenshareStore.ts +++ b/src/equicordplugins/betterScreenshare.desktop/stores/screenshareStore.ts @@ -17,7 +17,6 @@ */ import { createPluginStore, ProfilableInitializer, ProfilableStore, profileable, ProfileableProfile } from "../../philsPluginLibrary"; -import { PluginInfo } from "../constants"; export interface ScreenshareProfile { @@ -112,7 +111,7 @@ export let screenshareStore: ProfilableStore screenshareStore = createPluginStore( - PluginInfo.PLUGIN_NAME, + "BetterScreenshare", "ScreenshareStore", profileable( screenshareStoreDefault, diff --git a/src/equicordplugins/philsPluginLibrary/constants/constants.ts b/src/equicordplugins/philsPluginLibrary/constants/constants.ts deleted file mode 100644 index f92808c1..00000000 --- a/src/equicordplugins/philsPluginLibrary/constants/constants.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { Devs } from "@utils/constants"; - -import * as types from "../types/constants"; - -export const PluginInfo: types.PluginInfo = { - PLUGIN_NAME: "PhilsPluginLibrary", - DESCRIPTION: "A library for phil's plugins", - AUTHOR: { - ...Devs.philhk, - github: "https://github.com/philhk" - }, -} as const; diff --git a/src/equicordplugins/philsPluginLibrary/constants/index.ts b/src/equicordplugins/philsPluginLibrary/constants/index.ts deleted file mode 100644 index c7b948ab..00000000 --- a/src/equicordplugins/philsPluginLibrary/constants/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -export * from "./constants"; diff --git a/src/equicordplugins/philsPluginLibrary/index.tsx b/src/equicordplugins/philsPluginLibrary/index.tsx index 57b45f83..833aa958 100644 --- a/src/equicordplugins/philsPluginLibrary/index.tsx +++ b/src/equicordplugins/philsPluginLibrary/index.tsx @@ -16,33 +16,24 @@ * along with this program. If not, see . */ -import { Patch, PluginAuthor, PluginDef } from "@utils/types"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; -import { PluginInfo } from "./constants"; import { replacedUserPanelComponent } from "./patches"; -export default new class Plugin implements PluginDef { - readonly name: string; - readonly description: string; - readonly authors: PluginAuthor[]; - readonly patches: Omit[]; - - readonly replacedUserPanelComponent: typeof replacedUserPanelComponent; - - constructor() { - this.name = PluginInfo.PLUGIN_NAME; - this.description = PluginInfo.DESCRIPTION; - this.authors = PluginInfo.AUTHORS as PluginAuthor[]; - this.patches = [{ - find: "Messages.ACCOUNT_A11Y_LABEL", - replacement: { - match: /(?<=function)( .{0,8}(?={).)(.{0,1000}isFullscreenInContext\(\).+?\)]}\))(})/, - replace: "$1return $self.replacedUserPanelComponent(function(){$2}, this, arguments)$3" - } - }]; - this.replacedUserPanelComponent = replacedUserPanelComponent; - } -}; +export default definePlugin({ + name: "PhilsPluginLibrary", + description: "A library for phil's plugins", + authors: [Devs.philhk], + patches: [{ + find: "Messages.ACCOUNT_A11Y_LABEL", + replacement: { + match: /(?<=function)( .{0,8}(?={).)(.{0,1000}isFullscreenInContext\(\).+?\)]}\))(})/, + replace: "$1return $self.replacedUserPanelComponent(function(){$2}, this, arguments)$3" + } + }], + replacedUserPanelComponent: replacedUserPanelComponent +}); export * from "./components"; export * from "./discordModules";