1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-11 19:40:47 +01:00

[PM-13099] Enable browserintegration on dmg builds on adding an env variable (#11359)

* Enable browserintegration on dmg builds on adding an env variable

* Fix crash

* Cleanup
This commit is contained in:
Bernd Schoolmann 2024-12-09 02:09:57 -08:00 committed by GitHub
parent d5af932cef
commit 3bfe5e4a65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 62 additions and 35 deletions

View File

@ -632,43 +632,51 @@ export class SettingsComponent implements OnInit, OnDestroy {
}
async saveBrowserIntegration() {
if (
ipc.platform.deviceType === DeviceType.MacOsDesktop &&
!this.platformUtilsService.isMacAppStore() &&
!ipc.platform.isDev
) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationMasOnlyDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
const skipSupportedPlatformCheck =
ipc.platform.allowBrowserintegrationOverride || ipc.platform.isDev;
this.form.controls.enableBrowserIntegration.setValue(false);
return;
} else if (ipc.platform.isWindowsStore) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationWindowsStoreDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
if (skipSupportedPlatformCheck) {
if (
ipc.platform.deviceType === DeviceType.MacOsDesktop &&
!this.platformUtilsService.isMacAppStore()
) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationMasOnlyDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
this.form.controls.enableBrowserIntegration.setValue(false);
return;
} else if (ipc.platform.isSnapStore || ipc.platform.isFlatpak) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationLinuxDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
this.form.controls.enableBrowserIntegration.setValue(false);
return;
}
this.form.controls.enableBrowserIntegration.setValue(false);
return;
if (ipc.platform.isWindowsStore) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationWindowsStoreDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
this.form.controls.enableBrowserIntegration.setValue(false);
return;
}
if (ipc.platform.isSnapStore || ipc.platform.isFlatpak) {
await this.dialogService.openSimpleDialog({
title: { key: "browserIntegrationUnsupportedTitle" },
content: { key: "browserIntegrationLinuxDesc" },
acceptButtonText: { key: "ok" },
cancelButtonText: null,
type: "warning",
});
this.form.controls.enableBrowserIntegration.setValue(false);
return;
}
}
await this.desktopSettingsService.setBrowserIntegrationEnabled(

View File

@ -11,7 +11,15 @@ import {
Message,
UnencryptedMessageResponse,
} from "../models/native-messaging";
import { isAppImage, isDev, isFlatpak, isMacAppStore, isSnapStore, isWindowsStore } from "../utils";
import {
allowBrowserintegrationOverride,
isAppImage,
isDev,
isFlatpak,
isMacAppStore,
isSnapStore,
isWindowsStore,
} from "../utils";
import { ClipboardWriteMessage } from "./types/clipboard";
@ -140,6 +148,7 @@ export default {
isFlatpak: isFlatpak(),
isSnapStore: isSnapStore(),
isAppImage: isAppImage(),
allowBrowserintegrationOverride: allowBrowserintegrationOverride(),
reloadProcess: () => ipcRenderer.send("reload-process"),
focusWindow: () => ipcRenderer.send("window-focus"),
hideWindow: () => ipcRenderer.send("window-hide"),

View File

@ -70,6 +70,16 @@ export function isWindowsPortable() {
return isWindows() && process.env.PORTABLE_EXECUTABLE_DIR != null;
}
/**
* We block the browser integration on some unsupported platforms, which also
* blocks partially supported platforms (mac .dmg in dev builds) / prevents
* experimenting with the feature for QA. So this env var allows overriding
* the block.
*/
export function allowBrowserintegrationOverride() {
return process.env.ALLOW_BROWSER_INTEGRATION_OVERRIDE === "true";
}
/**
* Sanitize user agent so external resources used by the app can't built data on our users.
*/