admin username & jsonp fixed
This commit is contained in:
app
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user