Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.7.0
20
4 changes: 4 additions & 0 deletions js/preload/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
1 change: 1 addition & 0 deletions localization/languages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 - <a href=\"https://github.com/minbrowser/min/wiki/userscripts\">learn more</a>."
},
Expand Down
1 change: 1 addition & 0 deletions localization/languages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"settingsSeparateTitlebarToggle": "显示浏览器标题栏",
"settingsAutoplayToggle": "启用自动播放",
"settingsOpenTabsInForegroundToggle": "在前台打开新标签页",
"settingsOpenContentProtection": "保护浏览器不被其他程序捕获",
"settingsUserscriptsExplanation": {
"unsafeHTML": "自定义脚本允许您改变网站行为 - <a href=\"https://github.com/minbrowser/min/wiki/userscripts\">查看更多</a>."
},
Expand Down
10 changes: 9 additions & 1 deletion main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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.
Expand Down Expand Up @@ -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
}
8 changes: 8 additions & 0 deletions pages/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ <h3 data-string="settingsAdditionalFeaturesHeading"></h3>
></label>
</div>

<div class="setting-section" id="section-open-content-protection">
<input type="checkbox" id="checkbox-open-content-protection" />
<label
for="checkbox-open-content-protection"
data-string="settingsOpenContentProtection"
></label>
</div>

<div class="setting-section" id="section-user-agent">
<input type="checkbox" id="checkbox-user-agent" />
<label
Expand Down
14 changes: 14 additions & 0 deletions pages/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var userscriptsCheckbox = document.getElementById('checkbox-userscripts')
var userscriptsShowDirectorySection = document.getElementById('userscripts-show-directory')
var separateTitlebarCheckbox = document.getElementById('checkbox-separate-titlebar')
var openTabsInForegroundCheckbox = document.getElementById('checkbox-open-tabs-in-foreground')
var openContentProtectionCheckbox = document.getElementById('checkbox-open-content-protection')
var autoPlayCheckbox = document.getElementById('checkbox-enable-autoplay')
var userAgentCheckbox = document.getElementById('checkbox-user-agent')
var userAgentInput = document.getElementById('input-user-agent')
Expand Down Expand Up @@ -328,6 +329,19 @@ openTabsInForegroundCheckbox.addEventListener('change', function (e) {
settings.set('openTabsInForeground', this.checked)
})

/* open content protection setting */

settings.get('openContentProtection', function (value) {
if (value === true) {
openContentProtectionCheckbox.checked = true
}
})

openContentProtectionCheckbox.addEventListener('change', function (e) {
settings.set('openContentProtection', this.checked)
postMessage({ message:'openContentProtection', value: this.checked })
})

/* media autoplay setting */

settings.get('enableAutoplay', function (value) {
Expand Down