1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-30 16:23:53 +00:00

OSS and commercial desktop are up and running

This commit is contained in:
Derek Nance
2025-12-19 13:38:33 -06:00
parent 44e125da3d
commit c600d41c66
9 changed files with 56 additions and 21 deletions

View File

@@ -34,8 +34,10 @@
"build:renderer": "cross-env NODE_ENV=production webpack --config webpack.config.js --config-name renderer",
"build:renderer:dev": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer",
"build:renderer:watch": "cross-env NODE_ENV=development webpack --config webpack.config.js --config-name renderer --watch",
"build:bit": "concurrently -n Main,Rend,Prel -c yellow,cyan \"npm run build:bit:main\" \"npm run build:bit:renderer\" \"npm run build:bit:preload\"",
"build:bit:main": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name main",
"build:bit:renderer": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name renderer",
"build:bit:preload": "cross-env NODE_ENV=production webpack --config ../../bitwarden_license/bit-desktop/webpack.config.js --config-name preload",
"electron": "node ./scripts/start.js",
"electron:ignore": "node ./scripts/start.js --ignore-certificate-errors",
"flatpak:dev": "npm run clean:dist && electron-builder --dir -p never && flatpak-builder --force-clean --install --user ../../.flatpak/ ./resources/com.bitwarden.desktop.devel.yaml && flatpak run com.bitwarden.desktop",

View File

@@ -0,0 +1,13 @@
import tools from "./app/tools/preload";
import auth from "./auth/preload";
import autofill from "./autofill/preload";
import keyManagement from "./key-management/preload";
import platform from "./platform/preload";
export const ipc = {
auth,
autofill,
platform,
keyManagement,
tools,
} as const;

View File

@@ -1,10 +1,6 @@
import { contextBridge } from "electron";
import tools from "./app/tools/preload";
import auth from "./auth/preload";
import autofill from "./autofill/preload";
import keyManagement from "./key-management/preload";
import platform from "./platform/preload";
import { ipc } from "./preload.base";
/**
* Bitwarden Preload script.
@@ -17,12 +13,6 @@ import platform from "./platform/preload";
*/
// Each team owns a subspace of the `ipc` global variable in the renderer.
export const ipc = {
auth,
autofill,
platform,
keyManagement,
tools,
};
export { ipc };
contextBridge.exposeInMainWorld("ipc", ipc);

View File

@@ -1,9 +1,15 @@
import "zone.js";
// Register the locales for the application
import "@bitwarden/desktop/platform/app/locales";
import { NgModule } from "@angular/core";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ColorPasswordCountPipe } from "@bitwarden/angular/pipes/color-password-count.pipe";
import { ColorPasswordPipe } from "@bitwarden/angular/pipes/color-password.pipe";
import { CalloutModule, DialogModule } from "@bitwarden/components";
import { AppRoutingModule as OssAppRoutingModule } from "@bitwarden/desktop/app/app-routing.module";
import { UserVerificationComponent } from "@bitwarden/desktop/app/components/user-verification.component";
import { AccountSwitcherComponent } from "@bitwarden/desktop/app/layout/account-switcher.component";
import { HeaderComponent } from "@bitwarden/desktop/app/layout/header.component";
@@ -25,6 +31,7 @@ import { AppComponent } from "./app.component";
imports: [
BrowserAnimationsModule,
SharedModule,
OssAppRoutingModule,
AppRoutingModule,
VaultFilterModule,
LoginModule,

View File

@@ -3,14 +3,11 @@ import "core-js/proposals/explicit-resource-management";
import { enableProdMode } from "@angular/core";
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { ipc } from "@bitwarden/desktop/preload";
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../../../../apps/desktop/src/scss/styles.scss");
// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../../../../apps/desktop/src/scss/tailwind.css");
// TODO use commercial variant
import { AppModule } from "./app.module";
if (!ipc.platform.isDev) {

View File

@@ -0,0 +1,10 @@
declare module "forcefocus";
declare const ipc: typeof import("./preload").ipc;
/**
* Will be turned into a constant string in the main process only
* likely either `"development"` or `"production"`.
*
* This is done using the `DefinePlugin` in our webpack files.
*/
declare const BIT_ENVIRONMENT: string;

View File

@@ -0,0 +1,17 @@
import { contextBridge } from "electron";
import { ipc as ossIpc } from "@bitwarden/desktop/preload.base";
/**
* Bitwarden Preload script.
*
* This file extends the OSS IPC with commercial-specific channels.
*
* See the OSS preload script for more information.
*/
export const ipc = {
...ossIpc,
};
contextBridge.exposeInMainWorld("ipc", ipc);

View File

@@ -1,10 +1,9 @@
{
"extends": "../../apps/desktop/tsconfig.renderer.json",
"include": [
"src",
"../../apps/desktop/src/global.d.ts",
// "src",
"src/app/main.ts",
"src/global.d.ts",
"../../bitwarden_license/bit-common/src/platform/sdk/sdk-alias.d.ts"
]
}

View File

@@ -32,8 +32,8 @@ module.exports = (webpackConfig, context) => {
tsConfig: path.resolve(__dirname, "tsconfig.json"),
},
preload: {
entry: "",
tsConfig: "",
entry: path.resolve(__dirname, "src/preload.ts"),
tsConfig: path.resolve(__dirname, "tsconfig.json"),
},
});
}