From d83d5ff74fd217d5701d321041faf37f5f358f49 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 18 Dec 2024 17:09:45 +0800 Subject: [PATCH 1/4] :memo: Update changelogs --- app/changelogs/v0.1.0-v2.8.3/v0.1.0-v2.8.3.md | 2 +- app/changelogs/v3.1.16/v3.1.16.md | 4 ++++ app/changelogs/v3.1.16/v3.1.16_zh_CHT.md | 4 ++++ app/changelogs/v3.1.16/v3.1.16_zh_CN.md | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/changelogs/v0.1.0-v2.8.3/v0.1.0-v2.8.3.md b/app/changelogs/v0.1.0-v2.8.3/v0.1.0-v2.8.3.md index c5e15ba76..4af56e5db 100644 --- a/app/changelogs/v0.1.0-v2.8.3/v0.1.0-v2.8.3.md +++ b/app/changelogs/v0.1.0-v2.8.3/v0.1.0-v2.8.3.md @@ -5790,7 +5790,7 @@ Bug fixes and improves details. * [Weaken Markdown related content in the user guide](https://github.com/siyuan-note/siyuan/issues/2001) -### Abolishments +### Abolishment * [Remove editor options](https://github.com/siyuan-note/siyuan/issues/1997) * [Remove export option `fixTermTypo`](https://github.com/siyuan-note/siyuan/issues/1998) diff --git a/app/changelogs/v3.1.16/v3.1.16.md b/app/changelogs/v3.1.16/v3.1.16.md index 11ed11a4e..8da000354 100644 --- a/app/changelogs/v3.1.16/v3.1.16.md +++ b/app/changelogs/v3.1.16/v3.1.16.md @@ -29,6 +29,10 @@ Below are the detailed changes in this version. * [Improve serving assets performance](https://github.com/siyuan-note/siyuan/issues/13501) * [Improve data synchronization stability](https://github.com/siyuan-note/siyuan/issues/13503) +### Abolishment + +* [Remove Sentry reporting diagnostic data](https://github.com/siyuan-note/siyuan/issues/13522) + ### Bugfix * [Outline panel update overwrite content issue](https://github.com/siyuan-note/siyuan/issues/13409) diff --git a/app/changelogs/v3.1.16/v3.1.16_zh_CHT.md b/app/changelogs/v3.1.16/v3.1.16_zh_CHT.md index 121d3ea28..2280ddf6e 100644 --- a/app/changelogs/v3.1.16/v3.1.16_zh_CHT.md +++ b/app/changelogs/v3.1.16/v3.1.16_zh_CHT.md @@ -29,6 +29,10 @@ * [改進資源檔案載入效能](https://github.com/siyuan-note/siyuan/issues/13501) * [改善資料同步穩定性](https://github.com/siyuan-note/siyuan/issues/13503) +### 移除功能 + +* [移除 Sentry 報告診斷資料](https://github.com/siyuan-note/siyuan/issues/13522) + ### 修復缺陷 * [大綱面板更新覆蓋內容問題](https://github.com/siyuan-note/siyuan/issues/13409) diff --git a/app/changelogs/v3.1.16/v3.1.16_zh_CN.md b/app/changelogs/v3.1.16/v3.1.16_zh_CN.md index 86ebcaedf..22db2f274 100644 --- a/app/changelogs/v3.1.16/v3.1.16_zh_CN.md +++ b/app/changelogs/v3.1.16/v3.1.16_zh_CN.md @@ -29,6 +29,10 @@ * [改进资源文件加载性能](https://github.com/siyuan-note/siyuan/issues/13501) * [改进数据同步稳定性](https://github.com/siyuan-note/siyuan/issues/13503) +### 移除功能 + +* [移除 Sentry 报告诊断数据](https://github.com/siyuan-note/siyuan/issues/13522) + ### 修复缺陷 * [大纲面板更新覆盖内容问题](https://github.com/siyuan-note/siyuan/issues/13409) From 5fb2b78911fb6a307ee6b0771180a8ee7eff5958 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 18 Dec 2024 17:10:23 +0800 Subject: [PATCH 2/4] :fire: Remove Sentry reporting diagnostic data https://github.com/siyuan-note/siyuan/issues/13522 --- kernel/api/router.go | 1 - kernel/api/system.go | 17 ----------------- kernel/conf/system.go | 1 - kernel/go.mod | 9 ++++----- kernel/go.sum | 22 ++++++++-------------- kernel/model/conf.go | 10 ---------- 6 files changed, 12 insertions(+), 48 deletions(-) diff --git a/kernel/api/router.go b/kernel/api/router.go index 31f8197ea..8b6733a06 100644 --- a/kernel/api/router.go +++ b/kernel/api/router.go @@ -42,7 +42,6 @@ func ServeAPI(ginServer *gin.Engine) { ginServer.Handle("POST", "/api/system/setAccessAuthCode", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setAccessAuthCode) ginServer.Handle("POST", "/api/system/setFollowSystemLockScreen", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setFollowSystemLockScreen) ginServer.Handle("POST", "/api/system/setNetworkServe", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setNetworkServe) - ginServer.Handle("POST", "/api/system/setUploadErrLog", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setUploadErrLog) ginServer.Handle("POST", "/api/system/setAutoLaunch", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setAutoLaunch) ginServer.Handle("POST", "/api/system/setGoogleAnalytics", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setGoogleAnalytics) ginServer.Handle("POST", "/api/system/setDownloadInstallPkg", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setDownloadInstallPkg) diff --git a/kernel/api/system.go b/kernel/api/system.go index 19546b74f..7e91170e6 100644 --- a/kernel/api/system.go +++ b/kernel/api/system.go @@ -634,23 +634,6 @@ func setGoogleAnalytics(c *gin.Context) { model.Conf.Save() } -func setUploadErrLog(c *gin.Context) { - ret := gulu.Ret.NewResult() - defer c.JSON(http.StatusOK, ret) - - arg, ok := util.JsonArg(c, ret) - if !ok { - return - } - - uploadErrLog := arg["uploadErrLog"].(bool) - model.Conf.System.UploadErrLog = uploadErrLog - model.Conf.Save() - - util.PushMsg(model.Conf.Language(42), 1000*15) - time.Sleep(time.Second * 3) -} - func setAutoLaunch(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) diff --git a/kernel/conf/system.go b/kernel/conf/system.go index 7640ca224..5293eba24 100644 --- a/kernel/conf/system.go +++ b/kernel/conf/system.go @@ -39,7 +39,6 @@ type System struct { NetworkServe bool `json:"networkServe"` // 是否开启网络伺服 NetworkProxy *NetworkProxy `json:"networkProxy"` - UploadErrLog bool `json:"uploadErrLog"` DisableGoogleAnalytics bool `json:"disableGoogleAnalytics"` DownloadInstallPkg bool `json:"downloadInstallPkg"` AutoLaunch2 int `json:"autoLaunch2"` // 0:不自动启动,1:自动启动,2:自动启动+隐藏主窗口 diff --git a/kernel/go.mod b/kernel/go.mod index 959d90a9e..8f4fa4411 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -30,7 +30,6 @@ require ( github.com/flopp/go-findfont v0.1.0 github.com/fsnotify/fsnotify v1.7.0 github.com/gabriel-vasile/mimetype v1.4.5 - github.com/getsentry/sentry-go v0.30.0 github.com/gin-contrib/gzip v1.0.1 github.com/gin-contrib/sessions v1.0.1 github.com/gin-gonic/gin v1.10.0 @@ -57,12 +56,12 @@ require ( github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 github.com/sashabaranov/go-openai v1.29.1 github.com/shirou/gopsutil/v3 v3.24.5 - github.com/siyuan-note/dejavu v0.0.0-20241217094848-8beeb0605db2 + github.com/siyuan-note/dejavu v0.0.0-20241218090338-be682e478d2e github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 github.com/siyuan-note/filelock v0.0.0-20241212013445-c66518cdacfa - github.com/siyuan-note/httpclient v0.0.0-20241217094627-0dbb1d2d7698 - github.com/siyuan-note/logging v0.0.0-20241212013108-623e0bb0bcd9 + github.com/siyuan-note/httpclient v0.0.0-20241218090012-d3bf82b2e5be + github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742 github.com/siyuan-note/riff v0.0.0-20241217095231-017015753318 github.com/spf13/cast v1.7.0 github.com/steambap/captcha v1.4.1 @@ -169,7 +168,7 @@ require ( go.uber.org/mock v0.5.0 // indirect golang.org/x/arch v0.10.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e // indirect + golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/tools v0.28.0 // indirect diff --git a/kernel/go.sum b/kernel/go.sum index 263298c20..155a4b3f9 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -112,8 +112,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4= github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4= -github.com/getsentry/sentry-go v0.30.0 h1:lWUwDnY7sKHaVIoZ9wYqRHJ5iEmoc0pqcRqFkosKzBo= -github.com/getsentry/sentry-go v0.30.0/go.mod h1:WU9B9/1/sHDqeV8T+3VwwbjeR5MSXs/6aqG3mqZrezA= github.com/gigawattio/window v0.0.0-20180317192513-0f5467e35573 h1:u8AQ9bPa9oC+8/A/jlWouakhIvkFfuxgIIRjiy8av7I= github.com/gigawattio/window v0.0.0-20180317192513-0f5467e35573/go.mod h1:eBvb3i++NHDH4Ugo9qCvMw8t0mTSctaEa5blJbWcNxs= github.com/gin-contrib/gzip v1.0.1 h1:HQ8ENHODeLY7a4g1Au/46Z92bdGFl74OhxcZble9WJE= @@ -124,8 +122,6 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= @@ -284,8 +280,6 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -341,18 +335,18 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D 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/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= -github.com/siyuan-note/dejavu v0.0.0-20241217094848-8beeb0605db2 h1:Mv1yhF4uGmIInRDiwqODyoQFsySIntv1HYSYvhnLUkc= -github.com/siyuan-note/dejavu v0.0.0-20241217094848-8beeb0605db2/go.mod h1:C4VZXf61Q5nvWo4sWaBO4AnqJSg4ly3kHQI+FrEuV+M= +github.com/siyuan-note/dejavu v0.0.0-20241218090338-be682e478d2e h1:7cODlg7ji5r2CnwOqKwlZxJYvoyfO94l+w2wIGjAlEg= +github.com/siyuan-note/dejavu v0.0.0-20241218090338-be682e478d2e/go.mod h1:sFK/EOHuewC6XDc/udM4eIkw/MAn0vbdL0lrfhE/xic= github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4 h1:kJaw5L/evyW6LcB9IQT8PR4ppx8JVqOFP9Ix3rfwSrc= github.com/siyuan-note/encryption v0.0.0-20231219001248-1e028a4d13b4/go.mod h1:UYcCCY+0wh+GmUoDOaO63j1sV5lgy7laLAk1XhEiUis= github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8= github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97/go.mod h1:1/nGgthl89FPA7GzAcEWKl6zRRnfgyTjzLZj9bW7kuw= github.com/siyuan-note/filelock v0.0.0-20241212013445-c66518cdacfa h1:NM/0m8/hmFZGo0v+xNnjEeoqTtZShcVadWS0WYah+yI= github.com/siyuan-note/filelock v0.0.0-20241212013445-c66518cdacfa/go.mod h1:OmJuq0Dm+S8I713lmfmZNFwtQ/o4mdZHSfsEra39lfY= -github.com/siyuan-note/httpclient v0.0.0-20241217094627-0dbb1d2d7698 h1:vds4JlCUMdLlpaobBJTgojpCaxJVbk7zVrZpP2RZrxM= -github.com/siyuan-note/httpclient v0.0.0-20241217094627-0dbb1d2d7698/go.mod h1:z9ala5zx8ivq8UaySAFkfk1ItSUoV8I0196Fu5NnpeE= -github.com/siyuan-note/logging v0.0.0-20241212013108-623e0bb0bcd9 h1:DYF4JZFiVTy1hmFvrpyRxc+8qaymm/THwdyow/xWark= -github.com/siyuan-note/logging v0.0.0-20241212013108-623e0bb0bcd9/go.mod h1:jZ4dO1KQBl3mqarQCwL8bnAyWz3SeZsySLT6HjSuZjY= +github.com/siyuan-note/httpclient v0.0.0-20241218090012-d3bf82b2e5be h1:79eVdjQWZgJVAQr4xHSl0xj6Y22bSd8GzKR/rUXO38o= +github.com/siyuan-note/httpclient v0.0.0-20241218090012-d3bf82b2e5be/go.mod h1:5xZ2HLlIqlNKk/dZzM0zoOs/m5m25axMUKXLazqrllc= +github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742 h1:PPiRvQDZ6bhXqvQRkOLNyNICZ/gvDuDide6gswoGsAg= +github.com/siyuan-note/logging v0.0.0-20241218085028-6514639a9742/go.mod h1:uszawhOtHHcCLZN7CZDM40J/IiwprO2lJZP4Nf4FJ14= github.com/siyuan-note/riff v0.0.0-20241217095231-017015753318 h1:f85tgE/sYxCOvJSwmKlsVJO5NSSMsScZDJ+dhK0V+1o= github.com/siyuan-note/riff v0.0.0-20241217095231-017015753318/go.mod h1:y76kbfoAdNo04msO/YkoHZoxLIUF2J/CFP7abNN4LBc= github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= @@ -427,8 +421,8 @@ golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e h1:4qufH0hlUYs6AO6XmZC3GqfDPGSXHVXUFR6OND+iJX4= -golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= +golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78= diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 514717210..e95117c47 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -34,7 +34,6 @@ import ( "github.com/88250/lute" "github.com/88250/lute/ast" "github.com/Xuanwo/go-locale" - "github.com/getsentry/sentry-go" "github.com/sashabaranov/go-openai" "github.com/siyuan-note/eventbus" "github.com/siyuan-note/filelock" @@ -509,15 +508,6 @@ func InitConf() { Conf.Save() logging.SetLogLevel(Conf.LogLevel) - if Conf.System.UploadErrLog { - logging.LogInfof("user has enabled [Automatically upload error messages and diagnostic data]") - sentry.Init(sentry.ClientOptions{ - Dsn: "https://bdff135f14654ae58a054adeceb2c308@o1173696.ingest.sentry.io/6269178", - Release: util.Ver, - Environment: util.Mode, - }) - } - if Conf.System.DisableGoogleAnalytics { logging.LogInfof("user has disabled [Google Analytics]") } From b81de5d2dad454e455e8f4256f4a30d7c3d0dec9 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 18 Dec 2024 17:17:24 +0800 Subject: [PATCH 3/4] :art: Improve exporting data https://github.com/siyuan-note/siyuan/issues/13500 --- app/src/menus/navigation.ts | 3 +- kernel/api/export.go | 3 +- kernel/model/export.go | 65 ++++++++++++++++--------------------- kernel/model/tree.go | 3 +- 4 files changed, 32 insertions(+), 42 deletions(-) diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts index 6a0509c02..ebcb0130d 100644 --- a/app/src/menus/navigation.ts +++ b/app/src/menus/navigation.ts @@ -380,8 +380,7 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => { click: () => { const msgId = showMessage(window.siyuan.languages.exporting, -1); fetchPost("/api/export/exportNotebookMd", { - notebook: notebookId, - path: "/" + notebook: notebookId }, response => { hideMessage(msgId); openByMobile(response.data.zip); diff --git a/kernel/api/export.go b/kernel/api/export.go index c9cdc9041..9aef2c7cd 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -317,8 +317,7 @@ func exportNotebookMd(c *gin.Context) { } notebook := arg["notebook"].(string) - p := arg["path"].(string) - zipPath := model.ExportNotebookMarkdown(notebook, p) + zipPath := model.ExportNotebookMarkdown(notebook) ret.Data = map[string]interface{}{ "name": path.Base(zipPath), "zip": zipPath, diff --git a/kernel/model/export.go b/kernel/model/export.go index bc0fd8a52..4c6c33bf3 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -272,7 +272,7 @@ func Export2Liandi(id string) (err error) { ".md", 4, 1, 0, "#", "#", "", "", - false, nil, true) + false, nil, true, &map[string]*parse.Tree{}) result := gulu.Ret.NewResult() request := httpclient.NewCloudRequest30s() request = request. @@ -578,7 +578,7 @@ func Preview(id string) (retStdHTML string) { blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, - Conf.Export.AddTitle, true, true) + Conf.Export.AddTitle, true, true, &map[string]*parse.Tree{}) luteEngine := NewLute() luteEngine.SetFootnotes(true) addBlockIALNodes(tree, false) @@ -681,7 +681,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, - Conf.Export.AddTitle, true, true) + Conf.Export.AddTitle, true, true, &map[string]*parse.Tree{}) name = path.Base(tree.HPath) name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614 savePath = strings.TrimSpace(savePath) @@ -840,7 +840,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, - Conf.Export.AddTitle, true, true) + Conf.Export.AddTitle, true, true, &map[string]*parse.Tree{}) name = path.Base(tree.HPath) name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614 @@ -1440,7 +1440,7 @@ func ExportStdMarkdown(id string) string { ".md", Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, - Conf.Export.AddTitle, defBlockIDs, true) + Conf.Export.AddTitle, defBlockIDs, true, &map[string]*parse.Tree{}) } func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath string) { @@ -1468,32 +1468,21 @@ func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath s return } -func ExportNotebookMarkdown(boxID, folderPath string) (zipPath string) { +func ExportNotebookMarkdown(boxID string) (zipPath string) { box := Conf.Box(boxID) - - var baseFolderName string - if "/" == folderPath { - baseFolderName = box.Name - } else { - block := treenode.GetBlockTreeRootByHPath(box.ID, folderPath) - if nil == block { - logging.LogErrorf("not found block") - return - } - baseFolderName = path.Base(block.HPath) - } - if "" == baseFolderName { - baseFolderName = Conf.language(105) - } - - docFiles := box.ListFiles(folderPath) + docFiles := box.ListFiles("/") var docPaths []string for _, docFile := range docFiles { + id := strings.TrimSuffix(path.Base(docFile.path), ".sy") + if !ast.IsNodeIDPattern(id) { + continue + } + docPaths = append(docPaths, docFile.path) } defBlockIDs, trees, docPaths := prepareExportTrees(docPaths) - zipPath = exportPandocConvertZip(baseFolderName, docPaths, defBlockIDs, "", "", ".md", trees) + zipPath = exportPandocConvertZip(box.Name, docPaths, defBlockIDs, "", "", ".md", trees) return } @@ -1927,11 +1916,11 @@ func walkRelationAvs(avID string, exportAvIDs *hashset.Set) { } func ExportMarkdownContent(id string) (hPath, exportedMd string) { - return exportMarkdownContent(id, ".md", Conf.Export.BlockRefMode, nil, true) + return exportMarkdownContent(id, ".md", Conf.Export.BlockRefMode, nil, true, &map[string]*parse.Tree{}) } -func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []string, singleFile bool) (hPath, exportedMd string) { - tree, err := LoadTreeByBlockID(id) +func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []string, singleFile bool, treeCache *map[string]*parse.Tree) (hPath, exportedMd string) { + tree, err := loadTreeWithCache(id, treeCache) if err != nil { logging.LogErrorf("load tree by block id [%s] failed: %s", id, err) return @@ -1941,7 +1930,7 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri ext, exportRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, - Conf.Export.AddTitle, defBlockIDs, singleFile) + Conf.Export.AddTitle, defBlockIDs, singleFile, treeCache) docIAL := parse.IAL2Map(tree.Root.KramdownIAL) exportedMd = yfm(docIAL) + exportedMd return @@ -1950,12 +1939,12 @@ func exportMarkdownContent(id, ext string, exportRefMode int, defBlockIDs []stri func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDestSpace2Underscore bool, ext string, blockRefMode, blockEmbedMode, fileAnnotationRefMode int, tagOpenMarker, tagCloseMarker string, blockRefTextLeft, blockRefTextRight string, - addTitle bool, defBlockIDs []string, singleFile bool) (ret string) { + addTitle bool, defBlockIDs []string, singleFile bool, treeCache *map[string]*parse.Tree) (ret string) { tree = exportTree(tree, false, false, false, blockRefMode, blockEmbedMode, fileAnnotationRefMode, tagOpenMarker, tagCloseMarker, blockRefTextLeft, blockRefTextRight, - addTitle, 0 < len(defBlockIDs), singleFile) + addTitle, 0 < len(defBlockIDs), singleFile, treeCache) luteEngine := NewLute() luteEngine.SetFootnotes(true) luteEngine.SetKramdownIAL(false) @@ -2066,7 +2055,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool, blockRefMode, blockEmbedMode, fileAnnotationRefMode int, tagOpenMarker, tagCloseMarker string, blockRefTextLeft, blockRefTextRight string, - addTitle, addDocAnchorSpan, singleFile bool) (ret *parse.Tree) { + addTitle, addDocAnchorSpan, singleFile bool, treeCache *map[string]*parse.Tree) (ret *parse.Tree) { luteEngine := NewLute() ret = tree id := tree.Root.ID @@ -2075,17 +2064,15 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool, depth := 0 resolveEmbedR(ret.Root, blockEmbedMode, luteEngine, &[]string{}, &depth) - treeCache := map[string]*parse.Tree{} - treeCache[id] = ret // 将块超链接转换为引用 depth = 0 - blockLink2Ref(ret, ret.ID, &treeCache, &depth) + blockLink2Ref(ret, ret.ID, treeCache, &depth) // 收集引用转脚注+锚点哈希 var refFootnotes []*refAsFootnotes if 4 == blockRefMode && singleFile { depth = 0 - collectFootnotesDefs(ret, ret.ID, &refFootnotes, &treeCache, &depth) + collectFootnotesDefs(ret, ret.ID, &refFootnotes, treeCache, &depth) } currentTreeNodeIDs := map[string]bool{} @@ -2193,7 +2180,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool, if 4 == blockRefMode { // 脚注+锚点哈希 unlinks = nil - footnotesDefBlock := resolveFootnotesDefs(&refFootnotes, ret, currentTreeNodeIDs, blockRefTextLeft, blockRefTextRight, &treeCache) + footnotesDefBlock := resolveFootnotesDefs(&refFootnotes, ret, currentTreeNodeIDs, blockRefTextLeft, blockRefTextRight, treeCache) if nil != footnotesDefBlock { // 如果是聚焦导出,可能存在没有使用的脚注定义块,在这里进行清理 // Improve focus export conversion of block refs to footnotes https://github.com/siyuan-note/siyuan/issues/10647 @@ -3011,7 +2998,7 @@ func exportPandocConvertZip(baseFolderName string, docPaths, defBlockIDs []strin luteEngine := util.NewLute() for i, p := range docPaths { id := util.GetTreeID(p) - hPath, md := exportMarkdownContent(id, ext, exportRefMode, defBlockIDs, false) + hPath, md := exportMarkdownContent(id, ext, exportRefMode, defBlockIDs, false, treeCache) dir, name = path.Split(hPath) dir = util.FilterFilePath(dir) // 导出文档时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/4590 name = util.FilterFileName(name) @@ -3121,6 +3108,10 @@ func prepareExportTrees(docPaths []string) (defBlockIDs []string, trees *map[str treeCache := &map[string]*parse.Tree{} defBlockIDs = []string{} for _, p := range docPaths { + if strings.HasSuffix(p, ".sy") { + continue + } + id := util.GetTreeID(p) tree, err := loadTreeWithCache(id, treeCache) if err != nil { diff --git a/kernel/model/tree.go b/kernel/model/tree.go index 9a25802f9..84cd2130c 100644 --- a/kernel/model/tree.go +++ b/kernel/model/tree.go @@ -210,7 +210,8 @@ func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) { func LoadTreeByBlockID(id string) (ret *parse.Tree, err error) { if !ast.IsNodeIDPattern(id) { - logging.LogErrorf("block id is invalid [id=%s]", id) + stack := logging.ShortStack() + logging.LogErrorf("block id is invalid [id=%s], stack: [%s]", id, stack) return nil, ErrTreeNotFound } From 9bbbb2ca11e58f7a104161137937a1b4663dfb56 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 18 Dec 2024 17:21:12 +0800 Subject: [PATCH 4/4] :fire: Remove Sentry reporting diagnostic data https://github.com/siyuan-note/siyuan/issues/13522 --- .../20200813163359-v04n73b.sy | 108 +---------------- .../20211226114339-dk0gtpr.sy | 109 ++---------------- 2 files changed, 13 insertions(+), 204 deletions(-) diff --git a/app/guide/20210808180117-czj9bvb/20200813163359-v04n73b.sy b/app/guide/20210808180117-czj9bvb/20200813163359-v04n73b.sy index a1ecd308f..c97429467 100644 --- a/app/guide/20210808180117-czj9bvb/20200813163359-v04n73b.sy +++ b/app/guide/20210808180117-czj9bvb/20200813163359-v04n73b.sy @@ -7,7 +7,7 @@ "id": "20200813163359-v04n73b", "title": "隐私政策和用户协议", "type": "doc", - "updated": "20221027114353" + "updated": "20241218172032" }, "Children": [ { @@ -16,7 +16,7 @@ "HeadingLevel": 2, "Properties": { "id": "20220212224529-hcqln0k", - "updated": "20220212224529" + "updated": "20241218172032" }, "Children": [ { @@ -31,7 +31,7 @@ "ListData": {}, "Properties": { "id": "20220212224529-q784muc", - "updated": "20221027114353" + "updated": "20241218172032" }, "Children": [ { @@ -71,7 +71,7 @@ }, "Properties": { "id": "20220212224529-q652whb", - "updated": "20221027114353" + "updated": "20241218172032" }, "Children": [ { @@ -79,12 +79,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20220212224529-1embibu", - "updated": "20221027114353" + "updated": "20241218172032" }, "Children": [ { "Type": "NodeText", - "Data": "最新日期:2022 年 10 月 27 日" + "Data": "最新日期:2024 年 12 月 18 日" } ] } @@ -3501,102 +3501,6 @@ } ] }, - { - "ID": "20221027112340-j85t36u", - "Type": "NodeBlockquote", - "Properties": { - "id": "20221027112340-j85t36u", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeBlockquoteMarker", - "Data": "\u003e" - }, - { - "ID": "20221027112341-fh7jv2y", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027112341-fh7jv2y", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "SDK 名称:Sentry" - } - ] - }, - { - "ID": "20221027112341-znirf8k", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027112341-znirf8k", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "公司名称:FUNCTIONAL SOFTWARE, INC." - } - ] - }, - { - "ID": "20221027112341-japnv8y", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027112341-japnv8y", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "SDK 官网:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://sentry.io/", - "TextMarkTextContent": "https://sentry.io" - } - ] - }, - { - "ID": "20221027112341-ohaorb0", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027112341-ohaorb0", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "使用目的:用于收集报错信息和诊断数据,进而改善用户体验" - } - ] - }, - { - "ID": "20221027112341-n2n81eo", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027112341-n2n81eo", - "updated": "20221027112341" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "收集的个人信息类型/字段:设备标识信息和报错日志、诊断数据等不涉及个人隐私的数据 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://sentry.io/privacy/", - "TextMarkTextContent": "https://sentry.io/privacy/" - } - ] - } - ] - }, { "ID": "20221027112333-rjv80e0", "Type": "NodeBlockquote", diff --git a/app/guide/20211226090932-5lcq56f/20211226114339-dk0gtpr.sy b/app/guide/20211226090932-5lcq56f/20211226114339-dk0gtpr.sy index 88280597d..7bf1a54c7 100644 --- a/app/guide/20211226090932-5lcq56f/20211226114339-dk0gtpr.sy +++ b/app/guide/20211226090932-5lcq56f/20211226114339-dk0gtpr.sy @@ -6,7 +6,8 @@ "icon": "1f4c4", "id": "20211226114339-dk0gtpr", "title": "隱私政策和用戶協議", - "updated": "20230630145333" + "type": "doc", + "updated": "20241218172040" }, "Children": [ { @@ -15,7 +16,7 @@ "HeadingLevel": 2, "Properties": { "id": "20220212225517-09nj67f", - "updated": "20220212225517" + "updated": "20241218172040" }, "Children": [ { @@ -30,7 +31,7 @@ "ListData": {}, "Properties": { "id": "20220212225517-4qagezn", - "updated": "20221027114358" + "updated": "20241218172040" }, "Children": [ { @@ -68,7 +69,7 @@ }, "Properties": { "id": "20220212225517-pvls0y0", - "updated": "20221027114358" + "updated": "20241218172040" }, "Children": [ { @@ -76,12 +77,12 @@ "Type": "NodeParagraph", "Properties": { "id": "20220212225517-vgg1nrb", - "updated": "20221027114358" + "updated": "20241218172040" }, "Children": [ { "Type": "NodeText", - "Data": "最新日期:2022 年 10 月 27 日" + "Data": "最新日期:2024 年 12 月 18 日" } ] } @@ -3505,102 +3506,6 @@ } ] }, - { - "ID": "20221027113639-fos5fwy", - "Type": "NodeBlockquote", - "Properties": { - "id": "20221027113639-fos5fwy", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeBlockquoteMarker", - "Data": "\u003e" - }, - { - "ID": "20221027113639-sr12gat", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027113639-sr12gat", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "SDK 名稱:Sentry" - } - ] - }, - { - "ID": "20221027113639-tqeakh3", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027113639-tqeakh3", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "公司名稱:FUNCTIONAL SOFTWARE, INC." - } - ] - }, - { - "ID": "20221027113639-9f2m2y5", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027113639-9f2m2y5", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "SDK 官網:" - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://sentry.io/", - "TextMarkTextContent": "https://sentry.io" - } - ] - }, - { - "ID": "20221027113639-9ae8fqy", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027113639-9ae8fqy", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "使用目的:用於收集報錯資訊和診斷資料,進而改善用戶體驗" - } - ] - }, - { - "ID": "20221027113639-zlm8yb8", - "Type": "NodeParagraph", - "Properties": { - "id": "20221027113639-zlm8yb8", - "updated": "20221027113639" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "收集的個人資訊類型/字段:設備標識資訊和報錯日誌、診斷資料等不涉及個人隱私的資料 " - }, - { - "Type": "NodeTextMark", - "TextMarkType": "a", - "TextMarkAHref": "https://sentry.io/privacy/", - "TextMarkTextContent": "https://sentry.io/privacy/" - } - ] - } - ] - }, { "ID": "20221027113639-7ruumya", "Type": "NodeBlockquote",