diff --git a/.nvmrc b/.nvmrc index dd6ecf975..2edeafb09 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -15.7.0 \ No newline at end of file +20 \ No newline at end of file diff --git a/js/preload/default.js b/js/preload/default.js index 7b767285f..93d169c24 100644 --- a/js/preload/default.js +++ b/js/preload/default.js @@ -61,4 +61,8 @@ window.addEventListener('message', function (e) { if (e.data?.message === 'downloadFile') { ipc.send('downloadFile', e.data.url) } + + if (e.data?.message === 'openContentProtection') { + ipc.send('openContentProtection', e.data.value) + } }) diff --git a/localization/languages/en-US.json b/localization/languages/en-US.json index c04c26fd2..ff72f9df2 100644 --- a/localization/languages/en-US.json +++ b/localization/languages/en-US.json @@ -165,6 +165,7 @@ "settingsSeparateTitlebarToggle": "Use separate title bar", "settingsAutoplayToggle": "Enable Autoplay", "settingsOpenTabsInForegroundToggle": "Open new tabs in the foreground", + "settingsOpenContentProtection": "Prevents other programs from capturing", "settingsUserscriptsExplanation": { "unsafeHTML": "User scripts allow you to modify the behavior of websites - learn more." }, diff --git a/localization/languages/zh-CN.json b/localization/languages/zh-CN.json index f0cda5301..95ed34b5b 100644 --- a/localization/languages/zh-CN.json +++ b/localization/languages/zh-CN.json @@ -165,6 +165,7 @@ "settingsSeparateTitlebarToggle": "显示浏览器标题栏", "settingsAutoplayToggle": "启用自动播放", "settingsOpenTabsInForegroundToggle": "在前台打开新标签页", + "settingsOpenContentProtection": "保护浏览器不被其他程序捕获", "settingsUserscriptsExplanation": { "unsafeHTML": "自定义脚本允许您改变网站行为 - 查看更多." }, diff --git a/main/main.js b/main/main.js index 18ec46702..197627044 100644 --- a/main/main.js +++ b/main/main.js @@ -338,6 +338,7 @@ function createWindowWithBounds (bounds, customArgs) { return newWin } +let newWin = null // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function () { @@ -352,7 +353,9 @@ app.on('ready', function () { registerBundleProtocol(session.defaultSession) - const newWin = createWindow() + newWin = createWindow() + + if (settings.get('openContentProtection')) newWin.setContentProtection(true) getWindowWebContents(newWin).on('did-finish-load', function () { // if a URL was passed as a command line argument (probably because Min is set as the default browser on Linux), open it. @@ -492,6 +495,11 @@ ipc.on('places-connect', function (e) { placesWindow.webContents.postMessage('places-connect', null, e.ports) }) +ipc.on('openContentProtection', function (e, data) { + newWin.setContentProtection(data) + placesWindow.setContentProtection(data) +}) + function getWindowWebContents (win) { return win.getContentView().children[0].webContents } \ No newline at end of file diff --git a/pages/settings/index.html b/pages/settings/index.html index bc608428c..bfc816b42 100644 --- a/pages/settings/index.html +++ b/pages/settings/index.html @@ -192,6 +192,14 @@

> +
+ + +
+