diff --git a/src/renderer/patches/enableNotificationsByDefault.ts b/src/renderer/patches/enableNotificationsByDefault.ts new file mode 100644 index 0000000..9d0001c --- /dev/null +++ b/src/renderer/patches/enableNotificationsByDefault.ts @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3. + * Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop! + */ + +import { addPatch } from "./shared"; + +addPatch({ + patches: [ + { + find: '"NotificationSettingsStore', + replacement: { + // FIXME: fix eslint rule + // eslint-disable-next-line no-useless-escape + match: /\.isPlatformEmbedded(?=\?\i\.DesktopNotificationTypes\.ALL)/g, + replace: "$&||true" + } + } + ] +}); diff --git a/src/renderer/patches/hideSwitchDevice.tsx b/src/renderer/patches/hideSwitchDevice.tsx new file mode 100644 index 0000000..b4abd2a --- /dev/null +++ b/src/renderer/patches/hideSwitchDevice.tsx @@ -0,0 +1,24 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3. + * Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop! + */ + +import { addPatch } from "./shared"; + +addPatch({ + patches: [ + { + find: "lastOutputSystemDevice.justChanged", + replacement: { + // eslint-disable-next-line no-useless-escape + match: /(\i)\.default\.getState\(\).neverShowModal/, + replace: "$& || $self.shouldIgnore($1)" + } + } + ], + + shouldIgnore(state: any) { + return Object.keys(state?.default?.lastDeviceConnected ?? {})?.[0] === "vencord-screen-share"; + } +}); diff --git a/src/renderer/patches/hideVenmicInput.tsx b/src/renderer/patches/hideVenmicInput.tsx new file mode 100644 index 0000000..c0b73d9 --- /dev/null +++ b/src/renderer/patches/hideVenmicInput.tsx @@ -0,0 +1,25 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3. + * Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop! + */ + +import { addPatch } from "./shared"; + +addPatch({ + patches: [ + { + find: 'setSinkId"in', + replacement: { + // eslint-disable-next-line no-useless-escape + match: /return (\i)\?navigator\.mediaDevices\.enumerateDevices/, + replace: "return $1 ? $self.filteredDevices" + } + } + ], + + async filteredDevices() { + const original = await navigator.mediaDevices.enumerateDevices(); + return original.filter(x => x.label !== "vencord-screen-share"); + } +}); diff --git a/src/renderer/patches/index.ts b/src/renderer/patches/index.ts new file mode 100644 index 0000000..ffb379a --- /dev/null +++ b/src/renderer/patches/index.ts @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3. + * Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop! + */ + +// TODO: Possibly auto generate glob if we have more patches in the future +import "./enableNotificationsByDefault"; +import "./platformClass"; +import "./hideSwitchDevice"; +import "./hideVenmicInput"; +import "./screenShareFixes"; +import "./spellCheck"; +import "./windowsTitleBar"; diff --git a/src/renderer/patches/platformClass.tsx b/src/renderer/patches/platformClass.tsx new file mode 100644 index 0000000..f2cda02 --- /dev/null +++ b/src/renderer/patches/platformClass.tsx @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: GPL-3.0 + * Aerocord, a vesktop fork for older microsoft NT releases such as NT 6.0, 6.1, 6.2 and 6.3. + * Credits to vendicated and the rest of the vesktop contribuitors for making Vesktop! + */ + +import { Settings } from "renderer/settings"; +import { isMac } from "renderer/utils"; + +import { addPatch } from "./shared"; + +addPatch({ + patches: [ + { + find: "platform-web", + replacement: { + // eslint-disable-next-line no-useless-escape + match: /(?<=" platform-overlay"\):)\i/, + replace: "$self.getPlatformClass()" + } + } + ], + + getPlatformClass() { + if (Settings.store.customTitleBar) return "platform-win"; + if (isMac) return "platform-osx"; + return "platform-web"; + } +});