Allow configuring gpgPath in browser settings (#45)
This commit is contained in:
@@ -680,17 +680,26 @@ async function receiveMessage(message, sender, sendResponse) {
|
||||
* @return void
|
||||
*/
|
||||
async function saveSettings(settings) {
|
||||
// 'default' is our reserved name for the default store
|
||||
delete settings.stores.default;
|
||||
let settingsToSave = deepCopy(settings);
|
||||
|
||||
var response = await hostAction(settings, "configure");
|
||||
// 'default' is our reserved name for the default store
|
||||
delete settingsToSave.stores.default;
|
||||
|
||||
var response = await hostAction(settingsToSave, "configure");
|
||||
if (response.status != "ok") {
|
||||
throw new Error(JSON.stringify(response)); // TODO handle host error
|
||||
}
|
||||
|
||||
// before save, make sure to remove store settings that we receive from the host app
|
||||
if (typeof settingsToSave.stores === "object") {
|
||||
for (var store in settingsToSave.stores) {
|
||||
delete settingsToSave.stores[store].settings;
|
||||
}
|
||||
}
|
||||
|
||||
for (var key in defaultSettings) {
|
||||
if (settings.hasOwnProperty(key)) {
|
||||
localStorage.setItem(key, JSON.stringify(settings[key]));
|
||||
if (settingsToSave.hasOwnProperty(key)) {
|
||||
localStorage.setItem(key, JSON.stringify(settingsToSave[key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user