1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Merge branch 'master' into feature/org-admin-refresh

This commit is contained in:
Shane Melton
2022-08-18 07:24:51 -07:00
49 changed files with 547 additions and 165 deletions

View File

@@ -267,16 +267,23 @@ jobs:
- name: Login to Azure ACR
run: az acr login -n bitwardenqa
- name: Tag and Push RC to Azure ACR QA registry
- name: Tag and Push to Azure QA ACR
env:
REGISTRY: bitwardenqa.azurecr.io
run: |
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
if [[ $(grep "pull" <<< "${GITHUB_REF}") ]]; then
IMAGE_TAG=$(echo "${GITHUB_HEAD_REF}" | sed "s#/#-#g")
else
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g")
fi
if [[ "$IMAGE_TAG" == "master" ]]; then
IMAGE_TAG=dev
fi
docker tag bitwarden/web \
$REGISTRY/web-sh:$IMAGE_TAG
docker push $REGISTRY/web-sh:$IMAGE_TAG
- name: Log out of Docker

View File

@@ -1,6 +1,9 @@
{
"devFlags": {
"storeSessionDecrypted": false
"storeSessionDecrypted": false,
"managedEnvironment": {
"base": "https://localhost:8080"
}
},
"flags": {}
}

View File

@@ -1,10 +1,12 @@
import MainBackground from "./background/main.background";
import { onCommandListener } from "./listeners/onCommandListener";
import { onInstallListener } from "./listeners/onInstallListener";
const manifest = chrome.runtime.getManifest();
if (manifest.manifest_version === 3) {
chrome.commands.onCommand.addListener(onCommandListener);
chrome.runtime.onInstalled.addListener(onInstallListener);
} else {
const bitwardenMain = ((window as any).bitwardenMain = new MainBackground());
bitwardenMain.bootstrap().then(() => {

View File

@@ -47,7 +47,6 @@ import { AuditService } from "@bitwarden/common/services/audit.service";
import { AuthService } from "@bitwarden/common/services/auth.service";
import { CipherService } from "@bitwarden/common/services/cipher.service";
import { CollectionService } from "@bitwarden/common/services/collection.service";
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
import { ContainerService } from "@bitwarden/common/services/container.service";
import { EncryptService } from "@bitwarden/common/services/encrypt.service";
import { EventService } from "@bitwarden/common/services/event.service";
@@ -55,7 +54,6 @@ import { ExportService } from "@bitwarden/common/services/export.service";
import { FileUploadService } from "@bitwarden/common/services/fileUpload.service";
import { FolderApiService } from "@bitwarden/common/services/folder/folder-api.service";
import { KeyConnectorService } from "@bitwarden/common/services/keyConnector.service";
import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.service";
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
import { OrganizationService } from "@bitwarden/common/services/organization.service";
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
@@ -74,7 +72,6 @@ import { TwoFactorService } from "@bitwarden/common/services/twoFactor.service";
import { UserVerificationApiService } from "@bitwarden/common/services/userVerification/userVerification-api.service";
import { UserVerificationService } from "@bitwarden/common/services/userVerification/userVerification.service";
import { UsernameGenerationService } from "@bitwarden/common/services/usernameGeneration.service";
import { WebCryptoFunctionService } from "@bitwarden/common/services/webCryptoFunction.service";
import { BrowserApi } from "../browser/browserApi";
import { SafariApp } from "../browser/safariApp";
@@ -85,15 +82,11 @@ import { StateService as StateServiceAbstraction } from "../services/abstraction
import AutofillService from "../services/autofill.service";
import { BrowserEnvironmentService } from "../services/browser-environment.service";
import { BrowserCryptoService } from "../services/browserCrypto.service";
import BrowserLocalStorageService from "../services/browserLocalStorage.service";
import BrowserMessagingService from "../services/browserMessaging.service";
import BrowserMessagingPrivateModeBackgroundService from "../services/browserMessagingPrivateModeBackground.service";
import BrowserPlatformUtilsService from "../services/browserPlatformUtils.service";
import { FolderService } from "../services/folders/folder.service";
import I18nService from "../services/i18n.service";
import { KeyGenerationService } from "../services/keyGeneration.service";
import { LocalBackedSessionStorageService } from "../services/localBackedSessionStorage.service";
import { StateService } from "../services/state.service";
import { VaultFilterService } from "../services/vaultFilter.service";
import VaultTimeoutService from "../services/vaultTimeout.service";
@@ -104,6 +97,17 @@ import IconDetails from "./models/iconDetails";
import { NativeMessagingBackground } from "./nativeMessaging.background";
import NotificationBackground from "./notification.background";
import RuntimeBackground from "./runtime.background";
import { cryptoFunctionServiceFactory } from "./service_factories/crypto-function-service.factory";
import { encryptServiceFactory } from "./service_factories/encrypt-service.factory";
import { environmentServiceFactory } from "./service_factories/environment-service.factory";
import { logServiceFactory } from "./service_factories/log-service.factory";
import { stateMigrationServiceFactory } from "./service_factories/state-migration-service.factory";
import { stateServiceFactory } from "./service_factories/state-service.factory";
import {
diskStorageServiceFactory,
memoryStorageServiceFactory,
secureStorageServiceFactory,
} from "./service_factories/storage-service.factory";
import TabsBackground from "./tabs.background";
import WebRequestBackground from "./webRequest.background";
@@ -195,33 +199,40 @@ export default class MainBackground {
const logoutCallback = async (expired: boolean, userId?: string) =>
await this.logout(expired, userId);
const services: Record<string, unknown> = {};
const factoryOptions = {
logServiceOptions: {
isDev: false,
},
cryptoFunctionServiceOptions: {
win: window,
},
stateMigrationServiceOptions: {
stateFactory: new StateFactory(GlobalState, Account),
},
stateServiceOptions: {
stateFactory: new StateFactory(GlobalState, Account),
},
};
this.messagingService = isPrivateMode
? new BrowserMessagingPrivateModeBackgroundService()
: new BrowserMessagingService();
this.logService = new ConsoleLogService(false);
this.cryptoFunctionService = new WebCryptoFunctionService(window);
this.storageService = new BrowserLocalStorageService();
this.secureStorageService = new BrowserLocalStorageService();
this.memoryStorageService =
chrome.runtime.getManifest().manifest_version == 3
? new LocalBackedSessionStorageService(
new EncryptService(this.cryptoFunctionService, this.logService, false),
new KeyGenerationService(this.cryptoFunctionService)
)
: new MemoryStorageService();
this.stateMigrationService = new StateMigrationService(
this.storageService,
this.secureStorageService,
new StateFactory(GlobalState, Account)
);
this.stateService = new StateService(
this.storageService,
this.secureStorageService,
this.memoryStorageService,
this.logService,
this.stateMigrationService,
new StateFactory(GlobalState, Account)
);
this.logService = logServiceFactory(services, factoryOptions);
this.cryptoFunctionService = cryptoFunctionServiceFactory(services, factoryOptions);
this.storageService = diskStorageServiceFactory(services, factoryOptions);
this.secureStorageService = secureStorageServiceFactory(services, factoryOptions);
this.memoryStorageService = memoryStorageServiceFactory(services, {
...factoryOptions,
encryptServiceOptions: {
logMacFailures: false,
},
});
this.stateMigrationService = stateMigrationServiceFactory(services, factoryOptions);
this.stateService = stateServiceFactory(services, {
...factoryOptions,
encryptServiceOptions: { logMacFailures: false },
});
this.platformUtilsService = new BrowserPlatformUtilsService(
this.messagingService,
this.stateService,
@@ -245,7 +256,13 @@ export default class MainBackground {
}
);
this.i18nService = new I18nService(BrowserApi.getUILanguage(window));
this.encryptService = new EncryptService(this.cryptoFunctionService, this.logService, true);
this.encryptService = encryptServiceFactory(services, {
...factoryOptions,
encryptServiceOptions: {
logMacFailures: true,
},
alwaysInitializeNewService: true,
}); // Update encrypt service with new instances
this.cryptoService = new BrowserCryptoService(
this.cryptoFunctionService,
this.encryptService,
@@ -255,7 +272,12 @@ export default class MainBackground {
);
this.tokenService = new TokenService(this.stateService);
this.appIdService = new AppIdService(this.storageService);
this.environmentService = new BrowserEnvironmentService(this.stateService, this.logService);
this.environmentService = environmentServiceFactory(services, {
...factoryOptions,
encryptServiceOptions: {
logMacFailures: false,
},
});
this.apiService = new ApiService(
this.tokenService,
this.platformUtilsService,

View File

@@ -0,0 +1,24 @@
import { CryptoFunctionService } from "@bitwarden/common/abstractions/cryptoFunction.service";
import { WebCryptoFunctionService } from "@bitwarden/common/services/webCryptoFunction.service";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
type CryptoFunctionServiceFactoryOptions = FactoryOptions & {
cryptoFunctionServiceOptions: {
win: Window | typeof global;
};
};
export type CryptoFunctionServiceInitOptions = CryptoFunctionServiceFactoryOptions;
export function cryptoFunctionServiceFactory(
cache: { cryptoFunctionService?: CryptoFunctionService } & CachedServices,
opts: CryptoFunctionServiceFactoryOptions
): CryptoFunctionService {
return factory(
cache,
"cryptoFunctionService",
opts,
() => new WebCryptoFunctionService(opts.cryptoFunctionServiceOptions.win)
);
}

View File

@@ -0,0 +1,35 @@
import { EncryptService } from "@bitwarden/common/services/encrypt.service";
import {
cryptoFunctionServiceFactory,
CryptoFunctionServiceInitOptions,
} from "./crypto-function-service.factory";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
import { LogServiceInitOptions, logServiceFactory } from "./log-service.factory";
type EncryptServiceFactoryOptions = FactoryOptions & {
encryptServiceOptions: {
logMacFailures: boolean;
};
};
export type EncryptServiceInitOptions = EncryptServiceFactoryOptions &
CryptoFunctionServiceInitOptions &
LogServiceInitOptions;
export function encryptServiceFactory(
cache: { encryptService?: EncryptService } & CachedServices,
opts: EncryptServiceInitOptions
): EncryptService {
return factory(
cache,
"encryptService",
opts,
() =>
new EncryptService(
cryptoFunctionServiceFactory(cache, opts),
logServiceFactory(cache, opts),
opts.encryptServiceOptions.logMacFailures
)
);
}

View File

@@ -0,0 +1,30 @@
import { BrowserEnvironmentService } from "../../services/browser-environment.service";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
import {
stateServiceFactory as stateServiceFactory,
StateServiceInitOptions,
} from "./state-service.factory";
type EnvironmentServiceFactoryOptions = FactoryOptions;
export type EnvironmentServiceInitOptions = EnvironmentServiceFactoryOptions &
StateServiceInitOptions &
LogServiceInitOptions;
export function environmentServiceFactory(
cache: { environmentService?: BrowserEnvironmentService } & CachedServices,
opts: EnvironmentServiceInitOptions
): BrowserEnvironmentService {
return factory(
cache,
"environmentService",
opts,
() =>
new BrowserEnvironmentService(
stateServiceFactory(cache, opts),
logServiceFactory(cache, opts)
)
);
}

View File

@@ -0,0 +1,24 @@
export type CachedServices = Record<string, any>;
export type FactoryOptions = {
alwaysInitializeNewService?: boolean;
doNotStoreInitializedService?: boolean;
[optionsKey: string]: unknown;
};
export function factory<
TCache extends CachedServices,
TName extends keyof TCache,
TOpts extends FactoryOptions
>(cachedServices: TCache, name: TName, opts: TOpts, factory: () => TCache[TName]): TCache[TName] {
let instance = cachedServices[name];
if (opts.alwaysInitializeNewService || !instance) {
instance = factory();
}
if (!opts.doNotStoreInitializedService) {
cachedServices[name] = instance;
}
return instance as TCache[TName];
}

View File

@@ -0,0 +1,24 @@
import { KeyGenerationService } from "../../services/keyGeneration.service";
import {
cryptoFunctionServiceFactory,
CryptoFunctionServiceInitOptions,
} from "./crypto-function-service.factory";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
type KeyGenerationServiceFactoryOptions = FactoryOptions;
export type KeyGenerationServiceInitOptions = KeyGenerationServiceFactoryOptions &
CryptoFunctionServiceInitOptions;
export function keyGenerationServiceFactory(
cache: { keyGenerationService?: KeyGenerationService } & CachedServices,
opts: KeyGenerationServiceInitOptions
): KeyGenerationService {
return factory(
cache,
"keyGenerationService",
opts,
() => new KeyGenerationService(cryptoFunctionServiceFactory(cache, opts))
);
}

View File

@@ -0,0 +1,26 @@
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { LogLevelType } from "@bitwarden/common/enums/logLevelType";
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
type LogServiceFactoryOptions = FactoryOptions & {
logServiceOptions: {
isDev: boolean;
filter?: (level: LogLevelType) => boolean;
};
};
export type LogServiceInitOptions = LogServiceFactoryOptions;
export function logServiceFactory(
cache: { logService?: LogService } & CachedServices,
opts: LogServiceInitOptions
): LogService {
return factory(
cache,
"logService",
opts,
() => new ConsoleLogService(opts.logServiceOptions.isDev, opts.logServiceOptions.filter)
);
}

View File

@@ -0,0 +1,40 @@
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
import { GlobalState } from "@bitwarden/common/models/domain/globalState";
import { StateMigrationService } from "@bitwarden/common/services/stateMigration.service";
import { Account } from "../../models/account";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
import {
diskStorageServiceFactory,
DiskStorageServiceInitOptions,
secureStorageServiceFactory,
SecureStorageServiceInitOptions,
} from "./storage-service.factory";
type StateMigrationServiceFactoryOptions = FactoryOptions & {
stateMigrationServiceOptions: {
stateFactory: StateFactory<GlobalState, Account>;
};
};
export type StateMigrationServiceInitOptions = StateMigrationServiceFactoryOptions &
DiskStorageServiceInitOptions &
SecureStorageServiceInitOptions;
export function stateMigrationServiceFactory(
cache: { stateMigrationService?: StateMigrationService } & CachedServices,
opts: StateMigrationServiceInitOptions
): StateMigrationService {
return factory(
cache,
"stateMigrationService",
opts,
() =>
new StateMigrationService(
diskStorageServiceFactory(cache, opts),
secureStorageServiceFactory(cache, opts),
opts.stateMigrationServiceOptions.stateFactory
)
);
}

View File

@@ -0,0 +1,55 @@
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
import { GlobalState } from "@bitwarden/common/models/domain/globalState";
import { Account } from "../../models/account";
import { StateService } from "../../services/state.service";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
import {
stateMigrationServiceFactory,
StateMigrationServiceInitOptions,
} from "./state-migration-service.factory";
import {
diskStorageServiceFactory,
secureStorageServiceFactory,
memoryStorageServiceFactory,
DiskStorageServiceInitOptions,
SecureStorageServiceInitOptions,
MemoryStorageServiceInitOptions,
} from "./storage-service.factory";
type StateServiceFactoryOptions = FactoryOptions & {
stateServiceOptions: {
useAccountCache?: boolean;
stateFactory: StateFactory<GlobalState, Account>;
};
};
export type StateServiceInitOptions = StateServiceFactoryOptions &
DiskStorageServiceInitOptions &
SecureStorageServiceInitOptions &
MemoryStorageServiceInitOptions &
LogServiceInitOptions &
StateMigrationServiceInitOptions;
export function stateServiceFactory(
cache: { stateService?: StateService } & CachedServices,
opts: StateServiceInitOptions
): StateService {
return factory(
cache,
"stateService",
opts,
() =>
new StateService(
diskStorageServiceFactory(cache, opts),
secureStorageServiceFactory(cache, opts),
memoryStorageServiceFactory(cache, opts),
logServiceFactory(cache, opts),
stateMigrationServiceFactory(cache, opts),
opts.stateServiceOptions.stateFactory,
opts.stateServiceOptions.useAccountCache
)
);
}

View File

@@ -0,0 +1,49 @@
import { AbstractStorageService } from "@bitwarden/common/abstractions/storage.service";
import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.service";
import BrowserLocalStorageService from "../../services/browserLocalStorage.service";
import { LocalBackedSessionStorageService } from "../../services/localBackedSessionStorage.service";
import { encryptServiceFactory, EncryptServiceInitOptions } from "./encrypt-service.factory";
import { CachedServices, factory, FactoryOptions } from "./factory-options";
import {
keyGenerationServiceFactory,
KeyGenerationServiceInitOptions,
} from "./key-generation-service.factory";
type StorageServiceFactoryOptions = FactoryOptions;
export type DiskStorageServiceInitOptions = StorageServiceFactoryOptions;
export type SecureStorageServiceInitOptions = StorageServiceFactoryOptions;
export type MemoryStorageServiceInitOptions = StorageServiceFactoryOptions &
EncryptServiceInitOptions &
KeyGenerationServiceInitOptions;
export function diskStorageServiceFactory(
cache: { diskStorageService?: AbstractStorageService } & CachedServices,
opts: DiskStorageServiceInitOptions
): AbstractStorageService {
return factory(cache, "diskStorageService", opts, () => new BrowserLocalStorageService());
}
export function secureStorageServiceFactory(
cache: { secureStorageService?: AbstractStorageService } & CachedServices,
opts: SecureStorageServiceInitOptions
): AbstractStorageService {
return factory(cache, "secureStorageService", opts, () => new BrowserLocalStorageService());
}
export function memoryStorageServiceFactory(
cache: { memoryStorageService?: AbstractStorageService } & CachedServices,
opts: MemoryStorageServiceInitOptions
): AbstractStorageService {
return factory(cache, "memoryStorageService", opts, () => {
if (chrome.runtime.getManifest().manifest_version == 3) {
return new LocalBackedSessionStorageService(
encryptServiceFactory(cache, opts),
keyGenerationServiceFactory(cache, opts)
);
}
return new MemoryStorageService();
});
}

View File

@@ -1,3 +1,5 @@
import { GroupPolicyEnvironment } from "./types/group-policy-environment";
function getFlags<T>(envFlags: string | T): T {
if (typeof envFlags === "string") {
return JSON.parse(envFlags) as T;
@@ -21,11 +23,13 @@ export function flagEnabled(flag: FlagName): boolean {
*/
export type DevFlags = {
storeSessionDecrypted?: boolean;
managedEnvironment?: GroupPolicyEnvironment;
};
export type DevFlagName = keyof DevFlags;
/**
* Gets whether the given dev flag is truthy.
* Gets the value of a dev flag from environment.
* Will always return false unless in development.
* @param flag The name of the dev flag to check
@@ -37,5 +41,21 @@ export function devFlagEnabled(flag: DevFlagName): boolean {
}
const devFlags = getFlags<DevFlags>(process.env.DEV_FLAGS);
return devFlags[flag] == null || devFlags[flag];
return devFlags[flag] == null || !!devFlags[flag];
}
/**
* Gets the value of a dev flag from environment.
* Will always return false unless in development.
* @param flag The name of the dev flag to check
* @returns The value of the flag
* @throws Error if the flag is not enabled
*/
export function devFlagValue<K extends DevFlagName>(flag: K): DevFlags[K] {
if (!devFlagEnabled(flag)) {
throw new Error(`This method should not be called, it is protected by a disabled dev flag.`);
}
const devFlags = getFlags<DevFlags>(process.env.DEV_FLAGS);
return devFlags[flag];
}

View File

@@ -0,0 +1,38 @@
import { StateFactory } from "@bitwarden/common/factories/stateFactory";
import { GlobalState } from "@bitwarden/common/models/domain/globalState";
import { environmentServiceFactory } from "../background/service_factories/environment-service.factory";
import { BrowserApi } from "../browser/browserApi";
import { Account } from "../models/account";
export function onInstallListener(details: chrome.runtime.InstalledDetails) {
const cache = {};
const opts = {
encryptServiceOptions: {
logMacFailures: false,
},
cryptoFunctionServiceOptions: {
win: self,
},
logServiceOptions: {
isDev: false,
},
stateServiceOptions: {
stateFactory: new StateFactory(GlobalState, Account),
},
stateMigrationServiceOptions: {
stateFactory: new StateFactory(GlobalState, Account),
},
};
const environmentService = environmentServiceFactory(cache, opts);
setTimeout(async () => {
if (details.reason != null && details.reason === "install") {
BrowserApi.createNewTab("https://bitwarden.com/browser-start/");
if (await environmentService.hasManagedEnvironment()) {
await environmentService.setUrlsToManagedEnvironment();
}
}
}, 100);
}

View File

@@ -33,7 +33,7 @@
}
&:hover,
&:focus,
&:focus-visible,
&.active {
@include themify($themes) {
background-color: themed("boxBackgroundHoverColor");
@@ -441,7 +441,7 @@
}
}
&:focus {
&:not([type="file"]):focus {
outline: none;
}
}

View File

@@ -26,26 +26,19 @@
>
<button
appStopClick
appBlurClick
(click)="selectAllVaults()"
[ngClass]="{ active: !myVaultOnly && !selectOrganizationId }"
>
<i class="bwi bwi-fw bwi-filter" aria-hidden="true"></i>
&nbsp;{{ "allVaults" | i18n }}
</button>
<button
*ngIf="!enforcePersonalOwnwership"
appStopClick
appBlurClick
(click)="selectMyVault()"
>
<button *ngIf="!enforcePersonalOwnwership" appStopClick (click)="selectMyVault()">
<i class="bwi bwi-fw bwi-user" aria-hidden="true"></i>
&nbsp;{{ "myVault" | i18n }}
</button>
<button
*ngFor="let organization of organizations"
appStopClick
appBlurClick
(click)="selectOrganization(organization)"
>
<i

View File

@@ -2,15 +2,8 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { EnvironmentService } from "@bitwarden/common/services/environment.service";
type GroupPolicyEnvironment = {
base?: string;
webVault?: string;
api?: string;
identity?: string;
icons?: string;
notifications?: string;
events?: string;
};
import { devFlagEnabled, devFlagValue } from "../flags";
import { GroupPolicyEnvironment } from "../types/group-policy-environment";
export class BrowserEnvironmentService extends EnvironmentService {
constructor(stateService: StateService, private logService: LogService) {
@@ -41,15 +34,17 @@ export class BrowserEnvironmentService extends EnvironmentService {
}
getManagedEnvironment(): Promise<GroupPolicyEnvironment> {
return new Promise((resolve, reject) => {
chrome.storage.managed.get("environment", (result) => {
if (chrome.runtime.lastError) {
return reject(chrome.runtime.lastError);
}
return devFlagEnabled("managedEnvironment")
? new Promise((resolve) => resolve(devFlagValue("managedEnvironment")))
: new Promise((resolve, reject) => {
chrome.storage.managed.get("environment", (result) => {
if (chrome.runtime.lastError) {
return reject(chrome.runtime.lastError);
}
resolve(result.environment);
});
});
resolve(result.environment);
});
});
}
async setUrlsToManagedEnvironment() {

View File

@@ -0,0 +1,9 @@
export type GroupPolicyEnvironment = {
base?: string;
webVault?: string;
api?: string;
identity?: string;
icons?: string;
notifications?: string;
events?: string;
};

View File

@@ -281,7 +281,7 @@ export class Program extends BaseProgram {
writeLn("", true);
})
.action(async (cmd) => {
await this.exitIfLocked();
await this.exitIfNotAuthed();
const command = new SyncCommand(this.main.syncService);
const response = await command.run(cmd);
this.processResponse(response);

View File

@@ -1,7 +1,7 @@
{
"name": "@bitwarden/desktop",
"description": "A secure and free password manager for all of your devices.",
"version": "2022.8.1",
"version": "2022.8.2",
"keywords": [
"bitwarden",
"password",

View File

@@ -1,4 +1,4 @@
<div class="modal fade" role="dialog" aria-modal="true" attr.aria-label="{{ 'settings' | i18n }}">
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="deleteAccountTitle">
<div class="modal-dialog" role="document">
<form
class="modal-content"
@@ -13,7 +13,9 @@
{{ "deleteAccountWarning" | i18n }}
</app-callout>
<div class="box last">
<div class="box-header">{{ "deleteAccount" | i18n }}</div>
<h1 class="box-header" id="deleteAccountTitle">
{{ "deleteAccount" | i18n }}
</h1>
<div class="box-content">
<app-user-verification
ngDefaultControl

View File

@@ -1,11 +1,11 @@
<div class="modal fade" role="dialog" aria-modal="true" attr.aria-label="{{ 'settings' | i18n }}">
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="selfHosteEnvironmentTitle">
<div class="modal-dialog" role="document">
<form class="modal-content" (ngSubmit)="submit()">
<div class="modal-body">
<div class="box">
<div class="box-header">
<h1 class="box-header" id="selfHosteEnvironmentTitle">
{{ "selfHostedEnvironment" | i18n }}
</div>
</h1>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="baseUrl">{{ "baseUrl" | i18n }}</label>
@@ -24,13 +24,13 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
<button type="button" (click)="toggleCustom()" [attr.aria-expanded]="showCustom">
<i class="bwi bwi-plus-square" [hidden]="showCustom" aria-hidden="true"></i>
<i class="bwi bwi-minus-square" [hidden]="!showCustom" aria-hidden="true"></i>
{{ "customEnvironment" | i18n }}
</button>
</div>
</h2>
<div class="box-content" [hidden]="!showCustom">
<div class="box-content-row" appBoxRow>
<label for="webVaultUrl">{{ "webVaultUrl" | i18n }}</label>

View File

@@ -3,9 +3,9 @@
<div class="modal-content">
<div class="modal-body">
<div class="box">
<div class="box-header" id="premiumTitle">
<h1 class="box-header" id="premiumTitle">
{{ "premiumMembership" | i18n }}
</div>
</h1>
<div class="box-content box-content-padded">
<div *ngIf="!isPremium">
<p class="text-center lead">{{ "premiumNotCurrentMember" | i18n }}</p>

View File

@@ -1,11 +1,11 @@
<div class="modal fade" role="dialog" aria-modal="true" attr.aria-label="{{ 'settings' | i18n }}">
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="settingsTitle">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body form">
<div class="box">
<div class="box-header">
<h1 class="box-header" id="settingsTitle">
{{ "settingsTitle" | i18n: currentUserEmail }}
</div>
</h1>
<div class="box-content box-content-padded">
<h2>
<button

View File

@@ -3,9 +3,9 @@
<div class="modal-content">
<div class="modal-body">
<div class="box">
<div class="box-header" id="twoStepTitle">
<h1 class="box-header" id="twoStepTitle">
{{ "twoStepOptions" | i18n }}
</div>
</h1>
<div class="box-content">
<button
type="button"

View File

@@ -1,9 +1,11 @@
<div class="modal fade" role="dialog" aria-modal="true">
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="passwordConfirmationTitle">
<div class="modal-dialog modal-dialog-scrollable" role="document">
<form class="modal-content" #form (ngSubmit)="submit()">
<div class="modal-body">
<div class="box">
<div class="box-header">{{ "passwordConfirmation" | i18n }}</div>
<h1 class="box-header" id="passwordConfirmationTitle">
{{ "passwordConfirmation" | i18n }}
</h1>
<div class="box-content">
<div class="box-content-row box-content-row-flex" appBoxRow>
<div class="row-main">

View File

@@ -10,9 +10,9 @@
</app-callout>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ title }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="name">{{ "name" | i18n }}</label>
@@ -92,7 +92,7 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
<button
type="button"
class="toggle"
@@ -107,7 +107,7 @@
[ngClass]="{ 'bwi-angle-down': !showOptions, 'bwi-chevron-up': showOptions }"
></i>
</button>
</div>
</h2>
</div>
<div [hidden]="!showOptions">
<app-send-efflux-dates
@@ -179,9 +179,9 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "notes" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<textarea
@@ -227,9 +227,9 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "share" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row" appBoxRow *ngIf="editMode">
<label for="link">{{ "sendLinkLabel" | i18n }}</label>

View File

@@ -1,7 +1,7 @@
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "customFields" | i18n }}
</div>
</h2>
<div class="box-content">
<div cdkDropList (cdkDropListDropped)="drop($event)" *ngIf="cipher.hasFields">
<div

View File

@@ -5,9 +5,9 @@
<app-callout type="info" *ngIf="allowOwnershipOptions() && !allowPersonal">
{{ "personalOwnershipPolicyInEffect" | i18n }}
</app-callout>
<div class="box-header">
<h2 class="box-header">
{{ title }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row" *ngIf="!editMode" appBoxRow>
<label for="type">{{ "type" | i18n }}</label>
@@ -504,9 +504,9 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
<label for="notes">{{ "notes" | i18n }}</label>
</div>
</h2>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<textarea id="notes" name="Notes" rows="6" [(ngModel)]="cipher.notes"></textarea>
@@ -520,9 +520,9 @@
>
</app-vault-add-edit-custom-fields>
<div class="box" *ngIf="allowOwnershipOptions()">
<div class="box-header">
<h2 class="box-header">
{{ "ownership" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="organizationId">{{ "whoOwnsThisItem" | i18n }}</label>
@@ -539,9 +539,9 @@
</div>
</div>
<div class="box" *ngIf="(!editMode || cloneMode) && cipher.organizationId">
<div class="box-header">
<h2 class="box-header">
{{ "collections" | i18n }}
</div>
</h2>
<div class="box-content" *ngIf="!collections || !collections.length">
{{ "noCollectionsInList" | i18n }}
</div>

View File

@@ -3,9 +3,9 @@
<form class="modal-content" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<div class="modal-body">
<div class="box" *ngIf="cipher && cipher.hasAttachments">
<div class="box-header" id="attachmentsTitle">
<h1 class="box-header" id="attachmentsTitle">
{{ "attachments" | i18n }}
</div>
</h1>
<div class="box-content no-hover">
<div class="box-content-row box-content-row-flex" *ngFor="let a of cipher.attachments">
<div class="row-main">
@@ -39,9 +39,9 @@
</div>
</div>
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "newAttachment" | i18n }}
</div>
</h2>
<div class="box-content no-hover">
<div class="box-content-row">
<label for="file">{{ "file" | i18n }}</label>

View File

@@ -3,9 +3,9 @@
<form class="modal-content" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<div class="modal-body">
<div class="box">
<div class="box-header" id="collectionsTitle">
<h1 class="box-header" id="collectionsTitle">
{{ "collections" | i18n }}
</div>
</h1>
<div class="box-content" *ngIf="!collections || !collections.length">
{{ "noCollectionsInList" | i18n }}
</div>

View File

@@ -11,9 +11,9 @@
</app-callout>
<app-export-scope-callout *ngIf="!disabledByPolicy"></app-export-scope-callout>
<div class="box">
<div class="box-header" id="exportTitle">
<h1 class="box-header" id="exportTitle">
{{ "exportVault" | i18n }}
</div>
</h1>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="format">{{ "fileFormat" | i18n }}</label>

View File

@@ -3,9 +3,9 @@
<form class="modal-content" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<div class="modal-body">
<div class="box">
<div class="box-header" id="folderAddEditTitle">
<h1 class="box-header" id="folderAddEditTitle">
{{ title }}
</div>
</h1>
<div class="box-content">
<div class="box-content-row" appBoxRow>
<label for="name">{{ "name" | i18n }}</label>

View File

@@ -1,15 +1,10 @@
<div
class="modal fade"
role="dialog"
aria-modal="true"
attr.aria-label="{{ 'generatePassword' | i18n }}"
>
<div class="modal fade" role="dialog" aria-modal="true" aria-labelledby="generatorTitle">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-title">
<h1 class="modal-title" id="generatorTitle">
{{ "generator" | i18n }}
</div>
</h1>
<app-callout
type="info"
*ngIf="enforcedPasswordPolicyOptions?.inEffect() && type === 'password'"
@@ -103,7 +98,7 @@
</div>
<ng-container *ngIf="type === 'password'">
<div class="box">
<div class="box-header">
<h2 class="box-header">
<button
type="button"
(click)="toggleOptions()"
@@ -114,7 +109,7 @@
<i class="bwi bwi-minus-square" aria-hidden="true" [hidden]="!showOptions"></i>
{{ "options" | i18n }}
</button>
</div>
</h2>
<div class="box-content condensed" [hidden]="!showOptions">
<div
class="box-content-row box-content-row-radio"
@@ -303,7 +298,7 @@
</ng-container>
<ng-container *ngIf="type === 'username'">
<div class="box">
<div class="box-header">
<h2 class="box-header">
<button
type="button"
(click)="toggleOptions()"
@@ -314,7 +309,7 @@
<i class="bwi bwi-minus-square" aria-hidden="true" [hidden]="!showOptions"></i>
{{ "options" | i18n }}
</button>
</div>
</h2>
<div class="box-content condensed" [hidden]="!showOptions">
<div
class="box-content-row box-content-row-radio"

View File

@@ -3,9 +3,9 @@
<div class="modal-content">
<div class="modal-body">
<div class="box">
<div class="box-header" id="passwordGenHistoryTitle">
<h1 class="box-header" id="passwordGenHistoryTitle">
{{ "passwordHistory" | i18n }}
</div>
</h1>
<div class="box-content condensed">
<div class="box-content-row box-content-row-flex" *ngFor="let h of history">
<div class="row-main">

View File

@@ -3,9 +3,9 @@
<div class="modal-content">
<div class="modal-body">
<div class="box">
<div class="box-header" id="passwordHistoryTitle">
<h1 class="box-header" id="passwordHistoryTitle">
{{ "passwordHistory" | i18n }}
</div>
</h1>
<div class="box-content condensed">
<div class="box-content-row box-content-row-flex" *ngFor="let h of history">
<div class="row-main">

View File

@@ -3,9 +3,9 @@
<form class="modal-content" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<div class="modal-body">
<div class="box">
<div class="box-header" id="moveToOrgTitle">
<h1 class="box-header" id="moveToOrgTitle">
{{ "moveToOrganization" | i18n }}
</div>
</h1>
<div class="box-content" *ngIf="!organizations || !organizations.length">
<div class="box-content-row">
{{ "noOrganizationsList" | i18n }}
@@ -29,9 +29,9 @@
</div>
</div>
<div class="box" *ngIf="organizations && organizations.length">
<div class="box-header">
<h2 class="box-header">
{{ "collections" | i18n }}
</div>
</h2>
<div class="box-content" *ngIf="!collections || !collections.length">
{{ "noCollectionsInList" | i18n }}
</div>

View File

@@ -1,7 +1,7 @@
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "customFields" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row box-content-row-flex" *ngFor="let field of cipher.fields">
<div class="row-main">

View File

@@ -1,9 +1,9 @@
<div class="content">
<div class="inner-content" *ngIf="cipher">
<div class="box">
<div class="box-header">
<h2 class="box-header">
{{ "itemInformation" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row">
<span class="row-label">{{ "name" | i18n }}</span>
@@ -321,9 +321,9 @@
</div>
</div>
<div class="box" *ngIf="cipher.notes">
<div class="box-header">
<h2 class="box-header">
{{ "notes" | i18n }}
</div>
</h2>
<div class="box-content">
<div class="box-content-row pre-wrap">{{ cipher.notes }}</div>
</div>
@@ -336,9 +336,9 @@
>
</app-vault-view-custom-fields>
<div class="box" *ngIf="cipher.hasAttachments && (canAccessPremium || cipher.organizationId)">
<div class="box-header">
<h2 class="box-header">
{{ "attachments" | i18n }}
</div>
</h2>
<div class="box-content">
<button
type="button"

View File

@@ -1,12 +1,12 @@
{
"name": "@bitwarden/desktop",
"version": "2022.8.1",
"version": "2022.8.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@bitwarden/desktop",
"version": "2022.8.1",
"version": "2022.8.2",
"license": "GPL-3.0",
"dependencies": {
"@bitwarden/desktop-native": "file:../desktop_native"

View File

@@ -2,7 +2,7 @@
"name": "@bitwarden/desktop",
"productName": "Bitwarden",
"description": "A secure and free password manager for all of your devices.",
"version": "2022.8.1",
"version": "2022.8.2",
"author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)",
"homepage": "https://bitwarden.com",
"license": "GPL-3.0",

View File

@@ -31,10 +31,8 @@ h4,
h5,
h6 {
font-family: $font-family-sans-serif;
@include themify($themes) {
color: themed("textColor");
}
font-size: $font-size-base;
font-weight: normal;
}
p {

View File

@@ -48,7 +48,7 @@
}
&:hover,
&:focus,
&:focus-visible,
&.active {
@include themify($themes) {
background-color: themed("boxBackgroundHoverColor");
@@ -77,6 +77,10 @@
&.box-content-padded {
padding: 10px 15px;
.box-header-expandable[aria-expanded="true"] {
margin-bottom: 1rem;
}
}
&.condensed .box-content-row,
@@ -343,7 +347,7 @@
}
}
&:focus {
&:not([type="file"]):focus {
outline: none;
}
}

View File

@@ -41,7 +41,7 @@
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-submit" appBlurClick>
<button type="submit" class="btn btn-primary btn-submit">
<span>{{ "ok" | i18n }}</span>
</button>
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">

View File

@@ -2,7 +2,7 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title" title="2faDuoTitle">
<h2 class="modal-title" id="2faDuoTitle">
{{ "twoStepLogin" | i18n }}
<small>Duo</small>
</h2>

View File

@@ -1,12 +0,0 @@
import { Directive, ElementRef, HostListener } from "@angular/core";
@Directive({
selector: "[appBlurClick]",
})
export class BlurClickDirective {
constructor(private el: ElementRef) {}
@HostListener("click") onClick() {
this.el.nativeElement.blur();
}
}

View File

@@ -11,7 +11,6 @@ import { A11yInvalidDirective } from "./directives/a11y-invalid.directive";
import { A11yTitleDirective } from "./directives/a11y-title.directive";
import { ApiActionDirective } from "./directives/api-action.directive";
import { AutofocusDirective } from "./directives/autofocus.directive";
import { BlurClickDirective } from "./directives/blur-click.directive";
import { BoxRowDirective } from "./directives/box-row.directive";
import { FallbackSrcDirective } from "./directives/fallback-src.directive";
import { InputStripSpacesDirective } from "./directives/input-strip-spaces.directive";
@@ -48,7 +47,6 @@ import { PasswordStrengthComponent } from "./shared/components/password-strength
ApiActionDirective,
AutofocusDirective,
AvatarComponent,
BlurClickDirective,
BoxRowDirective,
CalloutComponent,
ColorPasswordCountPipe,
@@ -78,7 +76,6 @@ import { PasswordStrengthComponent } from "./shared/components/password-strength
AutofocusDirective,
AvatarComponent,
BitwardenToastModule,
BlurClickDirective,
BoxRowDirective,
CalloutComponent,
ColorPasswordCountPipe,

2
package-lock.json generated
View File

@@ -221,7 +221,7 @@
},
"apps/desktop": {
"name": "@bitwarden/desktop",
"version": "2022.8.1",
"version": "2022.8.2",
"hasInstallScript": true,
"license": "GPL-3.0"
},