An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Automatic launch at boot does not work Fix https://github.com/siyuan-note/siyuan/issues/7978
Liang Ding42c5dfcbda7c
diff --git a/app/electron/main.js b/app/electron/main.jsindex 5383f35bd1..dbd6cd9516 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -358,13 +358,13 @@ const boot = () => {// 当前页面链接使用浏览器打开currentWindow.webContents.on("will-navigate", (event, url) => {if (event.sender) {- const currentURL = new URL(event.sender.getURL());- if (url.startsWith(getServer(currentURL.port))) {- return;- }+ const currentURL = new URL(event.sender.getURL());+ if (url.startsWith(getServer(currentURL.port))) {+ return;+ }- event.preventDefault();- shell.openExternal(url);+ event.preventDefault();+ shell.openExternal(url);}});@@ -793,6 +793,9 @@ app.whenReady().then(() => {item.webContents.send("siyuan-send_windows", data);});});+ ipcMain.on("siyuan-auto-launch", (event, data) => {+ app.setLoginItemSettings({openAtLogin: data.openAtLogin});+ });if (firstOpen) {const firstOpenWindow = new BrowserWindow({diff --git a/app/src/config/about.ts b/app/src/config/about.tsindex 58fa9833ae..65b135ab41 100644--- a/app/src/config/about.ts+++ b/app/src/config/about.ts@@ -1,6 +1,6 @@import {Constants} from "../constants";/// #if !BROWSER-import {app, shell} from "electron";+import {ipcRenderer, shell} from "electron";/// #endifimport {isBrowser} from "../util/functions";import {fetchPost} from "../util/fetch";@@ -11,7 +11,7 @@ import {openByMobile, writeText} from "../protyle/util/compatibility";import {showMessage} from "../dialog/message";import {Dialog} from "../dialog";import {confirmDialog} from "../dialog/confirmDialog";-import { setProxy } from "./util/setProxy";+import {setProxy} from "./util/setProxy";export const about = {element: undefined as Element,@@ -338,7 +338,7 @@ export const about = {autoLaunchElement.addEventListener("change", () => {fetchPost("/api/system/setAutoLaunch", {autoLaunch: autoLaunchElement.checked}, () => {window.siyuan.config.system.autoLaunch = autoLaunchElement.checked;- app.setLoginItemSettings({openAtLogin: autoLaunchElement.checked});+ ipcRenderer.send(Constants.SIYUAN_AUTO_LAUNCH, {openAtLogin: autoLaunchElement.checked});});});/// #endifdiff --git a/app/src/constants.ts b/app/src/constants.tsindex cd2fc43b6c..d539d67f7e 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -36,6 +36,7 @@ export abstract class Constants {public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";public static readonly SIYUAN_EXPORT_CLOSE: string = "siyuan-export-close";public static readonly SIYUAN_EXPORT_PREVENT: string = "siyuan-export-prevent";+ public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";// sizepublic static readonly SIZE_TOOLBAR_HEIGHT: number = isMobile() ? 0 : 32;