Disable Dev Tools in production releases
`--enable-dev-tools` will bring it back.
This commit is contained in:
parent
18fb2b806e
commit
1934120e46
3 changed files with 28 additions and 7 deletions
19
app/menu.js
19
app/menu.js
|
@ -10,6 +10,7 @@ exports.createTemplate = (options, messages) => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isBeta,
|
isBeta,
|
||||||
|
devTools,
|
||||||
includeSetup,
|
includeSetup,
|
||||||
openContactUs,
|
openContactUs,
|
||||||
openForums,
|
openForums,
|
||||||
|
@ -118,13 +119,17 @@ exports.createTemplate = (options, messages) => {
|
||||||
label: messages.debugLog.message,
|
label: messages.debugLog.message,
|
||||||
click: showDebugLog,
|
click: showDebugLog,
|
||||||
},
|
},
|
||||||
{
|
...(devTools
|
||||||
type: 'separator',
|
? [
|
||||||
},
|
{
|
||||||
{
|
type: 'separator',
|
||||||
role: 'toggledevtools',
|
},
|
||||||
label: messages.viewMenuToggleDevTools.message,
|
{
|
||||||
},
|
role: 'toggledevtools',
|
||||||
|
label: messages.viewMenuToggleDevTools.message,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
15
main.js
15
main.js
|
@ -112,9 +112,16 @@ const {
|
||||||
getTitleBarVisibility,
|
getTitleBarVisibility,
|
||||||
TitleBarVisibility,
|
TitleBarVisibility,
|
||||||
} = require('./ts/types/Settings');
|
} = require('./ts/types/Settings');
|
||||||
|
const { Environment } = require('./ts/environment');
|
||||||
|
|
||||||
let appStartInitialSpellcheckSetting = true;
|
let appStartInitialSpellcheckSetting = true;
|
||||||
|
|
||||||
|
const defaultWebPrefs = {
|
||||||
|
devTools:
|
||||||
|
process.argv.some(arg => arg === '--enable-dev-tools') ||
|
||||||
|
config.environment !== Environment.Production,
|
||||||
|
};
|
||||||
|
|
||||||
async function getSpellCheckSetting() {
|
async function getSpellCheckSetting() {
|
||||||
const json = await sql.getItemById('spell-check');
|
const json = await sql.getItemById('spell-check');
|
||||||
|
|
||||||
|
@ -313,6 +320,7 @@ async function createWindow() {
|
||||||
? '#ffffff' // Tests should always be rendered on a white background
|
? '#ffffff' // Tests should always be rendered on a white background
|
||||||
: '#3a76f0',
|
: '#3a76f0',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -667,6 +675,7 @@ function showAbout() {
|
||||||
backgroundColor: '#3a76f0',
|
backgroundColor: '#3a76f0',
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -721,6 +730,7 @@ function showSettingsWindow() {
|
||||||
show: false,
|
show: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -790,6 +800,7 @@ async function showStickerCreator() {
|
||||||
backgroundColor: '#3a76f0',
|
backgroundColor: '#3a76f0',
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -844,6 +855,7 @@ async function showDebugLogWindow() {
|
||||||
show: false,
|
show: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -894,6 +906,7 @@ function showPermissionsPopupWindow(forCalling, forCamera) {
|
||||||
show: false,
|
show: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
|
@ -1027,6 +1040,7 @@ app.on('ready', async () => {
|
||||||
frame: false,
|
frame: false,
|
||||||
backgroundColor: '#3a76f0',
|
backgroundColor: '#3a76f0',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
...defaultWebPrefs,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
preload: path.join(__dirname, 'loading_preload.js'),
|
preload: path.join(__dirname, 'loading_preload.js'),
|
||||||
},
|
},
|
||||||
|
@ -1134,6 +1148,7 @@ function setupMenu(options) {
|
||||||
showAbout,
|
showAbout,
|
||||||
showSettings: showSettingsWindow,
|
showSettings: showSettingsWindow,
|
||||||
showStickerCreator,
|
showStickerCreator,
|
||||||
|
showDevTools: defaultWebPrefs.devTools,
|
||||||
openContactUs,
|
openContactUs,
|
||||||
openJoinTheBeta,
|
openJoinTheBeta,
|
||||||
openReleaseNotes,
|
openReleaseNotes,
|
||||||
|
|
|
@ -50,6 +50,7 @@ describe('SignalMenu', () => {
|
||||||
};
|
};
|
||||||
const options = {
|
const options = {
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
|
devTools: true,
|
||||||
openContactUs: null,
|
openContactUs: null,
|
||||||
openForums: null,
|
openForums: null,
|
||||||
openJoinTheBeta: null,
|
openJoinTheBeta: null,
|
||||||
|
|
Loading…
Add table
Reference in a new issue