VencordDesktop: Include web plugins & use proper showItemInFolder

This commit is contained in:
Vendicated 2023-04-05 04:09:42 +02:00
parent d8a5e43034
commit 676bc612d9
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
9 changed files with 21 additions and 13 deletions

View file

@ -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

View file

@ -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:[],"
}
}

View file

@ -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);
}