mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-16 00:50:56 +08:00
🎨 Data snapshot save device ID, name and OS https://github.com/siyuan-note/siyuan/issues/8094
This commit is contained in:
parent
9f9afdcfd0
commit
051ddf74ae
@ -161,6 +161,9 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
|
|||||||
hCreated: string,
|
hCreated: string,
|
||||||
count: number,
|
count: number,
|
||||||
hSize: string,
|
hSize: string,
|
||||||
|
systemID: string,
|
||||||
|
systemName: string,
|
||||||
|
systemOS: string,
|
||||||
tag: string,
|
tag: string,
|
||||||
typesCount: { type: string, count: number }[]
|
typesCount: { type: string, count: number }[]
|
||||||
}) => {
|
}) => {
|
||||||
@ -185,6 +188,8 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string
|
|||||||
${item.hSize}
|
${item.hSize}
|
||||||
<span class="fn__space"></span>
|
<span class="fn__space"></span>
|
||||||
${window.siyuan.languages.fileCount} ${item.count}
|
${window.siyuan.languages.fileCount} ${item.count}
|
||||||
|
<span class="fn__space"></span>
|
||||||
|
${item.systemOS}/${item.systemName}
|
||||||
</div>
|
</div>
|
||||||
${statHTML}`;
|
${statHTML}`;
|
||||||
/// #if MOBILE
|
/// #if MOBILE
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
type System struct {
|
type System struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
KernelVersion string `json:"kernelVersion"`
|
KernelVersion string `json:"kernelVersion"`
|
||||||
OS string `json:"os"`
|
OS string `json:"os"`
|
||||||
OSPlatform string `json:"osPlatform"`
|
OSPlatform string `json:"osPlatform"`
|
||||||
@ -47,6 +48,7 @@ type System struct {
|
|||||||
func NewSystem() *System {
|
func NewSystem() *System {
|
||||||
return &System{
|
return &System{
|
||||||
ID: util.GetDeviceID(),
|
ID: util.GetDeviceID(),
|
||||||
|
Name: util.GetDeviceName(),
|
||||||
KernelVersion: util.Ver,
|
KernelVersion: util.Ver,
|
||||||
NetworkProxy: &NetworkProxy{},
|
NetworkProxy: &NetworkProxy{},
|
||||||
DownloadInstallPkg: true,
|
DownloadInstallPkg: true,
|
||||||
|
@ -44,7 +44,7 @@ require (
|
|||||||
github.com/radovskyb/watcher v1.0.7
|
github.com/radovskyb/watcher v1.0.7
|
||||||
github.com/sashabaranov/go-gpt3 v1.4.0
|
github.com/sashabaranov/go-gpt3 v1.4.0
|
||||||
github.com/shirou/gopsutil/v3 v3.23.2
|
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/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
|
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
|
||||||
github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9
|
github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9
|
||||||
|
@ -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/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 h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
|
||||||
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
|
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-20230424034810-63afce096499 h1:2cAa1Y8GG1f13cyy1g1SLWHty/EYaj02EMza2ql3FTs=
|
||||||
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/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 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
|
||||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
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=
|
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=
|
||||||
|
@ -235,8 +235,12 @@ func InitConf() {
|
|||||||
if "" == Conf.System.ID {
|
if "" == Conf.System.ID {
|
||||||
Conf.System.ID = util.GetDeviceID()
|
Conf.System.ID = util.GetDeviceID()
|
||||||
}
|
}
|
||||||
|
if "" == Conf.System.Name {
|
||||||
|
Conf.System.Name = util.GetDeviceName()
|
||||||
|
}
|
||||||
if util.ContainerStd == util.Container {
|
if util.ContainerStd == util.Container {
|
||||||
Conf.System.ID = util.GetDeviceID()
|
Conf.System.ID = util.GetDeviceID()
|
||||||
|
Conf.System.Name = util.GetDeviceName()
|
||||||
}
|
}
|
||||||
|
|
||||||
Conf.System.AppDir = util.WorkingDir
|
Conf.System.AppDir = util.WorkingDir
|
||||||
|
@ -1401,7 +1401,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||||||
|
|
||||||
ignoreLines := getIgnoreLines()
|
ignoreLines := getIgnoreLines()
|
||||||
ignoreLines = append(ignoreLines, "/.siyuan/conf.json") // 忽略旧版同步配置
|
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 {
|
if nil != err {
|
||||||
logging.LogErrorf("init data repo failed: %s", err)
|
logging.LogErrorf("init data repo failed: %s", err)
|
||||||
return
|
return
|
||||||
|
@ -83,6 +83,14 @@ func GetDeviceID() string {
|
|||||||
return gulu.Rand.String(12)
|
return gulu.Rand.String(12)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetDeviceName() string {
|
||||||
|
ret, err := os.Hostname()
|
||||||
|
if nil != err {
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func SetNetworkProxy(proxyURL string) {
|
func SetNetworkProxy(proxyURL string) {
|
||||||
if err := os.Setenv("HTTPS_PROXY", proxyURL); nil != err {
|
if err := os.Setenv("HTTPS_PROXY", proxyURL); nil != err {
|
||||||
logging.LogErrorf("set env [HTTPS_PROXY] failed: %s", err)
|
logging.LogErrorf("set env [HTTPS_PROXY] failed: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user