Skip to content

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

:recycle: Remove account display settings superseded by entry visibility

Daniel7a3b341f81d1
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 2f7c8a2241..7068f2a661 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -168,35 +168,6 @@ test("top bar markup stays aligned with its configurable built-in catalog", () =
assert.doesNotMatch(source, /id="drag"[^>]*data-topbar-entry/);
});
-test("top bar account entries use legacy account switches only as defaults", () => {
- const windowDescriptor = Object.getOwnPropertyDescriptor(globalThis, "window");
- Object.defineProperty(globalThis, "window", {
- configurable: true,
- value: {
- siyuan: {
- config: {
- account: {
- displayVIP: false,
- displayTitle: true,
- },
- },
- },
- },
- });
- try {
- assert.equal(getEntryCatalogDefaultVisibility("topBar.toolbarVIP"), false);
- assert.equal(getEntryCatalogDefaultVisibility("topBar.toolbarTitle"), true);
- assert.equal(getEntryCatalogDefaultVisibility("topBar.barSearch"), true);
- assert.equal(getEntryCatalogDefaultVisibility("topBar.drag"), true);
- } finally {
- if (windowDescriptor) {
- Object.defineProperty(globalThis, "window", windowDescriptor);
- } else {
- Reflect.deleteProperty(globalThis, "window");
- }
- }
-});
-
test("daily note and flashcard top bar entries default to visible only in the Simple profile", () => {
for (const key of ["barDailyNote", "barRiffCard"]) {
const path = `${TOP_BAR_ROOT_PATH}.${key}`;
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index 5a8d839808..00ba75ff54 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -599,12 +599,8 @@ const topBarBuiltinChildren = [
node("barBack", lang("goBack")),
node("barForward", lang("goForward")),
fixed("drag", lang("entryTopBarDrag")),
- node("toolbarVIP", lang("accountDisplayVIP"), true, undefined, undefined, {
- defaultVisible: () => window.siyuan.config.account.displayVIP,
- }),
- node("toolbarTitle", lang("accountDisplayTitle"), true, undefined, undefined, {
- defaultVisible: () => window.siyuan.config.account.displayTitle,
- }),
+ node("toolbarVIP", lang("accountDisplayVIP")),
+ node("toolbarTitle", lang("accountDisplayTitle")),
node("barPlugins", lang("plugin")),
node("barCommand", lang("commandPanel")),
node("barSearch", lang("globalSearch")),
diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts
index 71be1efe1f..536153e10b 100644
--- a/app/src/types/config.d.ts
+++ b/app/src/types/config.d.ts
@@ -26,7 +26,6 @@ declare namespace Config {
*/
accessAuthCode: TAccessAuthCode;
oidc: IOIDC;
- account: IAccount;
ai: IAI;
api: IAPI;
appearance: IAppearance;
@@ -133,20 +132,6 @@ declare namespace Config {
claimRules: IOIDCClaimRule[];
}
- /**
- * Account configuration
- */
- export interface IAccount {
- /**
- * Display the title icon
- */
- displayTitle: boolean;
- /**
- * Display the VIP icon
- */
- displayVIP: boolean;
- }
-
/**
* Artificial Intelligence (AI) related configuration
*/
diff --git a/kernel/api/router.go b/kernel/api/router.go
index 4a20c2dbda..a5ef17f104 100644
--- a/kernel/api/router.go
+++ b/kernel/api/router.go
@@ -459,7 +459,6 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/transactions/redo", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, performRedo)
ginServer.Handle("POST", "/api/transactions/clearHistory", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, clearHistory)
- ginServer.Handle("POST", "/api/setting/setAccount", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setAccount)
ginServer.Handle("POST", "/api/setting/setEditor", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setEditor)
ginServer.Handle("POST", "/api/setting/setExport", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setExport)
ginServer.Handle("POST", "/api/setting/getPandocBin", model.CheckAuth, model.CheckAdminRole, getPandocBin)
diff --git a/kernel/api/setting.go b/kernel/api/setting.go
index 8d4012431d..93ff275e22 100644
--- a/kernel/api/setting.go
+++ b/kernel/api/setting.go
@@ -445,35 +445,6 @@ func setFlashcard(c *gin.Context) {
ret.Data = flashcard
}
-func setAccount(c *gin.Context) {
- ret := gulu.Ret.NewResult()
- defer c.JSON(http.StatusOK, ret)
-
- arg, ok := util.JsonArg(c, ret)
- if !ok {
- return
- }
-
- param, err := gulu.JSON.MarshalJSON(arg)
- if err != nil {
- ret.Code = -1
- ret.Msg = err.Error()
- return
- }
-
- account := &conf.Account{}
- if err = gulu.JSON.UnmarshalJSON(param, account); err != nil {
- ret.Code = -1
- ret.Msg = err.Error()
- return
- }
-
- model.Conf.Account = account
- model.Conf.Save()
-
- ret.Data = model.Conf.Account
-}
-
func setEditor(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
diff --git a/kernel/api/system.go b/kernel/api/system.go
index 1d41b80c09..5bb2992519 100644
--- a/kernel/api/system.go
+++ b/kernel/api/system.go
@@ -550,7 +550,6 @@ func exportConf(c *gin.Context) {
clonedConf.Export.PandocBin = ""
}
clonedConf.UserData = ""
- clonedConf.Account = nil
clonedConf.AccessAuthCode = ""
if nil != clonedConf.System {
clonedConf.System.NetworkProxy = &conf.NetworkProxy{}
diff --git a/kernel/conf/account.go b/kernel/conf/account.go
deleted file mode 100644
index c4590e22e5..0000000000
--- a/kernel/conf/account.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// SiYuan - From thought to insight, with agents
-// Copyright (c) 2020-present, b3log.org
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-package conf
-
-type Account struct {
- DisplayTitle bool `json:"displayTitle"`
- DisplayVIP bool `json:"displayVIP"`
-}
-
-func NewAccount() *Account {
- return &Account{
- DisplayTitle: true,
- DisplayVIP: true,
- }
-}
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 603ece8442..e17eeabd01 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -63,7 +63,6 @@ type AppConf struct {
UILayout *conf.UILayout `json:"uiLayout"` // 界面布局。不要直接使用,使用 GetUILayout() 和 SetUILayout() 方法
UserData string `json:"userData"` // 社区用户信息,对 User 加密存储
User *conf.User `json:"-"` // 社区用户内存结构,不持久化。不要直接使用,使用 GetUser() 和 SetUser() 方法
- Account *conf.Account `json:"account"` // 帐号配置
ReadOnly bool `json:"readonly"` // 是否是以只读模式运行
ServerAddrs []string `json:"serverAddrs"` // 本地服务器地址列表
AccessAuthCode string `json:"accessAuthCode"` // 锁屏密码
@@ -610,9 +609,6 @@ func InitConf() {
if "" != Conf.UserData {
Conf.SetUser(loadUserFromConf())
}
- if nil == Conf.Account {
- Conf.Account = conf.NewAccount()
- }
if nil == Conf.Sync {
Conf.Sync = conf.NewSync()