diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-11-21 12:51:36 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-11-21 12:51:36 -0500 |
commit | ef275ebf62608b1bd2c7e48862e723cd822d93c2 (patch) | |
tree | 1ff4e8cd2a7b85b85b19d03855cb51e6327c3e8a /modules | |
parent | 22ab4fa1b0bdbea10979ae87568452b5bbf9b6af (diff) | |
download | gitea-ef275ebf62608b1bd2c7e48862e723cd822d93c2.tar.gz gitea-ef275ebf62608b1bd2c7e48862e723cd822d93c2.zip |
more on change avatar
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/user_form.go | 3 | ||||
-rw-r--r-- | modules/setting/setting.go | 4 | ||||
-rw-r--r-- | modules/ssh/ssh.go | 13 |
3 files changed, 11 insertions, 9 deletions
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index afdd8be0c9..4dfe2499f1 100644 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -89,7 +89,8 @@ func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) } type UploadAvatarForm struct { - Avatar *multipart.FileHeader `form:"avatar" binding:"Required"` + Enable bool `form:"enable"` + Avatar *multipart.FileHeader `form:"avatar"` } func (f *UploadAvatarForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 49bd11c4c2..cf34c2edc6 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -20,7 +20,7 @@ import ( "github.com/macaron-contrib/session" "github.com/gogits/gogs/modules/log" - // "github.com/gogits/gogs-ng/modules/ssh" + // "github.com/gogits/gogs/modules/ssh" ) type Scheme string @@ -488,5 +488,5 @@ func NewServices() { newRegisterMailService() newNotifyMailService() newWebhookService() - // ssh.Listen("2022") + // ssh.Listen("2222") } diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go index 814a3dd1f4..26169e0f3d 100644 --- a/modules/ssh/ssh.go +++ b/modules/ssh/ssh.go @@ -13,9 +13,8 @@ import ( "os/exec" "strings" - "code.google.com/p/go.crypto/ssh" - "github.com/Unknwon/com" + "golang.org/x/crypto/ssh" "github.com/gogits/gogs/modules/log" ) @@ -35,8 +34,11 @@ func handleServerConn(keyId string, chans <-chan ssh.NewChannel) { go func(in <-chan *ssh.Request) { defer channel.Close() for req := range in { - ok, payload := false, strings.TrimLeft(string(req.Payload), "\x00") + ok, payload := false, strings.TrimLeft(string(req.Payload), "\x00&") fmt.Println("Request:", req.Type, req.WantReply, payload) + if req.WantReply { + fmt.Println(req.Reply(true, nil)) + } switch req.Type { case "env": args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v") @@ -54,7 +56,7 @@ func handleServerConn(keyId string, chans <-chan ssh.NewChannel) { case "exec": os.Setenv("SSH_ORIGINAL_COMMAND", strings.TrimLeft(payload, "'(")) log.Info("Payload: %v", strings.TrimLeft(payload, "'(")) - cmd := exec.Command("/Users/jiahuachen/Applications/Go/src/github.com/gogits/gogs-ng/gogs-ng", "serv", "key-"+keyId) + cmd := exec.Command("/Users/jiahuachen/Applications/Go/src/github.com/gogits/gogs/gogs", "serv", "key-"+keyId) cmd.Stdout = channel cmd.Stdin = channel cmd.Stderr = channel.Stderr() @@ -65,7 +67,6 @@ func handleServerConn(keyId string, chans <-chan ssh.NewChannel) { } } fmt.Println("Done:", ok) - req.Reply(ok, nil) // BUG: Git on Mac seems not know this reply and hang? } fmt.Println("Done!!!") }(requests) @@ -101,7 +102,7 @@ func Listen(port string) { config := &ssh.ServerConfig{ PublicKeyCallback: func(conn ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) { // keyCache[string(ssh.MarshalAuthorizedKey(key))] = 2 - return &ssh.Permissions{Extensions: map[string]string{"key-id": "2"}}, nil + return &ssh.Permissions{Extensions: map[string]string{"key-id": "1"}}, nil }, } |