further work on vencord

This commit is contained in:
Malte Jürgens
2022-10-22 23:56:49 +02:00
parent 0493a76117
commit 9eae8bbe4f
6 changed files with 122 additions and 40 deletions

View File

@@ -21,9 +21,9 @@ window.VencordNative = {
webclass.vencordSend(event, args);
},
sendSync: (event: string, ...args: any[]) => {
// We need this hack because Vencord requires its settings right when it starts
if (event === "VencordGetSettings") {
console.log("stub: IPC VencordGetSettings");
return "{}";
return window.discordScreenaudioVencordSettings || "{}";
} else throw new Error("Synchroneous IPC not implemented");
},
on(event: string, listener: () => {}) {
@@ -34,6 +34,9 @@ window.VencordNative = {
},
invoke: async (event: string, ...args: any[]) => {
await prepareWebclass();
if (event === "VencordSetSettings") {
window.discordScreenaudioVencordSettings = args[0];
}
return webclass.vencordSend(event, args);
},
},

View File

@@ -0,0 +1,46 @@
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 8ffe111..8f037bd 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -61,37 +61,22 @@ export default ErrorBoundary.wrap(function Settings() {
Settings Directory: <code style={{ userSelect: "text", cursor: "text" }}>{settingsDir}</code>
</Forms.FormText>
- {!IS_WEB && <Flex className={Margins.marginBottom20} style={{ marginTop: 8 }}>
+ <Flex className={Margins.marginBottom20} style={{ marginTop: 8 }}>
<Button
- onClick={() => window.DiscordNative.app.relaunch()}
- size={Button.Sizes.SMALL}
- color={Button.Colors.GREEN}
- >
- Reload
- </Button>
- <Button
- onClick={() => window.DiscordNative.fileManager.showItemInFolder(settingsDir)}
+ onClick={() => VencordNative.ipc.send(IpcEvents.OPEN_EXTERNAL, settingsDir)}
size={Button.Sizes.SMALL}
disabled={settingsDirPending}
>
Launch Directory
</Button>
<Button
- onClick={() => VencordNative.ipc.invoke(IpcEvents.OPEN_MONACO_EDITOR)}
+ onClick={() => VencordNative.ipc.send(IpcEvents.OPEN_EXTERNAL, settingsDir + "/quickCss.css")}
size={Button.Sizes.SMALL}
disabled={settingsDir === "Loading..."}
>
Open QuickCSS File
</Button>
- </Flex>}
-
- {IS_WEB && <Button
- onClick={launchMonacoEditor}
- size={Button.Sizes.SMALL}
- disabled={settingsDir === "Loading..."}
- >
- Open QuickCSS File
- </Button>}
+ </Flex>
<Forms.FormDivider />
<Switch

File diff suppressed because one or more lines are too long