diff --git a/src/importExport.ts b/src/importExport.ts index b71c035..6a8727c 100644 --- a/src/importExport.ts +++ b/src/importExport.ts @@ -1,4 +1,5 @@ import QRCode from "qrcode"; +import cloneDeep from "lodash/cloneDeep"; import { COMMAND_URI, @@ -11,7 +12,10 @@ export const exportQrCodeUri = async ( currentVaultName: string, pluginVersion: string ) => { - const data = encodeURIComponent(JSON.stringify(settings)); + const settings2 = cloneDeep(settings); + delete settings2.dropbox; + delete settings2.onedrive; + const data = encodeURIComponent(JSON.stringify(settings2)); const vault = encodeURIComponent(currentVaultName); const version = encodeURIComponent(pluginVersion); const rawUri = `obsidian://${COMMAND_URI}?func=settings&version=${version}&vault=${vault}&data=${data}`; diff --git a/src/main.ts b/src/main.ts index c200ce4..3883aa5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -96,10 +96,10 @@ export default class RemotelySavePlugin extends Plugin { } else { const copied = cloneDeep(parsed.result); // new Notice(JSON.stringify(copied)) - this.settings = copied; + this.settings = Object.assign({}, this.settings, copied); this.saveSettings(); new Notice( - `New settings for ${this.manifest.name} saved. Reopen the plugin Settings to the effect.` + `New not-oauth2 settings for ${this.manifest.name} saved. Reopen the plugin Settings to the effect.` ); } }); diff --git a/src/settings.ts b/src/settings.ts index d462555..af0d2da 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -258,6 +258,9 @@ class ExportSettingsQrCodeModal extends Modal { ); const div1 = contentEl.createDiv(); + div1.createEl("p", { + text: "This exports not-oauth2 settings. (It means that Dropbox, OneDrive info are NOT exported.)", + }); div1.createEl("p", { text: "You can use another device to scan this qrcode.", }); @@ -855,11 +858,13 @@ export class RemotelySaveSettingTab extends PluginSettingTab { // import and export const importExportDiv = containerEl.createEl("div"); - importExportDiv.createEl("h2", { text: "Import and Export Settings" }); + importExportDiv.createEl("h2", { + text: "Import and Export Partial Settings", + }); new Setting(importExportDiv) .setName("export") - .setDesc("Export all settings by generating a qrcode.") + .setDesc("Export not-oauth2 settings by generating a qrcode.") .addButton(async (button) => { button.setButtonText("Get QR Code"); button.onClick(async () => {