Skip to content

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

:art: Remove loading button state from all encrypted notebook dialogs https://github.com/siyuan-note/siyuan/issues/18034

Daniel0fbde75396b7
diff --git a/app/src/config/tabs/accessTab.ts b/app/src/config/tabs/accessTab.ts
index bda31ed78f..af3a10b724 100644
--- a/app/src/config/tabs/accessTab.ts
+++ b/app/src/config/tabs/accessTab.ts
@@ -516,19 +516,11 @@ const openEnableEncryptedDialog = (onSuccess: () => void, onCancel: () => void)
showMessage(window.siyuan.languages.passwordNoMatch);
return;
}
- // Argon2id 密钥派生约耗时 1 秒,期间禁用按钮并显示 loading,避免用户误以为卡住而重复点击
- const originalText = confirmBtn.textContent;
- confirmBtn.setAttribute("disabled", "disabled");
- confirmBtn.textContent = window.siyuan.languages.loading;
const response = await fetchSyncPost("/api/notebook/enableEncryptedNotebooks", {password: pwd1});
if (response.code === 0) {
showMessage(window.siyuan.languages.encryptedNotebookEnabled);
dialog.destroy();
onSuccess();
- } else {
- // fetchSyncPost 已通过 processMessage 弹出错误提示,这里只需恢复按钮
- confirmBtn.removeAttribute("disabled");
- confirmBtn.textContent = originalText;
}
});
};
@@ -565,11 +557,6 @@ const openChangeMasterPasswordDialog = () => {
showMessage(window.siyuan.languages.passwordNoMatch);
return;
}
- // 改密需校验旧密码 + 重新派生 KEK + 重包络所有加密 box 的 DEK,耗时较长
- const confirmBtn = btnsElement[1] as HTMLButtonElement;
- const originalText = confirmBtn.textContent;
- confirmBtn.setAttribute("disabled", "disabled");
- confirmBtn.textContent = window.siyuan.languages.loading;
const response = await fetchSyncPost("/api/notebook/changeMasterPassword", {
oldPassword: oldPwd,
newPassword: newPwd
@@ -577,10 +564,6 @@ const openChangeMasterPasswordDialog = () => {
if (response.code === 0) {
showMessage(window.siyuan.languages.changeMasterPasswordSuccessTip);
dialog.destroy();
- } else {
- // fetchSyncPost 已通过 processMessage 弹出错误提示,这里只需恢复按钮
- confirmBtn.removeAttribute("disabled");
- confirmBtn.textContent = originalText;
}
});
};
diff --git a/app/src/util/mount.ts b/app/src/util/mount.ts
index b9bb8ce9e3..beaddba921 100644
--- a/app/src/util/mount.ts
+++ b/app/src/util/mount.ts
@@ -213,10 +213,6 @@ export const openEncryptedNotebook = (app: App, notebookId: string, name: string
if (!password) {
return false;
}
- const unlockBtn = btnsElement[1] as HTMLButtonElement;
- const originalText = unlockBtn.textContent;
- unlockBtn.setAttribute("disabled", "disabled");
- unlockBtn.textContent = window.siyuan.languages.loading;
// 先解锁(派生 KEK + 解 DEK + 打开加密 db,Argon2id 约耗时 1 秒),成功后再挂载
const response = await fetchSyncPost("/api/notebook/unlockBox", {
notebook: notebookId,
@@ -227,10 +223,6 @@ export const openEncryptedNotebook = (app: App, notebookId: string, name: string
notebook: notebookId
});
dialog.destroy();
- } else {
- // fetchSyncPost 已通过 processMessage 弹出错误提示,这里只需恢复按钮
- unlockBtn.removeAttribute("disabled");
- unlockBtn.textContent = originalText;
}
});
};