diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index 319ab1d7..a7204767 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -16,6 +16,7 @@ import { JslibServicesModule } from "jslib-angular/services/jslib-services.modul import { ContainerService } from "jslib-common/services/container.service"; +import { NodeApiService } from "jslib-node/services/nodeApi.service"; import { NodeCryptoFunctionService } from "jslib-node/services/nodeCryptoFunction.service"; import { ApiService as ApiServiceAbstraction } from "jslib-common/abstractions/api.service"; @@ -135,12 +136,17 @@ export function initFactory( messagingService: MessagingServiceAbstraction, injector: Injector ) => - new ApiService( + new NodeApiService( tokenService, platformUtilsService, environmentService, - refreshTokenCallback(injector), - async (expired: boolean) => messagingService.send("logout", { expired: expired }) + async (expired: boolean) => messagingService.send("logout", { expired: expired }), + "Bitwarden_DC/" + + platformUtilsService.getApplicationVersion() + + " (" + + platformUtilsService.getDeviceString().toUpperCase() + + ")", + refreshTokenCallback(injector) ), deps: [ TokenServiceAbstraction, diff --git a/src/bwdc.ts b/src/bwdc.ts index 31f88da0..669d0c49 100644 --- a/src/bwdc.ts +++ b/src/bwdc.ts @@ -8,13 +8,13 @@ import { AuthService } from "./services/auth.service"; import { I18nService } from "./services/i18n.service"; import { KeytarSecureStorageService } from "./services/keytarSecureStorage.service"; import { LowdbStorageService } from "./services/lowdbStorage.service"; -import { NodeApiService } from "./services/nodeApi.service"; import { StateService } from "./services/state.service"; import { StateMigrationService } from "./services/stateMigration.service"; import { SyncService } from "./services/sync.service"; import { CliPlatformUtilsService } from "jslib-node/cli/services/cliPlatformUtils.service"; import { ConsoleLogService } from "jslib-node/cli/services/consoleLog.service"; +import { NodeApiService } from "jslib-node/services/nodeApi.service"; import { NodeCryptoFunctionService } from "jslib-node/services/nodeCryptoFunction.service"; import { AppIdService } from "jslib-common/services/appId.service"; @@ -148,7 +148,6 @@ export class Main { this.tokenService, this.platformUtilsService, this.environmentService, - () => refreshToken(this.stateService, this.authService), async (expired: boolean) => await this.logout(), "Bitwarden_DC/" + this.platformUtilsService.getApplicationVersion() + diff --git a/src/services/nodeApi.service.ts b/src/services/nodeApi.service.ts deleted file mode 100644 index b41c5e3a..00000000 --- a/src/services/nodeApi.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { EnvironmentService } from "jslib-common/abstractions/environment.service"; -import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service"; -import { TokenService } from "jslib-common/abstractions/token.service"; - -import { NodeApiService as NodeApiServiceBase } from "jslib-node/services/nodeApi.service"; - -export class NodeApiService extends NodeApiServiceBase { - constructor( - tokenService: TokenService, - platformUtilsService: PlatformUtilsService, - environmentService: EnvironmentService, - private refreshTokenCallback: () => Promise, - logoutCallback: (expired: boolean) => Promise, - customUserAgent: string = null, - apiKeyRefresh: (clientId: string, clientSecret: string) => Promise - ) { - super( - tokenService, - platformUtilsService, - environmentService, - logoutCallback, - customUserAgent, - apiKeyRefresh - ); - } - - doRefreshToken(): Promise { - return this.refreshTokenCallback(); - } -}