mirror of
https://github.com/bitwarden/browser
synced 2026-02-11 05:53:42 +00:00
Add mac, snap
This commit is contained in:
@@ -19,8 +19,11 @@ pub const NATIVE_MESSAGING_BUFFER_SIZE: usize = 1024 * 1024;
|
||||
/// but ideally the messages should be processed as quickly as possible.
|
||||
pub const MESSAGE_CHANNEL_BUFFER: usize = 32;
|
||||
|
||||
pub const FLATPAK_PATHS: [&str; 1] = [
|
||||
pub const FLATPAK_PATHS: [&str; 4] = [
|
||||
"org.mozilla.firefox/.mozilla/native-messaging-hosts",
|
||||
"com.google.Chrome/.config/google-chrome/NativeMessagingHosts",
|
||||
"org.chromium.Chromium/.config/chromium/NativeMessagingHosts",
|
||||
"com.microsoft.Edge/.config/microsoft-edge/NativeMessagingHosts",
|
||||
];
|
||||
|
||||
/// This is the codec used for communication through the UNIX socket / Windows named pipe.
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
"to": "desktop_proxy"
|
||||
}
|
||||
],
|
||||
"target": ["deb", "freebsd", "rpm", "AppImage", "snap"],
|
||||
"target": ["snap"],
|
||||
"desktop": {
|
||||
"Name": "Bitwarden",
|
||||
"Type": "Application",
|
||||
@@ -256,6 +256,12 @@
|
||||
"action-prefix": "com.bitwarden.Bitwarden"
|
||||
}
|
||||
},
|
||||
{
|
||||
"personal-files": {
|
||||
"read": [],
|
||||
"write": ["$HOME/.config/chromium", "$HOME/.config/google-chrome", "$HOME/.mozilla"]
|
||||
}
|
||||
},
|
||||
"u2f-devices"
|
||||
],
|
||||
"stagePackages": ["default"]
|
||||
|
||||
@@ -17,7 +17,7 @@ finish-args:
|
||||
- --talk-name=org.freedesktop.secrets
|
||||
- --talk-name=com.canonical.AppMenu.Registrar
|
||||
- --system-talk-name=org.freedesktop.PolicyKit1
|
||||
# Lock on lockscreen
|
||||
# Lock on lockscreen
|
||||
- --talk-name=org.gnome.ScreenSaver
|
||||
- --talk-name=org.freedesktop.ScreenSaver
|
||||
- --system-talk-name=org.freedesktop.login1
|
||||
@@ -27,8 +27,12 @@ finish-args:
|
||||
# Browser integration
|
||||
# The config directory is needed to write manifests for non-flatpak
|
||||
# Sockets are mounted in each app's directory
|
||||
- --filesystem=xdg-config
|
||||
#
|
||||
# Non-sandboxed
|
||||
- --filesystem=xdg-config/google-chrome
|
||||
- --filesystem=xdg-config/chromium
|
||||
- --filesystem=home/.mozilla
|
||||
# Flatpak-sandboxed
|
||||
- --filesystem=~/.var/app/org.mozilla.firefox/
|
||||
modules:
|
||||
- name: bitwarden-desktop
|
||||
|
||||
@@ -693,22 +693,6 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
ipc.platform.allowBrowserintegrationOverride || ipc.platform.isDev;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (ipc.platform.isWindowsStore) {
|
||||
await this.dialogService.openSimpleDialog({
|
||||
title: { key: "browserIntegrationUnsupportedTitle" },
|
||||
@@ -721,19 +705,6 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
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(
|
||||
|
||||
@@ -2115,15 +2115,9 @@
|
||||
"browserIntegrationErrorDesc": {
|
||||
"message": "An error has occurred while enabling browser integration."
|
||||
},
|
||||
"browserIntegrationMasOnlyDesc": {
|
||||
"message": "Unfortunately browser integration is only supported in the Mac App Store version for now."
|
||||
},
|
||||
"browserIntegrationWindowsStoreDesc": {
|
||||
"message": "Unfortunately browser integration is currently not supported in the Microsoft Store version."
|
||||
},
|
||||
"browserIntegrationLinuxDesc": {
|
||||
"message": "Unfortunately browser integration is currently not supported in the linux version."
|
||||
},
|
||||
"enableBrowserIntegrationFingerprint": {
|
||||
"message": "Require verification for browser integration"
|
||||
},
|
||||
|
||||
@@ -110,7 +110,7 @@ export class NativeMessagingMain {
|
||||
}
|
||||
});
|
||||
|
||||
for (const path in this.ipcServer.getPaths()) {
|
||||
for (const path of this.ipcServer.getPaths()) {
|
||||
this.logService.info("Native messaging server started at:", path);
|
||||
}
|
||||
|
||||
@@ -197,17 +197,33 @@ export class NativeMessagingMain {
|
||||
break;
|
||||
}
|
||||
case "linux": {
|
||||
// Because on linux, th path inside the sandbox is different, and we want to support:
|
||||
// Flatpak App, Unsandboxed App, Flatpak Browser, Unsandboxed Browser, Snap App, Unsandboxed App
|
||||
// and any combination of the above, we copy the binary to the applications native-messaging-hosts path
|
||||
// so that a canonical path to put in the manifest can be used.
|
||||
|
||||
// Unsandboxed browser
|
||||
for (const [key, value] of Object.entries(this.getLinuxNMHS())) {
|
||||
if (existsSync(value)) {
|
||||
let nhmsPath = path.join(value, "NativeMessagingHosts");
|
||||
if (key === "Firefox") {
|
||||
nhmsPath = path.join(value, "native-messaging-hosts");
|
||||
}
|
||||
const browserBinaryPath = path.join(nhmsPath, ".bitwarden_desktop_proxy");
|
||||
|
||||
await fs.mkdir(nhmsPath, { recursive: true });
|
||||
await fs.copyFile(binaryPath, browserBinaryPath);
|
||||
this.logService.info(`Copied ${binaryPath} to ${browserBinaryPath}`);
|
||||
|
||||
if (key === "Firefox") {
|
||||
await this.writeManifest(
|
||||
path.join(value, "native-messaging-hosts", "com.8bit.bitwarden.json"),
|
||||
await this.generateFirefoxJson(binaryPath),
|
||||
path.join(nhmsPath, "com.8bit.bitwarden.json"),
|
||||
await this.generateFirefoxJson(browserBinaryPath),
|
||||
);
|
||||
} else {
|
||||
await this.writeManifest(
|
||||
path.join(value, "NativeMessagingHosts", "com.8bit.bitwarden.json"),
|
||||
await this.generateChromeJson(binaryPath),
|
||||
path.join(nhmsPath, "com.8bit.bitwarden.json"),
|
||||
await this.generateChromeJson(browserBinaryPath),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -216,11 +232,9 @@ export class NativeMessagingMain {
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(this.getFlatpakNMHS())) {
|
||||
this.logService.info(`Flatpak ${key} found at ${value}`);
|
||||
if (existsSync(value)) {
|
||||
this.logService.info(`Flatpak ${key} found at ${value}`);
|
||||
const sandboxedProxyBinaryPath = path.join(value, "bitwarden_desktop_proxy");
|
||||
await fs.copyFile(binaryPath, path.join(value, "bitwarden_desktop_proxy"));
|
||||
await fs.copyFile(binaryPath, path.join(value, ".bitwarden_desktop_proxy"));
|
||||
this.logService.info(
|
||||
`Copied ${sandboxedProxyBinaryPath} to ${path.join(value, "bitwarden_desktop_proxy")}`,
|
||||
);
|
||||
@@ -372,6 +386,9 @@ export class NativeMessagingMain {
|
||||
private getFlatpakNMHS() {
|
||||
return {
|
||||
Firefox: `${this.homedir()}/.var/app/org.mozilla.firefox/.mozilla/native-messaging-hosts/`,
|
||||
Chrome: `${this.homedir()}/.var/app/com.google.Chrome/.config/google-chrome/`,
|
||||
Chromium: `${this.homedir()}/.var/app/org.chromium.Chromium/.config/chromium/`,
|
||||
"Microsoft Edge": `${this.homedir()}/.var/app/com.microsoft.Edge/.config/microsoft-edge/`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export function isWindowsPortable() {
|
||||
|
||||
/**
|
||||
* We block the browser integration on some unsupported platforms, which also
|
||||
* blocks partially supported platforms (mac .dmg in dev builds) / prevents
|
||||
* blocks partially supported platforms / prevents
|
||||
* experimenting with the feature for QA. So this env var allows overriding
|
||||
* the block.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user