mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
convert to processFolder helper
This commit is contained in:
parent
7ca2a40478
commit
89779db1f2
@ -47,29 +47,7 @@ export class BitwardenCsvImporter extends BaseImporter implements Importer {
|
|||||||
result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
result.collectionRelationships.push([result.ciphers.length, collectionIndex]);
|
||||||
});
|
});
|
||||||
} else if (!this.organization) {
|
} else if (!this.organization) {
|
||||||
let folderIndex = result.folders.length;
|
this.processFolder(result, value.folder);
|
||||||
const hasFolder = !this.isNullOrWhitespace(value.folder);
|
|
||||||
let addFolder = hasFolder;
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
for (let i = 0; i < result.folders.length; i++) {
|
|
||||||
if (result.folders[i].name === value.folder) {
|
|
||||||
addFolder = false;
|
|
||||||
folderIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addFolder) {
|
|
||||||
const f = new FolderView();
|
|
||||||
f.name = value.folder;
|
|
||||||
result.folders.push(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cipher = new CipherView();
|
const cipher = new CipherView();
|
||||||
|
@ -22,29 +22,7 @@ export class KeePassXCsvImporter extends BaseImporter implements Importer {
|
|||||||
value.Group = !this.isNullOrWhitespace(value.Group) && value.Group.startsWith('Root/') ?
|
value.Group = !this.isNullOrWhitespace(value.Group) && value.Group.startsWith('Root/') ?
|
||||||
value.Group.replace('Root/', '') : value.Group;
|
value.Group.replace('Root/', '') : value.Group;
|
||||||
const groupName = !this.isNullOrWhitespace(value.Group) ? value.Group.split('/').join(' > ') : null;
|
const groupName = !this.isNullOrWhitespace(value.Group) ? value.Group.split('/').join(' > ') : null;
|
||||||
|
this.processFolder(result, groupName);
|
||||||
let folderIndex = result.folders.length;
|
|
||||||
const hasFolder = groupName != null;
|
|
||||||
let addFolder = hasFolder;
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
for (let i = 0; i < result.folders.length; i++) {
|
|
||||||
if (result.folders[i].name === groupName) {
|
|
||||||
addFolder = false;
|
|
||||||
folderIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addFolder) {
|
|
||||||
const f = new FolderView();
|
|
||||||
f.name = groupName;
|
|
||||||
result.folders.push(f);
|
|
||||||
}
|
|
||||||
if (hasFolder) {
|
|
||||||
result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value.Notes);
|
cipher.notes = this.getValueOrDefault(value.Notes);
|
||||||
|
@ -19,29 +19,7 @@ export class KeeperCsvImporter extends BaseImporter implements Importer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let folderIndex = result.folders.length;
|
this.processFolder(result, value[0]);
|
||||||
const hasFolder = !this.isNullOrWhitespace(value[0]);
|
|
||||||
let addFolder = hasFolder;
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
for (let i = 0; i < result.folders.length; i++) {
|
|
||||||
if (result.folders[i].name === value[0]) {
|
|
||||||
addFolder = false;
|
|
||||||
folderIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addFolder) {
|
|
||||||
const f = new FolderView();
|
|
||||||
f.name = value[0];
|
|
||||||
result.folders.push(f);
|
|
||||||
}
|
|
||||||
if (hasFolder) {
|
|
||||||
result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cipher = this.initLoginCipher();
|
const cipher = this.initLoginCipher();
|
||||||
cipher.notes = this.getValueOrDefault(value[5]) + '\n';
|
cipher.notes = this.getValueOrDefault(value[5]) + '\n';
|
||||||
cipher.name = this.getValueOrDefault(value[1], '--');
|
cipher.name = this.getValueOrDefault(value[1], '--');
|
||||||
|
@ -52,29 +52,8 @@ export class PadlockCsvImporter extends BaseImporter implements Importer {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const tags = (value[1] as string).split(',');
|
const tags = (value[1] as string).split(',');
|
||||||
let folderIndex = result.folders.length;
|
const tag = tags.length > 0 ? tags[0].trim() : null;
|
||||||
const hasFolder = tags.length > 0 && !this.isNullOrWhitespace(tags[0].trim());
|
this.processFolder(result, tag);
|
||||||
let addFolder = hasFolder;
|
|
||||||
const tag = tags[0].trim();
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
for (let i = 0; i < result.folders.length; i++) {
|
|
||||||
if (result.folders[i].name === tag) {
|
|
||||||
addFolder = false;
|
|
||||||
folderIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addFolder) {
|
|
||||||
const f = new FolderView();
|
|
||||||
f.name = tag;
|
|
||||||
result.folders.push(f);
|
|
||||||
}
|
|
||||||
if (hasFolder) {
|
|
||||||
result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,30 +17,9 @@ export class PasswordDragonXmlImporter extends BaseImporter implements Importer
|
|||||||
const records = doc.querySelectorAll('PasswordManager > record');
|
const records = doc.querySelectorAll('PasswordManager > record');
|
||||||
Array.from(records).forEach((record) => {
|
Array.from(records).forEach((record) => {
|
||||||
const category = this.querySelectorDirectChild(record, 'Category');
|
const category = this.querySelectorDirectChild(record, 'Category');
|
||||||
|
const categoryText = category != null && !this.isNullOrWhitespace(category.textContent) &&
|
||||||
let folderIndex = result.folders.length;
|
category.textContent !== 'Unfiled' ? category.textContent : null;
|
||||||
const hasFolder = category != null && !this.isNullOrWhitespace(category.textContent) &&
|
this.processFolder(result, categoryText);
|
||||||
category.textContent !== 'Unfiled';
|
|
||||||
let addFolder = hasFolder;
|
|
||||||
|
|
||||||
if (hasFolder) {
|
|
||||||
for (let i = 0; i < result.folders.length; i++) {
|
|
||||||
if (result.folders[i].name === category.textContent) {
|
|
||||||
addFolder = false;
|
|
||||||
folderIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (addFolder) {
|
|
||||||
const f = new FolderView();
|
|
||||||
f.name = category.textContent;
|
|
||||||
result.folders.push(f);
|
|
||||||
}
|
|
||||||
if (hasFolder) {
|
|
||||||
result.folderRelationships.push([result.ciphers.length, folderIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const accountName = this.querySelectorDirectChild(record, 'Account-Name');
|
const accountName = this.querySelectorDirectChild(record, 'Account-Name');
|
||||||
const userId = this.querySelectorDirectChild(record, 'User-Id');
|
const userId = this.querySelectorDirectChild(record, 'User-Id');
|
||||||
|
Loading…
Reference in New Issue
Block a user