refactor: review suggestions
This commit is contained in:
parent
95acf9cdb4
commit
e52d82daab
1 changed files with 9 additions and 5 deletions
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
import { PatchBay } from "@vencord/venmic";
|
||||
import type { PatchBay } from "@vencord/venmic";
|
||||
import { app, ipcMain } from "electron";
|
||||
import { join } from "path";
|
||||
import { IpcEvents } from "shared/IpcEvents";
|
||||
|
@ -55,14 +55,16 @@ ipcMain.handle(IpcEvents.VIRT_MIC_LIST, () => {
|
|||
});
|
||||
|
||||
ipcMain.handle(IpcEvents.VIRT_MIC_START, (_, targets: string[], workaround?: boolean) => {
|
||||
const pid = getRendererAudioServicePid();
|
||||
|
||||
const data: LinkData = {
|
||||
include: targets.map(target => ({ key: "application.name", value: target })),
|
||||
exclude: [{ key: "application.process.id", value: getRendererAudioServicePid() }]
|
||||
exclude: [{ key: "application.process.id", value: pid }]
|
||||
};
|
||||
|
||||
if (workaround) {
|
||||
data.workaround = [
|
||||
{ key: "application.process.id", value: getRendererAudioServicePid() },
|
||||
{ key: "application.process.id", value: pid },
|
||||
{ key: "media.name", value: "RecordStream" }
|
||||
];
|
||||
}
|
||||
|
@ -71,13 +73,15 @@ ipcMain.handle(IpcEvents.VIRT_MIC_START, (_, targets: string[], workaround?: boo
|
|||
});
|
||||
|
||||
ipcMain.handle(IpcEvents.VIRT_MIC_START_SYSTEM, (_, workaround?: boolean) => {
|
||||
const pid = getRendererAudioServicePid();
|
||||
|
||||
const data: LinkData = {
|
||||
exclude: [{ key: "application.process.id", value: getRendererAudioServicePid() }]
|
||||
exclude: [{ key: "application.process.id", value: pid }]
|
||||
};
|
||||
|
||||
if (workaround) {
|
||||
data.workaround = [
|
||||
{ key: "application.process.id", value: getRendererAudioServicePid() },
|
||||
{ key: "application.process.id", value: pid },
|
||||
{ key: "media.name", value: "RecordStream" }
|
||||
];
|
||||
}
|
||||
|
|
Reference in a new issue