Skip to content

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

:bug: Avoid encrypted notebook keepalive in publish mode

Daniel8752ddeeddac
diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.ts
index 864b8704d6..96bd281dd9 100644
--- a/app/src/boot/globalEvent/event.ts
+++ b/app/src/boot/globalEvent/event.ts
@@ -16,18 +16,21 @@ import {getDockByType} from "../../layout/tabUtil";
import {fetchPost} from "../../util/fetch";
export const initWindowEvent = (app: App) => {
- let lastEncryptedNotebookTouch = 0;
- const touchEncryptedNotebooks = () => {
- const now = Date.now();
- if (now - lastEncryptedNotebookTouch < 30000) {
- return;
- }
- lastEncryptedNotebookTouch = now;
- fetchPost("/api/notebook/touchEncryptedNotebooks", {});
- };
- window.addEventListener("pointerdown", touchEncryptedNotebooks, {passive: true});
- window.addEventListener("keydown", touchEncryptedNotebooks);
- document.addEventListener("touchstart", touchEncryptedNotebooks, {passive: true});
+ let lastEncryptedNotebookTouch = 0;
+ const touchEncryptedNotebooks = () => {
+ if (window.siyuan.isPublish) {
+ return;
+ }
+ const now = Date.now();
+ if (now - lastEncryptedNotebookTouch < 30000) {
+ return;
+ }
+ lastEncryptedNotebookTouch = now;
+ fetchPost("/api/notebook/touchEncryptedNotebooks", {});
+ };
+ window.addEventListener("pointerdown", touchEncryptedNotebooks, {passive: true});
+ window.addEventListener("keydown", touchEncryptedNotebooks);
+ document.addEventListener("touchstart", touchEncryptedNotebooks, {passive: true});
document.body.addEventListener("mouseleave", () => {
if (window.siyuan.layout.leftDock) {