mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
blackberry csv importer
This commit is contained in:
36
src/importers/blackBerryCsvImporter.ts
Normal file
36
src/importers/blackBerryCsvImporter.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { BaseImporter } from './baseImporter';
|
||||
import { Importer } from './importer';
|
||||
|
||||
import { ImportResult } from '../models/domain/importResult';
|
||||
|
||||
export class BlackBerryCsvImporter extends BaseImporter implements Importer {
|
||||
parse(data: string): ImportResult {
|
||||
const result = new ImportResult();
|
||||
const results = this.parseCsv(data, true);
|
||||
if (results == null) {
|
||||
result.success = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
results.forEach((value) => {
|
||||
if (value.grouping === 'list') {
|
||||
return;
|
||||
}
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.favorite = value.fav === '1';
|
||||
cipher.name = this.getValueOrDefault(value.name);
|
||||
cipher.notes = this.getValueOrDefault(value.extra);
|
||||
if (value.grouping !== 'note') {
|
||||
cipher.login.uris = this.makeUriArray(value.url);
|
||||
cipher.login.password = this.getValueOrDefault(value.password);
|
||||
cipher.login.username = this.getValueOrDefault(value.username);
|
||||
}
|
||||
this.convertToNoteIfNeeded(cipher);
|
||||
this.cleanupCipher(cipher);
|
||||
result.ciphers.push(cipher);
|
||||
});
|
||||
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import { AvastCsvImporter } from '../importers/avastCsvImporter';
|
||||
import { AviraCsvImporter } from '../importers/aviraCsvImporter';
|
||||
import { BitwardenCsvImporter } from '../importers/bitwardenCsvImporter';
|
||||
import { BitwardenJsonImporter } from '../importers/bitwardenJsonImporter';
|
||||
import { BlackBerryCsvImporter } from '../importers/blackBerryCsvImporter';
|
||||
import { BlurCsvImporter } from '../importers/blurCsvImporter';
|
||||
import { ChromeCsvImporter } from '../importers/chromeCsvImporter';
|
||||
import { ClipperzHtmlImporter } from '../importers/clipperzHtmlImporter';
|
||||
@@ -121,6 +122,7 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
{ id: 'mykicsv', name: 'Myki (csv)' },
|
||||
{ id: 'securesafecsv', name: 'SecureSafe (csv)' },
|
||||
{ id: 'logmeoncecsv', name: 'LogMeOnce (csv)' },
|
||||
{ id: 'blackberrycsv', name: 'BlackBerry Password Keeper (csv)' },
|
||||
];
|
||||
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
@@ -259,6 +261,8 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
return new SecureSafeCsvImporter();
|
||||
case 'logmeoncecsv':
|
||||
return new LogMeOnceCsvImporter();
|
||||
case 'blackberrycsv':
|
||||
return new BlackBerryCsvImporter();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user