mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[PM-12989] Create process for qa to build client with particular sdk version (#11601)
* feat: update sdk service abstraction with documentation and new `userClient$` function * feat: add uninitialized user client with cache * feat: initialize user crypto * feat: initialize org keys * fix: org crypto not initializing properly * feat: avoid creating clients unnecessarily * chore: remove dev print/subscription * fix: clean up cache * chore: update sdk version * feat: implement clean-up logic (#11504) * chore: bump sdk version to fix build issues * chore: bump sdk version to fix build issues * fix: missing constructor parameters * refactor: simplify free() and delete() calls * refactor: use a named function for client creation * fix: client never freeing after refactor * fix: broken impl and race condition in tests * feat: add sdk override to desktop build * feat: add SDK version to browser about dialog * feat: add sdk override to browser build * fix: `npm ci` overriding the override * fix: artifacts not properly downloaded * fix: switch to new repository * feat: add debug version function to web * feat: add sdk-version to CLI * feat: add version to desktop * feat: add override to cli * feat: add override to web * fix: cli version acting as default command * fix: consistent workflow input name * feat: add error handling * feat: upgrade sdk-internal * fix: forgot to update package lock * fix: broken CI build move sdk version to a regular command * chore: revert version changes * refactor: move error handling code * chore: bump SDK to 0.2.0.main-1 * fix: clean up references to inputs.sdk_commit * refactor: rename `init` to `applyVersionToWindow`
This commit is contained in:
@@ -17,6 +17,8 @@ import { EventUploadService } from "@bitwarden/common/services/event/event-uploa
|
||||
import { VaultTimeoutService } from "@bitwarden/common/services/vault-timeout/vault-timeout.service";
|
||||
import { KeyService as KeyServiceAbstraction } from "@bitwarden/key-management";
|
||||
|
||||
import { VersionService } from "../platform/version.service";
|
||||
|
||||
@Injectable()
|
||||
export class InitService {
|
||||
constructor(
|
||||
@@ -32,6 +34,7 @@ export class InitService {
|
||||
private encryptService: EncryptService,
|
||||
private userAutoUnlockKeyService: UserAutoUnlockKeyService,
|
||||
private accountService: AccountService,
|
||||
private versionService: VersionService,
|
||||
@Inject(DOCUMENT) private document: Document,
|
||||
) {}
|
||||
|
||||
@@ -54,6 +57,8 @@ export class InitService {
|
||||
const htmlEl = this.win.document.documentElement;
|
||||
htmlEl.classList.add("locale_" + this.i18nService.translationLocale);
|
||||
this.themingService.applyThemeChangesTo(this.document);
|
||||
this.versionService.applyVersionToWindow();
|
||||
|
||||
const containerService = new ContainerService(this.keyService, this.encryptService);
|
||||
containerService.attachToGlobal(this.win);
|
||||
};
|
||||
|
||||
34
apps/web/src/app/platform/version.service.ts
Normal file
34
apps/web/src/app/platform/version.service.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { catchError, firstValueFrom, map } from "rxjs";
|
||||
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
||||
|
||||
type Version = {
|
||||
client: string;
|
||||
sdk: string;
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class VersionService {
|
||||
constructor(
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private sdkService: SdkService,
|
||||
) {}
|
||||
|
||||
applyVersionToWindow() {
|
||||
(window as any).__version = async (): Promise<Version> => {
|
||||
return {
|
||||
client: await this.platformUtilsService.getApplicationVersion(),
|
||||
sdk: await firstValueFrom(
|
||||
this.sdkService.client$.pipe(
|
||||
map((client) => client.version()),
|
||||
catchError(() => "Unsupported"),
|
||||
),
|
||||
),
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user