1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

update for jslib importer service changes

This commit is contained in:
Kyle Spearrin 2018-08-06 11:43:07 -04:00
parent 59efdbd43e
commit f988c77755
3 changed files with 9 additions and 10 deletions

2
jslib

@ -1 +1 @@
Subproject commit 8b26d90e742966bff3dc9e57ecb104b59e48371b
Subproject commit 3429b57db42a3e1e9948b870bf24fcc02ebc8a99

View File

@ -102,7 +102,7 @@ export class Main {
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
this.totpService = new TotpService(this.storageService, this.cryptoFunctionService);
this.importService = new ImportService(this.cipherService, this.folderService, this.apiService,
this.i18nService);
this.i18nService, this.collectionService);
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);
this.authService = new AuthService(this.cryptoService, this.apiService, this.userService, this.tokenService,
this.appIdService, this.i18nService, this.platformUtilsService, this.messagingService, true);

View File

@ -49,7 +49,7 @@ export class ImportCommand {
return Response.badRequest('Invalid master password.');
}
const importer = await this.importService.getImporter(format);
const importer = await this.importService.getImporter(format, false);
if (importer === null) {
return Response.badRequest('Proper importer type required.');
}
@ -60,20 +60,19 @@ export class ImportCommand {
return Response.badRequest('Import file was empty.');
}
const submitResult = await this.importService.import(importer, contents);
if (submitResult !== null) {
const res = new MessageResponse('Imported ' + filepath, null);
return Response.success(res);
} else {
return Response.badRequest(submitResult.message);
const err = await this.importService.import(importer, contents, null);
if (err == null) {
return Response.badRequest(err.message);
}
const res = new MessageResponse('Imported ' + filepath, null);
return Response.success(res);
} catch (err) {
return Response.badRequest(err);
}
}
private async list() {
const options = this.importService.importOptions.sort((a, b) => {
const options = this.importService.getImportOptions().sort((a, b) => {
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
}).map((option) => option.id).join('\n');
const res = new MessageResponse('Supported input formats:', options);