diff --git a/app/src/history/history.ts b/app/src/history/history.ts index 1f609d3cf..8c8184ace 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -161,6 +161,9 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string hCreated: string, count: number, hSize: string, + systemID: string, + systemName: string, + systemOS: string, tag: string, typesCount: { type: string, count: number }[] }) => { @@ -178,13 +181,15 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string ${item.tag}
${statHTML}`; /// #if MOBILE diff --git a/kernel/conf/system.go b/kernel/conf/system.go index b3bdffc37..917cfaa6c 100644 --- a/kernel/conf/system.go +++ b/kernel/conf/system.go @@ -22,6 +22,7 @@ import ( type System struct { ID string `json:"id"` + Name string `json:"name"` KernelVersion string `json:"kernelVersion"` OS string `json:"os"` OSPlatform string `json:"osPlatform"` @@ -47,6 +48,7 @@ type System struct { func NewSystem() *System { return &System{ ID: util.GetDeviceID(), + Name: util.GetDeviceName(), KernelVersion: util.Ver, NetworkProxy: &NetworkProxy{}, DownloadInstallPkg: true, diff --git a/kernel/go.mod b/kernel/go.mod index 70a5f808c..88abbb676 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -44,7 +44,7 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-gpt3 v1.4.0 github.com/shirou/gopsutil/v3 v3.23.2 - github.com/siyuan-note/dejavu v0.0.0-20230421144748-43d79a87c9f9 + github.com/siyuan-note/dejavu v0.0.0-20230424035816-c47703a13fd4 github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9 diff --git a/kernel/go.sum b/kernel/go.sum index a4c3eb570..9a606fd2f 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -277,8 +277,10 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/siyuan-note/dejavu v0.0.0-20230421144748-43d79a87c9f9 h1:vOGSTlJpei7tyVOpgwSXVChmf65NHkuL9GvMWPjfPgo= -github.com/siyuan-note/dejavu v0.0.0-20230421144748-43d79a87c9f9/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI= +github.com/siyuan-note/dejavu v0.0.0-20230424034810-63afce096499 h1:2cAa1Y8GG1f13cyy1g1SLWHty/EYaj02EMza2ql3FTs= +github.com/siyuan-note/dejavu v0.0.0-20230424034810-63afce096499/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI= +github.com/siyuan-note/dejavu v0.0.0-20230424035816-c47703a13fd4 h1:5hkMgzn1kyrBVK0BQTSh6jrCMrNDBKoJD/tR7U+4Tqc= +github.com/siyuan-note/dejavu v0.0.0-20230424035816-c47703a13fd4/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg= diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 904f5ca2b..f1a10af12 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -235,8 +235,12 @@ func InitConf() { if "" == Conf.System.ID { Conf.System.ID = util.GetDeviceID() } + if "" == Conf.System.Name { + Conf.System.Name = util.GetDeviceName() + } if util.ContainerStd == util.Container { Conf.System.ID = util.GetDeviceID() + Conf.System.Name = util.GetDeviceName() } Conf.System.AppDir = util.WorkingDir diff --git a/kernel/model/repository.go b/kernel/model/repository.go index 5623197a0..62a6c0a8c 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -1401,7 +1401,7 @@ func newRepository() (ret *dejavu.Repo, err error) { ignoreLines := getIgnoreLines() ignoreLines = append(ignoreLines, "/.siyuan/conf.json") // 忽略旧版同步配置 - ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.System.ID, Conf.Repo.Key, ignoreLines, cloudRepo) + ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.System.ID, Conf.System.Name, Conf.System.OS, Conf.Repo.Key, ignoreLines, cloudRepo) if nil != err { logging.LogErrorf("init data repo failed: %s", err) return diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go index 596bf6810..d6272adfd 100644 --- a/kernel/util/runtime.go +++ b/kernel/util/runtime.go @@ -83,6 +83,14 @@ func GetDeviceID() string { return gulu.Rand.String(12) } +func GetDeviceName() string { + ret, err := os.Hostname() + if nil != err { + return "unknown" + } + return ret +} + func SetNetworkProxy(proxyURL string) { if err := os.Setenv("HTTPS_PROXY", proxyURL); nil != err { logging.LogErrorf("set env [HTTPS_PROXY] failed: %s", err)