🎨 加入升级信息日志

This commit is contained in:
Liang Ding 2023-03-07 09:49:36 +08:00
parent 81fa346073
commit 9ce3cb75c6
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -19,7 +19,6 @@ package model
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/88250/lute/ast"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -31,6 +30,7 @@ import (
"github.com/88250/gulu" "github.com/88250/gulu"
"github.com/88250/lute" "github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/Xuanwo/go-locale" "github.com/Xuanwo/go-locale"
humanize "github.com/dustin/go-humanize" humanize "github.com/dustin/go-humanize"
"github.com/getsentry/sentry-go" "github.com/getsentry/sentry-go"
@ -40,6 +40,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/sql" "github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode" "github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
"golang.org/x/mod/semver"
"golang.org/x/text/language" "golang.org/x/text/language"
) )
@ -213,6 +214,11 @@ func InitConf() {
Conf.System = conf.NewSystem() Conf.System = conf.NewSystem()
Conf.OpenHelp = true Conf.OpenHelp = true
} else { } else {
if 0 < semver.Compare("v"+util.Ver, "v"+Conf.System.KernelVersion) {
logging.LogInfof("upgraded from version [%s] to [%s]", Conf.System.KernelVersion, util.Ver)
} else {
logging.LogInfof("downgraded from version [%s] to [%s]", Conf.System.KernelVersion, util.Ver)
}
Conf.OpenHelp = Conf.System.KernelVersion != util.Ver Conf.OpenHelp = Conf.System.KernelVersion != util.Ver
Conf.System.KernelVersion = util.Ver Conf.System.KernelVersion = util.Ver
Conf.System.IsInsider = util.IsInsider Conf.System.IsInsider = util.IsInsider