From f054ca2f0312e31d8d620bb5f5b1766d9e6ee4f0 Mon Sep 17 00:00:00 2001 From: 2meito <74376924+2meito@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:06:29 -0400 Subject: [PATCH] Add setting for WebRTCIPHandlingPolicy (#1283) Co-authored-by: Zylanx <32674125+Zylanx@users.noreply.github.com> --- src/main/index.ts | 12 ++++++ src/renderer/components/settings/Settings.tsx | 6 ++- .../settings/WebRTCIPHandlingPolicyPicker.tsx | 42 +++++++++++++++++++ src/shared/settings.d.ts | 5 +++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 src/renderer/components/settings/WebRTCIPHandlingPolicyPicker.tsx diff --git a/src/main/index.ts b/src/main/index.ts index 2f4c399..0c81512 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -158,3 +158,15 @@ app.on("open-url", (_, url) => { app.on("window-all-closed", () => { if (process.platform !== "darwin") app.quit(); }); + +// 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"); + } +}); diff --git a/src/renderer/components/settings/Settings.tsx b/src/renderer/components/settings/Settings.tsx index 82a58db..e0d0b0d 100644 --- a/src/renderer/components/settings/Settings.tsx +++ b/src/renderer/components/settings/Settings.tsx @@ -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 { Settings, useSettings } from "renderer/settings"; import { isMac, isWindows } from "renderer/utils"; @@ -146,8 +147,11 @@ const SettingsOptions: Record> 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] }; diff --git a/src/renderer/components/settings/WebRTCIPHandlingPolicyPicker.tsx b/src/renderer/components/settings/WebRTCIPHandlingPolicyPicker.tsx new file mode 100644 index 0000000..533dde0 --- /dev/null +++ b/src/renderer/components/settings/WebRTCIPHandlingPolicyPicker.tsx @@ -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 ( + +
+ WebRTC IP Handling Policy + + Changing this may help with voice connection issues on some networks, most notably VPNs like + Tailscale. + +