diff options
author | Vendicated <vendicated@riseup.net> | 2023-04-05 04:09:42 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2023-04-05 04:09:42 +0200 |
commit | 676bc612d96c3d1d7c7a80e62bf8e50a2a6fb74b (patch) | |
tree | abb127ffe188202339dae149e8afee3b2d22b36e | |
parent | d8a5e430340c22ba348c0ec62f4cf788a59f049d (diff) | |
download | Vencord-676bc612d96c3d1d7c7a80e62bf8e50a2a6fb74b.tar.gz Vencord-676bc612d96c3d1d7c7a80e62bf8e50a2a6fb74b.tar.bz2 Vencord-676bc612d96c3d1d7c7a80e62bf8e50a2a6fb74b.zip |
VencordDesktop: Include web plugins & use proper showItemInFolder
-rwxr-xr-x | scripts/build/build.mjs | 4 | ||||
-rw-r--r-- | scripts/build/buildWeb.mjs | 2 | ||||
-rw-r--r-- | scripts/build/common.mjs | 12 | ||||
-rw-r--r-- | src/components/VencordSettings/VencordTab.tsx | 7 | ||||
-rw-r--r-- | src/plugins/apiContextMenu.ts | 2 | ||||
-rw-r--r-- | src/plugins/noRPC.discordDesktop.ts (renamed from src/plugins/noRPC.desktop.ts) | 0 | ||||
-rw-r--r-- | src/plugins/noSystemBadge.discordDesktop.ts (renamed from src/plugins/noSystemBadge.desktop.ts) | 0 | ||||
-rw-r--r-- | src/plugins/volumeBooster.discordDesktop.ts (renamed from src/plugins/volumeBooster.desktop.ts) | 0 | ||||
-rw-r--r-- | src/utils/native.ts | 7 |
9 files changed, 21 insertions, 13 deletions
diff --git a/scripts/build/build.mjs b/scripts/build/build.mjs index a4b06f5..45cda74 100755 --- a/scripts/build/build.mjs +++ b/scripts/build/build.mjs @@ -80,7 +80,7 @@ await Promise.all([ globalName: "Vencord", sourcemap, plugins: [ - globPlugins, + globPlugins("discordDesktop"), ...commonOpts.plugins ], define: { @@ -114,7 +114,7 @@ await Promise.all([ globalName: "Vencord", sourcemap, plugins: [ - globPlugins, + globPlugins("vencordDesktop"), ...commonOpts.plugins ], define: { diff --git a/scripts/build/buildWeb.mjs b/scripts/build/buildWeb.mjs index df75d35..98d56b0 100644 --- a/scripts/build/buildWeb.mjs +++ b/scripts/build/buildWeb.mjs @@ -38,7 +38,7 @@ const commonOptions = { format: "iife", external: ["plugins", "git-hash", "/assets/*"], plugins: [ - globPlugins, + globPlugins("web"), ...commonOpts.plugins, ], target: ["esnext"], diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs index 53eb23f..7ff599a 100644 --- a/scripts/build/common.mjs +++ b/scripts/build/common.mjs @@ -48,9 +48,9 @@ export const makeAllPackagesExternalPlugin = { }; /** - * @type {import("esbuild").Plugin} + * @type {(kind: "web" | "discordDesktop" | "vencordDesktop") => import("esbuild").Plugin} */ -export const globPlugins = { +export const globPlugins = kind => ({ name: "glob-plugins", setup: build => { const filter = /^~plugins$/; @@ -76,8 +76,10 @@ export const globPlugins = { if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) { const mod = fileBits.at(-2); if (mod === "dev" && !watch) continue; - if (mod === "web" && !isWeb) continue; - if (mod === "desktop" && isWeb) continue; + if (mod === "web" && kind === "discordDesktop") continue; + if (mod === "desktop" && kind === "web") continue; + if (mod === "discordDesktop" && kind !== "discordDesktop") continue; + if (mod === "vencordDesktop" && kind !== "vencordDesktop") continue; } const mod = `p${i}`; @@ -93,7 +95,7 @@ export const globPlugins = { }; }); } -}; +}); /** * @type {import("esbuild").Plugin} diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index 8b86968..3bdd9b7 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -26,7 +26,7 @@ import { ErrorCard } from "@components/ErrorCard"; import IpcEvents from "@utils/IpcEvents"; import { Margins } from "@utils/margins"; import { identity, useAwaiter } from "@utils/misc"; -import { relaunch } from "@utils/native"; +import { relaunch, showItemInFolder } from "@utils/native"; import { Button, Card, Forms, React, Select, Slider, Switch } from "@webpack/common"; const cl = classNameFactory("vc-settings-"); @@ -65,7 +65,7 @@ function VencordSettings() { title: "Enable React Developer Tools", note: "Requires a full restart" }, - !IS_WEB && (!isWindows ? { + !IS_WEB && (!IS_DISCORD_DESKTOP || !isWindows ? { key: "frameless", title: "Disable the window frame", note: "Requires a full restart" @@ -112,8 +112,7 @@ function VencordSettings() { Open QuickCSS File </Button> <Button - // FIXME: Vencord Desktop support - onClick={() => window.DiscordNative.fileManager.showItemInFolder(settingsDir)} + onClick={() => showItemInFolder(settingsDir)} size={Button.Sizes.SMALL} disabled={settingsDirPending}> Open Settings Folder diff --git a/src/plugins/apiContextMenu.ts b/src/plugins/apiContextMenu.ts index aeaa0c4..cb85c4f 100644 --- a/src/plugins/apiContextMenu.ts +++ b/src/plugins/apiContextMenu.ts @@ -35,7 +35,7 @@ export default definePlugin({ find: ".Menu,{", all: true, replacement: { - match: /(?<=\.jsxs?\)\(\i\.Menu,)\{/, + match: /(?<=\.jsxs?\)\(\i\.Menu,)\{/g, replace: "{contextMenuApiArguments:typeof arguments!=='undefined'?arguments:[]," } } diff --git a/src/plugins/noRPC.desktop.ts b/src/plugins/noRPC.discordDesktop.ts index ebd7b1a..ebd7b1a 100644 --- a/src/plugins/noRPC.desktop.ts +++ b/src/plugins/noRPC.discordDesktop.ts diff --git a/src/plugins/noSystemBadge.desktop.ts b/src/plugins/noSystemBadge.discordDesktop.ts index 591a0be..591a0be 100644 --- a/src/plugins/noSystemBadge.desktop.ts +++ b/src/plugins/noSystemBadge.discordDesktop.ts diff --git a/src/plugins/volumeBooster.desktop.ts b/src/plugins/volumeBooster.discordDesktop.ts index b77af57..b77af57 100644 --- a/src/plugins/volumeBooster.desktop.ts +++ b/src/plugins/volumeBooster.discordDesktop.ts diff --git a/src/utils/native.ts b/src/utils/native.ts index 70e4c0e..05fa0aa 100644 --- a/src/utils/native.ts +++ b/src/utils/native.ts @@ -22,3 +22,10 @@ export function relaunch() { else window.VencordDesktop.app.relaunch(); } + +export function showItemInFolder(path: string) { + if (IS_DISCORD_DESKTOP) + window.DiscordNative.fileManager.showItemInFolder(path); + else + window.VencordDesktop.fileManager.showItemInFolder(path); +} |