1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-27 13:43:41 +00:00

Add importing of 1passwords 1pux files (#1507)

* Pull in jslib

* Install jszip

* Display help on selecting 1pux importer

* Unzip 1pux and pass content of export.data to 1pux importer

* Update jslib
This commit is contained in:
Daniel James Smith
2022-03-03 15:41:48 +01:00
committed by GitHub
parent 06e1af6d48
commit 1076749635
5 changed files with 146 additions and 2 deletions

View File

@@ -110,7 +110,10 @@
</ng-container>
<ng-container
*ngIf="
format === '1password1pif' || format === '1passwordwincsv' || format === '1passwordmaccsv'
format === '1password1pux' ||
format === '1password1pif' ||
format === '1passwordwincsv' ||
format === '1passwordmaccsv'
"
>
See detailed instructions on our help site at

View File

@@ -1,5 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import * as JSZip from "jszip";
import Swal, { SweetAlertIcon } from "sweetalert2";
import { I18nService } from "jslib-common/abstractions/i18n.service";
@@ -181,6 +182,10 @@ export class ImportComponent implements OnInit {
}
private getFileContents(file: File): Promise<string> {
if (this.format === "1password1pux") {
return this.extract1PuxContent(file);
}
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsText(file, "utf-8");
@@ -204,4 +209,20 @@ export class ImportComponent implements OnInit {
};
});
}
private extract1PuxContent(file: File): Promise<string> {
return new JSZip()
.loadAsync(file)
.then((zip) => {
return zip.file("export.data").async("string");
})
.then(
function success(content) {
return content;
},
function error(e) {
return "";
}
);
}
}