diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/globals.d.ts | 3 | ||||
-rw-r--r-- | src/plugins/arRPC.web.tsx (renamed from src/plugins/arRPC.tsx) | 4 | ||||
-rw-r--r-- | src/plugins/consoleShortcuts.ts | 8 | ||||
-rw-r--r-- | src/plugins/devCompanion.dev.tsx | 7 | ||||
-rw-r--r-- | src/plugins/noRPC.desktop.ts (renamed from src/plugins/noRPC.ts) | 1 | ||||
-rw-r--r-- | src/plugins/noSystemBadge.desktop.ts (renamed from src/plugins/noSystemBadge.ts) | 1 | ||||
-rw-r--r-- | src/plugins/richerCider.desktop.tsx (renamed from src/plugins/richerCider.tsx) | 134 | ||||
-rw-r--r-- | src/plugins/volumeBooster.desktop.ts (renamed from src/plugins/volumeBooster.ts) | 0 | ||||
-rw-r--r-- | src/plugins/webContextMenus.web.ts (renamed from src/plugins/webContextMenus.ts) | 2 | ||||
-rw-r--r-- | src/utils/types.ts | 4 |
10 files changed, 80 insertions, 84 deletions
diff --git a/src/globals.d.ts b/src/globals.d.ts index 6c5b437..7c494e2 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -51,8 +51,7 @@ declare global { * Only available when running in Electron, undefined on web. * Thus, avoid using this or only use it inside an {@link IS_WEB} guard. * - * If you really must use it, mark your plugin as Desktop App only via - * `target: "DESKTOP"` + * If you really must use it, mark your plugin as Desktop App only by naming it Foo.desktop.ts(x) */ export var DiscordNative: any; diff --git a/src/plugins/arRPC.tsx b/src/plugins/arRPC.web.tsx index ca94a0e..9a16c64 100644 --- a/src/plugins/arRPC.tsx +++ b/src/plugins/arRPC.web.tsx @@ -48,7 +48,6 @@ export default definePlugin({ name: "WebRichPresence (arRPC)", description: "Client plugin for arRPC to enable RPC on Discord Web (experimental)", authors: [Devs.Ducko], - target: "WEB", settingsAboutComponent: () => ( <> @@ -60,6 +59,9 @@ export default definePlugin({ ), async start() { + // ArmCord comes with its own arRPC implementation, so this plugin just confuses users + if ("armcord" in window) return; + if (ws) ws.close(); ws = new WebSocket("ws://127.0.0.1:1337"); // try to open WebSocket diff --git a/src/plugins/consoleShortcuts.ts b/src/plugins/consoleShortcuts.ts index 83b5291..70a9875 100644 --- a/src/plugins/consoleShortcuts.ts +++ b/src/plugins/consoleShortcuts.ts @@ -32,14 +32,14 @@ export default definePlugin({ authors: [Devs.Ven], getShortcuts() { - function newFindWrapper(filterFactory: (props: any) => Webpack.FilterFn) { - const cache = new Map<string, any>(); + function newFindWrapper(filterFactory: (...props: any[]) => Webpack.FilterFn) { + const cache = new Map<string, unknown>(); - return function (filterProps: any) { + return function (...filterProps: unknown[]) { const cacheKey = String(filterProps); if (cache.has(cacheKey)) return cache.get(cacheKey); - const matches = findAll(filterFactory(filterProps)); + const matches = findAll(filterFactory(...filterProps)); const result = (() => { switch (matches.length) { diff --git a/src/plugins/devCompanion.dev.tsx b/src/plugins/devCompanion.dev.tsx index 1dbf4ca..cea71e0 100644 --- a/src/plugins/devCompanion.dev.tsx +++ b/src/plugins/devCompanion.dev.tsx @@ -112,7 +112,7 @@ function initWs(isManual = false) { }); ws.addEventListener("close", e => { - if (!wasConnected && !hasErrored) return; + if (!wasConnected || hasErrored) return; logger.info("Dev Companion Disconnected:", e.code, e.reason); @@ -204,8 +204,9 @@ function initWs(isManual = false) { return reply("Unknown Find Type " + type); } - if (results.length === 0) throw "No results"; - if (results.length > 1) throw "Found more than one result! Make this filter more specific"; + const uniqueResultsCount = new Set(results).size; + if (uniqueResultsCount === 0) throw "No results"; + if (uniqueResultsCount > 1) throw "Found more than one result! Make this filter more specific"; } catch (err) { return reply("Failed to find: " + err); } diff --git a/src/plugins/noRPC.ts b/src/plugins/noRPC.desktop.ts index a78cc27..ebd7b1a 100644 --- a/src/plugins/noRPC.ts +++ b/src/plugins/noRPC.desktop.ts @@ -25,7 +25,6 @@ export default definePlugin({ name: "NoRPC", description: "Disables Discord's RPC server.", authors: [Devs.Cyn], - target: "DESKTOP", patches: [ { find: '.ensureModule("discord_rpc")', diff --git a/src/plugins/noSystemBadge.ts b/src/plugins/noSystemBadge.desktop.ts index e487a97..591a0be 100644 --- a/src/plugins/noSystemBadge.ts +++ b/src/plugins/noSystemBadge.desktop.ts @@ -23,7 +23,6 @@ export default definePlugin({ name: "NoSystemBadge", description: "Disables the taskbar and system tray unread count badge.", authors: [Devs.rushii], - target: "DESKTOP", patches: [ { find: "setSystemTrayApplications:function", diff --git a/src/plugins/richerCider.tsx b/src/plugins/richerCider.desktop.tsx index 08b0096..8b6fb5e 100644 --- a/src/plugins/richerCider.tsx +++ b/src/plugins/richerCider.desktop.tsx @@ -1,67 +1,67 @@ -/*
- * Vencord, a modification for Discord's desktop app
- * Copyright (c) 2022 OpenAsar
- *
- * 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 <https://www.gnu.org/licenses/>.
-*/
-
-import { Link } from "@components/Link";
-import definePlugin from "@utils/types";
-import { Forms } from "@webpack/common";
-const appIds = [
- "911790844204437504",
- "886578863147192350",
- "1020414178047041627",
- "1032800329332445255"
-];
-export default definePlugin({
- name: "richerCider",
- description: "Enhances Cider (More details in info button) by adding the \"Listening to\" type prefix to the user's rich presence when an applicable ID is found.",
- authors: [{
- id: 191621342473224192n,
- name: "cryptofyre",
- }],
- patches: [
- {
- find: '.displayName="LocalActivityStore"',
- replacement: {
- match: /LOCAL_ACTIVITY_UPDATE:function\((\i)\)\{/,
- replace: "$&$self.patchActivity($1.activity);",
- }
- }
- ],
- settingsAboutComponent: () => (
- <>
- <Forms.FormTitle tag="h3">Install Cider to use this Plugin</Forms.FormTitle>
- <Forms.FormText>
- <Link href="https://cider.sh">Follow the link to our website</Link> to get Cider up and running, and then enable the plugin.
- </Forms.FormText>
- <br></br>
- <Forms.FormTitle tag="h3">What is Cider?</Forms.FormTitle>
- <Forms.FormText>
- Cider is an open-source and community oriented Apple Music client for Windows, macOS, and Linux.
- </Forms.FormText>
- <br></br>
- <Forms.FormTitle tag="h3">Recommended Optional Plugins</Forms.FormTitle>
- <Forms.FormText>
- I'd recommend using TimeBarAllActivities alongside this plugin to give off a much better visual to the eye (Keep in mind this only affects your client and will not show for other users)
- </Forms.FormText>
- </>
- ),
- patchActivity(activity: any) {
- if (appIds.includes(activity.application_id)) {
- activity.type = 2; /* LISTENING type */
- }
- },
-});
+/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2022 OpenAsar + * + * 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 <https://www.gnu.org/licenses/>. +*/ + +import { Link } from "@components/Link"; +import definePlugin from "@utils/types"; +import { Forms } from "@webpack/common"; +const appIds = [ + "911790844204437504", + "886578863147192350", + "1020414178047041627", + "1032800329332445255" +]; +export default definePlugin({ + name: "richerCider", + description: "Enhances Cider (More details in info button) by adding the \"Listening to\" type prefix to the user's rich presence when an applicable ID is found.", + authors: [{ + id: 191621342473224192n, + name: "cryptofyre", + }], + patches: [ + { + find: '.displayName="LocalActivityStore"', + replacement: { + match: /LOCAL_ACTIVITY_UPDATE:function\((\i)\)\{/, + replace: "$&$self.patchActivity($1.activity);", + } + } + ], + settingsAboutComponent: () => ( + <> + <Forms.FormTitle tag="h3">Install Cider to use this Plugin</Forms.FormTitle> + <Forms.FormText> + <Link href="https://cider.sh">Follow the link to our website</Link> to get Cider up and running, and then enable the plugin. + </Forms.FormText> + <br></br> + <Forms.FormTitle tag="h3">What is Cider?</Forms.FormTitle> + <Forms.FormText> + Cider is an open-source and community oriented Apple Music client for Windows, macOS, and Linux. + </Forms.FormText> + <br></br> + <Forms.FormTitle tag="h3">Recommended Optional Plugins</Forms.FormTitle> + <Forms.FormText> + I'd recommend using TimeBarAllActivities alongside this plugin to give off a much better visual to the eye (Keep in mind this only affects your client and will not show for other users) + </Forms.FormText> + </> + ), + patchActivity(activity: any) { + if (appIds.includes(activity.application_id)) { + activity.type = 2; /* LISTENING type */ + } + }, +}); diff --git a/src/plugins/volumeBooster.ts b/src/plugins/volumeBooster.desktop.ts index 7d81449..7d81449 100644 --- a/src/plugins/volumeBooster.ts +++ b/src/plugins/volumeBooster.desktop.ts diff --git a/src/plugins/webContextMenus.ts b/src/plugins/webContextMenus.web.ts index 6419cfd..56990e1 100644 --- a/src/plugins/webContextMenus.ts +++ b/src/plugins/webContextMenus.web.ts @@ -23,7 +23,7 @@ export default definePlugin({ name: "WebContextMenus", description: "Re-adds some of context menu items missing on the web version of Discord, namely Copy/Open Link", authors: [Devs.Ven], - target: "WEB", + enabledByDefault: true, patches: [{ // There is literally no reason for Discord to make this Desktop only. diff --git a/src/utils/types.ts b/src/utils/types.ts index 96aa4ab..76a3d74 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -80,10 +80,6 @@ export interface PluginDef { */ enabledByDefault?: boolean; /** - * Set this if your plugin only works on Browser or Desktop, not both - */ - target?: "WEB" | "DESKTOP" | "BOTH"; - /** * Optionally provide settings that the user can configure in the Plugins tab of settings. * @deprecated Use `settings` instead */ |