Commit Graph

81 Commits

Author SHA1 Message Date
Yingyi / 颖逸 c4ae1d44e5 🎨 Fix kernel plugin related issues (#17670)
* feat(kernel-plugin): Prevent storage.put and storage.remove in read-only mode

* feat(kernel-plugin): Reload petal plugin on install

When installing a Bazaar package, ensure that if the corresponding petal exists and is enabled we call SetPetalEnabled to trigger a kernel plugin reload before scheduling the plugin reload. This ensures the petal's kernel plugin picks up the newly installed package immediately.

* feat(kernel-plugin): Use gin-contrib/sse.Event for SSE handling

Replace the custom sseEvent type with gin-contrib/sse.Event and update the SSE handling pipeline. The JS handler now accepts an event object (data, event, id, retry), which is validated and converted to sse.Event before being sent on the channel; the server renders events with c.Render(-1, e). Added import for github.com/gin-contrib/sse and bumped gin-contrib/sse to v1.1.1 in go.mod (go.sum updated accordingly).

* feat(kernel-plugin): Add global kernel plugin start/stop hooks

Introduce OnKernelPluginsStart and OnKernelPluginsStop hooks and replace the previous OnKernelPluginShutdown usage. Update Close to call OnKernelPluginsStop and wire the new hooks in the plugin manager (OnKernelPluginsStart -> GetManager().Start, OnKernelPluginsStop -> GetManager().Stop). Existing per-plugin OnKernelPluginStart/OnKernelPluginStop handlers remain unchanged. This adds global lifecycle hooks to start and stop all valid plugins via the manager.

* feat(kernel-plugin): Add plugin manager state and bazaar handling

Call kernel plugin start/stop callbacks when bazaar settings change and add lifecycle state to the PluginManager. setting.go now triggers model.OnKernelPluginsStop or model.OnKernelPluginsStart when Bazaar.PetalDisabled or Bazaar.Trust change. plugin/manager.go introduces a PluginManagerState enum, initializes the manager as stopped, adds a State() accessor, and changes lifecycleMu to an RWMutex. Start/Stop now check the current state to avoid redundant operations, skip starting if bazaar config disables plugins, and update the manager state after start/stop, with additional log messages. These changes improve safety around concurrent start/stop and ensure bazaar configuration is honored.

* feat(kernel-plugin): Add plugin hot-reload watcher and per-plugin dirs

Add fsnotify-based watcher and manager context to detect kernel.js changes and trigger plugin hot-reloads. Introduce pluginsDir, pluginDir and storageDir fields and use storageDir in storage API to prevent path traversal. Replace single plugin mutex map with per-plugin mutex map, serialize start/stop per plugin, and adjust StartPlugin/StopPlugin flow to stop first for hot-reload, honor Bazaar config flags, and propagate start context. Update KernelPlugin to accept a start context and set per-plugin directories. Add helper functions to add/remove plugin dirs from the watcher and simplify GetLoadedPlugin. (Note: go.sum changes are present but not described.)

* feat(kernel-plugin): Add storage watcher and plugin reload improvements

Introduce per-plugin fsnotify storage watcher and expose a JS API for it (siyuan.storage.watcher.add/remove). KernelPlugin now accepts a parent context, creates an fsnotify.Watcher, starts a storage watch goroutine that publishes standardized runtime events (createEventMessage) for fs changes, and provides addStorageWatch/removeStorageWatch helpers. Manager API renamed to addPluginSourceWatch/removePluginSourceWatch with safer watcher handling and clearer reload logging; StartPlugin now passes the manager context into NewKernelPlugin. Also refactor runtime start/stop event publishing to use createEventMessage and add minor logging/error handling for watcher creation and path watch operations. The JS watcher object is frozen and integrated into siyuan.storage.
2026-05-13 08:24:46 +08:00
Daniel 38be2cd887 ✨ Shorthands on mobile https://github.com/siyuan-note/siyuan/issues/14414
Signed-off-by: Daniel <845765@qq.com>
2026-05-09 18:33:19 +08:00
Jeffrey Chen 5c674d7249 ♻️ Replace interface{} with any (#17415) 2026-04-05 16:48:32 +08:00
Jeffrey Chen 9256842fca ♻️ ParseJsonArg adds null value check (#17399) 2026-04-04 08:53:09 +08:00
Jeffrey Chen ea69c9ab3c 🎨 Add kernel API /api/setting/setIcon (#17326) 2026-03-24 23:00:53 +08:00
Daniel a8abfa5ddf ♻️ https://github.com/siyuan-note/siyuan/pull/17307
Signed-off-by: Daniel <845765@qq.com>
2026-03-22 12:26:51 +08:00
Daniel f31ba9485c 🎨 Improve set publish
Signed-off-by: Daniel <845765@qq.com>
2026-03-18 12:43:55 +08:00
Jeffrey Chen c14301aed1 ♻️ Improve /api/setting/setTheme https://github.com/siyuan-note/siyuan/pull/17198 (#17205) 2026-03-13 20:38:32 +08:00
konti1334 2e6b13eec4 🎨 add POST /api/setting/setTheme endpoint (#17198)
Adds a minimal endpoint for activating a theme by name and mode without
requiring the caller to fetch and re-POST the entire appearance config blob.

Request body:
  { "theme": "<theme-dir-name>", "mode": 0|1 }

Behaviour:
- Sets both ThemeLight and ThemeDark to the supplied theme name
- Sets Mode (0 = light, 1 = dark)
- Calls InitAppearance() to validate the theme exists and reads its
  version from theme.json for cache-busting
- Saves conf.json
- Broadcasts the "setAppearance" WebSocket event so all open windows
  call loadAssets() and reload the theme CSS with the new ?v= parameter

Returns the full Appearance config (same shape as setAppearance).

Motivation: external tools (e.g. OS-level theme switchers) previously
had to GET /api/system/getConf, patch the appearance object, and POST
the entire blob to /api/setting/setAppearance.  /api/setting/setTheme
reduces that to a single, self-contained call with no dependencies.

Co-authored-by: You name <konty@github.com>
2026-03-13 17:28:45 +08:00
Jeffrey Chen 465755e184 ♻️ Remove bazaar cache clear on appearance language change (#17160) 2026-03-08 15:13:43 +08:00
Daniel e878e5cc4b 🎨 Support configuring the floating window hover trigger delay https://github.com/siyuan-note/siyuan/pull/17123
Signed-off-by: Daniel <845765@qq.com>
2026-03-02 23:28:49 +08:00
Jeffrey Chen 2739def842 🎨 Support configuring the floating window hover trigger delay (#17123)
* 🎨 Support configuring the floating window hover trigger delay

* 🎨 Support configuring the floating window hover trigger delay
2026-03-02 23:13:02 +08:00
Daniel 9d1302a8f1 🎨 Supports setting Pandoc parameters for export docx https://github.com/siyuan-note/siyuan/issues/16845
Signed-off-by: Daniel <845765@qq.com>
2026-01-23 20:58:53 +08:00
Daniel e9564ff0ec 🎨 Supports setting Pandoc parameters for export docx https://github.com/siyuan-note/siyuan/issues/16845
Signed-off-by: Daniel <845765@qq.com>
2026-01-20 10:05:49 +08:00
Daniel 28c51981e4 🎨 Automatically apply code snippets after data synchronization https://github.com/siyuan-note/siyuan/issues/16736
Signed-off-by: Daniel <845765@qq.com>
2026-01-02 12:38:37 +08:00
Daniel 42b7929786 🎨 Supports configuring the maximum number of Recent documents to be listed https://github.com/siyuan-note/siyuan/issues/16720
Signed-off-by: Daniel <845765@qq.com>
2025-12-30 08:48:45 +08:00
Daniel 96c2093bd8 🎨 Supports configuring the maximum number of Recent documents to be listed https://github.com/siyuan-note/siyuan/issues/16720
Signed-off-by: Daniel <845765@qq.com>
2025-12-29 22:36:56 +08:00
Daniel 364b253082 🎨 Improve file history generation https://github.com/siyuan-note/siyuan/issues/16501
Signed-off-by: Daniel <845765@qq.com>
2025-12-03 18:09:49 +08:00
Daniel fb982b5a81 🎨 Improve interface loading after switching themes and updating code snippets https://github.com/siyuan-note/siyuan/issues/16390
Signed-off-by: Daniel <845765@qq.com>
2025-11-23 19:33:45 +08:00
Daniel 3cc93f2425 🎨 Improve interface loading after switching themes and updating code snippets https://github.com/siyuan-note/siyuan/issues/16390
Signed-off-by: Daniel <845765@qq.com>
2025-11-23 15:40:35 +08:00
Daniel 47a6d288b0 🎨 Support setting status bar message switch https://github.com/siyuan-note/siyuan/issues/16236
Signed-off-by: Daniel <845765@qq.com>
2025-11-13 13:01:12 +08:00
Daniel c3da02f657 🎨 History Retention Days supports a maximum setting of 3650 https://github.com/siyuan-note/siyuan/issues/15979
Signed-off-by: Daniel <845765@qq.com>
2025-09-29 22:22:15 +08:00
Daniel e36592ab5c 🎨 History Retention Days supports a maximum setting of 3650 https://github.com/siyuan-note/siyuan/issues/15979
Signed-off-by: Daniel <845765@qq.com>
2025-09-29 21:14:44 +08:00
Daniel eb13c34fe5 🎨 Alert users when .sy file or database .json exceed 8MB https://github.com/siyuan-note/siyuan/issues/15451 2025-08-24 10:50:03 +08:00
Daniel e492b1fa51 🎨 XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034 2025-06-23 11:03:39 +08:00
Daniel 526e436fbc 🔒 XSS through emoji name https://github.com/siyuan-note/siyuan/issues/15034 https://github.com/siyuan-note/siyuan/pull/15041 2025-06-17 17:00:29 +08:00
Daniel 4c080e2b34 🎨 Trim space in dialynote/block ref/new doc save path https://github.com/siyuan-note/siyuan/issues/14482 2025-03-31 15:29:59 +08:00
Daniel e25e8042ba 🐛 The marketplace language does not change after switching the appearance language https://github.com/siyuan-note/siyuan/issues/12892 2024-10-26 21:36:08 +08:00
Oleksandr Redko b100721fee ♻️ Refactor Go to err != nil, err == nil (#12385) 2024-09-04 09:40:50 +08:00
Daniel 4e9b0bc6c6 🐛 Publish https://github.com/siyuan-note/siyuan/issues/11902 2024-07-07 22:39:53 +08:00
Yingyi / 颖逸 f25b36ff38 Disable some menu items in read-only mode (#11733)
* 🎨 kernel supports read-only publishing services

* 🐛 Fix authentication vulnerabilities

* 🎨 Protect secret information

* 🎨 Adjust the permission control

* 🎨 Adjust the permission control

* 🎨 Fixed the vulnerability that `getFile` gets file `conf.json`

* 🎨 Add API `/api/setting/setPublish`

* 🎨 Add API `/api/setting/getPublish`

* 🐛 Fixed the issue that PWA-related files could not pass BasicAuth

* 🎨 Add a settings panel for publishing features

* 📝 Add guide for `Publish Service`

* 📝 Update Japanese user guide

* 🎨 Merge fixed static file services

* 🎨 Disable some menu items in read-only mode

* 🎨 Disable some menu items in read-only mode

* Update router.go
2024-07-05 20:01:43 +08:00
Daniel 8bdd59a156 🎨 https://github.com/siyuan-note/siyuan/issues/11707 2024-06-15 11:20:06 +08:00
Yingyi / 颖逸 ba2193403d ✨ Support read-only publish service
* 🎨 kernel supports read-only publishing services

* 🐛 Fix authentication vulnerabilities

* 🎨 Protect secret information

* 🎨 Adjust the permission control

* 🎨 Adjust the permission control

* 🎨 Fixed the vulnerability that `getFile` gets file `conf.json`

* 🎨 Add API `/api/setting/setPublish`

* 🎨 Add API `/api/setting/getPublish`

* 🐛 Fixed the issue that PWA-related files could not pass BasicAuth

* 🎨 Add a settings panel for publishing features

* 📝 Add guide for `Publish Service`

* 📝 Update Japanese user guide

* 🎨 Merge fixed static file services
2024-06-12 21:03:51 +08:00
Daniel 43359e92ec 🎨 Supports specifying the notebook to save new docs https://github.com/siyuan-note/siyuan/issues/10671 2024-04-26 18:35:03 +08:00
Daniel b9f269ae85 🎨 Supports disabling Markdown syntax input for some inline elements https://github.com/siyuan-note/siyuan/issues/11141 2024-04-26 12:08:01 +08:00
Daniel 5300638622 🎨 AI supports configuration randomness and context number https://github.com/siyuan-note/siyuan/issues/10660 2024-03-20 11:45:22 +08:00
Daniel a7e1e3abac 🎨 AI supports configuration randomness and context number https://github.com/siyuan-note/siyuan/issues/10660 2024-03-20 11:11:18 +08:00
Daniel 3dc93ff409 🎨 When New document save location is configured as /, it will be completed as /Untitled https://github.com/siyuan-note/siyuan/issues/10305 2024-02-04 10:15:28 +08:00
Daniel 0dd90ecef6 🎨 Add internal kernel API /api/setting/setEditorReadOnly https://github.com/siyuan-note/siyuan/issues/10268 2024-01-28 10:13:51 +08:00
Daniel e4cee23592 🎨 Improve New document save location https://github.com/siyuan-note/siyuan/issues/10094 2024-01-07 15:27:37 +08:00
Daniel 65f747fbf2 🎨 Enable or disable all CSS and JS code snippets https://github.com/siyuan-note/siyuan/issues/9860 2023-12-18 10:04:42 +08:00
Daniel 9052e4ff92 🎨 Add internal kernel API /api/setting/addVirtualBlockRefInclude and addVirtualBlockRefExclude https://github.com/siyuan-note/siyuan/issues/9909 2023-12-17 22:45:09 +08:00
Daniel 32ce33d0fb 🎨 Add internal kernel API /api/setting/addVirtualBlockRefInclude and addVirtualBlockRefExclude https://github.com/siyuan-note/siyuan/issues/9909 2023-12-17 22:34:35 +08:00
Daniel 1d54de679f 🎨 Improve kernel stability by eliminating some data races https://github.com/siyuan-note/siyuan/issues/9842 2023-12-08 21:47:15 +08:00
Daniel 802a703486 🎨 Add internal kernel API /api/setting/refreshVirtualBlockRef Fix https://github.com/siyuan-note/siyuan/issues/9829 2023-12-06 16:26:23 +08:00
Daniel d6765e0303 🎨 Add internal kernel API /api/setting/refreshVirtualBlockRef Fix https://github.com/siyuan-note/siyuan/issues/9829 2023-12-06 16:25:49 +08:00
Daniel 10ac5e557d 🎨 Update av export 2023-09-26 10:30:08 +08:00
Daniel 092b8b16ca 🎨 AI Maximum number of Tokens setting value is no longer limited Fix https://github.com/siyuan-note/siyuan/issues/9023 2023-08-23 09:41:15 +08:00
Daniel 9eeee3965a ⚡ Support for saving .sy files in the single-line format https://github.com/siyuan-note/siyuan/issues/8712 2023-07-09 22:24:32 +08:00
Daniel b9c35fd0f5 🎨 Update slogan Refactor your thinking https://github.com/siyuan-note/siyuan/issues/8608 2023-06-24 20:39:55 +08:00