[PM-6006] Restrict desktop devtools to dev mode only (#7765)

This commit is contained in:
Oscar Hinton 2024-02-19 16:08:25 +01:00 committed by GitHub
parent cbcd5d9747
commit 8e1ccb293e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,8 @@ import { MenuItemConstructorOptions } from "electron";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { isDev } from "../../utils";
import { IMenubarMenu } from "./menubar"; import { IMenubarMenu } from "./menubar";
export class ViewMenu implements IMenubarMenu { export class ViewMenu implements IMenubarMenu {
@ -13,7 +15,7 @@ export class ViewMenu implements IMenubarMenu {
} }
get items(): MenuItemConstructorOptions[] { get items(): MenuItemConstructorOptions[] {
return [ const items = [
this.searchVault, this.searchVault,
this.separator, this.separator,
this.generator, this.generator,
@ -26,8 +28,13 @@ export class ViewMenu implements IMenubarMenu {
this.toggleFullscreen, this.toggleFullscreen,
this.separator, this.separator,
this.reload, this.reload,
this.toggleDevTools,
]; ];
if (isDev()) {
items.push(this.toggleDevTools);
}
return items;
} }
private readonly _i18nService: I18nService; private readonly _i18nService: I18nService;

View File

@ -166,6 +166,7 @@ export class WindowMain {
backgroundThrottling: false, backgroundThrottling: false,
contextIsolation: true, contextIsolation: true,
session: this.session, session: this.session,
devTools: isDev(),
}, },
}); });