aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.ts
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2022-09-08 00:41:49 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-07 23:41:49 +0000
commit6125918e90347c891db435842d7de66060a8fbf6 (patch)
tree78488a9b5aa88b2df3d8f37b2079e85c81969f62 /src/index.ts
parentUpgrade 'electron' to '20.1.2' (diff)
downloadferdium-app-6125918e90347c891db435842d7de66060a8fbf6.tar.gz
ferdium-app-6125918e90347c891db435842d7de66060a8fbf6.tar.zst
ferdium-app-6125918e90347c891db435842d7de66060a8fbf6.zip
feat: add ability to set how ferdium handles webrtc ip when using a VPN (#602)
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts
index 7c80ca955..97c77d185 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -90,8 +90,8 @@ if (isWindows) {
90const settings = new Settings('app', DEFAULT_APP_SETTINGS); 90const settings = new Settings('app', DEFAULT_APP_SETTINGS);
91const proxySettings = new Settings('proxy'); 91const proxySettings = new Settings('proxy');
92 92
93const retrieveSettingValue = (key: string, defaultValue: boolean) => 93const retrieveSettingValue = (key: string, defaultValue: boolean | string) =>
94 ifUndefined<boolean>(settings.get(key), defaultValue); 94 ifUndefined<boolean | string>(settings.get(key), defaultValue);
95 95
96const liftSingleInstanceLock = retrieveSettingValue( 96const liftSingleInstanceLock = retrieveSettingValue(
97 'liftSingleInstanceLock', 97 'liftSingleInstanceLock',
@@ -164,6 +164,15 @@ if (!retrieveSettingValue('enableGPUAcceleration', false)) {
164 app.disableHardwareAcceleration(); 164 app.disableHardwareAcceleration();
165} 165}
166 166
167const webRTCIPHandlingPolicy = retrieveSettingValue(
168 'webRTCIPHandlingPolicy',
169 DEFAULT_APP_SETTINGS.webRTCIPHandlingPolicy,
170) as
171 | 'disable_non_proxied_udp'
172 | 'default'
173 | 'default_public_interface_only'
174 | 'default_public_and_private_interfaces';
175
167const createWindow = () => { 176const createWindow = () => {
168 // Remember window size 177 // Remember window size
169 const mainWindowState = windowStateKeeper({ 178 const mainWindowState = windowStateKeeper({
@@ -202,7 +211,7 @@ const createWindow = () => {
202 spellcheck: retrieveSettingValue( 211 spellcheck: retrieveSettingValue(
203 'enableSpellchecking', 212 'enableSpellchecking',
204 DEFAULT_APP_SETTINGS.enableSpellchecking, 213 DEFAULT_APP_SETTINGS.enableSpellchecking,
205 ), 214 ) as boolean | undefined,
206 nodeIntegration: true, 215 nodeIntegration: true,
207 contextIsolation: false, 216 contextIsolation: false,
208 webviewTag: true, 217 webviewTag: true,
@@ -210,6 +219,7 @@ const createWindow = () => {
210 }); 219 });
211 220
212 enableWebContents(mainWindow.webContents); 221 enableWebContents(mainWindow.webContents);
222 mainWindow.webContents.setWebRTCIPHandlingPolicy(webRTCIPHandlingPolicy);
213 223
214 app.on('browser-window-created', (_, window) => { 224 app.on('browser-window-created', (_, window) => {
215 enableWebContents(window.webContents); 225 enableWebContents(window.webContents);
@@ -532,6 +542,7 @@ ipcMain.on('open-browser-window', (_e, { url, serviceId }) => {
532 }, 542 },
533 }); 543 });
534 enableWebContents(child.webContents); 544 enableWebContents(child.webContents);
545 child.webContents.setWebRTCIPHandlingPolicy(webRTCIPHandlingPolicy);
535 child.show(); 546 child.show();
536 child.loadURL(url); 547 child.loadURL(url);
537 debug('Received open-browser-window', url); 548 debug('Received open-browser-window', url);