mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
297e536a09
7 changed files with 26 additions and 13 deletions
|
|
@ -159,15 +159,16 @@ func InstalledIcons() (ret []*Icon) {
|
|||
continue
|
||||
}
|
||||
|
||||
icon.RepoURL = icon.URL
|
||||
icon.DisallowInstall = disallowInstallBazaarPackage(icon.Package)
|
||||
if bazaarPkg := getBazaarIcon(icon.Name, bazaarIcons); nil != bazaarPkg {
|
||||
icon.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)
|
||||
icon.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion
|
||||
icon.RepoURL = bazaarPkg.RepoURL
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.IconsPath, dirName)
|
||||
icon.Installed = true
|
||||
icon.RepoURL = icon.URL
|
||||
icon.PreviewURL = "/appearance/icons/" + dirName + "/preview.png"
|
||||
icon.PreviewURLThumb = "/appearance/icons/" + dirName + "/preview.png"
|
||||
icon.IconURL = "/appearance/icons/" + dirName + "/icon.png"
|
||||
|
|
|
|||
|
|
@ -195,15 +195,16 @@ func InstalledPlugins(frontend string) (ret []*Plugin) {
|
|||
continue
|
||||
}
|
||||
|
||||
plugin.RepoURL = plugin.URL
|
||||
plugin.DisallowInstall = disallowInstallBazaarPackage(plugin.Package)
|
||||
if bazaarPkg := getBazaarPlugin(plugin.Name, bazaarPlugins); nil != bazaarPkg {
|
||||
plugin.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)
|
||||
plugin.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion
|
||||
plugin.RepoURL = bazaarPkg.RepoURL
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.DataDir, "plugins", dirName)
|
||||
plugin.Installed = true
|
||||
plugin.RepoURL = plugin.URL
|
||||
plugin.PreviewURL = "/plugins/" + dirName + "/preview.png"
|
||||
plugin.PreviewURLThumb = "/plugins/" + dirName + "/preview.png"
|
||||
plugin.IconURL = "/plugins/" + dirName + "/icon.png"
|
||||
|
|
|
|||
|
|
@ -160,15 +160,16 @@ func InstalledTemplates() (ret []*Template) {
|
|||
continue
|
||||
}
|
||||
|
||||
template.RepoURL = template.URL
|
||||
template.DisallowInstall = disallowInstallBazaarPackage(template.Package)
|
||||
if bazaarPkg := getBazaarTemplate(template.Name, bazaarTemplates); nil != bazaarPkg {
|
||||
template.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)
|
||||
template.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion
|
||||
template.RepoURL = bazaarPkg.RepoURL
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.DataDir, "templates", dirName)
|
||||
template.Installed = true
|
||||
template.RepoURL = template.URL
|
||||
template.PreviewURL = "/templates/" + dirName + "/preview.png"
|
||||
template.PreviewURLThumb = "/templates/" + dirName + "/preview.png"
|
||||
template.IconURL = "/templates/" + dirName + "/icon.png"
|
||||
|
|
|
|||
|
|
@ -161,15 +161,16 @@ func InstalledThemes() (ret []*Theme) {
|
|||
continue
|
||||
}
|
||||
|
||||
theme.RepoURL = theme.URL
|
||||
theme.DisallowInstall = disallowInstallBazaarPackage(theme.Package)
|
||||
if bazaarPkg := getBazaarTheme(theme.Name, bazaarThemes); nil != bazaarPkg {
|
||||
theme.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)
|
||||
theme.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion
|
||||
theme.RepoURL = bazaarPkg.RepoURL
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.ThemesPath, dirName)
|
||||
theme.Installed = true
|
||||
theme.RepoURL = theme.URL
|
||||
theme.PreviewURL = "/appearance/themes/" + dirName + "/preview.png"
|
||||
theme.PreviewURLThumb = "/appearance/themes/" + dirName + "/preview.png"
|
||||
theme.IconURL = "/appearance/themes/" + dirName + "/icon.png"
|
||||
|
|
|
|||
|
|
@ -157,15 +157,16 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
continue
|
||||
}
|
||||
|
||||
widget.RepoURL = widget.URL
|
||||
widget.DisallowInstall = disallowInstallBazaarPackage(widget.Package)
|
||||
if bazaarPkg := getBazaarWidget(widget.Name, bazaarWidgets); nil != bazaarPkg {
|
||||
widget.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)
|
||||
widget.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion
|
||||
widget.RepoURL = bazaarPkg.RepoURL
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.DataDir, "widgets", dirName)
|
||||
widget.Installed = true
|
||||
widget.RepoURL = widget.URL
|
||||
widget.PreviewURL = "/widgets/" + dirName + "/preview.png"
|
||||
widget.PreviewURLThumb = "/widgets/" + dirName + "/preview.png"
|
||||
widget.IconURL = "/widgets/" + dirName + "/icon.png"
|
||||
|
|
|
|||
|
|
@ -177,11 +177,18 @@ func UnusedAttributeViews() (ret []*UnusedItem) {
|
|||
}
|
||||
|
||||
// 按文件更新时间排序
|
||||
modTimes := make([]time.Time, len(ret))
|
||||
for i := range ret {
|
||||
p := filepath.Join(util.DataDir, "storage", "av", ret[i].Item+".json")
|
||||
if info, statErr := os.Stat(p); nil != statErr {
|
||||
modTimes[i] = info.ModTime()
|
||||
} else {
|
||||
modTimes[i] = time.Time{}
|
||||
}
|
||||
}
|
||||
sort.Slice(ret, func(i, j int) bool {
|
||||
iInfo, iErr := os.Stat(filepath.Join(util.DataDir, "storage", "av", ret[i].Item+".json"))
|
||||
jInfo, jErr := os.Stat(filepath.Join(util.DataDir, "storage", "av", ret[j].Item+".json"))
|
||||
if iErr != nil || jErr != nil {
|
||||
return iInfo.ModTime().After(jInfo.ModTime())
|
||||
if !modTimes[i].Equal(modTimes[j]) {
|
||||
return modTimes[i].After(modTimes[j])
|
||||
}
|
||||
return ret[i].Item > ret[j].Item
|
||||
})
|
||||
|
|
|
|||
|
|
@ -95,12 +95,13 @@ func InitDatabase(forceRebuild bool) (err error) {
|
|||
|
||||
// 不存在库或者版本不一致都会走到这里
|
||||
|
||||
closeDatabase()
|
||||
if err = closeDatabase(); nil != err {
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "close database failed: %s", err)
|
||||
}
|
||||
|
||||
if gulu.File.IsExist(util.DBPath) {
|
||||
if err = removeDatabaseFile(); err != nil {
|
||||
logging.LogErrorf("remove database file [%s] failed: %s", util.DBPath, err)
|
||||
util.PushClearProgress()
|
||||
err = nil
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "remove database file [%s] failed: %s", util.DBPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue