Skip to content

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

:art: Add mobile.log file to diagnose mobile issues https://github.com/siyuan-note/siyuan/issues/10270

Daniel8c5f8d2bc405
diff --git a/kernel/go.mod b/kernel/go.mod
index aa4ec2d251..935e56c057 100644
--- a/kernel/go.mod
+++ b/kernel/go.mod
@@ -54,7 +54,7 @@ require (
github.com/siyuan-note/dejavu v0.0.0-20240124091649-941e2960dc74
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4
github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255
- github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1
+ github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a
github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690
github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0
github.com/siyuan-note/riff v0.0.0-20231226152006-8833f8b9a6c1
diff --git a/kernel/go.sum b/kernel/go.sum
index 6d08e1549b..6efbf6c45a 100644
--- a/kernel/go.sum
+++ b/kernel/go.sum
@@ -358,8 +358,8 @@ github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/e
github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis=
github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255 h1:WTAUBlU2v7ISet9ankbjqZrRKo6MLGK1LBmDyNlehPY=
github.com/siyuan-note/eventbus v0.0.0-20240124091459-8e1b37a55255/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw=
-github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1 h1:eNHKiqE5yPnj1PYk0PJhxP+oqWdKi+0ZI28lBQmz5qg=
-github.com/siyuan-note/filelock v0.0.0-20240121150730-38e4487651d1/go.mod h1:CYJQjSyKYLhEJJC+5I+R4uNcpyW0X2CaUYwMVbkelDk=
+github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a h1:77b+pJn6eb905MMGKynV/OJBzSkNfh96QUnpzgT7v18=
+github.com/siyuan-note/filelock v0.0.0-20240128062546-4cf460a2732a/go.mod h1:CYJQjSyKYLhEJJC+5I+R4uNcpyW0X2CaUYwMVbkelDk=
github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690 h1:r7qWSaYQhomCAdQl/dZe4NdAn1zadytb4jcOeopdHw4=
github.com/siyuan-note/httpclient v0.0.0-20240105083729-70d0557bc690/go.mod h1:ZWp+cGHwkXXCIYudLUxI9AV2IcbsgPGhQVL/1SqUxQg=
github.com/siyuan-note/logging v0.0.0-20231208035918-61f884c854f0 h1:+XjUr9UMXsczdO2bGA72p/k9wa2ShPb8ybi7CDBJ7HQ=
diff --git a/kernel/mobile/kernel.go b/kernel/mobile/kernel.go
index 632e35d93b..624fbb55e4 100644
--- a/kernel/mobile/kernel.go
+++ b/kernel/mobile/kernel.go
@@ -84,6 +84,10 @@ func SetHttpServerPort(port int) {
filelock.AndroidServerPort = port
}
+func GetCurrentWorkspacePath() string {
+ return util.WorkspaceDir
+}
+
func SetTimezone(container, appDir, timezoneID string) {
if "ios" == container {
os.Setenv("ZONEINFO", filepath.Join(appDir, "app", "zoneinfo.zip"))
diff --git a/kernel/model/export.go b/kernel/model/export.go
index d34a64b248..5740bd5d51 100644
--- a/kernel/model/export.go
+++ b/kernel/model/export.go
@@ -328,6 +328,14 @@ func ExportSystemLog() (zipPath string) {
}
}
+ mobileLog := filepath.Join(util.TempDir, "mobile.log")
+ if gulu.File.IsExist(mobileLog) {
+ to := filepath.Join(exportFolder, "mobile.log")
+ if err := filelock.Copy(mobileLog, to); nil != err {
+ logging.LogErrorf("copy mobile log from [%s] to [%s] failed: %s", err, mobileLog, to)
+ }
+ }
+
zipPath = exportFolder + ".zip"
zip, err := gulu.Zip.Create(zipPath)
if nil != err {
diff --git a/kernel/util/working_mobile.go b/kernel/util/working_mobile.go
index f532223094..b9bbd1ed4f 100644
--- a/kernel/util/working_mobile.go
+++ b/kernel/util/working_mobile.go
@@ -50,7 +50,6 @@ func BootMobile(container, appDir, workspaceBaseDir, lang string) {
logging.LogErrorf("create user home conf folder [%s] failed: %s", userHomeConfDir, err)
os.Exit(logging.ExitCodeInitWorkspaceErr)
}
-
}
defaultWorkspaceDir := filepath.Join(workspaceBaseDir, "siyuan")