diff --git a/changelogs.md b/changelogs.md new file mode 100644 index 00000000..d41e3733 --- /dev/null +++ b/changelogs.md @@ -0,0 +1,11 @@ +## v1.9.1 / 2020-01-16 + +### 引入特性 + +* [编辑器 Vditor 所见即所得](https://github.com/88250/pipe/issues/8) + +### 改进功能 + +* [使用社区登录](https://github.com/88250/pipe/issues/6) +* [加入返回博客信息接口](https://github.com/88250/pipe/issues/7) +* [关闭评论功能后不显示评论相关模块](https://github.com/88250/pipe/issues/10) diff --git a/changelogs.html b/changelogs_2017-2019.html similarity index 100% rename from changelogs.html rename to changelogs_2017-2019.html diff --git a/console/package-lock.json b/console/package-lock.json index 031c0e74..0dcae320 100644 --- a/console/package-lock.json +++ b/console/package-lock.json @@ -1,6 +1,6 @@ { "name": "pipe-admin", - "version": "1.9.0", + "version": "1.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/console/package.json b/console/package.json index 03a305fe..21823790 100644 --- a/console/package.json +++ b/console/package.json @@ -1,6 +1,6 @@ { "name": "pipe-admin", - "version": "1.9.0", + "version": "1.9.1", "author": "Vanessa ", "private": true, "config": { diff --git a/controller/indexctl.go b/controller/indexctl.go index b5ba32dc..df02efe6 100644 --- a/controller/indexctl.go +++ b/controller/indexctl.go @@ -17,6 +17,7 @@ package controller import ( + "github.com/88250/pipe/util" "io/ioutil" "net/http" "path/filepath" @@ -41,6 +42,19 @@ func showIndexAction(c *gin.Context) { t.Execute(c.Writer, nil) } +func showChangelogsAction(c *gin.Context) { + data, err := ioutil.ReadFile("changelogs.md") + if nil != err { + logger.Errorf("load changelogs.md failed: " + err.Error()) + c.String(http.StatusNotFound, "load changelogs failed") + + return + } + + result := util.Markdown(string(data)) + c.Data(http.StatusOK, "text/html; charset=utf-8", gulu.Str.ToBytes(result.ContentHTML)) +} + func showStartPageAction(c *gin.Context) { t, err := template.ParseFiles("console/dist/start/index.html") if nil != err { diff --git a/controller/router.go b/controller/router.go index 1dbc2f12..d1a3197a 100644 --- a/controller/router.go +++ b/controller/router.go @@ -189,13 +189,13 @@ func MapRoutes() *gin.Engine { indexGroup := ret.Group("") indexGroup.Use(fillUser) indexGroup.GET("", showIndexAction) + indexGroup.GET(util.PathChangelogs, showChangelogsAction) initGroup := ret.Group(util.PathInit) initGroup.Use(fillUser) initGroup.GET("", showStartPageAction) ret.Static(util.PathConsoleDist, "console/dist") - ret.StaticFile(util.PathChangelogs, "changelogs.html") ret.StaticFile(util.PathRobots, "theme/robots.txt") ret.NoRoute(func(c *gin.Context) { notFound(c) diff --git a/model/confs.go b/model/confs.go index f4ba97fc..32152ee6 100644 --- a/model/confs.go +++ b/model/confs.go @@ -35,7 +35,7 @@ import ( var logger = gulu.Log.NewLogger(os.Stdout) // Version of Pipe. -const Version = "1.9.0" +const Version = "1.9.1" // Conf of Pipe. var Conf *Configuration diff --git a/service/upgradesrv.go b/service/upgradesrv.go index 2a6ee22a..33e23fdd 100644 --- a/service/upgradesrv.go +++ b/service/upgradesrv.go @@ -58,11 +58,37 @@ func (srv *upgradeService) Perform() { fallthrough case "1.8.9": perform189_190() + fallthrough + case "1.9.0": + perform190_191() default: logger.Fatalf("please upgrade to v1.8.7 first") } } +func perform190_191() { + fromVer := "1.9.0" + logger.Infof("upgrading from version [" + fromVer + "] to version [" + model.Version + "]....") + + var verSettings []model.Setting + if err := db.Model(&model.Setting{}).Where("`name`= ?", model.SettingNameSystemVer).Find(&verSettings).Error; nil != err { + logger.Fatalf("load settings failed: %s", err) + } + + tx := db.Begin() + for _, setting := range verSettings { + setting.Value = model.Version + if err := tx.Save(setting).Error; nil != err { + tx.Rollback() + + logger.Fatalf("update setting [%+v] failed: %s", setting, err.Error()) + } + } + tx.Commit() + + logger.Infof("upgraded from version [" + fromVer + "] to version [" + model.Version + "] successfully") +} + func perform189_190() { fromVer := "1.8.9" logger.Infof("upgrading from version [" + fromVer + "] to version [" + model.Version + "]....") diff --git a/theme/package-lock.json b/theme/package-lock.json index 9c7517a5..a73c46ee 100644 --- a/theme/package-lock.json +++ b/theme/package-lock.json @@ -1,6 +1,6 @@ { "name": "Pipe", - "version": "1.9.0", + "version": "1.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/theme/package.json b/theme/package.json index 7c5dd4ce..3f7a8667 100644 --- a/theme/package.json +++ b/theme/package.json @@ -1,6 +1,6 @@ { "name": "Pipe", - "version": "1.9.0", + "version": "1.9.1", "description": "Pipe theme", "homepage": "https://github.com/88250/pipe", "repository": {