change qrcode
This commit is contained in:
parent
4639b93cfa
commit
5b703334d7
@ -1,4 +1,5 @@
|
|||||||
import QRCode from "qrcode";
|
import QRCode from "qrcode";
|
||||||
|
import cloneDeep from "lodash/cloneDeep";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
COMMAND_URI,
|
COMMAND_URI,
|
||||||
@ -11,7 +12,10 @@ export const exportQrCodeUri = async (
|
|||||||
currentVaultName: string,
|
currentVaultName: string,
|
||||||
pluginVersion: 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 vault = encodeURIComponent(currentVaultName);
|
||||||
const version = encodeURIComponent(pluginVersion);
|
const version = encodeURIComponent(pluginVersion);
|
||||||
const rawUri = `obsidian://${COMMAND_URI}?func=settings&version=${version}&vault=${vault}&data=${data}`;
|
const rawUri = `obsidian://${COMMAND_URI}?func=settings&version=${version}&vault=${vault}&data=${data}`;
|
||||||
|
|||||||
@ -96,10 +96,10 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
} else {
|
} else {
|
||||||
const copied = cloneDeep(parsed.result);
|
const copied = cloneDeep(parsed.result);
|
||||||
// new Notice(JSON.stringify(copied))
|
// new Notice(JSON.stringify(copied))
|
||||||
this.settings = copied;
|
this.settings = Object.assign({}, this.settings, copied);
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
new Notice(
|
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.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -258,6 +258,9 @@ class ExportSettingsQrCodeModal extends Modal {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const div1 = contentEl.createDiv();
|
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", {
|
div1.createEl("p", {
|
||||||
text: "You can use another device to scan this qrcode.",
|
text: "You can use another device to scan this qrcode.",
|
||||||
});
|
});
|
||||||
@ -855,11 +858,13 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
// import and export
|
// import and export
|
||||||
const importExportDiv = containerEl.createEl("div");
|
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)
|
new Setting(importExportDiv)
|
||||||
.setName("export")
|
.setName("export")
|
||||||
.setDesc("Export all settings by generating a qrcode.")
|
.setDesc("Export not-oauth2 settings by generating a qrcode.")
|
||||||
.addButton(async (button) => {
|
.addButton(async (button) => {
|
||||||
button.setButtonText("Get QR Code");
|
button.setButtonText("Get QR Code");
|
||||||
button.onClick(async () => {
|
button.onClick(async () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user