Skip to content

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

:bug: Enforce AI feature disabling for mobile distributions https://github.com/siyuan-note/siyuan/issues/19620

Daniel5b892a518b0f
diff --git a/app/src/ai/editor.ts b/app/src/ai/editor.ts
index 67e2cb1a82..836641ee3d 100644
--- a/app/src/ai/editor.ts
+++ b/app/src/ai/editor.ts
@@ -12,7 +12,7 @@ import {insertHTML} from "../protyle/util/insertHTML";
import {blockRender} from "../protyle/render/blockRender";
import {processRender} from "../protyle/util/processCode";
import {highlightRender} from "../protyle/render/highlightRender";
-import {copyPlainText} from "../protyle/util/compatibility";
+import {copyPlainText, isDisabledFeature} from "../protyle/util/compatibility";
import {showMessage} from "../dialog/message";
import {confirmDialog} from "../dialog/confirmDialog";
import {escapeAriaLabel, escapeHtml} from "../util/escape";
@@ -714,6 +714,9 @@ const createTask = (protyle: IProtyle, source: IAIEditorSource) => {
};
const beginTask = (protyle: IProtyle, source: IAIEditorSource) => {
+ if (isDisabledFeature("ai")) {
+ return;
+ }
const state = getState(protyle);
const start = () => {
if (state.task) {
diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts
index 5080e6ada2..0edc67a490 100644
--- a/app/src/mobile/menu/search.ts
+++ b/app/src/mobile/menu/search.ts
@@ -10,7 +10,7 @@ import {preventScroll} from "../../protyle/scroll/preventScroll";
import {openModel} from "./model";
import {getDisplayName, getNotebookIcon, getNotebookName, isEncryptedBox, movePathTo, pathPosix} from "../../util/pathName";
import {getKeyByLiElement, initCriteriaMenu, moreMenu} from "../../search/menu";
-import {setStorageVal} from "../../protyle/util/compatibility";
+import {isDisabledFeature, setStorageVal} from "../../protyle/util/compatibility";
import {escapeHtml} from "../../util/escape";
import {unicode2Emoji} from "../../emoji";
import {getFileTreeIconHTML} from "../../emoji/fileTreeIcon";
@@ -763,7 +763,7 @@ export const popSearch = (app: App, searchConfig?: Config.IUILayoutTabSearchConf
if (currentEditor && isEncryptedBox(currentEditor.protyle.notebookId)) {
config.sensitive = true;
}
- if (config.method === 4 && !window.siyuan.config.ai.embedding.enabled) {
+ if (config.method === 4 && (isDisabledFeature("ai") || !window.siyuan.config.ai.embedding.enabled)) {
config.method = 0;
}
const rangeText = (currentEditor?.protyle.toolbar.range ||
diff --git a/app/src/mobile/util/mobileBottomBar.ts b/app/src/mobile/util/mobileBottomBar.ts
index 3e6a06fc51..1e1b0353f5 100644
--- a/app/src/mobile/util/mobileBottomBar.ts
+++ b/app/src/mobile/util/mobileBottomBar.ts
@@ -306,8 +306,8 @@ export const initMobileBottomBar = (app: App) => {
};
const genBottomBarOptions = (pluginDockEntries: readonly IMobilePluginDockEntry[]) => [
- ...MOBILE_BOTTOM_BAR_ACTIONS.map((action) =>
- `<option value="${action}"${action === "agent" && isDisabledFeature("ai") ? " disabled" : ""}>${escapeHtml(getActionLabel(action))}</option>`),
+ ...MOBILE_BOTTOM_BAR_ACTIONS.filter(action => action !== "agent" || !isDisabledFeature("ai")).map((action) =>
+ `<option value="${action}">${escapeHtml(getActionLabel(action))}</option>`),
...pluginDockEntries.map((entry) =>
`<option value="${escapeAttr(entry.key)}">${escapeHtml(getPluginDockLabel(entry))}</option>`),
].join("");
diff --git a/app/src/mobile/util/mobileSidePanelSetting.ts b/app/src/mobile/util/mobileSidePanelSetting.ts
index 14905113de..a6842b7b87 100644
--- a/app/src/mobile/util/mobileSidePanelSetting.ts
+++ b/app/src/mobile/util/mobileSidePanelSetting.ts
@@ -1,5 +1,5 @@
import {Constants} from "../../constants";
-import {setStorageVal} from "../../protyle/util/compatibility";
+import {isDisabledFeature, setStorageVal} from "../../protyle/util/compatibility";
import {escapeAttr, escapeHtml} from "../../util/escape";
import {
getMobilePluginDockEntries,
@@ -93,7 +93,8 @@ const getVisibleDockIds = (
config: IMobileSidePanelConfig,
side: MobileSidePanelSide,
pluginEntriesById: ReadonlyMap<string, IMobilePluginDockEntry>,
-) => config[side].filter(id => isMobileSidePanelBuiltInDockId(id) || pluginEntriesById.has(id));
+) => config[side].filter(id => (id !== "agent" || !isDisabledFeature("ai")) &&
+ (isMobileSidePanelBuiltInDockId(id) || pluginEntriesById.has(id)));
const genDockItemHtml = (
dockId: MobileSidePanelDockId,
@@ -196,11 +197,14 @@ export const mountMobileSidePanelSetting = (root: HTMLElement) => {
side: side === "left" ? "right" : "left",
}, pluginDockContext.layouts);
} else if (actionElement.dataset.action === "up" || actionElement.dataset.action === "down") {
+ const availableDockIds = config[side].filter(id =>
+ isMobileSidePanelBuiltInDockId(id) || pluginDockContext.entriesById.has(id));
+ const targetId = visibleDockIds[index + (actionElement.dataset.action === "up" ? -1 : 1)];
config = reduceMobileSidePanelConfig(config, {
type: "reorder",
side,
- fromIndex: index,
- toIndex: index + (actionElement.dataset.action === "up" ? -1 : 1),
+ fromIndex: availableDockIds.indexOf(dockId),
+ toIndex: availableDockIds.indexOf(targetId),
}, pluginDockContext.layouts);
} else {
return;
diff --git a/app/src/search/menu.ts b/app/src/search/menu.ts
index e0ec66f84c..a50f723484 100644
--- a/app/src/search/menu.ts
+++ b/app/src/search/menu.ts
@@ -6,7 +6,7 @@ import {Constants} from "../constants";
import {showMessage} from "../dialog/message";
import {fetchPost} from "../util/fetch";
import {escapeHtml} from "../util/escape";
-import {isSensitiveSearchConfig, setStorageVal} from "../protyle/util/compatibility";
+import {isDisabledFeature, isSensitiveSearchConfig, setStorageVal} from "../protyle/util/compatibility";
import {confirmDialog} from "../dialog/confirmDialog";
import {goUnRef, updateSearchResult} from "../mobile/menu/search";
import {bindSearchSubtypeFilters} from "./subTypes";
@@ -338,7 +338,7 @@ export const queryMenu = (config: Config.IUILayoutTabSearchConfig, cb: () => voi
cb();
}
}).element);
- if (window.siyuan.config.ai.embedding.enabled) {
+ if (!isDisabledFeature("ai") && window.siyuan.config.ai.embedding.enabled) {
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconSparkles",
label: window.siyuan.languages.semanticSearch,
@@ -536,7 +536,7 @@ export const moreMenu = async (config: Config.IUILayoutTabSearchConfig,
updateSearchResult(config, element, true);
}
}];
- if (window.siyuan.config.ai.embedding.enabled) {
+ if (!isDisabledFeature("ai") && window.siyuan.config.ai.embedding.enabled) {
searchMethodSubmenu.push({
icon: "iconSparkles",
label: window.siyuan.languages.semanticSearch,
diff --git a/app/src/search/spread.ts b/app/src/search/spread.ts
index 0a1fb9582d..6419aaf809 100644
--- a/app/src/search/spread.ts
+++ b/app/src/search/spread.ts
@@ -13,6 +13,7 @@ import {
setSearchConfigTemporaryPath,
} from "./config";
import {beginSearchPathRequest} from "./path";
+import {isDisabledFeature} from "../protyle/util/compatibility";
let openSearchVersion = 0;
@@ -62,7 +63,7 @@ export const openSearch = async (options: {
k: options.key || localData.k,
r: localData.r,
hasReplace: options.hotkey === Constants.DIALOG_REPLACE,
- method: localData.method === 4 && !window.siyuan.config.ai.embedding.enabled ? 0 : localData.method,
+ method: localData.method === 4 && (isDisabledFeature("ai") || !window.siyuan.config.ai.embedding.enabled) ? 0 : localData.method,
hPath,
idPath,
group: localData.group,
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 9d0fb5a5e5..d4df239430 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -20,7 +20,7 @@ import {getIconByType} from "../editor/getIcon";
import {unicode2Emoji} from "../emoji";
import {getFileTreeIconHTML} from "../emoji/fileTreeIcon";
import {hasClosestBlock, hasClosestByClassName, hasClosestByTag} from "../protyle/util/hasClosest";
-import {isIPad, isNotCtrl, isPhablet, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
+import {isDisabledFeature, isIPad, isNotCtrl, isPhablet, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
import {newFile} from "../util/newFile";
import {
filterMenu,
@@ -112,7 +112,7 @@ export const openGlobalSearch = (app: App, text: string, replace: boolean, searc
k: text,
r: "",
hasReplace: false,
- method: searchData ? searchData.method : (localData.method === 4 && !window.siyuan.config.ai.embedding.enabled ? 0 : localData.method),
+ method: searchData ? searchData.method : (localData.method === 4 && (isDisabledFeature("ai") || !window.siyuan.config.ai.embedding.enabled) ? 0 : localData.method),
hPath: "",
idPath: [],
group: localData.group,
diff --git a/docs/API-CONTRACTS.md b/docs/API-CONTRACTS.md
index f148316e10..41e38da343 100644
--- a/docs/API-CONTRACTS.md
+++ b/docs/API-CONTRACTS.md
@@ -34,6 +34,8 @@ Encrypted notebook lifecycle endpoints use typed requests and responses while re
## Compatibility requirements
+Mobile distributions may call `DisableFeature("ai")` before kernel startup. All `/api/ai/` endpoints and `/api/setting/setAI` reject requests before body decoding while retaining route authentication and authorization. JSON endpoints return code `-1` with null data; the MCP OAuth callback returns HTTP 403 as plain text. Stored AI configuration is preserved. Embedding indexing, reranking, and outgoing MCP connections also honor the flag. `TestAPIContractAIDisabled`, `TestAIDisabledBackgroundFeatures`, and `TestAIDisabledMCPConnections` run in the full kernel CI suite. Run the affected checks with `go test -tags "fts5 sqlcipher" ./api ./model ./mcp/client -run 'Test(APIContractAI|AIDisabled)' -count=1` and `go test ./apicontract/...`.
+
Encrypted notebook system-lock endpoints preserve administrator authorization and read-only checks. The boolean preference is stored in system configuration, outside authenticated key backups. `TestAPIContractNotebookSystemLock` covers persistence, disabled behavior, independence from the idle timeout, multiple notebooks (including an unlocked but unmounted notebook), repeated locking, denied reads after locking, and authenticated reads of unchanged ciphertext after re-unlocking. It is included in the full kernel command below; run it separately with `go test -tags "fts5 sqlcipher" ./api -run 'TestAPIContractNotebook(SystemLock|CryptoAuthorization)$' -count=1`. `TestNotebookSystemLockContract` covers strict boolean input and `TestRouteCoverage` checks registration and handler bindings.
At migration completion on September 14, 2026, all 629 method/path registrations in `kernel/api/router.go` were contracted and the legacy list was empty. At that baseline, four `ANY` registrations expanded to 661 concrete method/path pairs in generated metadata. Use the generator and route coverage checks for current counts as endpoints are added. Static resources, the main application WebSocket, and other transport services registered by `kernel/server/serve.go` are outside this API route inventory.
diff --git a/kernel/api/ai_disabled_test.go b/kernel/api/ai_disabled_test.go
new file mode 100644
index 0000000000..5b72191643
--- /dev/null
+++ b/kernel/api/ai_disabled_test.go
@@ -0,0 +1,72 @@
+package api
+
+import (
+ "net/http/httptest"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/gin-gonic/gin"
+ "github.com/siyuan-note/siyuan/kernel/apicontract"
+ "github.com/siyuan-note/siyuan/kernel/model"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestAPIContractAIDisabled(t *testing.T) {
+ aiContractConfiguration(t)
+ previousWorkingDir := util.WorkingDir
+ t.Cleanup(func() { util.WorkingDir = previousWorkingDir })
+ util.WorkingDir = filepath.Join("..", "..", "app")
+ model.Conf.Lang = "en"
+ previous := util.DisabledFeatures
+ t.Cleanup(func() { util.DisabledFeatures = previous })
+ util.DisabledFeatures = []string{"ai"}
+ bundle, err := apicontract.BuildBundle()
+ if err != nil {
+ t.Fatal(err)
+ }
+ engine := gin.New()
+ for path, handler := range map[string]gin.HandlerFunc{
+ "/api/ai/chatGPT": chatGPT,
+ "/api/ai/editor/chat": aiEditorChat,
+ "/api/ai/agent/chat": agentChat,
+ "/api/ai/testModel": testModel,
+ "/api/ai/testEmbeddingModel": testEmbeddingModel,
+ "/api/ai/testRerankModel": testRerankModel,
+ "/api/ai/listModels": listModels,
+ "/api/ai/mcpOAuthAuthorize": mcpOAuthAuthorize,
+ "/api/ai/reindexEmbedding": reindexEmbedding,
+ "/api/ai/agent/saveSession": saveSession,
+ "/api/ai/agent/manageSkills": manageSkills,
+ "/api/setting/setAI": setAI,
+ } {
+ engine.POST(path, handler)
+ request := httptest.NewRequest("POST", path, nil)
+ request.Body = aiUnreadBody{t: t}
+ recorder := httptest.NewRecorder()
+ engine.ServeHTTP(recorder, request)
+ if recorder.Code != 200 || !strings.Contains(recorder.Body.String(), `"code":-1`) || !strings.Contains(recorder.Body.String(), "Currently unavailable") {
+ t.Fatalf("%s: %d %s", path, recorder.Code, recorder.Body.String())
+ }
+ if err := bundle.ValidateErrorResponse("POST", path, recorder.Body.Bytes()); err != nil {
+ t.Fatalf("%s: %s", path, err)
+ }
+ }
+ engine.GET("/api/ai/mcp/oauth/callback/:flowID", mcpOAuthCallback)
+ recorder := httptest.NewRecorder()
+ engine.ServeHTTP(recorder, httptest.NewRequest("GET", "/api/ai/mcp/oauth/callback/test", nil))
+ if recorder.Code != 403 {
+ t.Fatalf("OAuth callback was not disabled: %d", recorder.Code)
+ }
+ if err := bundle.ValidateHTTPResponse("GET", "/api/ai/mcp/oauth/callback/:flowID", recorder.Code, recorder.Header().Get("Content-Type"), recorder.Body.Bytes()); err != nil {
+ t.Fatal(err)
+ }
+
+ // 其他功能开关不影响 AI 接口,移除渠道限制后恢复原有响应。
+ util.DisabledFeatures = []string{"bazaar"}
+ recorder = httptest.NewRecorder()
+ engine.ServeHTTP(recorder, httptest.NewRequest("POST", "/api/ai/testModel", strings.NewReader("{")))
+ if strings.Contains(recorder.Body.String(), "Currently unavailable") {
+ t.Fatal("AI remains disabled without the AI feature flag")
+ }
+}
diff --git a/kernel/api/contract.go b/kernel/api/contract.go
index fba444b33b..660efa32f0 100644
--- a/kernel/api/contract.go
+++ b/kernel/api/contract.go
@@ -11,6 +11,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/apicontract"
"github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/model"
+ "github.com/siyuan-note/siyuan/kernel/util"
)
func notebookConfContract(value *conf.BoxConf) *apicontract.NotebookConf {
@@ -75,6 +76,16 @@ func contractHandler[Request, Data any](endpoint apicontract.Endpoint[Request, D
}
c.JSON(status, response)
}
+ // 渠道禁用在读取请求体前生效,路由上的身份和权限中间件仍先执行。
+ if apicontract.RequiresAI(endpoint.Definition().Path) && util.IsDisabledFeature("ai") {
+ message := util.I18nTerm(model.Conf.Lang, "agentCapabilitiesUnavailable")
+ if endpoint.Definition().Path == apicontract.AIMCPOAuthCallback.Definition().Path {
+ c.Data(403, "text/plain; charset=utf-8", []byte(message))
+ } else {
+ writeResponse(apicontract.Failure[Data](-1, message))
+ }
+ return
+ }
// 保留在读取请求体前完成的角色判断或大小限制,提前响应也使用相同的载荷类型。
for _, before := range beforeDecode {
if response := before(c); response != nil {
diff --git a/kernel/apicontract/ai.go b/kernel/apicontract/ai.go
index 827964fe6a..ee8d7b981a 100644
--- a/kernel/apicontract/ai.go
+++ b/kernel/apicontract/ai.go
@@ -1,5 +1,12 @@
package apicontract
+import "strings"
+
+// RequiresAI 标识受 AI 功能开关控制的接口,包含配置保存和 OAuth 回调。
+func RequiresAI(path string) bool {
+ return strings.HasPrefix(path, "/api/ai/") || path == "/api/setting/setAI"
+}
+
type AIEditorChatRequest struct {
TaskID string `json:"taskID" api:"optional,nullable"`
IDs []string `json:"ids" api:"optional,nullable"`
diff --git a/kernel/mcp/client/ai_disabled_test.go b/kernel/mcp/client/ai_disabled_test.go
new file mode 100644
index 0000000000..0996c5a3c8
--- /dev/null
+++ b/kernel/mcp/client/ai_disabled_test.go
@@ -0,0 +1,24 @@
+package client
+
+import (
+ "testing"
+
+ "github.com/siyuan-note/siyuan/kernel/conf"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestAIDisabledMCPConnections(t *testing.T) {
+ previous := util.DisabledFeatures
+ t.Cleanup(func() { util.DisabledFeatures = previous })
+ util.DisabledFeatures = []string{"ai"}
+ servers := []conf.MCPServer{{ID: "disabled-test", Enabled: true, URL: "http://127.0.0.1:1/mcp"}}
+ EnsureMCPConnected(servers)
+ ReconnectMCPAsync(servers, nil, nil)
+ mcpMu.Lock()
+ defer mcpMu.Unlock()
+ for _, server := range mcpServers {
+ if server.ID == "disabled-test" {
+ t.Fatal("disabled AI scheduled an MCP connection")
+ }
+ }
+}
diff --git a/kernel/mcp/client/mcp.go b/kernel/mcp/client/mcp.go
index d11a3becc4..13337e120a 100644
--- a/kernel/mcp/client/mcp.go
+++ b/kernel/mcp/client/mcp.go
@@ -39,6 +39,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/mcp/tools"
"github.com/siyuan-note/siyuan/kernel/model"
+ "github.com/siyuan-note/siyuan/kernel/util"
)
const (
@@ -131,6 +132,9 @@ func setMCPRuntimeStateLocked(serverID, status string, toolsCount int, errMsg, a
// 连接完成前发起的 Agent 请求本轮可能看不到 MCP 工具,下轮即可用。
// 后续调用若已连接则直接返回;若后台连接仍在进行则也直接返回,等其完成。
func EnsureMCPConnected(servers []conf.MCPServer) {
+ if util.IsDisabledFeature("ai") {
+ return
+ }
servers = append([]conf.MCPServer(nil), servers...)
mcpMu.Lock()
if mcpConnecting {
@@ -872,6 +876,9 @@ func reconnectMCPServer(serverID string) bool {
// ReconnectMCPAsync 用最新的 server 配置异步重连,不阻塞调用方(如 setAI 配置保存)。
// 适用于配置变更(开关切换、编辑、增删 server)后让连接立即跟上,而非等下次 Agent 请求。
func ReconnectMCPAsync(servers []conf.MCPServer, forceServerIDs, interactiveServerIDs []string) {
+ if util.IsDisabledFeature("ai") {
+ return
+ }
servers = append([]conf.MCPServer(nil), servers...)
force := make(map[string]bool, len(forceServerIDs))
for _, serverID := range forceServerIDs {
diff --git a/kernel/model/ai_disabled_test.go b/kernel/model/ai_disabled_test.go
new file mode 100644
index 0000000000..b5437c6b4c
--- /dev/null
+++ b/kernel/model/ai_disabled_test.go
@@ -0,0 +1,30 @@
+package model
+
+import (
+ "testing"
+
+ "github.com/siyuan-note/siyuan/kernel/conf"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestAIDisabledBackgroundFeatures(t *testing.T) {
+ previousConf, previousFeatures := Conf, util.DisabledFeatures
+ t.Cleanup(func() { Conf, util.DisabledFeatures = previousConf, previousFeatures })
+ Conf = NewAppConf()
+ Conf.AI = conf.NewAI()
+ Conf.AI.Embedding = &conf.Embedding{Enabled: true, APIKey: "embedding-key"}
+ Conf.AI.Rerank = &conf.Rerank{Enabled: true, APIKey: "rerank-key"}
+ util.DisabledFeatures = []string{"ai"}
+ if isEmbeddingEnabled() || isRerankEnabled() {
+ t.Fatal("AI background features are enabled")
+ }
+ fullReindexEmbedding()
+ retryFailedEmbedding()
+ if !Conf.AI.Embedding.Enabled || !Conf.AI.Rerank.Enabled || Conf.AI.Embedding.APIKey != "embedding-key" {
+ t.Fatal("disabling AI modified stored configuration")
+ }
+ util.DisabledFeatures = nil
+ if !isEmbeddingEnabled() || !isRerankEnabled() {
+ t.Fatal("AI configuration did not become available again")
+ }
+}
diff --git a/kernel/model/embedding.go b/kernel/model/embedding.go
index cfce9f2153..f6e7126652 100644
--- a/kernel/model/embedding.go
+++ b/kernel/model/embedding.go
@@ -622,7 +622,7 @@ func SemanticSearchBlock(query string, boxes, paths []string, types, subTypes ma
}
func isEmbeddingEnabled() bool {
- return nil != Conf.AI.Embedding && Conf.AI.Embedding.Enabled && len(Conf.AI.Embedding.APIKey) > 0
+ return !util.IsDisabledFeature("ai") && nil != Conf.AI.Embedding && Conf.AI.Embedding.Enabled && len(Conf.AI.Embedding.APIKey) > 0
}
// rerankSqlBlocks 用重排模型对候选块按 query 逐对精排。未启用或调用失败时原样返回(降级为向量相似度排序)。
diff --git a/kernel/model/rerank.go b/kernel/model/rerank.go
index d29d92d30f..45cf19b332 100644
--- a/kernel/model/rerank.go
+++ b/kernel/model/rerank.go
@@ -23,7 +23,7 @@ const defaultRerankCandidateCount = 30
// isRerankEnabled 判断重排是否可用:配置已开启且填了 APIKey。语义搜索在召回后会据此决定是否走重排。
func isRerankEnabled() bool {
- return nil != Conf.AI.Rerank && Conf.AI.Rerank.Enabled && len(Conf.AI.Rerank.APIKey) > 0
+ return !util.IsDisabledFeature("ai") && nil != Conf.AI.Rerank && Conf.AI.Rerank.Enabled && len(Conf.AI.Rerank.APIKey) > 0
}
func rerankKey() string {
diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go
index 41e6aed10e..27fea213a5 100644
--- a/kernel/util/runtime.go
+++ b/kernel/util/runtime.go
@@ -50,6 +50,16 @@ func DisableFeature(feature string) {
DisabledFeatures = gulu.Str.RemoveDuplicatedElem(DisabledFeatures)
}
+// IsDisabledFeature 查询原生端启动时禁用的功能,不修改用户配置。
+func IsDisabledFeature(feature string) bool {
+ for _, disabled := range DisabledFeatures {
+ if disabled == feature {
+ return true
+ }
+ }
+ return false
+}
+
var (
UseSingleLineSave = true // UseSingleLineSave 是否使用单行保存 .sy 和数据库 .json 文件。
LargeFileWarningSize = 8 // LargeFileWarningSize 大文件警告大小,单位:MB