Merge remote-tracking branch 'origin/main' into global-shortcuts

This commit is contained in:
Vendicated
2026-07-21 15:41:10 +02:00
25 changed files with 1588 additions and 2170 deletions
+5 -5
View File
@@ -14,13 +14,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4 # Install pnpm using packageManager key in package.json
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
- name: Install dependencies
run: pnpm i
+5 -5
View File
@@ -22,13 +22,13 @@ jobs:
platform: windows
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4 # Install pnpm using packageManager key in package.json
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
cache: "pnpm"
- name: Install dependencies
+5 -5
View File
@@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4 # Install pnpm using packageManager key in package.json
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 20
node-version: 24
cache: "pnpm"
- name: Install dependencies
-2
View File
@@ -1,2 +0,0 @@
node-linker=hoisted
package-manager-strict=false
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
+1
View File
@@ -0,0 +1 @@
designated => certificate leaf = H"a7718adf9b038153ba0576411cb131c87fa1d11e" or anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "N3WUQV79ZX"
+17 -27
View File
@@ -28,7 +28,7 @@
},
"dependencies": {
"arrpc": "github:OpenAsar/arrpc#2234e9c9111f4c42ebcc3aa6a2215bfd979eef77",
"electron-updater": "^6.6.2"
"electron-updater": "6.6.2"
},
"optionalDependencies": {
"@vencord/venmic": "^6.1.0"
@@ -36,34 +36,34 @@
"devDependencies": {
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@stylistic/eslint-plugin": "^5.10.0",
"@types/node": "^25.5.0",
"@types/node": "^26.0.1",
"@types/react": "19.2.9",
"@vencord/types": "^1.14.1",
"dotenv": "^17.3.1",
"electron": "^41.0.4",
"electron-builder": "^26.8.1",
"esbuild": "^0.27.4",
"eslint": "^10.1.0",
"electron": "^43.0.0",
"electron-builder": "^26.15.3",
"esbuild": "^0.28.1",
"eslint": "^10.6.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-path-alias": "^2.1.0",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-simple-header": "^1.2.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-simple-import-sort": "^13.0.0",
"eslint-plugin-unused-imports": "^4.4.1",
"libvesktop": "link:packages/libvesktop",
"prettier": "^3.8.1",
"prettier": "^3.9.4",
"source-map-support": "^0.5.21",
"tsx": "^4.21.0",
"type-fest": "^5.5.0",
"typescript": "^6.0.2",
"typescript-eslint": "^8.57.2",
"tsx": "^4.22.4",
"type-fest": "^5.7.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.62.1",
"xml-formatter": "^3.6.7"
},
"packageManager": "pnpm@10.7.1",
"packageManager": "pnpm@11.9.0",
"engines": {
"node": ">=18",
"pnpm": ">=8"
"node": ">=22",
"pnpm": ">=11"
},
"build": {
"appId": "dev.vencord.vesktop",
@@ -149,6 +149,7 @@
"com.apple.security.device.camera": true,
"CFBundleIconName": "Icon"
},
"requirements": "build/signing-requirements.txt",
"notarize": true
},
"dmg": {
@@ -213,16 +214,5 @@
"loadBrowserProcessSpecificV8Snapshot": false,
"grantFileProtocolExtraPrivileges": false
}
},
"pnpm": {
"patchedDependencies": {
"arrpc@3.5.0": "patches/arrpc@3.5.0.patch",
"electron-updater": "patches/electron-updater.patch"
},
"onlyBuiltDependencies": [
"@vencord/venmic",
"electron",
"esbuild"
]
}
}
+1204 -1895
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
patchedDependencies:
arrpc@3.5.0: patches/arrpc@3.5.0.patch
electron-updater: patches/electron-updater.patch
nodeLinker: hoisted
allowBuilds:
"@vencord/venmic": true
electron: true
electron-winstaller: false
esbuild: true
pmOnFail: warn
verifyDepsBeforeRun: warn
recursiveInstall: false
packages:
- packages/*
minimumReleaseAgeExclude:
- electron
+5 -1
View File
@@ -73,7 +73,11 @@ function makeAutoStartLinuxPortal() {
}
const autoStartWindowsMac: AutoStart = {
isEnabled: () => app.getLoginItemSettings().openAtLogin,
isEnabled: () => {
const { openAtLogin, executableWillLaunchAtLogin } = app.getLoginItemSettings();
// Windows only reports openAtLogin as true when queried with the same args set in enable()
return openAtLogin || executableWillLaunchAtLogin;
},
enable: () =>
app.setLoginItemSettings({
openAtLogin: true,
+4
View File
@@ -48,6 +48,10 @@ const options = {
description:
"Run a predefined shortcut action (for custom key binds). Vesktop has to be open for this to have any effect",
argumentName: "action"
},
repair: {
type: "boolean",
description: "Repair the application by re-downloading the latest Vencord files"
}
} satisfies Record<string, Option>;
+7 -163
View File
@@ -1,173 +1,17 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* Copyright (c) 2026 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./cli";
import "./updater";
import "./ipc";
import "./userAssets";
import "./vesktopProtocol";
import { app } from "electron";
import { app, BrowserWindow, nativeTheme } from "electron";
import { IpcCommands } from "shared/IpcEvents";
// eslint-disable-next-line no-duplicate-imports
import { CommandLine } from "./cli";
import { DATA_DIR } from "./constants";
import { createFirstLaunchTour } from "./firstLaunch";
import { sendRendererCommand } from "./ipcCommands";
import { initSocket } from "./ipcSocket";
import { registerKeyBinds } from "./keyBinds";
import { createWindows, mainWin } from "./mainWindow";
import { registerMediaPermissionsHandler } from "./mediaPermissions";
import { registerScreenShareHandler } from "./screenShare";
import { Settings, State } from "./settings";
import { setAsDefaultProtocolClient } from "./utils/setAsDefaultProtocolClient";
import { isDeckGameMode } from "./utils/steamOS";
import { downloadVencordFiles } from "./utils/vencordLoader";
console.log("Vesktop v" + app.getVersion());
// Make the Vencord files use our DATA_DIR
process.env.VENCORD_USER_DATA_DIR = DATA_DIR;
const isLinux = process.platform === "linux";
export let enableHardwareAcceleration = true;
function init() {
setAsDefaultProtocolClient("discord");
const { disableSmoothScroll, hardwareAcceleration, hardwareVideoAcceleration } = Settings.store;
const enabledFeatures = new Set(app.commandLine.getSwitchValue("enable-features").split(","));
const disabledFeatures = new Set(app.commandLine.getSwitchValue("disable-features").split(","));
app.commandLine.removeSwitch("enable-features");
app.commandLine.removeSwitch("disable-features");
if (hardwareAcceleration === false || process.argv.includes("--disable-gpu")) {
enableHardwareAcceleration = false;
app.disableHardwareAcceleration();
} else {
if (hardwareVideoAcceleration) {
enabledFeatures.add("AcceleratedVideoEncoder");
enabledFeatures.add("AcceleratedVideoDecoder");
if (isLinux) {
enabledFeatures.add("AcceleratedVideoDecodeLinuxGL");
enabledFeatures.add("AcceleratedVideoDecodeLinuxZeroCopyGL");
}
}
}
if (disableSmoothScroll) {
app.commandLine.appendSwitch("disable-smooth-scrolling");
}
// Enable Wayland Portal for global shortcuts
enabledFeatures.add("GlobalShortcutsPortal");
// disable renderer backgrounding to prevent the app from unloading when in the background
// https://github.com/electron/electron/issues/2822
// https://github.com/GoogleChrome/chrome-launcher/blob/5a27dd574d47a75fec0fb50f7b774ebf8a9791ba/docs/chrome-flags-for-tools.md#task-throttling
app.commandLine.appendSwitch("disable-renderer-backgrounding");
app.commandLine.appendSwitch("disable-background-timer-throttling");
app.commandLine.appendSwitch("disable-backgrounding-occluded-windows");
if (process.platform === "win32") {
disabledFeatures.add("CalculateNativeWinOcclusion");
}
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling, MediaSessionService: Prevent Discord from registering as a media service.
disabledFeatures.add("WinRetrieveSuggestionsOnlyOnDemand");
disabledFeatures.add("HardwareMediaKeyHandling");
disabledFeatures.add("MediaSessionService");
if (isLinux) {
// Support TTS on Linux using https://wiki.archlinux.org/title/Speech_dispatcher
app.commandLine.appendSwitch("enable-speech-dispatcher");
}
disabledFeatures.forEach(feat => enabledFeatures.delete(feat));
const enabledFeaturesArray = enabledFeatures.values().filter(Boolean).toArray();
const disabledFeaturesArray = disabledFeatures.values().filter(Boolean).toArray();
if (enabledFeaturesArray.length) {
app.commandLine.appendSwitch("enable-features", enabledFeaturesArray.join(","));
console.log("Enabled Chromium features:", enabledFeaturesArray.join(", "));
}
if (disabledFeaturesArray.length) {
app.commandLine.appendSwitch("disable-features", disabledFeaturesArray.join(","));
console.log("Disabled Chromium features:", disabledFeaturesArray.join(", "));
}
// In the Flatpak on SteamOS the theme is detected as light, but SteamOS only has a dark mode, so we just override it
if (isDeckGameMode) nativeTheme.themeSource = "dark";
app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
if (data.IS_DEV) app.quit();
else if (mainWin) {
if (mainWin.isMinimized()) mainWin.restore();
if (!mainWin.isVisible()) mainWin.show();
mainWin.focus();
}
});
app.whenReady().then(async () => {
if (process.platform === "win32") app.setAppUserModelId("dev.vencord.vesktop");
registerScreenShareHandler();
registerMediaPermissionsHandler();
registerKeyBinds();
initSocket();
bootstrap();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindows();
});
});
}
if (!app.requestSingleInstanceLock({ IS_DEV, args: CommandLine })) {
if (IS_DEV) {
console.log("Vesktop is already running. Quitting previous instance...");
init();
} else {
console.log("Vesktop is already running. Quitting...");
app.quit();
}
if (CommandLine.values.repair) {
console.log("Repairing Vesktop...");
downloadVencordFiles().then(() => app.quit());
} else {
init();
require("./main");
}
async function bootstrap() {
if (!Object.hasOwn(State.store, "firstLaunch")) {
createFirstLaunchTour();
} else {
createWindows();
}
}
// MacOS only event
export let darwinURL: string | undefined;
app.on("open-url", (_, url) => {
darwinURL = url;
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});
app.on("second-instance", (_e, _argv, _cwd, data) => {
const { args } = data as { args: typeof CommandLine; IS_DEV: boolean };
const { "run-shortcut": shortcut } = args.values;
if (shortcut) sendRendererCommand(IpcCommands.KEY_BINDS_HANDLE, shortcut);
});
+1 -4
View File
@@ -20,13 +20,13 @@ import {
} from "electron";
import { readFileSync, watch } from "fs";
import { readFile, stat } from "fs/promises";
import { enableHardwareAcceleration } from "main";
import { release } from "os";
import { join } from "path";
import { IpcEvents } from "../shared/IpcEvents";
import { setBadgeCount } from "./appBadge";
import { autoStart } from "./autoStart";
import { enableHardwareAcceleration } from "./main";
import { mainWin } from "./mainWindow";
import { Settings, State } from "./settings";
import { handle, handleSync } from "./utils/ipcWrappers";
@@ -35,9 +35,6 @@ import { isDeckGameMode, showGamePage } from "./utils/steamOS";
import { isValidVencordInstall } from "./utils/vencordLoader";
import { VENCORD_FILES_DIR } from "./vencordFilesDir";
handleSync(IpcEvents.DEPRECATED_GET_VENCORD_PRELOAD_SCRIPT_PATH, () =>
join(VENCORD_FILES_DIR, "vencordDesktopPreload.js")
);
handleSync(IpcEvents.GET_VENCORD_PRELOAD_SCRIPT, () =>
readFileSync(join(VENCORD_FILES_DIR, "vencordDesktopPreload.js"), "utf-8")
);
+190
View File
@@ -0,0 +1,190 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./cli";
import "./updater";
import "./ipc";
import "./userAssets";
import "./vesktopProtocol";
import { app, BrowserWindow, nativeTheme } from "electron";
import { IpcCommands } from "shared/IpcEvents";
// eslint-disable-next-line no-duplicate-imports
import { CommandLine } from "./cli";
import { DATA_DIR } from "./constants";
import { createFirstLaunchTour } from "./firstLaunch";
import { sendRendererCommand } from "./ipcCommands";
import { initSocket } from "./ipcSocket";
import { registerKeyBinds } from "./keyBinds";
import { createWindows, mainWin } from "./mainWindow";
import { registerMediaPermissionsHandler } from "./mediaPermissions";
import { registerScreenShareHandler } from "./screenShare";
import { Settings, State } from "./settings";
import { setAsDefaultProtocolClient } from "./utils/setAsDefaultProtocolClient";
import { isDeckGameMode } from "./utils/steamOS";
console.log("Vesktop v" + app.getVersion());
// Make the Vencord files use our DATA_DIR
process.env.VENCORD_USER_DATA_DIR = DATA_DIR;
const isLinux = process.platform === "linux";
export let enableHardwareAcceleration = true;
function init() {
setAsDefaultProtocolClient("discord");
const { disableSmoothScroll, hardwareAcceleration, hardwareVideoAcceleration } = Settings.store;
const enabledFeatures = new Set(app.commandLine.getSwitchValue("enable-features").split(","));
const disabledFeatures = new Set(app.commandLine.getSwitchValue("disable-features").split(","));
app.commandLine.removeSwitch("enable-features");
app.commandLine.removeSwitch("disable-features");
if (hardwareAcceleration === false || process.argv.includes("--disable-gpu")) {
enableHardwareAcceleration = false;
app.disableHardwareAcceleration();
} else {
if (hardwareVideoAcceleration) {
enabledFeatures.add("AcceleratedVideoEncoder");
enabledFeatures.add("AcceleratedVideoDecoder");
if (isLinux) {
enabledFeatures.add("AcceleratedVideoDecodeLinuxGL");
enabledFeatures.add("AcceleratedVideoDecodeLinuxZeroCopyGL");
}
}
}
if (disableSmoothScroll) {
app.commandLine.appendSwitch("disable-smooth-scrolling");
}
// disable renderer backgrounding to prevent the app from unloading when in the background
// https://github.com/electron/electron/issues/2822
// https://github.com/GoogleChrome/chrome-launcher/blob/5a27dd574d47a75fec0fb50f7b774ebf8a9791ba/docs/chrome-flags-for-tools.md#task-throttling
app.commandLine.appendSwitch("disable-renderer-backgrounding");
app.commandLine.appendSwitch("disable-background-timer-throttling");
app.commandLine.appendSwitch("disable-backgrounding-occluded-windows");
if (process.platform === "win32") {
disabledFeatures.add("CalculateNativeWinOcclusion");
}
// work around chrome 66 disabling autoplay by default
app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// WinRetrieveSuggestionsOnlyOnDemand: Work around electron 13 bug w/ async spellchecking on Windows.
// HardwareMediaKeyHandling, MediaSessionService: Prevent Discord from registering as a media service.
disabledFeatures.add("WinRetrieveSuggestionsOnlyOnDemand");
disabledFeatures.add("HardwareMediaKeyHandling");
disabledFeatures.add("MediaSessionService");
if (isLinux) {
// Support TTS on Linux using https://wiki.archlinux.org/title/Speech_dispatcher
app.commandLine.appendSwitch("enable-speech-dispatcher");
// This is needed to fix washed out colours - https://github.com/electron/electron/issues/49566
// Supposed to be fixed already according to comments there, but it's just not lol, I can repro on Electron 43.0.0
// when moving the window from my main monitor (HDR - not sure if this is relevant lol) to second monitor (SDR) and back
disabledFeatures.add("WaylandWpColorManagerV1");
// Enable Wayland Portal for global shortcuts
enabledFeatures.add("GlobalShortcutsPortal");
}
disabledFeatures.forEach(feat => enabledFeatures.delete(feat));
const enabledFeaturesArray = enabledFeatures.values().filter(Boolean).toArray();
const disabledFeaturesArray = disabledFeatures.values().filter(Boolean).toArray();
if (enabledFeaturesArray.length) {
app.commandLine.appendSwitch("enable-features", enabledFeaturesArray.join(","));
console.log("Enabled Chromium features:", enabledFeaturesArray.join(", "));
}
if (disabledFeaturesArray.length) {
app.commandLine.appendSwitch("disable-features", disabledFeaturesArray.join(","));
console.log("Disabled Chromium features:", disabledFeaturesArray.join(", "));
}
// In the Flatpak on SteamOS the theme is detected as light, but SteamOS only has a dark mode, so we just override it
if (isDeckGameMode) nativeTheme.themeSource = "dark";
app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
if (data.IS_DEV) app.quit();
else if (mainWin) {
if (mainWin.isMinimized()) mainWin.restore();
if (!mainWin.isVisible()) mainWin.show();
mainWin.focus();
}
});
app.whenReady().then(async () => {
if (process.platform === "win32") app.setAppUserModelId("dev.vencord.vesktop");
registerScreenShareHandler();
registerMediaPermissionsHandler();
registerKeyBinds();
initSocket();
bootstrap();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) createWindows();
});
});
}
if (!app.requestSingleInstanceLock({ IS_DEV, args: CommandLine })) {
if (IS_DEV) {
console.log("Vesktop is already running. Quitting previous instance...");
init();
} else {
console.log("Vesktop is already running. Quitting...");
app.quit();
}
} else {
init();
}
async function bootstrap() {
if (!Object.hasOwn(State.store, "firstLaunch")) {
createFirstLaunchTour();
} else {
createWindows();
}
}
// MacOS only event
export let darwinURL: string | undefined;
app.on("open-url", (_, url) => {
darwinURL = url;
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});
app.on("second-instance", (_e, _argv, _cwd, data) => {
const { args } = data as { args: typeof CommandLine; IS_DEV: boolean };
const { "run-shortcut": shortcut } = args.values;
if (shortcut) sendRendererCommand(IpcCommands.KEY_BINDS_HANDLE, shortcut);
});
// Sets the WebRTC IP handling policy for all current and future windows.
// Switching to "default_public_and_private_interfaces" may fix calls stuck at "DTLS Connecting" when using VPNs, Tailscale, etc.
// https://github.com/Vencord/Vesktop/issues/876
app.on("web-contents-created", (_event, contents) => {
contents.setWebRTCIPHandlingPolicy(Settings.store.webRTCIPHandlingPolicy ?? "default");
});
Settings.addChangeListener("webRTCIPHandlingPolicy", () => {
for (const win of BrowserWindow.getAllWindows()) {
win.webContents.setWebRTCIPHandlingPolicy(Settings.store.webRTCIPHandlingPolicy ?? "default");
}
});
+3 -3
View File
@@ -26,15 +26,15 @@ import { initArRPC } from "./arrpc";
import { CommandLine } from "./cli";
import { BrowserUserAgent, DEFAULT_HEIGHT, DEFAULT_WIDTH, MIN_HEIGHT, MIN_WIDTH } from "./constants";
import { AppEvents } from "./events";
import { darwinURL } from "./index";
import { sendRendererCommand } from "./ipcCommands";
import { darwinURL } from "./main";
import { Settings, State, VencordSettings } from "./settings";
import { createSplashWindow, updateSplashMessage } from "./splash";
import { destroyTray, initTray } from "./tray";
import { clearData } from "./utils/clearData";
import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
import { applyDeckKeyboardFix, askToApplySteamLayout, isDeckGameMode } from "./utils/steamOS";
import { downloadVencordFiles, ensureVencordFiles, vencordSupportsSandboxing } from "./utils/vencordLoader";
import { downloadVencordFiles, ensureVencordFiles } from "./utils/vencordLoader";
import { VENCORD_FILES_DIR } from "./vencordFilesDir";
let isQuitting = false;
@@ -326,7 +326,7 @@ function buildBrowserWindowOptions(): BrowserWindowConstructorOptions {
backgroundColor,
webPreferences: {
nodeIntegration: false,
sandbox: vencordSupportsSandboxing(),
sandbox: true,
contextIsolation: true,
devTools: true,
preload: join(__dirname, "preload.js"),
+1 -14
View File
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { mkdirSync, readFileSync } from "fs";
import { mkdirSync } from "fs";
import { access, constants as FsConstants, writeFile } from "fs/promises";
import { VENCORD_FILES_DIR } from "main/vencordFilesDir";
import { join } from "path";
@@ -75,16 +75,3 @@ export async function ensureVencordFiles() {
await Promise.all([downloadVencordFiles(), writeFile(join(VENCORD_FILES_DIR, "package.json"), "{}")]);
}
// TODO: remove this once enough time has passed
export function vencordSupportsSandboxing() {
const supports = readFileSync(join(VENCORD_FILES_DIR, "vencordDesktopMain.js"), "utf-8").includes(
"VencordGetRendererCss"
);
if (!supports) {
console.warn(
"⚠️ [VencordLoader] Vencord version is outdated and does not support sandboxing. Please update Vencord to the latest version."
);
}
return supports;
}
+4 -10
View File
@@ -11,22 +11,16 @@ import { VesktopNative } from "./VesktopNative";
contextBridge.exposeInMainWorld("VesktopNative", VesktopNative);
// TODO: remove this legacy workaround once some time has passed
const isSandboxed = typeof __dirname === "undefined";
if (isSandboxed) {
// While sandboxed, Electron "polyfills" these APIs as local variables.
// We have to pass them as arguments as they are not global
Function(
// While sandboxed, Electron "polyfills" these APIs as local variables.
// We have to pass them as arguments as they are not global
Function(
"require",
"Buffer",
"process",
"clearImmediate",
"setImmediate",
ipcRenderer.sendSync(IpcEvents.GET_VENCORD_PRELOAD_SCRIPT)
)(require, Buffer, process, clearImmediate, setImmediate);
} else {
require(ipcRenderer.sendSync(IpcEvents.DEPRECATED_GET_VENCORD_PRELOAD_SCRIPT_PATH));
}
)(require, Buffer, process, clearImmediate, setImmediate);
webFrame.executeJavaScript(ipcRenderer.sendSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT));
webFrame.executeJavaScript(ipcRenderer.sendSync(IpcEvents.GET_VESKTOP_RENDERER_SCRIPT));
+21 -1
View File
@@ -17,6 +17,8 @@ const logger = new Logger("VesktopRPC", "#5865f2");
const arRPC = Vencord.Plugins.plugins["WebRichPresence (arRPC)"] as typeof arRpcPlugin;
let userDisabledStreamerMode = false;
onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
if (!Settings.store.arRPC) return;
@@ -25,17 +27,35 @@ onIpcCommand(IpcCommands.RPC_ACTIVITY, async jsonData => {
const data = JSON.parse(jsonData);
if (data.socketId === "STREAMERMODE" && StreamerModeStore.autoToggle) {
const value = data.activity?.application_id === "STREAMERMODE";
if (!value) {
userDisabledStreamerMode = false;
} else if (userDisabledStreamerMode) {
return;
}
FluxDispatcher.dispatch({
type: "STREAMER_MODE_UPDATE",
key: "enabled",
value: data.activity?.application_id === "STREAMERMODE"
value,
isAuto: true
});
return;
}
arRPC.handleEvent(new MessageEvent("message", { data: jsonData }));
});
onceReady.then(() => {
FluxDispatcher.subscribe("STREAMER_MODE_UPDATE", e => {
if (!e.isAuto && !e.value) {
userDisabledStreamerMode = true;
}
});
});
onIpcCommand(IpcCommands.RPC_INVITE, async code => {
const { invite } = await InviteActions.resolveInvite(code, "Desktop Modal");
if (!invite) return false;
@@ -757,6 +757,7 @@ function ModalComponent({
if (conn) {
conn.videoStreamParameters[0].maxFrameRate = frameRate;
conn.videoStreamParameters[0].maxResolution ??= { width: 0, height: 0 };
conn.videoStreamParameters[0].maxResolution.height = height;
conn.videoStreamParameters[0].maxResolution.width = width;
}
@@ -772,6 +773,7 @@ function ModalComponent({
);
if (!conn) return;
// @ts-expect-error incorrect type
const track = conn.input.stream.getVideoTracks()[0];
const constraints = {
+18
View File
@@ -0,0 +1,18 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2026 Vendicated and Vesktop contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { IconProps } from "@vencord/types/utils/types";
export function VesktopSettingsIcon(props: IconProps) {
return (
<svg {...props} viewBox="0 0 24 24">
<path
fill="currentColor"
d="M18.157.056a1.224 1.224 0 0 0-.709.628c-.105.229-.114.305-.115 1.081v.836l-.351.176a5.545 5.545 0 0 0-.586.342l-.233.167-.543-.311c-.899-.515-.944-.535-1.293-.539-.562-.004-1.018.352-1.17.917-.07.262-.021.567.138.858.151.28.21.325 1.02.794l.606.35v1.38l-.606.35c-.81.469-.869.514-1.02.793-.16.291-.208.597-.137.859.151.564.607.92 1.17.916.347-.004.393-.023 1.289-.537l.54-.308.313.21c.172.116.438.262.588.325l.275.114v.85c.001.793.009.87.115 1.098a1.19 1.19 0 0 0 1.969.282c.269-.307.292-.412.292-1.37v-.869l.315-.148c.173-.081.435-.228.582-.325l.266-.177.706.4c.796.45 1.029.523 1.408.438.882-.198 1.235-1.287.635-1.96-.085-.097-.457-.348-.827-.56l-.67-.385V5.359l.67-.386c.37-.212.742-.463.827-.56.6-.672.247-1.762-.635-1.96-.38-.084-.612-.012-1.405.437l-.7.397-.235-.18a3.792 3.792 0 0 0-.586-.344l-.35-.163v-.848c0-.935-.023-1.044-.292-1.35a1.2 1.2 0 0 0-1.26-.346M4.007 1.25a4.15 4.15 0 0 0-1.21.44c-.354.207-1.102.955-1.309 1.309-.199.34-.374.837-.441 1.252-.07.434-.07 10.426 0 10.86.127.792.42 1.343 1.039 1.963.477.478.81.697 1.317.874.59.204.818.216 4.125.217h3.163v2.42l-1.975.014c-2.202.015-2.148.008-2.5.362-.255.253-.346.474-.346.84s.09.587.345.84c.376.376-.09.348 5.688.348 5.75 0 5.309.025 5.67-.327a1.1 1.1 0 0 0 .362-.86c.002-.367-.09-.586-.344-.84-.353-.355-.3-.348-2.5-.363l-1.976-.014v-2.42h3.164c3.306-.001 3.535-.013 4.124-.217.508-.177.84-.396 1.318-.874.882-.882 1.113-1.57 1.082-3.213-.018-.956-.047-1.068-.364-1.384-.253-.255-.474-.346-.84-.346s-.586.091-.84.346c-.317.316-.343.42-.372 1.47-.023.846-.036.966-.13 1.14a1.22 1.22 0 0 1-.597.553c-.217.098-.276.098-7.757.098-7.48 0-7.54 0-7.757-.098a1.153 1.153 0 0 1-.612-.602l-.114-.242V9.68c.001-5.041.003-5.119.1-5.333.122-.27.3-.462.553-.599.19-.103.242-.104 2.958-.128 3.08-.027 2.927-.01 3.288-.372.255-.254.345-.474.345-.84s-.09-.587-.345-.84c-.364-.365-.204-.347-3.288-.355-1.52-.004-2.881.012-3.024.036m15.047 3.693c.207.108.452.361.57.59.143.278.143.755 0 1.028-.285.54-1.08.81-1.636.556a1.357 1.357 0 0 1-.59-.625c-.107-.255-.092-.7.032-.956.121-.251.46-.568.69-.645.213-.073.755-.043.934.052"
/>
</svg>
);
}
@@ -9,6 +9,7 @@ import "./settings.css";
import { classNameFactory } from "@vencord/types/api/Styles";
import { BaseText, Divider, ErrorBoundary } from "@vencord/types/components";
import { ComponentType } from "react";
import { WebRTCIPHandlingPolicyPicker } from "renderer/components/settings/WebRTCIPHandlingPolicyPicker";
import { KeybindsButton } from "renderer/globalShortcuts/ShortcutSettings";
import { Settings, useSettings } from "renderer/settings";
import { isMac, isWindows } from "renderer/utils";
@@ -148,8 +149,11 @@ const SettingsOptions: Record<string, Array<BooleanSetting | SettingsComponent>>
title: "Open Links in app (experimental)",
description: "Opens links in a new Vesktop window instead of your web browser",
defaultValue: false
}
},
WebRTCIPHandlingPolicyPicker
],
"Developer Options": [DeveloperOptionsButton]
};
@@ -0,0 +1,42 @@
/*
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Heading, Margins, Paragraph } from "@vencord/types/components";
import { Select } from "@vencord/types/webpack/common";
import { SimpleErrorBoundary } from "../SimpleErrorBoundary";
import { SettingsComponent } from "./Settings";
export const WebRTCIPHandlingPolicyPicker: SettingsComponent = ({ settings }) => {
return (
<SimpleErrorBoundary>
<div>
<Heading tag="h5">WebRTC IP Handling Policy</Heading>
<Paragraph className={Margins.bottom8}>
Changing this may help with voice connection issues on some networks, most notably VPNs like
Tailscale.
</Paragraph>
<Select
placeholder="Default"
options={[
{ label: "Default", value: "default", default: true },
{ label: "Default Public Interface Only", value: "default_public_interface_only" },
{
label: "Default Public And Private Interfaces",
value: "default_public_and_private_interfaces"
},
{ label: "Disable Non-Proxied UDP", value: "disable_non_proxied_udp" }
]}
closeOnSelect={true}
select={v => (settings.webRTCIPHandlingPolicy = v)}
isSelected={v => v === (settings.webRTCIPHandlingPolicy ?? "default")}
serialize={s => s}
/>
</div>
</SimpleErrorBoundary>
);
};
+11 -20
View File
@@ -13,32 +13,23 @@ import "__patches__"; // auto generated by the build script
export * as Components from "./components";
import { VesktopSettingsIcon } from "@vencord/types/components";
import SettingsUi from "./components/settings/Settings";
import { VesktopLogger } from "./logger";
import { Settings } from "./settings";
export { Settings };
import type SettingsPlugin from "@vencord/types/plugins/_core/settings";
VesktopLogger.log("read if cute :3");
VesktopLogger.log("Vesktop v" + VesktopNative.app.getVersion());
// TODO
const customSettingsSections = (Vencord.Plugins.plugins.Settings as typeof SettingsPlugin).customSections;
const SettingsPlugin = Vencord.Plugins.plugins
.Settings as typeof import("@vencord/types/plugins/_core/settings").default;
customSettingsSections.push(() => ({
section: "Vesktop",
label: "Vesktop Settings",
element: SettingsUi,
className: "vc-vesktop-settings"
}));
// TODO: remove this legacy workaround once some time has passed
if (!Vencord.Api.Styles.vencordRootNode) {
const style = document.createElement("style");
style.id = "vesktop-css-core";
VesktopNative.app.getRendererCss().then(css => (style.textContent = css));
document.addEventListener("DOMContentLoaded", () => document.documentElement.append(style), { once: true });
}
SettingsPlugin.customEntries.push({
key: "vesktop",
title: "Vesktop",
panelTitle: "Vesktop Settings",
Component: SettingsUi,
Icon: VesktopSettingsIcon
});
-1
View File
@@ -6,7 +6,6 @@
export const enum IpcEvents {
GET_VENCORD_PRELOAD_SCRIPT = "VCD_GET_VC_PRELOAD_SCRIPT",
DEPRECATED_GET_VENCORD_PRELOAD_SCRIPT_PATH = "DEPRECATED_GET_VENCORD_PRELOAD_SCRIPT_PATH",
GET_VENCORD_RENDERER_SCRIPT = "VCD_GET_VC_RENDERER_SCRIPT",
GET_VESKTOP_RENDERER_SCRIPT = "VCD_GET_RENDERER_SCRIPT",
+5
View File
@@ -10,6 +10,11 @@ import { KeyBind } from "renderer/globalShortcuts/ShortcutSettings";
export interface Settings {
discordBranch?: "stable" | "canary" | "ptb";
transparencyOption?: "none" | "mica" | "tabbed" | "acrylic";
webRTCIPHandlingPolicy?:
| "default"
| "default_public_interface_only"
| "default_public_and_private_interfaces"
| "disable_non_proxied_udp";
tray?: boolean;
minimizeToTray?: boolean;
autoStartMinimized?: boolean;