Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-08-12 10:29:00 +08:00
commit e4ab00df37
8 changed files with 51 additions and 6 deletions

View file

@ -37,6 +37,11 @@ type Icon struct {
func Icons() (icons []*Icon) {
icons = []*Icon{}
isOnline := isBazzarOnline()
if !isOnline {
return
}
stageIndex, err := getStageIndex("icons")
if nil != err {
return

View file

@ -482,6 +482,15 @@ func isOutdatedTemplate(template *Template, bazaarTemplates []*Template) bool {
return false
}
func isBazzarOnline() (ret bool) {
// Improve marketplace loading when offline https://github.com/siyuan-note/siyuan/issues/12050
ret = util.IsOnline(util.BazaarOSSServer, true)
if !ret {
util.PushErrMsg(util.Langs[util.Lang][24], 5000)
}
return
}
func GetPackageREADME(repoURL, repoHash, packageType string) (ret string) {
repoURLHash := repoURL + "@" + repoHash

View file

@ -39,6 +39,11 @@ type Plugin struct {
func Plugins(frontend string) (plugins []*Plugin) {
plugins = []*Plugin{}
isOnline := isBazzarOnline()
if !isOnline {
return
}
stageIndex, err := getStageIndex("plugins")
if nil != err {
return

View file

@ -38,6 +38,11 @@ type Template struct {
func Templates() (templates []*Template) {
templates = []*Template{}
isOnline := isBazzarOnline()
if !isOnline {
return
}
stageIndex, err := getStageIndex("templates")
if nil != err {
return

View file

@ -39,6 +39,11 @@ type Theme struct {
func Themes() (ret []*Theme) {
ret = []*Theme{}
isOnline := isBazzarOnline()
if !isOnline {
return
}
stageIndex, err := getStageIndex("themes")
if nil != err {
return

View file

@ -37,6 +37,11 @@ type Widget struct {
func Widgets() (widgets []*Widget) {
widgets = []*Widget{}
isOnline := isBazzarOnline()
if !isOnline {
return
}
stageIndex, err := getStageIndex("widgets")
if nil != err {
return

View file

@ -538,7 +538,7 @@ func ExportResources(resourcePaths []string, mainName string) (exportFilePath st
func Preview(id string) (retStdHTML string, retOutline []*Path) {
tree, _ := LoadTreeByBlockID(id)
tree = exportTree(tree, false, false,
tree = exportTree(tree, false, false, true,
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@ -643,7 +643,7 @@ func ExportMarkdownHTML(id, savePath string, docx, merge bool) (name, dom string
}
}
tree = exportTree(tree, true, false,
tree = exportTree(tree, true, false, true,
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@ -793,7 +793,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
}
}
tree = exportTree(tree, true, keepFold,
tree = exportTree(tree, true, keepFold, true,
Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode,
Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker,
Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
@ -1840,7 +1840,7 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
blockRefTextLeft, blockRefTextRight string,
addTitle bool,
defBlockIDs []string) (ret string) {
tree = exportTree(tree, false, false,
tree = exportTree(tree, false, false, false,
blockRefMode, blockEmbedMode, fileAnnotationRefMode,
tagOpenMarker, tagCloseMarker,
blockRefTextLeft, blockRefTextRight,
@ -1929,7 +1929,7 @@ func exportMarkdownContent0(tree *parse.Tree, cloudAssetsBase string, assetsDest
return
}
func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
blockRefMode, blockEmbedMode, fileAnnotationRefMode int,
tagOpenMarker, tagCloseMarker string,
blockRefTextLeft, blockRefTextRight string,
@ -2223,6 +2223,11 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
mdTableHeadRow := &ast.Node{Type: ast.NodeTableRow, TableAligns: aligns}
mdTableHead.AppendChild(mdTableHeadRow)
for _, col := range table.Columns {
if avHiddenCol && col.Hidden {
// 按需跳过隐藏列 Improve database table view exporting https://github.com/siyuan-note/siyuan/issues/12232
continue
}
cell := &ast.Node{Type: ast.NodeTableCell}
name := string(lex.EscapeProtyleMarkers([]byte(col.Name)))
name = strings.ReplaceAll(name, "\\|", "|")
@ -2236,6 +2241,12 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold bool,
mdTableRow := &ast.Node{Type: ast.NodeTableRow, TableAligns: aligns}
mdTable.AppendChild(mdTableRow)
for _, cell := range row.Cells {
if avHiddenCol && nil != cell.Value {
if col := table.GetColumn(cell.Value.KeyID); nil != col && col.Hidden {
continue
}
}
mdTableCell := &ast.Node{Type: ast.NodeTableCell}
mdTableRow.AppendChild(mdTableCell)
var val string

View file

@ -111,7 +111,7 @@ func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {
}
c.SetUserAgent(UserAgent)
for i := 0; i < 3; i++ {
for i := 0; i < 2; i++ {
resp, err := c.R().Get(checkURL)
if resp.GetHeader("Location") != "" {