Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4078d33e34
5 changed files with 25 additions and 27 deletions
|
@ -56,7 +56,7 @@ 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-20241220041421-b6410d912871
|
||||
github.com/siyuan-note/dejavu v0.0.0-20241223030943-e7887b6676f2
|
||||
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
|
||||
|
|
|
@ -365,8 +365,8 @@ 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-20241220041421-b6410d912871 h1:U65kVBfF0+PYdlJ1btDxhIfuUElmz7iRbtu3yyyIo8w=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20241220041421-b6410d912871/go.mod h1:YtT05UDgrYO5Cb/aWc2COwqId56n6qHP+jptvITAags=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20241223030943-e7887b6676f2 h1:UG2aeo6ME5B/EZ6h0pGjQrqyx89yOHUdE+aUIdDEqZk=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20241223030943-e7887b6676f2/go.mod h1:+gaHpNFsoVagw956l456Cm4eZclB/gXsjkW4YmvWmJM=
|
||||
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=
|
||||
|
|
|
@ -711,13 +711,12 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
|
|||
}
|
||||
}
|
||||
|
||||
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
|
||||
srcs := []string{"stage/build/export", "stage/protyle"}
|
||||
for _, src := range srcs {
|
||||
from := filepath.Join(util.WorkingDir, src)
|
||||
to := filepath.Join(savePath, src)
|
||||
if err := filelock.Copy(from, to); err != nil {
|
||||
logging.LogWarnf("copy stage from [%s] to [%s] failed: %s", from, savePath, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -869,7 +868,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
|
|||
}
|
||||
|
||||
if !pdf && "" != savePath { // 导出 HTML 需要复制静态资源
|
||||
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
|
||||
srcs := []string{"stage/build/export", "stage/protyle"}
|
||||
for _, src := range srcs {
|
||||
from := filepath.Join(util.WorkingDir, src)
|
||||
to := filepath.Join(savePath, src)
|
||||
|
@ -899,7 +898,6 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
|
|||
to := filepath.Join(savePath, "appearance", src)
|
||||
if err := filelock.Copy(from, to); err != nil {
|
||||
logging.LogErrorf("copy appearance from [%s] to [%s] failed: %s", from, savePath, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1288,14 +1288,13 @@ func bootSyncRepo() (err error) {
|
|||
|
||||
isBootSyncing.Store(true)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
waitGroup := sync.WaitGroup{}
|
||||
var errs []error
|
||||
waitGroup.Add(1)
|
||||
go func() {
|
||||
defer waitGroup.Done()
|
||||
|
||||
start := time.Now()
|
||||
_, _, indexErr := indexRepoBeforeCloudSync(repo)
|
||||
if indexErr != nil {
|
||||
errs = append(errs, indexErr)
|
||||
|
@ -1311,6 +1310,8 @@ func bootSyncRepo() (err error) {
|
|||
isBootSyncing.Store(false)
|
||||
return
|
||||
}
|
||||
|
||||
logging.LogInfof("boot index repo elapsed [%.2fs]", time.Since(start).Seconds())
|
||||
}()
|
||||
|
||||
var fetchedFiles []*entity.File
|
||||
|
@ -1318,6 +1319,7 @@ func bootSyncRepo() (err error) {
|
|||
go func() {
|
||||
defer waitGroup.Done()
|
||||
|
||||
start := time.Now()
|
||||
syncContext := map[string]interface{}{eventbus.CtxPushMsg: eventbus.CtxPushMsgToStatusBar}
|
||||
cloudLatest, getErr := repo.GetCloudLatest(syncContext)
|
||||
if nil != getErr {
|
||||
|
@ -1342,29 +1344,14 @@ func bootSyncRepo() (err error) {
|
|||
isBootSyncing.Store(false)
|
||||
return
|
||||
}
|
||||
|
||||
logging.LogInfof("boot get sync cloud files elapsed [%.2fs]", time.Since(start).Seconds())
|
||||
}()
|
||||
waitGroup.Wait()
|
||||
if 0 < len(errs) {
|
||||
err = errs[0]
|
||||
return
|
||||
}
|
||||
|
||||
syncingFiles = sync.Map{}
|
||||
syncingStorages.Store(false)
|
||||
for _, fetchedFile := range fetchedFiles {
|
||||
name := path.Base(fetchedFile.Path)
|
||||
if strings.HasSuffix(name, ".sy") {
|
||||
id := name[:len(name)-3]
|
||||
syncingFiles.Store(id, true)
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(fetchedFile.Path, "/storage/") {
|
||||
syncingStorages.Store(true)
|
||||
}
|
||||
}
|
||||
|
||||
elapsed := time.Since(start)
|
||||
logging.LogInfof("boot get sync cloud files elapsed [%.2fs]", elapsed.Seconds())
|
||||
if err != nil {
|
||||
autoSyncErrCount++
|
||||
planSyncAfter(fixSyncInterval)
|
||||
|
@ -1387,6 +1374,20 @@ func bootSyncRepo() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
syncingFiles = sync.Map{}
|
||||
syncingStorages.Store(false)
|
||||
for _, fetchedFile := range fetchedFiles {
|
||||
name := path.Base(fetchedFile.Path)
|
||||
if strings.HasSuffix(name, ".sy") {
|
||||
id := name[:len(name)-3]
|
||||
syncingFiles.Store(id, true)
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(fetchedFile.Path, "/storage/") {
|
||||
syncingStorages.Store(true)
|
||||
}
|
||||
}
|
||||
|
||||
if 0 < len(fetchedFiles) {
|
||||
go func() {
|
||||
_, syncErr := syncRepo(false, false)
|
||||
|
|
|
@ -214,7 +214,6 @@ func CheckAuth(c *gin.Context) {
|
|||
// 放过 /appearance/
|
||||
if strings.HasPrefix(c.Request.RequestURI, "/appearance/") ||
|
||||
strings.HasPrefix(c.Request.RequestURI, "/stage/build/export/") ||
|
||||
strings.HasPrefix(c.Request.RequestURI, "/stage/build/fonts/") ||
|
||||
strings.HasPrefix(c.Request.RequestURI, "/stage/protyle/") {
|
||||
c.Next()
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue