1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-11 13:53:25 +00: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

Submodule jslib updated: 8b26d90e74...3429b57db4

View File

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

View File

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