diff --git a/app/controllers/BlogController.go b/app/controllers/BlogController.go index fbbf6ca..b5bf765 100644 --- a/app/controllers/BlogController.go +++ b/app/controllers/BlogController.go @@ -57,9 +57,9 @@ func (c Blog) render(templateName string, themePath string) revel.Result { isPreview = true themePath = themePath2.(string) c.setPreviewUrl() - + // 因为common的themeInfo是从UserBlog.ThemeId来取的, 所以这里要fugai下 - c.RenderArgs["themeInfo"] = c.RenderArgs["themeInfoPreview"] + c.RenderArgs["themeInfo"] = c.RenderArgs["themeInfoPreview"]; } return blog.RenderTemplate(templateName, c.RenderArgs, revel.BasePath+"/"+themePath, isPreview) } @@ -119,9 +119,9 @@ func (c Blog) setPreviewUrl() { indexUrl = blogUrl + "/" + userIdOrEmail cateUrl = blogUrl + "/cate/" + userIdOrEmail // /notebookId - postUrl = blogUrl + "/post/" + userIdOrEmail // /xxxxx + postUrl = blogUrl + "/post/" + userIdOrEmail // /xxxxx searchUrl = blogUrl + "/search/" + userIdOrEmail // blog.leanote.com/search/userId - singleUrl = blogUrl + "/single/" + userIdOrEmail // blog.leanote.com/single/singleId + singleUrl = blogUrl + "/single/" + userIdOrEmail // blog.leanote.com/single/singleId archiveUrl = blogUrl + "/archives/" + userIdOrEmail // blog.leanote.com/archive/userId tagsUrl = blogUrl + "/tags/" + userIdOrEmail // blog.leanote.com/archive/userId @@ -143,6 +143,10 @@ func (c Blog) setPreviewUrl() { // 各种地址设置 func (c Blog) setUrl(userBlog info.UserBlog, userInfo info.User) { // 主页 http://leanote.com/blog/life or http://blog.leanote.com/life or http:// xxxx.leanote.com or aa.com + host := c.Request.Request.Host + var staticUrl = configService.GetUserUrl(strings.Split(host, ":")[0]) + // staticUrl == host, 为保证同源!!! 只有host, http://leanote.com, http://blog/leanote.com + // life.leanote.com, lealife.com siteUrl := configService.GetSiteUrl() blogUrls := blogService.GetBlogUrls(&userBlog, &userInfo) // 分类 @@ -169,12 +173,12 @@ func (c Blog) setUrl(userBlog info.UserBlog, userInfo info.User) { c.RenderArgs["prettifyJsUrl"] = siteUrl + "/js/google-code-prettify/prettify.js" c.RenderArgs["prettifyCssUrl"] = siteUrl + "/js/google-code-prettify/prettify.css" - c.RenderArgs["blogCommonJsUrl"] = siteUrl + "/blog/js/common.js" + c.RenderArgs["blogCommonJsUrl"] = siteUrl + "/public/blog/js/common.js" - c.RenderArgs["shareCommentCssUrl"] = siteUrl + "/blog/css/share_comment.css" - c.RenderArgs["shareCommentJsUrl"] = siteUrl + "/blog/js/share_comment.js" + c.RenderArgs["shareCommentCssUrl"] = siteUrl + "/public/blog/css/share_comment.css" + c.RenderArgs["shareCommentJsUrl"] = siteUrl + "/public/blog/js/share_comment.js" - c.RenderArgs["fontAwesomeUrl"] = siteUrl + "/css/font-awesome-4.2.0/css/font-awesome.css" + c.RenderArgs["fontAwesomeUrl"] = staticUrl + "/css/font-awesome-4.2.0/css/font-awesome.css" c.RenderArgs["bootstrapCssUrl"] = siteUrl + "/css/bootstrap.css" c.RenderArgs["bootstrapJsUrl"] = siteUrl + "/js/bootstrap-min.js" @@ -506,7 +510,6 @@ func (c Blog) Archives(userIdOrEmail string, cateId string, year, month int) (re // 进入某个用户的博客 var blogPageSize = 5 var searchBlogPageSize = 30 - // 分类 /cate/xxxxxxxx?notebookId=1212 func (c Blog) Cate(userIdOrEmail string, notebookId string) (re revel.Result) { // 自定义域名 diff --git a/app/init.go b/app/init.go index e5134d1..6d4501b 100644 --- a/app/init.go +++ b/app/init.go @@ -376,4 +376,4 @@ func init() { service.ConfigS.InitGlobalConfigs() api.InitService() }) -} \ No newline at end of file +} diff --git a/app/views/home/header.html b/app/views/home/header.html index 74fed89..566d1c7 100644 --- a/app/views/home/header.html +++ b/app/views/home/header.html @@ -44,6 +44,7 @@ function log(o) { -->
  • {{msg . "download"}}
  • {{msg . "donate"}}
  • +
  • lea++
  • {{msg . "discussion"}}
    @@ -107,4 +108,4 @@ function log(o) { ---> \ No newline at end of file +--> diff --git a/conf/app.conf b/conf/app.conf index 05e1e98..41ded9d 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -8,7 +8,6 @@ site.url=http://localhost:9000 # or http://x.com:8080, http://www.xx.com:9000 # mongdb db.host=localhost -#db.host=leanote db.port=27017 db.dbname=leanote # required db.username= # if not exists, please leave it blank @@ -17,13 +16,14 @@ db.password= # if not exists, please leave it blank # mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb # db.url=mongodb://root:root123@localhost:27017/leanote +# You Must Change It !! About Security!! +app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y #-------------------------------- # revel config # for dev #-------------------------------- app.name=leanote -app.secret=V85ZzBeTnzpsHyjQX4zukbQ8qqtju9y2aDM55VWxAH9Qop19poekx3xkcDVvrD0y http.addr= http.ssl=false cookie.httponly=false diff --git a/conf/routes b/conf/routes index 96acbc2..a03a70f 100644 --- a/conf/routes +++ b/conf/routes @@ -5,7 +5,7 @@ module:testrunner # Home is My Blog -Get / Index.Index +Get / Index.Default GET /note Note.Index # leanote home GET /index Index.Index