Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
100fe6ae1e
11 changed files with 47 additions and 13 deletions
|
@ -398,7 +398,7 @@ ${window.siyuan.languages.account9}
|
|||
}
|
||||
if (window.siyuan.config.account.displayTitle && window.siyuan.user) {
|
||||
window.siyuan.user.userTitles.forEach(item => {
|
||||
html += `<div class="toolbar__item fn__a b3-tooltips b3-tooltips__sw" aria-label="${item.name}:${item.desc}">${item.icon}</div>`;
|
||||
html += `<div class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${item.name}:${item.desc}">${item.icon}</div>`;
|
||||
});
|
||||
}
|
||||
document.getElementById("toolbarVIP").innerHTML = html;
|
||||
|
|
|
@ -347,7 +347,7 @@ func exportDocx(c *gin.Context) {
|
|||
}
|
||||
err := model.ExportDocx(id, savePath, removeAssets, merge)
|
||||
if nil != err {
|
||||
ret.Code = 1
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 7000}
|
||||
return
|
||||
|
|
|
@ -48,7 +48,7 @@ require (
|
|||
github.com/siyuan-note/dejavu v0.0.0-20230612120039-bba808ca7649
|
||||
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-20230523004741-d9121740f638
|
||||
github.com/siyuan-note/filelock v0.0.0-20230615011542-df9ae6b3f981
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230610031552-11458e2e39b0
|
||||
github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493
|
||||
github.com/siyuan-note/riff v0.0.0-20230516073320-b440b8feaabd
|
||||
|
@ -59,7 +59,7 @@ require (
|
|||
golang.org/x/image v0.7.0
|
||||
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda
|
||||
golang.org/x/mod v0.10.0
|
||||
golang.org/x/text v0.9.0
|
||||
golang.org/x/text v0.10.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -132,7 +132,7 @@ require (
|
|||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sync v0.2.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/sys v0.9.0 // indirect
|
||||
golang.org/x/tools v0.9.3 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
|
|
|
@ -289,6 +289,8 @@ github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0
|
|||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230523004741-d9121740f638 h1:0dvT+1FvuUf6/GFkFRQML0Q3DLulbswj1GJJ0j7BlD8=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230523004741-d9121740f638/go.mod h1:v2bpUtjvsvt1TRHgly1mIXQjAEo/t50dOM9YiC813qQ=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230615011542-df9ae6b3f981 h1:ulmzDD3Z3tsJAIec9sLLGuK88tuuE2o9Ux8Vog8KQBc=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230615011542-df9ae6b3f981/go.mod h1:jK5lCYfPbFOrW23/HMeU7kmpLdEd5GkennF+kUpy7Vs=
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230610031552-11458e2e39b0 h1:RKdpy6P1LjUBgQ/7hKO+UmcSwfWzcpMAKRh/deNiVXQ=
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230610031552-11458e2e39b0/go.mod h1:wqRaWZoA/NZJzZ6aCszp75Bi6dH7ZVcb8JWRysvrC2Y=
|
||||
github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI=
|
||||
|
@ -411,6 +413,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
@ -428,6 +432,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
|
||||
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
|
|
@ -19,7 +19,6 @@ package model
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/sashabaranov/go-openai"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
@ -35,6 +34,8 @@ import (
|
|||
"github.com/Xuanwo/go-locale"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/sashabaranov/go-openai"
|
||||
"github.com/siyuan-note/eventbus"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/conf"
|
||||
|
@ -892,3 +893,15 @@ func upgradeUserGuide() {
|
|||
index(boxID)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
subscribeConfEvents()
|
||||
}
|
||||
|
||||
func subscribeConfEvents() {
|
||||
eventbus.Subscribe(util.EvtConfPandocInitialized, func() {
|
||||
logging.LogInfof("pandoc initialized, set pandoc bin to [%s]", util.PandocBinPath)
|
||||
Conf.Export.PandocBin = util.PandocBinPath
|
||||
Conf.Save()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ func ExportDataInFolder(exportFolder string) (name string, err error) {
|
|||
name = filepath.Base(zipPath)
|
||||
targetZipPath := filepath.Join(exportFolder, name)
|
||||
zipAbsPath := filepath.Join(util.TempDir, "export", name)
|
||||
err = filelock.RoboCopy(zipAbsPath, targetZipPath)
|
||||
err = filelock.Copy(zipAbsPath, targetZipPath)
|
||||
if nil != err {
|
||||
logging.LogErrorf("copy export zip from [%s] to [%s] failed: %s", zipAbsPath, targetZipPath, err)
|
||||
return
|
||||
|
@ -291,7 +291,7 @@ func exportData(exportFolder string) (zipPath string, err error) {
|
|||
}
|
||||
|
||||
data := filepath.Join(util.WorkspaceDir, "data")
|
||||
if err = filelock.RoboCopy(data, exportFolder); nil != err {
|
||||
if err = filelock.Copy(data, exportFolder); nil != err {
|
||||
logging.LogErrorf("copy data dir from [%s] to [%s] failed: %s", data, baseFolderName, err)
|
||||
err = errors.New(fmt.Sprintf(Conf.Language(14), err.Error()))
|
||||
return
|
||||
|
@ -333,7 +333,11 @@ func Preview(id string) string {
|
|||
|
||||
func ExportDocx(id, savePath string, removeAssets, merge bool) (err error) {
|
||||
if !util.IsValidPandocBin(Conf.Export.PandocBin) {
|
||||
return errors.New(Conf.Language(115))
|
||||
Conf.Export.PandocBin = util.PandocBinPath
|
||||
Conf.Save()
|
||||
if !util.IsValidPandocBin(Conf.Export.PandocBin) {
|
||||
return errors.New(Conf.Language(115))
|
||||
}
|
||||
}
|
||||
|
||||
tmpDir := filepath.Join(util.TempDir, "export", gulu.Rand.String(7))
|
||||
|
|
|
@ -383,7 +383,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
return nil
|
||||
})
|
||||
|
||||
if err = filelock.RoboCopy(unzipRootPath, targetDir); nil != err {
|
||||
if err = filelock.Copy(unzipRootPath, targetDir); nil != err {
|
||||
logging.LogErrorf("copy data dir from [%s] to [%s] failed: %s", unzipRootPath, util.DataDir, err)
|
||||
err = errors.New("copy data failed")
|
||||
return
|
||||
|
@ -440,7 +440,7 @@ func ImportData(zipPath string) (err error) {
|
|||
}
|
||||
|
||||
tmpDataPath := filepath.Join(unzipPath, dirs[0].Name())
|
||||
if err = filelock.RoboCopy(tmpDataPath, util.DataDir); nil != err {
|
||||
if err = filelock.Copy(tmpDataPath, util.DataDir); nil != err {
|
||||
logging.LogErrorf("copy data dir from [%s] to [%s] failed: %s", tmpDataPath, util.DataDir, err)
|
||||
err = errors.New("copy data failed")
|
||||
return
|
||||
|
|
|
@ -253,6 +253,10 @@ func updateEmbedBlockContent(embedBlockID string, queryResultBlocks []*EmbedBloc
|
|||
}
|
||||
|
||||
func init() {
|
||||
subscribeSQLEvents()
|
||||
}
|
||||
|
||||
func subscribeSQLEvents() {
|
||||
//eventbus.Subscribe(eventbus.EvtSQLInsertBlocks, func(context map[string]interface{}, current, total, blockCount int, hash string) {
|
||||
// if util.ContainerAndroid == util.Container || util.ContainerIOS == util.Container {
|
||||
// // Android/iOS 端不显示数据索引和搜索索引状态提示 https://github.com/siyuan-note/siyuan/issues/6392
|
||||
|
|
|
@ -57,7 +57,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
subscribeEvents()
|
||||
subscribeRepoEvents()
|
||||
}
|
||||
|
||||
type Snapshot struct {
|
||||
|
@ -1476,7 +1476,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func subscribeEvents() {
|
||||
func subscribeRepoEvents() {
|
||||
eventbus.Subscribe(eventbus.EvtIndexBeforeWalkData, func(context map[string]interface{}, path string) {
|
||||
msg := fmt.Sprintf(Conf.Language(158), path)
|
||||
util.SetBootDetails(msg)
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/siyuan-note/eventbus"
|
||||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
|
@ -105,6 +106,8 @@ func initPandoc() {
|
|||
}
|
||||
}
|
||||
|
||||
defer eventbus.Publish(EvtConfPandocInitialized)
|
||||
|
||||
if gulu.OS.IsWindows() {
|
||||
PandocBinPath = filepath.Join(pandocDir, "bin", "pandoc.exe")
|
||||
} else if gulu.OS.IsDarwin() || gulu.OS.IsLinux() {
|
||||
|
|
|
@ -401,3 +401,7 @@ func existAvailabilityStatus(workspaceAbsPath string) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const (
|
||||
EvtConfPandocInitialized = "conf.pandoc.initialized"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue