1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

[PM-1349] Update client service to retrieve feature flags from API (#5064)

* [PM-1351] Add property to server-config.response. Change config to be able to fetch without being authed.

* [PM-1351] fetch every hour.

* [PM-1351] fetch on vault sync.

* [PM-1351] browser desktop fetch configs on sync complete.

* [PM-1351] Add methods to retrieve feature flags

* [PM-1351] Add enum to use as key to get values feature flag values

* [PM-1351] Remove debug code

* [PM-1351] Get flags when unauthed. Add enums as params. Hourly always fetch.

* [PM-1351] add check for authed user using auth service

* [PM-1351] remove unnecessary timer on account unlock
This commit is contained in:
André Bispo
2023-04-26 15:30:39 +01:00
committed by GitHub
parent dfe69f77f5
commit cfc380c697
12 changed files with 95 additions and 35 deletions

View File

@@ -2,6 +2,8 @@ import { AvatarUpdateService as AvatarUpdateServiceAbstraction } from "@bitwarde
import { ApiService as ApiServiceAbstraction } from "@bitwarden/common/abstractions/api.service";
import { AppIdService as AppIdServiceAbstraction } from "@bitwarden/common/abstractions/appId.service";
import { AuditService as AuditServiceAbstraction } from "@bitwarden/common/abstractions/audit.service";
import { ConfigApiServiceAbstraction } from "@bitwarden/common/abstractions/config/config-api.service.abstraction";
import { ConfigServiceAbstraction } from "@bitwarden/common/abstractions/config/config.service.abstraction";
import { CryptoService as CryptoServiceAbstraction } from "@bitwarden/common/abstractions/crypto.service";
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitwarden/common/abstractions/cryptoFunction.service";
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
@@ -49,6 +51,7 @@ import { AvatarUpdateService } from "@bitwarden/common/services/account/avatar-u
import { ApiService } from "@bitwarden/common/services/api.service";
import { AppIdService } from "@bitwarden/common/services/appId.service";
import { AuditService } from "@bitwarden/common/services/audit.service";
import { ConfigService } from "@bitwarden/common/services/config/config.service";
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
import { ContainerService } from "@bitwarden/common/services/container.service";
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
@@ -185,6 +188,8 @@ export default class MainBackground {
avatarUpdateService: AvatarUpdateServiceAbstraction;
mainContextMenuHandler: MainContextMenuHandler;
cipherContextMenuHandler: CipherContextMenuHandler;
configService: ConfigServiceAbstraction;
configApiService: ConfigApiServiceAbstraction;
// Passed to the popup for Safari to workaround issues with theming, downloading, etc.
backgroundWindow = window;
@@ -493,6 +498,12 @@ export default class MainBackground {
this.userVerificationApiService
);
this.configService = new ConfigService(
this.stateService,
this.configApiService,
this.authService
);
const systemUtilsServiceReloadCallback = () => {
const forceWindowReload =
this.platformUtilsService.isSafari() ||
@@ -522,7 +533,8 @@ export default class MainBackground {
this.systemService,
this.environmentService,
this.messagingService,
this.logService
this.logService,
this.configService
);
this.nativeMessagingBackground = new NativeMessagingBackground(
this.cryptoService,

View File

@@ -1,3 +1,4 @@
import { ConfigServiceAbstraction } from "@bitwarden/common/abstractions/config/config.service.abstraction";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
@@ -28,7 +29,8 @@ export default class RuntimeBackground {
private systemService: SystemService,
private environmentService: BrowserEnvironmentService,
private messagingService: MessagingService,
private logService: LogService
private logService: LogService,
private configService: ConfigServiceAbstraction
) {
// onInstalled listener must be wired up before anything else, so we do it in the ctor
chrome.runtime.onInstalled.addListener((details: any) => {
@@ -94,6 +96,7 @@ export default class RuntimeBackground {
await this.main.refreshMenu();
}, 2000);
this.main.avatarUpdateService.loadColorFromState();
this.configService.fetchServerConfig();
}
break;
case "openPopup":