From 1c876bea55377a65ca7ee6afe713c35a8ef4eb3e Mon Sep 17 00:00:00 2001 From: aj-rosado <109146700+aj-rosado@users.noreply.github.com> Date: Tue, 2 Jan 2024 10:54:32 +0000 Subject: [PATCH] Getting the WebVault url before returning the send on cli's remove password command (#7382) --- apps/cli/src/commands/serve.command.ts | 1 + apps/cli/src/tools/send/commands/remove-password.command.ts | 5 ++++- apps/cli/src/tools/send/send.program.ts | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/cli/src/commands/serve.command.ts b/apps/cli/src/commands/serve.command.ts index 0f81fde1284..588ff202ec9 100644 --- a/apps/cli/src/commands/serve.command.ts +++ b/apps/cli/src/commands/serve.command.ts @@ -160,6 +160,7 @@ export class ServeCommand { this.sendRemovePasswordCommand = new SendRemovePasswordCommand( this.main.sendService, this.main.sendApiService, + this.main.environmentService, ); } diff --git a/apps/cli/src/tools/send/commands/remove-password.command.ts b/apps/cli/src/tools/send/commands/remove-password.command.ts index cdfc29be26f..a25ca4c07e4 100644 --- a/apps/cli/src/tools/send/commands/remove-password.command.ts +++ b/apps/cli/src/tools/send/commands/remove-password.command.ts @@ -1,3 +1,4 @@ +import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; import { SendService } from "@bitwarden/common/tools/send/services//send.service.abstraction"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; @@ -8,6 +9,7 @@ export class SendRemovePasswordCommand { constructor( private sendService: SendService, private sendApiService: SendApiService, + private environmentService: EnvironmentService, ) {} async run(id: string) { @@ -16,7 +18,8 @@ export class SendRemovePasswordCommand { const updatedSend = await this.sendService.get(id); const decSend = await updatedSend.decrypt(); - const res = new SendResponse(decSend); + const webVaultUrl = this.environmentService.getWebVaultUrl(); + const res = new SendResponse(decSend, webVaultUrl); return Response.success(res); } catch (e) { return Response.error(e); diff --git a/apps/cli/src/tools/send/send.program.ts b/apps/cli/src/tools/send/send.program.ts index 01c1c00a691..59f0b7ecdb5 100644 --- a/apps/cli/src/tools/send/send.program.ts +++ b/apps/cli/src/tools/send/send.program.ts @@ -297,7 +297,11 @@ export class SendProgram extends Program { }) .action(async (id: string) => { await this.exitIfLocked(); - const cmd = new SendRemovePasswordCommand(this.main.sendService, this.main.sendApiService); + const cmd = new SendRemovePasswordCommand( + this.main.sendService, + this.main.sendApiService, + this.main.environmentService, + ); const response = await cmd.run(id); this.processResponse(response); });