split export

This commit is contained in:
fyears 2024-05-25 15:22:19 +08:00
parent 408acb6230
commit 7497b5fae7
6 changed files with 49 additions and 7 deletions

View File

@ -106,7 +106,13 @@ export type SyncDirectionType =
export type CipherMethodType = "rclone-base64" | "openssl-base64" | "unknown"; export type CipherMethodType = "rclone-base64" | "openssl-base64" | "unknown";
export type QRExportType = "all_but_oauth2" | "dropbox" | "onedrive"; export type QRExportType =
| "basic_and_advanced"
| "s3"
| "dropbox"
| "onedrive"
| "webdav"
| "webdis";
export interface ProfilerConfig { export interface ProfilerConfig {
enablePrinting?: boolean; enablePrinting?: boolean;

View File

@ -17,14 +17,23 @@ export const exportQrCodeUri = async (
) => { ) => {
let settings2: Partial<RemotelySavePluginSettings> = {}; let settings2: Partial<RemotelySavePluginSettings> = {};
if (exportFields === "all_but_oauth2") { if (exportFields === "basic_and_advanced") {
settings2 = cloneDeep(settings); settings2 = cloneDeep(settings);
delete settings2.s3;
delete settings2.dropbox; delete settings2.dropbox;
delete settings2.onedrive; delete settings2.onedrive;
delete settings2.webdav;
delete settings2.webdis;
} else if (exportFields === "s3") {
settings2 = { s3: cloneDeep(settings.s3) };
} else if (exportFields === "dropbox") { } else if (exportFields === "dropbox") {
settings2 = { dropbox: cloneDeep(settings.dropbox) }; settings2 = { dropbox: cloneDeep(settings.dropbox) };
} else if (exportFields === "onedrive") { } else if (exportFields === "onedrive") {
settings2 = { onedrive: getShrinkedSettings(settings.onedrive) }; settings2 = { onedrive: getShrinkedSettings(settings.onedrive) };
} else if (exportFields === "webdav") {
settings2 = { webdav: cloneDeep(settings.webdav) };
} else if (exportFields === "webdis") {
settings2 = { webdis: cloneDeep(settings.webdis) };
} }
delete settings2.vaultRandomID; delete settings2.vaultRandomID;

View File

@ -302,9 +302,12 @@
"settings_importexport": "Import and Export Partial Settings", "settings_importexport": "Import and Export Partial Settings",
"settings_export": "Export", "settings_export": "Export",
"settings_export_desc": "Export settings by generating a QR code or URI.", "settings_export_desc": "Export settings by generating a QR code or URI.",
"settings_export_all_but_oauth2_button": "Export Non-Oauth2 Part", "settings_export_basic_and_advanced_button": "Export Basic And Advanced Part",
"settings_export_s3_button": "Export S3 Part",
"settings_export_dropbox_button": "Export Dropbox Part", "settings_export_dropbox_button": "Export Dropbox Part",
"settings_export_onedrive_button": "Export OneDrive Part", "settings_export_onedrive_button": "Export OneDrive Part",
"settings_export_webdav_button": "Export Webdav Part",
"settings_export_webdis_button": "Export Webdis Part",
"settings_import": "Import", "settings_import": "Import",
"settings_import_desc": "Paste the exported URI into here and click \"Import\". Or, you can open a camera or scan-qrcode app to scan the QR code.", "settings_import_desc": "Paste the exported URI into here and click \"Import\". Or, you can open a camera or scan-qrcode app to scan the QR code.",
"settings_import_button": "Import", "settings_import_button": "Import",

View File

@ -301,9 +301,12 @@
"settings_importexport": "导入导出部分设置", "settings_importexport": "导入导出部分设置",
"settings_export": "导出", "settings_export": "导出",
"settings_export_desc": "用 QR 码或 URI 导出设置信息。", "settings_export_desc": "用 QR 码或 URI 导出设置信息。",
"settings_export_all_but_oauth2_button": "导出非 Oauth2 部分", "settings_export_basic_and_advanced_button": "导出基本或进阶设置",
"settings_export_s3_button": "导出 S3 部分",
"settings_export_dropbox_button": "导出 Dropbox 部分", "settings_export_dropbox_button": "导出 Dropbox 部分",
"settings_export_onedrive_button": "导出 OneDrive 部分", "settings_export_onedrive_button": "导出 OneDrive 部分",
"settings_export_webdav_button": "导出 Webdav 部分",
"settings_export_webdis_button": "导出 Webdis 部分",
"settings_import": "导入", "settings_import": "导入",
"settings_import_desc": "粘贴之前导出的 URI 到这里然后点击“导入”。或,使用拍摄 app 或者扫描 QR 码的 app来扫描对应的 QR 码。", "settings_import_desc": "粘贴之前导出的 URI 到这里然后点击“导入”。或,使用拍摄 app 或者扫描 QR 码的 app来扫描对应的 QR 码。",
"settings_import_button": "导入", "settings_import_button": "导入",

View File

@ -300,9 +300,12 @@
"settings_importexport": "匯入匯出部分設定", "settings_importexport": "匯入匯出部分設定",
"settings_export": "匯出", "settings_export": "匯出",
"settings_export_desc": "用 QR 碼或 URI 匯出設定資訊。", "settings_export_desc": "用 QR 碼或 URI 匯出設定資訊。",
"settings_export_all_but_oauth2_button": "匯出非 Oauth2 部分", "settings_export_basic_and_advanced_button": "匯出基本或進階設定",
"settings_export_s3_button": "匯出 S3 部分",
"settings_export_dropbox_button": "匯出 Dropbox 部分", "settings_export_dropbox_button": "匯出 Dropbox 部分",
"settings_export_onedrive_button": "匯出 OneDrive 部分", "settings_export_onedrive_button": "匯出 OneDrive 部分",
"settings_export_webdav_button": "匯出 Webdav 部分",
"settings_export_webdis_button": "匯出 Webdis 部分",
"settings_import": "匯入", "settings_import": "匯入",
"settings_import_desc": "貼上之前匯出的 URI 到這裡然後點選“匯入”。或,使用拍攝 app 或者掃描 QR 碼的 app來掃描對應的 QR 碼。", "settings_import_desc": "貼上之前匯出的 URI 到這裡然後點選“匯入”。或,使用拍攝 app 或者掃描 QR 碼的 app來掃描對應的 QR 碼。",
"settings_import_button": "匯入", "settings_import_button": "匯入",

View File

@ -2317,15 +2317,21 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
importExportDivSetting1.settingEl.addClass("setting-need-wrapping"); importExportDivSetting1.settingEl.addClass("setting-need-wrapping");
importExportDivSetting1 importExportDivSetting1
.addButton(async (button) => { .addButton(async (button) => {
button.setButtonText(t("settings_export_all_but_oauth2_button")); button.setButtonText(t("settings_export_basic_and_advanced_button"));
button.onClick(async () => { button.onClick(async () => {
new ExportSettingsQrCodeModal( new ExportSettingsQrCodeModal(
this.app, this.app,
this.plugin, this.plugin,
"all_but_oauth2" "basic_and_advanced"
).open(); ).open();
}); });
}) })
.addButton(async (button) => {
button.setButtonText(t("settings_export_s3_button"));
button.onClick(async () => {
new ExportSettingsQrCodeModal(this.app, this.plugin, "s3").open();
});
})
.addButton(async (button) => { .addButton(async (button) => {
button.setButtonText(t("settings_export_dropbox_button")); button.setButtonText(t("settings_export_dropbox_button"));
button.onClick(async () => { button.onClick(async () => {
@ -2345,6 +2351,18 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
"onedrive" "onedrive"
).open(); ).open();
}); });
})
.addButton(async (button) => {
button.setButtonText(t("settings_export_webdav_button"));
button.onClick(async () => {
new ExportSettingsQrCodeModal(this.app, this.plugin, "webdav").open();
});
})
.addButton(async (button) => {
button.setButtonText(t("settings_export_webdis_button"));
button.onClick(async () => {
new ExportSettingsQrCodeModal(this.app, this.plugin, "webdis").open();
});
}); });
let importSettingVal = ""; let importSettingVal = "";