support duoshuo mirror of gravatar
This commit is contained in:
		
					parent
					
						
							
								4c770b87c5
							
						
					
				
			
			
				commit
				
					
						340a4595dd
					
				
			
		
					 8 changed files with 20 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -167,6 +167,8 @@ SESSION_LIFE_TIME = 86400
 | 
			
		|||
[picture]
 | 
			
		||||
; The place to picture data, either "server" or "qiniu", default is "server"
 | 
			
		||||
SERVICE = server
 | 
			
		||||
; Chinese users can choose "duoshuo"
 | 
			
		||||
GRAVATAR_SOURCE = gravatar
 | 
			
		||||
DISABLE_GRAVATAR = false
 | 
			
		||||
 | 
			
		||||
[attachment]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								gogs.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -17,7 +17,7 @@ import (
 | 
			
		|||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const APP_VER = "0.5.8.1114 Beta"
 | 
			
		||||
const APP_VER = "0.5.8.1116 Beta"
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ func (u *User) AvatarLink() string {
 | 
			
		|||
	} else if setting.Service.EnableCacheAvatar {
 | 
			
		||||
		return setting.AppSubUrl + "/avatar/" + u.Avatar
 | 
			
		||||
	}
 | 
			
		||||
	return "//1.gravatar.com/avatar/" + u.Avatar
 | 
			
		||||
	return setting.GravatarSource + u.Avatar
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewGitSig generates and returns the signature of given user.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -207,6 +207,7 @@ const (
 | 
			
		|||
	PUSH HookEventType = "push"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// FIXME: just use go-gogs-client structs maybe?
 | 
			
		||||
type PayloadAuthor struct {
 | 
			
		||||
	Name     string `json:"name"`
 | 
			
		||||
	Email    string `json:"email"`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,7 +180,7 @@ func AvatarLink(email string) string {
 | 
			
		|||
	} else if setting.Service.EnableCacheAvatar {
 | 
			
		||||
		return setting.AppSubUrl + "/avatar/" + EncodeMd5(email)
 | 
			
		||||
	}
 | 
			
		||||
	return "//1.gravatar.com/avatar/" + EncodeMd5(email)
 | 
			
		||||
	return setting.GravatarSource + EncodeMd5(email)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Seconds-based time units
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,6 +67,7 @@ var (
 | 
			
		|||
 | 
			
		||||
	// Picture settings.
 | 
			
		||||
	PictureService  string
 | 
			
		||||
	GravatarSource  string
 | 
			
		||||
	DisableGravatar bool
 | 
			
		||||
 | 
			
		||||
	// Log settings.
 | 
			
		||||
| 
						 | 
				
			
			@ -257,8 +258,13 @@ func NewConfigContext() {
 | 
			
		|||
	}
 | 
			
		||||
	ScriptType = Cfg.MustValue("repository", "SCRIPT_TYPE", "bash")
 | 
			
		||||
 | 
			
		||||
	PictureService = Cfg.MustValueRange("picture", "SERVICE", "server",
 | 
			
		||||
		[]string{"server"})
 | 
			
		||||
	PictureService = Cfg.MustValueRange("picture", "SERVICE", "server", []string{"server"})
 | 
			
		||||
	switch Cfg.MustValue("picture", "GRAVATAR_SOURCE", "gravatar") {
 | 
			
		||||
	case "duoshuo":
 | 
			
		||||
		GravatarSource = "http://gravatar.duoshuo.com/avatar/"
 | 
			
		||||
	default:
 | 
			
		||||
		GravatarSource = "//1.gravatar.com/avatar/"
 | 
			
		||||
	}
 | 
			
		||||
	DisableGravatar = Cfg.MustBool("picture", "DISABLE_GRAVATAR")
 | 
			
		||||
 | 
			
		||||
	MaxGitDiffLines = Cfg.MustInt("git", "MAX_GITDIFF_LINES", 10000)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								routers/api/v1/repo_file.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								routers/api/v1/repo_file.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
// Copyright 2014 The Gogs Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a MIT-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
package v1
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
0.5.8.1114 Beta
 | 
			
		||||
0.5.8.1116 Beta
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue