remove unused codes and add site'url configuration on admin

This commit is contained in:
lealife
2016-05-25 16:05:47 +08:00
parent a007b89ebb
commit a07bb25128
21 changed files with 117 additions and 1047 deletions

View File

@ -518,7 +518,7 @@ func (this *BlogService) fixUserBlog(userBlog *info.UserBlog) {
// Logo路径问题, 有些有http: 有些没有
if userBlog.Logo != "" && !strings.HasPrefix(userBlog.Logo, "http") {
userBlog.Logo = strings.Trim(userBlog.Logo, "/")
userBlog.Logo = configService.GetSiteUrl() + "/" + userBlog.Logo
userBlog.Logo = "/" + userBlog.Logo
}
if userBlog.SortField == "" {
@ -1108,6 +1108,7 @@ func (this *BlogService) SortSingles(userId string, singleIds []string) (ok bool
// 得到用户的博客url
func (this *BlogService) GetUserBlogUrl(userBlog *info.UserBlog, username string) string {
/*
if userBlog != nil {
if userBlog.Domain != "" && configService.AllowCustomDomain() {
return configService.GetUserUrl(userBlog.Domain)
@ -1118,12 +1119,15 @@ func (this *BlogService) GetUserBlogUrl(userBlog *info.UserBlog, username string
username = userBlog.UserId.Hex()
}
}
*/
return configService.GetBlogUrl() + "/" + username
}
// 得到所有url
func (this *BlogService) GetBlogUrls(userBlog *info.UserBlog, userInfo *info.User) info.BlogUrls {
var indexUrl, postUrl, searchUrl, cateUrl, singleUrl, tagsUrl, archiveUrl, tagPostsUrl string
/*
if userBlog.Domain != "" && configService.AllowCustomDomain() { // http://demo.com
// ok
indexUrl = configService.GetUserUrl(userBlog.Domain)
@ -1144,6 +1148,7 @@ func (this *BlogService) GetBlogUrls(userBlog *info.UserBlog, userInfo *info.Use
tagsUrl = indexUrl + "/tags"
tagPostsUrl = indexUrl + "/tag"
} else {
*/
// ok
blogUrl := configService.GetBlogUrl() // blog.leanote.com
userIdOrEmail := ""
@ -1162,7 +1167,7 @@ func (this *BlogService) GetBlogUrls(userBlog *info.UserBlog, userInfo *info.Use
archiveUrl = blogUrl + "/archives/" + userIdOrEmail // blog.leanote.com/archive/username
tagsUrl = blogUrl + "/tags/" + userIdOrEmail
tagPostsUrl = blogUrl + "/tag/" + userIdOrEmail // blog.leanote.com/archive/username
}
// }
return info.BlogUrls{
IndexUrl: indexUrl,