From e52d82daababd2cf10dc4e341fe516cce5bedfad Mon Sep 17 00:00:00 2001 From: Curve Date: Thu, 25 Jan 2024 08:55:35 +0100 Subject: [PATCH] refactor: review suggestions --- src/main/venmic.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/venmic.ts b/src/main/venmic.ts index 8b9142a..c6f9d44 100644 --- a/src/main/venmic.ts +++ b/src/main/venmic.ts @@ -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" } ]; }