Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lock: Confirm before exporting encrypted documents #18034

Danielabd8c72e0923
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index ecc35ba154..3b2dd70634 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -13,6 +13,7 @@ import {Dialog} from "../../dialog";
import {replaceLocalPath} from "../../editor/rename";
import {getScreenWidth, isInMobileApp, saveExportFile, setStorageVal} from "../util/compatibility";
import {getFrontend} from "../../util/functions";
+import {isEncryptedBox} from "../../util/pathName";
const getPluginStyle = async () => {
const response = await fetchSyncPost("/api/petal/loadPetals", {frontend: getFrontend()});
@@ -702,7 +703,7 @@ ${getSnippetJS()}
});
};
-const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubdocs?: boolean) => {
+const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubdocs?: boolean, confirmed = false) => {
fetchPost("/api/block/getBlockInfo", {
id: option.id
}, async (response) => {
@@ -710,6 +711,12 @@ const getExportPath = (option: IExportOptions, removeAssets?: boolean, mergeSubd
showMessage(response.msg);
return;
}
+ if (!confirmed && isEncryptedBox(response.data.box)) {
+ confirmDialog(window.siyuan.languages.export, window.siyuan.languages.encryptedExportRiskTip, () => {
+ getExportPath(option, removeAssets, mergeSubdocs, true);
+ });
+ return;
+ }
let exportType = "HTML (SiYuan)";
switch (option.type) {
case "htmlmd":