mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[PM-686] [CLI] Add proxy support for file downloads (#7345)
* Add proxy support for file downloads Instead of using node's native fetch we extend ApiService with NodeApiService to add support for proxies using `node-fetch` * Add comments to the DownloadCommand --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
99008267e6
commit
065725df7a
@@ -3,6 +3,7 @@
|
||||
import { OptionValues } from "commander";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
|
||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
@@ -20,8 +21,9 @@ export class SendGetCommand extends DownloadCommand {
|
||||
private environmentService: EnvironmentService,
|
||||
private searchService: SearchService,
|
||||
encryptService: EncryptService,
|
||||
apiService: ApiService,
|
||||
) {
|
||||
super(encryptService);
|
||||
super(encryptService, apiService);
|
||||
}
|
||||
|
||||
async run(id: string, options: OptionValues) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { OptionValues } from "commander";
|
||||
import * as inquirer from "inquirer";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { ErrorResponse } from "@bitwarden/common/models/response/error.response";
|
||||
import { CryptoFunctionService } from "@bitwarden/common/platform/abstractions/crypto-function.service";
|
||||
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
|
||||
@@ -35,8 +36,9 @@ export class SendReceiveCommand extends DownloadCommand {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private environmentService: EnvironmentService,
|
||||
private sendApiService: SendApiService,
|
||||
apiService: ApiService,
|
||||
) {
|
||||
super(encryptService);
|
||||
super(encryptService, apiService);
|
||||
}
|
||||
|
||||
async run(url: string, options: OptionValues): Promise<Response> {
|
||||
|
||||
@@ -108,6 +108,7 @@ export class SendProgram extends BaseProgram {
|
||||
this.serviceContainer.platformUtilsService,
|
||||
this.serviceContainer.environmentService,
|
||||
this.serviceContainer.sendApiService,
|
||||
this.serviceContainer.apiService,
|
||||
);
|
||||
const response = await cmd.run(url, options);
|
||||
this.processResponse(response);
|
||||
@@ -190,6 +191,7 @@ export class SendProgram extends BaseProgram {
|
||||
this.serviceContainer.environmentService,
|
||||
this.serviceContainer.searchService,
|
||||
this.serviceContainer.encryptService,
|
||||
this.serviceContainer.apiService,
|
||||
);
|
||||
const response = await cmd.run(id, options);
|
||||
this.processResponse(response);
|
||||
@@ -249,6 +251,7 @@ export class SendProgram extends BaseProgram {
|
||||
this.serviceContainer.environmentService,
|
||||
this.serviceContainer.searchService,
|
||||
this.serviceContainer.encryptService,
|
||||
this.serviceContainer.apiService,
|
||||
);
|
||||
const cmd = new SendEditCommand(
|
||||
this.serviceContainer.sendService,
|
||||
|
||||
Reference in New Issue
Block a user