Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6632a3719b
9 changed files with 66 additions and 29 deletions
|
@ -1055,6 +1055,7 @@
|
|||
"180": "Search content block does not exist",
|
||||
"181": "The document has been shared to Liandi, <a href=\"%s\" target=\"_blank\">click to view</a>",
|
||||
"182": "Sharing document, please wait...",
|
||||
"183": "Validating index document tree [%d/%d %s]"
|
||||
"183": "Validating index document tree [%d/%d %s]",
|
||||
"184": "Powered by <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1055,6 +1055,7 @@
|
|||
"180": "El bloque de contenido de búsqueda no existe",
|
||||
"181": "El documento ha sido compartido con Liandi, <a href=\"%s\" target=\"_blank\">haga clic para ver</a>",
|
||||
"182": "Compartiendo documento, por favor espere...",
|
||||
"183": "Validando el árbol del documento de índice [%d/%d %s]"
|
||||
"183": "Validando el árbol del documento de índice [%d/%d %s]",
|
||||
"184": "Con la tecnología de <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1055,6 +1055,7 @@
|
|||
"180": "Le bloc de contenu de recherche n'existe pas",
|
||||
"181": "Le document a été partagé avec Liandi, <a href=\"%s\" target=\"_blank\">cliquez pour afficher</a>",
|
||||
"182": "Partage du document, veuillez patienter...",
|
||||
"183": "Validation de l'arborescence du document d'index [%d/%d %s]"
|
||||
"183": "Validation de l'arborescence du document d'index [%d/%d %s]",
|
||||
"184": "Propulsé par <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1055,6 +1055,7 @@
|
|||
"180": "不存在符合條件的內容塊",
|
||||
"181": "已分享文檔到鏈滴,<a href=\"%s\" target=\"_blank\">點擊查看</a>",
|
||||
"182": "正在分享文檔,請稍等...",
|
||||
"183": "正在校驗索引文檔樹 [%d/%d %s]"
|
||||
"183": "正在校驗索引文檔樹 [%d/%d %s]",
|
||||
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1055,6 +1055,7 @@
|
|||
"180": "不存在符合条件的内容块",
|
||||
"181": "已分享文档到链滴,<a href=\"%s\" target=\"_blank\">点击查看</a>",
|
||||
"182": "正在分享文档,请稍等...",
|
||||
"183": "正在校验索引文档树 [%d/%d %s]"
|
||||
"183": "正在校验索引文档树 [%d/%d %s]",
|
||||
"184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源笔记</a>强力驱动"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@
|
|||
<body>
|
||||
<div style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;"></div>
|
||||
<div style="position: relative;z-index: 2;text-align: center">
|
||||
<h1 style="margin-bottom: 48px;color:var(--b3-theme-on-background)">{{.l4}}</h1>
|
||||
<h1 style="margin-bottom: 48px;color:var(--b3-theme-on-background)">{{.workspace}}</h1>
|
||||
<input class="b3-text-filed" id="authCode" type="password" placeholder="{{.l0}}"/><br>
|
||||
<div style="position: relative;width: 240px;margin: 8px auto 0;display: none">
|
||||
<img id="captchaImg" style="top: 1px;position: absolute;height: 28px;right: 1px;cursor: pointer">
|
||||
|
@ -195,6 +195,9 @@
|
|||
{{.l2}}
|
||||
</div>
|
||||
<button class="b3-button b3-button--white" onclick="exitSiYuan()">{{.l5}}</button>
|
||||
<div class="ft__on-surface">
|
||||
{{.l7}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow: hidden;position: absolute;height: 100%;width: 100%;top: 0;left: 0;">
|
||||
<svg style="top: 50%;left: 50%;width: 200%;transform: translate(-50%, -50%);position: absolute;z-index: 1;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" height="1602"
|
||||
|
|
|
@ -106,13 +106,6 @@ func removeWorkspaceDir(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err = os.RemoveAll(path); nil != err {
|
||||
msg := fmt.Sprintf("remove workspace dir [%s] failed: %s", path, err)
|
||||
ret.Code = -1
|
||||
ret.Msg = msg
|
||||
return
|
||||
}
|
||||
|
||||
if util.WorkspaceDir == path {
|
||||
os.Exit(util.ExitCodeOk)
|
||||
}
|
||||
|
|
|
@ -61,33 +61,66 @@ func SearchTemplate(keyword string) (ret []*Block) {
|
|||
ret = []*Block{}
|
||||
|
||||
templates := filepath.Join(util.DataDir, "templates")
|
||||
groups, err := os.ReadDir(templates)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read templates failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
sort.Slice(ret, func(i, j int) bool {
|
||||
return util.PinYinCompare(filepath.Base(groups[i].Name()), filepath.Base(groups[j].Name()))
|
||||
})
|
||||
|
||||
k := strings.ToLower(keyword)
|
||||
filepath.Walk(templates, func(path string, info fs.FileInfo, err error) error {
|
||||
name := strings.ToLower(info.Name())
|
||||
if !strings.HasSuffix(name, ".md") {
|
||||
return nil
|
||||
for _, group := range groups {
|
||||
if strings.HasPrefix(group.Name(), ".") {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(name, ".") || "readme.md" == name {
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
if group.IsDir() {
|
||||
var templateBlocks []*Block
|
||||
templateDir := filepath.Join(templates, group.Name())
|
||||
filepath.Walk(templateDir, func(path string, info fs.FileInfo, err error) error {
|
||||
name := strings.ToLower(info.Name())
|
||||
if strings.HasPrefix(name, ".") {
|
||||
if info.IsDir() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(name, ".md") || "readme.md" == name || !strings.Contains(name, k) {
|
||||
return nil
|
||||
}
|
||||
|
||||
content := strings.TrimPrefix(path, templates)
|
||||
content = strings.TrimSuffix(content, ".md")
|
||||
content = filepath.ToSlash(content)
|
||||
content = content[1:]
|
||||
_, content = search.MarkText(content, keyword, 32, Conf.Search.CaseSensitive)
|
||||
b := &Block{Path: path, Content: content}
|
||||
templateBlocks = append(templateBlocks, b)
|
||||
return nil
|
||||
})
|
||||
sort.Slice(templateBlocks, func(i, j int) bool {
|
||||
return util.PinYinCompare(filepath.Base(templateBlocks[i].Path), filepath.Base(templateBlocks[j].Path))
|
||||
})
|
||||
ret = append(ret, templateBlocks...)
|
||||
} else {
|
||||
name := strings.ToLower(group.Name())
|
||||
if strings.HasPrefix(name, ".") || !strings.HasSuffix(name, ".md") || "readme.md" == name || !strings.Contains(name, k) {
|
||||
continue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.Contains(name, k) {
|
||||
content := strings.TrimPrefix(path, templates)
|
||||
content = strings.ReplaceAll(content, "templates"+string(os.PathSeparator), "")
|
||||
content := group.Name()
|
||||
content = strings.TrimSuffix(content, ".md")
|
||||
content = filepath.ToSlash(content)
|
||||
content = content[1:]
|
||||
_, content = search.MarkText(content, keyword, 32, Conf.Search.CaseSensitive)
|
||||
b := &Block{Path: path, Content: content}
|
||||
b := &Block{Path: filepath.Join(templates, group.Name()), Content: content}
|
||||
ret = append(ret, b)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
sort.Slice(ret, func(i, j int) bool { return util.PinYinCompare(filepath.Base(ret[i].Path), filepath.Base(ret[j].Path)) })
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -286,8 +286,11 @@ func serveCheckAuth(c *gin.Context) {
|
|||
"l4": model.Conf.Language(176),
|
||||
"l5": model.Conf.Language(177),
|
||||
"l6": model.Conf.Language(178),
|
||||
"l7": template.HTML(model.Conf.Language(184)),
|
||||
"appearanceMode": model.Conf.Appearance.Mode,
|
||||
"appearanceModeOS": model.Conf.Appearance.ModeOS,
|
||||
"workspace": filepath.Base(util.WorkspaceDir),
|
||||
"workspacePath": util.WorkspaceDir,
|
||||
}
|
||||
buf := &bytes.Buffer{}
|
||||
if err = tpl.Execute(buf, model); nil != err {
|
||||
|
|
Loading…
Add table
Reference in a new issue