diff --git a/src/baseTypes.ts b/src/baseTypes.ts
index a2523c8..442dbc7 100644
--- a/src/baseTypes.ts
+++ b/src/baseTypes.ts
@@ -115,6 +115,8 @@ export interface RemotelySavePluginSettings {
protectModifyPercentage?: number;
syncDirection?: SyncDirectionType;
+ obfuscateSettingFile?: boolean;
+
/**
* @deprecated
*/
diff --git a/src/langs/en.json b/src/langs/en.json
index 1289e64..50ac395 100644
--- a/src/langs/en.json
+++ b/src/langs/en.json
@@ -277,6 +277,8 @@
"settings_outputsettingsconsole_desc": "The settings save on disk in encoded. Click this to see the decoded settings in console.",
"settings_outputsettingsconsole_button": "Output",
"settings_outputsettingsconsole_notice": "Finished outputing in console.",
+ "settings_obfuscatesettingfile": "Obfuscate The Setting File Or Not",
+ "settings_obfuscatesettingfile_desc": "The setting file (data.json) has some sensitive information. It's strongly recommended to obfuscate it to avoid unexpected read and modification. If you are sure to view and edit it manually, you can disable the obfuscation.",
"settings_viewconsolelog": "View Console Log",
"settings_viewconsolelog_desc": "On desktop, please press \"ctrl+shift+i\" or \"cmd+shift+i\" to view the log. On mobile, please install the third-party plugin Logstravaganza to export the console log to a note.",
"settings_syncplans": "Export Sync Plans",
diff --git a/src/langs/zh_cn.json b/src/langs/zh_cn.json
index 09eb696..ebe3f34 100644
--- a/src/langs/zh_cn.json
+++ b/src/langs/zh_cn.json
@@ -277,6 +277,8 @@
"settings_outputsettingsconsole_desc": "硬盘上的设置文件是编码过的,点击这里从而解码并输出到终端。",
"settings_outputsettingsconsole_button": "输出",
"settings_outputsettingsconsole_notice": "已输出到终端",
+ "settings_obfuscatesettingfile": "是否混淆保存设置文件",
+ "settings_obfuscatesettingfile_desc": "设置文件(data.json)含有敏感信息。强烈建议混淆后保存它,从而避免出乎意料的读取和修改。如果您确认要手动查看和修改它,可以关闭混淆保存。",
"settings_viewconsolelog": "查看终端输出",
"settings_viewconsolelog_desc": "电脑上,输入“ctrl+shift+i”或“cmd+shift+i”来查看终端输出。手机上,安装第三方插件 Logstravaganza 来导出终端输出到一篇笔记上。",
"settings_syncplans": "导出同步计划",
diff --git a/src/langs/zh_tw.json b/src/langs/zh_tw.json
index 01ba2f0..4143dbd 100644
--- a/src/langs/zh_tw.json
+++ b/src/langs/zh_tw.json
@@ -277,6 +277,8 @@
"settings_outputsettingsconsole_desc": "硬碟上的設定檔案是編碼過的,點選這裡從而解碼並輸出到終端。",
"settings_outputsettingsconsole_button": "輸出",
"settings_outputsettingsconsole_notice": "已輸出到終端",
+ "settings_obfuscatesettingfile": "是否混淆儲存設定檔案",
+ "settings_obfuscatesettingfile_desc": "設定檔案(data.json)含有敏感資訊。強烈建議混淆後儲存它,從而避免出乎意料的讀取和修改。如果您確認要手動檢視和修改它,可以關閉混淆儲存。",
"settings_viewconsolelog": "檢視終端輸出",
"settings_viewconsolelog_desc": "電腦上,輸入“ctrl+shift+i”或“cmd+shift+i”來檢視終端輸出。手機上,安裝第三方外掛 Logstravaganza 來匯出終端輸出到一篇筆記上。",
"settings_syncplans": "匯出同步計劃",
diff --git a/src/main.ts b/src/main.ts
index e54b21d..30f0057 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -95,6 +95,7 @@ const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
howToCleanEmptyFolder: "skip",
protectModifyPercentage: 50,
syncDirection: "bidirectional",
+ obfuscateSettingFile: true,
};
interface OAuth2Info {
@@ -895,11 +896,19 @@ export default class RemotelySavePlugin extends Plugin {
this.settings.syncDirection = "bidirectional";
}
+ if (this.settings.obfuscateSettingFile === undefined) {
+ this.settings.obfuscateSettingFile = true;
+ }
+
await this.saveSettings();
}
async saveSettings() {
- await this.saveData(normalConfigToMessy(this.settings));
+ if (this.settings.obfuscateSettingFile) {
+ await this.saveData(normalConfigToMessy(this.settings));
+ } else {
+ await this.saveData(this.settings);
+ }
}
/**
diff --git a/src/settings.ts b/src/settings.ts
index c7f7e55..8ec8a16 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -2075,6 +2075,30 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
});
});
+ new Setting(debugDiv)
+ .setName(t("settings_obfuscatesettingfile"))
+ .setDesc(t("settings_obfuscatesettingfile_desc"))
+ .addDropdown(async (dropdown) => {
+ dropdown
+ .addOption("enable", t("enable"))
+ .addOption("disable", t("disable"));
+
+ dropdown
+ .setValue(
+ `${
+ this.plugin.settings.obfuscateSettingFile ? "enable" : "disable"
+ }`
+ )
+ .onChange(async (val) => {
+ if (val === "enable") {
+ this.plugin.settings.obfuscateSettingFile = true;
+ } else {
+ this.plugin.settings.obfuscateSettingFile = false;
+ }
+ await this.plugin.saveSettings();
+ });
+ });
+
new Setting(debugDiv)
.setName(t("settings_viewconsolelog"))
.setDesc(stringToFragment(t("settings_viewconsolelog_desc")));