diff --git a/app/controllers/BlogController.go b/app/controllers/BlogController.go index 7c9fde2..30a79bc 100644 --- a/app/controllers/BlogController.go +++ b/app/controllers/BlogController.go @@ -161,7 +161,7 @@ func (c Blog) Cate(notebookId string) revel.Result { } // 显示分类的最近博客, json -func (c Blog) ListCateLatest(notebookId string) revel.Result { +func (c Blog) ListCateLatest(notebookId, callback string) revel.Result { if notebookId == "" { return c.E404() } @@ -192,7 +192,7 @@ func (c Blog) ListCateLatest(notebookId string) revel.Result { re := info.NewRe() re.Ok = true re.List = blogs - return c.RenderJson(re) + return c.RenderJsonP(callback, re) } func (c Blog) Index(userIdOrEmail string) revel.Result { diff --git a/app/controllers/NoteController.go b/app/controllers/NoteController.go index a321e42..6811c3f 100644 --- a/app/controllers/NoteController.go +++ b/app/controllers/NoteController.go @@ -53,8 +53,7 @@ func (c Note) Index() revel.Result { // 当然, 还需要得到第一个notes的content //... - adminUsername, _ := revel.Config.String("adminUsername") - c.RenderArgs["isAdmin"] = adminUsername == userInfo.Username + c.RenderArgs["isAdmin"] = leanoteUserId == userInfo.Username c.RenderArgs["userInfo"] = userInfo c.RenderArgs["userInfoJson"] = c.Json(userInfo) c.RenderArgs["notebooks"] = c.Json(notebooks) diff --git a/app/controllers/admin/init.go b/app/controllers/admin/init.go index f725029..c151864 100644 --- a/app/controllers/admin/init.go +++ b/app/controllers/admin/init.go @@ -129,7 +129,4 @@ func init() { revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminEmail{}) revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminUpgrade{}) revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminData{}) - revel.OnAppStart(func() { - adminUsername, _ = revel.Config.String("adminUsername") - }) } \ No newline at end of file diff --git a/app/views/Admin/index.html b/app/views/Admin/index.html index 65165d9..0b718de 100644 --- a/app/views/Admin/index.html +++ b/app/views/Admin/index.html @@ -61,23 +61,28 @@