An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle:
Vanessae451bc3dab0b
diff --git a/app/electron/main.js b/app/electron/main.jsindex 014f3ce959..0e190a9ac0 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -431,7 +431,7 @@ const initMainWindow = () => {}).then((response) => {setProxy(`${response.data.proxy.scheme}://${response.data.proxy.host}:${response.data.proxy.port}`, currentWindow.webContents).then(() => {// 加载主界面- currentWindow.loadURL(getServer() + "/stage/build/app/?v=" + new Date().getTime());+ currentWindow.loadURL(getServer() + "/stage/build/app/?v=" + Date.now());});});diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.tsindex ff37c16868..61db6c99a6 100644--- a/app/src/boot/globalEvent/event.ts+++ b/app/src/boot/globalEvent/event.ts@@ -127,7 +127,7 @@ export const initWindowEvent = (app: App) => {let time = 0;document.addEventListener("touchstart", (event) => {- time = new Date().getTime();+ time = Date.now();// https://github.com/siyuan-note/siyuan/issues/6328const target = event.target as HTMLElement;if (hasClosestByClassName(target, "protyle-icons") ||@@ -147,7 +147,8 @@ export const initWindowEvent = (app: App) => {return;}// pad 端长按事件- if (isIPad() && new Date().getTime() - time > 900) {+ const currentTime = Date.now();+ if (isIPad() && currentTime - time > 900 && currentTime - time < 2000) {event.target.dispatchEvent(new MouseEvent("contextmenu", {bubbles: true,cancelable: true,diff --git a/app/src/config/account.ts b/app/src/config/account.tsindex 5864a0ce43..2a666d423f 100644--- a/app/src/config/account.ts+++ b/app/src/config/account.ts@@ -104,7 +104,7 @@ ${genSVGBG()}const renewHTML = `<div class="fn__hr--b"></div><div class="ft__on-surface ft__smaller">${window.siyuan.languages.account6}- ${Math.max(0, Math.floor((window.siyuan.user.userSiYuanProExpireTime - new Date().getTime()) / 1000 / 60 / 60 / 24))}+ ${Math.max(0, Math.floor((window.siyuan.user.userSiYuanProExpireTime - Date.now()) / 1000 / 60 / 60 / 24))}${window.siyuan.languages.day}${isIOS ? `<a href="javascript:void(0)" data-action="iOSPay" data-type="subscribe">${window.siyuan.languages.clickMeToRenew}</a>` : `<a href="${getCloudURL("subscribe/siyuan")}" target="_blank">${window.siyuan.languages.clickMeToRenew}</a>`}</div>`;@@ -392,7 +392,7 @@ ${renewHTML}<div class="fn__hr--b"></div>`;let token: string;let needCaptcha: string;captchaImgElement.addEventListener("click", () => {- captchaImgElement.setAttribute("src", getCloudURL("captcha") + `/login?needCaptcha=${needCaptcha}&t=${new Date().getTime()}`);+ captchaImgElement.setAttribute("src", getCloudURL("captcha") + `/login?needCaptcha=${needCaptcha}&t=${Date.now()}`);});const cloudRegionElement = element.querySelector("#cloudRegion") as HTMLSelectElement;diff --git a/app/src/layout/Model.ts b/app/src/layout/Model.tsindex aed0ae80ef..926925dba7 100644--- a/app/src/layout/Model.ts+++ b/app/src/layout/Model.ts@@ -90,7 +90,7 @@ export class Model {if (!this.ws) { // Inbox 无 wsreturn;}- this.reqId = process ? 0 : new Date().getTime();+ this.reqId = process ? 0 : Date.now();this.ws.send(JSON.stringify({cmd,reqId: this.reqId,diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.tsindex 1914735724..effef0dff6 100644--- a/app/src/menus/workspace.ts+++ b/app/src/menus/workspace.ts@@ -74,7 +74,7 @@ const editLayout = (layoutName?: string) => {window.siyuan.storage[Constants.LOCAL_LAYOUTS].find((layoutItem: ISaveLayout) => {if (layoutItem.name === layoutName) {layoutItem.name = value;- layoutItem.time = new Date().getTime();+ layoutItem.time = Date.now();setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);return true;}@@ -91,7 +91,7 @@ const editLayout = (layoutName?: string) => {window.siyuan.storage[Constants.LOCAL_LAYOUTS].find((layoutItem: ISaveLayout) => {if (layoutItem.name === layoutName) {layoutItem.name = value;- layoutItem.time = new Date().getTime();+ layoutItem.time = Date.now();layoutItem.layout = getAllLayout();layoutItem.filesPaths = window.siyuan.storage[Constants.LOCAL_FILESPATHS];setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);@@ -104,7 +104,7 @@ const editLayout = (layoutName?: string) => {if (item.name === value) {confirmDialog(window.siyuan.languages.save, window.siyuan.languages.exportTplTip, () => {item.layout = getAllLayout();- item.time = new Date().getTime();+ item.time = Date.now();item.filesPaths = window.siyuan.storage[Constants.LOCAL_FILESPATHS];setStorageVal(Constants.LOCAL_LAYOUTS, window.siyuan.storage[Constants.LOCAL_LAYOUTS]);});@@ -116,7 +116,7 @@ const editLayout = (layoutName?: string) => {}window.siyuan.storage[Constants.LOCAL_LAYOUTS].push({name: value,- time: new Date().getTime(),+ time: Date.now(),layout: getAllLayout(),filesPaths: window.siyuan.storage[Constants.LOCAL_FILESPATHS]});diff --git a/app/src/mobile/settings/account.ts b/app/src/mobile/settings/account.tsindex df6f83ef84..a5debe5dd9 100644--- a/app/src/mobile/settings/account.ts+++ b/app/src/mobile/settings/account.ts@@ -62,7 +62,7 @@ export const showAccountInfo = () => {const renewHTML = `<div class="fn__hr--b"></div><div class="ft__on-surface ft__smaller">${window.siyuan.languages.account6}- ${Math.max(0, Math.floor((window.siyuan.user.userSiYuanProExpireTime - new Date().getTime()) / 1000 / 60 / 60 / 24))}+ ${Math.max(0, Math.floor((window.siyuan.user.userSiYuanProExpireTime - Date.now()) / 1000 / 60 / 60 / 24))}${window.siyuan.languages.day}${isIOS ? `<a href="javascript:void(0)" data-action="iOSPay" data-type="subscribe">${window.siyuan.languages.clickMeToRenew}</a>` : `<a href="${getCloudURL("subscribe/siyuan")}" target="_blank">${window.siyuan.languages.clickMeToRenew}</a>`}</div>`;@@ -310,7 +310,7 @@ const bindLoginEvent = (modelMainElement: HTMLElement, deactive = false) => {});}captchaImgElement.addEventListener("click", () => {- captchaImgElement.setAttribute("src", getCloudURL("captcha") + `/login?needCaptcha=${needCaptcha}&t=${new Date().getTime()}`);+ captchaImgElement.setAttribute("src", getCloudURL("captcha") + `/login?needCaptcha=${needCaptcha}&t=${Date.now()}`);});const cloudRegionElement = modelMainElement.querySelector("#cloudRegion") as HTMLSelectElement;diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex 3ac2124f58..ebfe0c4d95 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -405,7 +405,7 @@ export class Title {this.element.querySelector(".protyle-attr").insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block">${response.data.refCount}</div>`);}// 存在设置新建文档名模板,不能使用 Untitled 进行判断,https://ld246.com/article/1649301009888- if (this.editElement && new Date().getTime() - dayjs(response.data.id.split("-")[0]).toDate().getTime() < 2000) {+ if (this.editElement && Date.now() - dayjs(response.data.id.split("-")[0]).toDate().getTime() < 2000) {const range = this.editElement.ownerDocument.createRange();range.selectNodeContents(this.editElement);focusByRange(range);diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 67c5264f7a..31ce96ac7f 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -72,7 +72,7 @@ export class Protyle {this.protyle = {getInstance: () => this,app,- transactionTime: new Date().getTime(),+ transactionTime: Date.now(),id: genUUID(),disabled: false,updated: false,diff --git a/app/src/protyle/render/av/date.ts b/app/src/protyle/render/av/date.tsindex 41d1667896..32ab3bfc25 100644--- a/app/src/protyle/render/av/date.ts+++ b/app/src/protyle/render/av/date.ts@@ -5,7 +5,7 @@ export const getDateHTML = (cellElements: HTMLElement[]) => {const cellValue = genCellValueByElement("date", cellElements[0]).date;const isNotTime = cellValue.isNotTime;let value = "";- const currentDate = new Date().getTime();+ const currentDate = Date.now();if (cellValue.isNotEmpty) {value = dayjs(cellValue.content).format(isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");const year = value.split("-")[0];@@ -84,7 +84,7 @@ export const bindDateEvent = (options: {inputElements[2].addEventListener("change", () => {if (inputElements[2].checked) {if (!inputElements[1].dataset.value) {- const currentDate = new Date().getTime();+ const currentDate = Date.now();inputElements[1].dataset.value = dayjs(currentDate).format("YYYY-MM-DD HH:mm");inputElements[1].value = dayjs(currentDate).format(inputElements[3].checked ? "YYYY-MM-DD HH:mm" : "YYYY-MM-DD");}diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex cbbf6a0987..c453f74963 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -1380,7 +1380,7 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoOconst lastTransaction = window.siyuan.transactions[window.siyuan.transactions.length - 1];let needDebounce = false;- const time = new Date().getTime();+ const time = Date.now();if (lastTransaction && lastTransaction.doOperations.length === 1 && lastTransaction.doOperations[0].action === "update" &&doOperations.length === 1 && doOperations[0].action === "update" &&lastTransaction.doOperations[0].id === doOperations[0].id &&diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 587bc0bc97..fcb62415cf 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -282,7 +282,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele}}let clickTimeout: number;- let lastClickTime = new Date().getTime();+ let lastClickTime = Date.now();searchInputElement.value = config.k || "";replaceInputElement.value = config.r || "";@@ -803,7 +803,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, elelet isDblClick = event.detail === 2;/// #if BROWSERif (isIPad()) { // 需要进行 ipad 判断 https://github.com/siyuan-note/siyuan/issues/12704- const newDate = new Date().getTime();+ const newDate = Date.now();isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK;isDblClick = !isClick;lastClickTime = newDate;diff --git a/app/src/util/fetch.ts b/app/src/util/fetch.tsindex 5efb555391..2b1077762b 100644--- a/app/src/util/fetch.ts+++ b/app/src/util/fetch.ts@@ -17,7 +17,7 @@ export const fetchPost = (if (data) {if (["/api/search/searchRefBlock", "/api/graph/getGraph", "/api/graph/getLocalGraph","/api/block/getRecentUpdatedBlocks", "/api/search/fullTextSearchBlock"].includes(url)) {- window.siyuan.reqIds[url] = new Date().getTime();+ window.siyuan.reqIds[url] = Date.now();if (data.type === "local" && url === "/api/graph/getLocalGraph") {// 当打开文档A的关系图、关系图、文档A后刷新,由于防止请求重复处理,文档A关系图无法渲染。} else {@@ -26,7 +26,7 @@ export const fetchPost = (}// 并发导出后端接受顺序不一致if (url === "/api/transactions") {- data.reqId = new Date().getTime();+ data.reqId = Date.now();}if (data instanceof FormData) {init.body = data;