1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

Direct download for send (#288)

* Allow for responding with time-limited download URL

* Re-verify access on download link request
This commit is contained in:
Matt Gibson
2021-03-01 15:03:04 -06:00
committed by GitHub
parent 301ef455f3
commit 1324416784
7 changed files with 26 additions and 9 deletions

View File

@@ -112,6 +112,7 @@ import { PreloginResponse } from '../models/response/preloginResponse';
import { ProfileResponse } from '../models/response/profileResponse';
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
import { SendAccessResponse } from '../models/response/sendAccessResponse';
import { SendFileDownloadDataResponse } from '../models/response/sendFileDownloadDataResponse';
import { SendResponse } from '../models/response/sendResponse';
import { SubscriptionResponse } from '../models/response/subscriptionResponse';
import { SyncResponse } from '../models/response/syncResponse';
@@ -129,6 +130,8 @@ import {
import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse';
import { UserKeyResponse } from '../models/response/userKeyResponse';
import { SendAccessView } from '../models/view/sendAccessView';
export class ApiService implements ApiServiceAbstraction {
urlsSet: boolean = false;
apiBaseUrl: string;
@@ -416,6 +419,12 @@ export class ApiService implements ApiServiceAbstraction {
return new SendAccessResponse(r);
}
async getSendFileDownloadData(send: SendAccessView, request: SendAccessRequest): Promise<SendFileDownloadDataResponse> {
const r = await this.send('POST', '/sends/' + send.id + '/access/file/' + send.file.id, request, false, true);
return new SendFileDownloadDataResponse(r);
}
async getSends(): Promise<ListResponse<SendResponse>> {
const r = await this.send('GET', '/sends', null, true, true);
return new ListResponse(r, SendResponse);