Skip to content

Commit

Permalink
Add option to include passwords in export
Browse files Browse the repository at this point in the history
  • Loading branch information
proginosko committed Dec 3, 2022
1 parent dbbd65c commit 94558d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const GENERAL_OPTIONS = {
processActiveTabs: { type: "boolean", def: false, id: "processActiveTabs" }, // default: disabled
accessCodeImage: { type: "boolean", def: false, id: "accessCodeImage" }, // default: disabled
diagMode: { type: "boolean", def: false, id: "diagMode" }, // default: disabled
exportPasswords: { type: "boolean", def: false, id: "exportPasswords" }, // default: disabled
autoExportSync: { type: "boolean", def: true, id: "autoExportSync" }, // default: enabled
lockdownHours: { type: "string", def: "", id: null }, // default: blank
lockdownMins: { type: "string", def: "", id: null }, // default: blank
Expand Down
4 changes: 4 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@
<button id="importOptions" type="button">Import Options from File</button>
<input type="file" id="importFile">
</p>
<p>
<input id="exportPasswords" type="checkbox">
<label for="exportPasswords">Include passwords in exported options</label>
</p>
<span id="syncOpts2">
<hr>
<p>
Expand Down
9 changes: 6 additions & 3 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function showClockOffsetTime() {

// Compile options for export
//
function compileExportOptions() {
function compileExportOptions(passwords) {
let options = {};

// Per-set options
Expand Down Expand Up @@ -715,6 +715,7 @@ function compileExportOptions() {

// General options
for (let name in GENERAL_OPTIONS) {
if (!passwords && (name == "password" || name == "orp")) continue;
let type = GENERAL_OPTIONS[name].type;
let id = GENERAL_OPTIONS[name].id;
if (id) {
Expand Down Expand Up @@ -787,7 +788,9 @@ function applyImportOptions(options) {
// Export options to file
//
function exportOptions() {
let options = compileExportOptions();
let exportPasswords = getElement("exportPasswords").checked;

let options = compileExportOptions(exportPasswords);

// Convert options to text lines
let lines = [];
Expand Down Expand Up @@ -877,7 +880,7 @@ function importOptions() {
// Export options to sync storage
//
function exportOptionsSync(event) {
let options = compileExportOptions();
let options = compileExportOptions(true);

browser.storage.sync.set(options).then(onSuccess, onError);

Expand Down

0 comments on commit 94558d7

Please sign in to comment.