🚸 improve: 优化导航栏 close #55 close #56

This commit is contained in:
naiba
2021-01-16 11:42:12 +08:00
parent 345511e90f
commit 1c2cc5dcab
3 changed files with 28 additions and 18 deletions

View File

@@ -10,9 +10,18 @@ import (
"github.com/naiba/nezha/service/dao"
)
var adminPage = map[string]bool{
"/server": true,
"/monitor": true,
"/setting": true,
"/notification": true,
}
func CommonEnvironment(c *gin.Context, data map[string]interface{}) gin.H {
data["MatchedPath"] = c.MustGet("MatchedPath")
data["Version"] = dao.Version
// 是否是管理页面
data["IsAdminPage"] = adminPage[data["MatchedPath"].(string)]
// 站点标题
if t, has := data["Title"]; !has {
data["Title"] = dao.Conf.Site.Brand