From d725c41b56e072122faf539d5a14d36c18f5c312 Mon Sep 17 00:00:00 2001 From: skyblue Date: Fri, 21 Mar 2014 22:35:43 +0800 Subject: [PATCH 01/22] add CR in C++ gitignore And try if I can commit. --- conf/gitignore/C++ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/gitignore/C++ b/conf/gitignore/C++ index 5a1b6ec43..620d3dc8a 100644 --- a/conf/gitignore/C++ +++ b/conf/gitignore/C++ @@ -10,4 +10,4 @@ # Compiled Static libraries *.lai *.la -*.a \ No newline at end of file +*.a From 8e47ae21024bc35a82215e16f1e586f94ae622c9 Mon Sep 17 00:00:00 2001 From: skyblue Date: Sun, 23 Mar 2014 12:24:09 +0800 Subject: [PATCH 02/22] add avatar inorder to view code on github --- modules/avatar/avatar.go | 136 ++++++++++++++++++++++++++++++++++ modules/avatar/avatar_test.go | 35 +++++++++ 2 files changed, 171 insertions(+) create mode 100644 modules/avatar/avatar.go create mode 100644 modules/avatar/avatar_test.go diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go new file mode 100644 index 000000000..93f842eae --- /dev/null +++ b/modules/avatar/avatar.go @@ -0,0 +1,136 @@ +package avatar + +import ( + "crypto/md5" + "encoding/hex" + "fmt" + "io" + "log" + "net/http" + "net/url" + "os" + "path/filepath" + "strings" + "sync" + "time" +) + +var gravatar = "http://www.gravatar.com/avatar" + +// hash email to md5 string +func HashEmail(email string) string { + h := md5.New() + h.Write([]byte(strings.ToLower(email))) + return hex.EncodeToString(h.Sum(nil)) +} + +type Avatar struct { + Hash string + cacheDir string // image save dir + reqParams string + imagePath string +} + +func New(hash string, cacheDir string) *Avatar { + return &Avatar{ + Hash: hash, + cacheDir: cacheDir, + reqParams: url.Values{ + "d": {"retro"}, + "size": {"200"}, + "r": {"pg"}}.Encode(), + imagePath: filepath.Join(cacheDir, hash+".jpg"), + } +} + +// get image from gravatar.com +func (this *Avatar) Update() { + thunder.Fetch(gravatar+"/"+this.Hash+"?"+this.reqParams, + this.Hash+".jpg") +} + +func (this *Avatar) UpdateTimeout(timeout time.Duration) { + select { + case <-time.After(timeout): + log.Println("timeout") + case <-thunder.GoFetch(gravatar+"/"+this.Hash+"?"+this.reqParams, + this.Hash+".jpg"): + } +} + +var thunder = &Thunder{QueueSize: 10} + +type Thunder struct { + QueueSize int // download queue size + q chan *thunderTask + once sync.Once +} + +func (t *Thunder) init() { + if t.QueueSize < 1 { + t.QueueSize = 1 + } + t.q = make(chan *thunderTask, t.QueueSize) + for i := 0; i < t.QueueSize; i++ { + go func() { + for { + task := <-t.q + task.Fetch() + } + }() + } +} + +func (t *Thunder) Fetch(url string, saveFile string) error { + t.once.Do(t.init) + task := &thunderTask{ + Url: url, + SaveFile: saveFile, + } + task.Add(1) + t.q <- task + task.Wait() + return task.err +} + +func (t *Thunder) GoFetch(url, saveFile string) chan error { + c := make(chan error) + go func() { + c <- t.Fetch(url, saveFile) + }() + return c +} + +// thunder download +type thunderTask struct { + Url string + SaveFile string + sync.WaitGroup + err error +} + +func (this *thunderTask) Fetch() { + this.err = this.fetch() + this.Done() +} + +func (this *thunderTask) fetch() error { + resp, err := http.Get(this.Url) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + return fmt.Errorf("status code: %d", resp.StatusCode) + } + fd, err := os.Create(this.SaveFile) + if err != nil { + return err + } + defer fd.Close() + _, err = io.Copy(fd, resp.Body) + if err != nil { + return err + } + return nil +} diff --git a/modules/avatar/avatar_test.go b/modules/avatar/avatar_test.go new file mode 100644 index 000000000..49f8f91f3 --- /dev/null +++ b/modules/avatar/avatar_test.go @@ -0,0 +1,35 @@ +package avatar + +import ( + "log" + "strconv" + "testing" + "time" +) + +func TestFetch(t *testing.T) { + hash := HashEmail("ssx205@gmail.com") + avatar := New(hash, "./") + //avatar.Update() + avatar.UpdateTimeout(time.Millisecond * 200) + time.Sleep(5 * time.Second) +} + +func TestFetchMany(t *testing.T) { + log.Println("start") + var n = 50 + ch := make(chan bool, n) + for i := 0; i < n; i++ { + go func(i int) { + hash := HashEmail(strconv.Itoa(i) + "ssx205@gmail.com") + avatar := New(hash, "./") + avatar.Update() + log.Println("finish", hash) + ch <- true + }(i) + } + for i := 0; i < n; i++ { + <-ch + } + log.Println("end") +} From 79604f553f45af658a884544187b00fb9fa3169c Mon Sep 17 00:00:00 2001 From: skyblue Date: Sun, 23 Mar 2014 15:55:27 +0800 Subject: [PATCH 03/22] fix download part problem, add png support --- modules/avatar/avatar.go | 179 +++++++++++++++++++++++++++++++++++---- 1 file changed, 162 insertions(+), 17 deletions(-) diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go index 93f842eae..55d1e13d9 100644 --- a/modules/avatar/avatar.go +++ b/modules/avatar/avatar.go @@ -3,7 +3,11 @@ package avatar import ( "crypto/md5" "encoding/hex" + "errors" "fmt" + "image" + "image/jpeg" + "image/png" "io" "log" "net/http" @@ -13,9 +17,14 @@ import ( "strings" "sync" "time" + + "github.com/nfnt/resize" ) -var gravatar = "http://www.gravatar.com/avatar" +var ( + gravatar = "http://www.gravatar.com/avatar" + defaultImagePath = "./default.jpg" +) // hash email to md5 string func HashEmail(email string) string { @@ -25,37 +34,145 @@ func HashEmail(email string) string { } type Avatar struct { - Hash string - cacheDir string // image save dir - reqParams string - imagePath string + Hash string + cacheDir string // image save dir + reqParams string + imagePath string + expireDuration time.Duration } func New(hash string, cacheDir string) *Avatar { return &Avatar{ - Hash: hash, - cacheDir: cacheDir, + Hash: hash, + cacheDir: cacheDir, + expireDuration: time.Minute * 10, reqParams: url.Values{ "d": {"retro"}, "size": {"200"}, "r": {"pg"}}.Encode(), - imagePath: filepath.Join(cacheDir, hash+".jpg"), + imagePath: filepath.Join(cacheDir, hash+".image"), //maybe png or jpeg } } +func (this *Avatar) InCache() bool { + fileInfo, err := os.Stat(this.imagePath) + return err == nil && fileInfo.Mode().IsRegular() +} + +func (this *Avatar) Modtime() (modtime time.Time, err error) { + fileInfo, err := os.Stat(this.imagePath) + if err != nil { + return + } + return fileInfo.ModTime(), nil +} + +func (this *Avatar) Expired() bool { + if !this.InCache() { + return true + } + fileInfo, err := os.Stat(this.imagePath) + return err != nil || time.Since(fileInfo.ModTime()) > this.expireDuration +} + +// default image format: jpeg +func (this *Avatar) Encode(wr io.Writer, size int) (err error) { + var img image.Image + decodeImageFile := func(file string) (img image.Image, err error) { + fd, err := os.Open(file) + if err != nil { + return + } + defer fd.Close() + img, err = jpeg.Decode(fd) + if err != nil { + fd.Seek(0, os.SEEK_SET) + img, err = png.Decode(fd) + } + return + } + imgPath := this.imagePath + if !this.InCache() { + imgPath = defaultImagePath + } + img, err = decodeImageFile(imgPath) + if err != nil { + return + } + m := resize.Resize(uint(size), 0, img, resize.Lanczos3) + return jpeg.Encode(wr, m, nil) +} + // get image from gravatar.com func (this *Avatar) Update() { thunder.Fetch(gravatar+"/"+this.Hash+"?"+this.reqParams, - this.Hash+".jpg") + this.imagePath) } -func (this *Avatar) UpdateTimeout(timeout time.Duration) { +func (this *Avatar) UpdateTimeout(timeout time.Duration) error { + var err error select { case <-time.After(timeout): - log.Println("timeout") - case <-thunder.GoFetch(gravatar+"/"+this.Hash+"?"+this.reqParams, - this.Hash+".jpg"): + err = errors.New("get gravatar image timeout") + case err = <-thunder.GoFetch(gravatar+"/"+this.Hash+"?"+this.reqParams, + this.imagePath): } + return err +} + +func init() { + log.SetFlags(log.Lshortfile | log.LstdFlags) +} + +// http.Handle("/avatar/", avatar.HttpHandler("./cache")) +func HttpHandler(cacheDir string) func(w http.ResponseWriter, r *http.Request) { + MustInt := func(r *http.Request, defaultValue int, keys ...string) int { + var v int + for _, k := range keys { + if _, err := fmt.Sscanf(r.FormValue(k), "%d", &v); err == nil { + defaultValue = v + } + } + return defaultValue + } + + return func(w http.ResponseWriter, r *http.Request) { + urlPath := r.URL.Path + hash := urlPath[strings.LastIndex(urlPath, "/")+1:] + hash = HashEmail(hash) + size := MustInt(r, 80, "s", "size") // size = 80*80 + + avatar := New(hash, cacheDir) + if avatar.Expired() { + err := avatar.UpdateTimeout(time.Millisecond * 500) + if err != nil { + log.Println(err) + } + } + if modtime, err := avatar.Modtime(); err == nil { + etag := fmt.Sprintf("size(%d)", size) + if t, err := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); err == nil && modtime.Before(t.Add(1*time.Second)) && etag == r.Header.Get("If-None-Match") { + h := w.Header() + delete(h, "Content-Type") + delete(h, "Content-Length") + w.WriteHeader(http.StatusNotModified) + return + } + w.Header().Set("Last-Modified", modtime.UTC().Format(http.TimeFormat)) + w.Header().Set("ETag", etag) + } + w.Header().Set("Content-Type", "image/jpeg") + err := avatar.Encode(w, size) + if err != nil { + log.Println(err) + w.WriteHeader(500) + } + } +} + +func init() { + http.HandleFunc("/", HttpHandler("./")) + log.Fatal(http.ListenAndServe(":8001", nil)) } var thunder = &Thunder{QueueSize: 10} @@ -114,8 +231,17 @@ func (this *thunderTask) Fetch() { this.Done() } +var client = &http.Client{} + func (this *thunderTask) fetch() error { - resp, err := http.Get(this.Url) + log.Println("thunder, fetch", this.Url) + req, _ := http.NewRequest("GET", this.Url, nil) + req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") + req.Header.Set("Accept-Encoding", "gzip,deflate,sdch") + req.Header.Set("Accept-Language", "zh-CN,zh;q=0.8") + req.Header.Set("Cache-Control", "no-cache") + req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36") + resp, err := client.Do(req) if err != nil { return err } @@ -123,14 +249,33 @@ func (this *thunderTask) fetch() error { if resp.StatusCode != 200 { return fmt.Errorf("status code: %d", resp.StatusCode) } - fd, err := os.Create(this.SaveFile) + + /* + log.Println("headers:", resp.Header) + switch resp.Header.Get("Content-Type") { + case "image/jpeg": + this.SaveFile += ".jpeg" + case "image/png": + this.SaveFile += ".png" + } + */ + /* + imgType := resp.Header.Get("Content-Type") + if imgType != "image/jpeg" && imgType != "image/png" { + return errors.New("not png or jpeg") + } + */ + + tmpFile := this.SaveFile + ".part" // mv to destination when finished + fd, err := os.Create(tmpFile) if err != nil { return err } - defer fd.Close() _, err = io.Copy(fd, resp.Body) + fd.Close() if err != nil { + os.Remove(tmpFile) return err } - return nil + return os.Rename(tmpFile, this.SaveFile) } From 964e537479c497a5ba42799a1c1a7c430720e990 Mon Sep 17 00:00:00 2001 From: Gogs Date: Sun, 23 Mar 2014 18:13:23 +0800 Subject: [PATCH 04/22] append route to web --- conf/app.ini | 8 +- models/user.go | 2 +- modules/avatar/avatar.go | 137 +++++++++++++++++++--------------- modules/avatar/avatar_test.go | 41 +++++++--- modules/base/tool.go | 2 +- public/img/avatar/default.jpg | Bin 0 -> 17379 bytes web.go | 5 +- 7 files changed, 118 insertions(+), 77 deletions(-) create mode 100644 public/img/avatar/default.jpg diff --git a/conf/app.ini b/conf/app.ini index ecb0d2511..160aef0ff 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -7,7 +7,7 @@ RUN_USER = lunny RUN_MODE = dev [repository] -ROOT = /Users/%(RUN_USER)s/git/gogs-repositories +ROOT = /home/work/%(RUN_USER)s/git/gogs-repositories LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License @@ -15,7 +15,7 @@ LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0| DOMAIN = localhost ROOT_URL = http://%(DOMAIN)s:%(HTTP_PORT)s/ HTTP_ADDR = -HTTP_PORT = 3000 +HTTP_PORT = 8002 [database] ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice @@ -23,7 +23,7 @@ DB_TYPE = mysql HOST = NAME = gogs USER = root -PASSWD = +PASSWD = toor ; For "postgres" only, either "disable", "require" or "verify-full" SSL_MODE = disable ; For "sqlite3" only @@ -120,4 +120,4 @@ HOST = USER = PASSWD = ; Receivers, can be one or more, e.g. ["1@example.com","2@example.com"] -RECEIVERS = \ No newline at end of file +RECEIVERS = diff --git a/models/user.go b/models/user.go index 3c1109128..cedf34249 100644 --- a/models/user.go +++ b/models/user.go @@ -72,7 +72,7 @@ func (user *User) HomeLink() string { // AvatarLink returns the user gravatar link. func (user *User) AvatarLink() string { - return "http://1.gravatar.com/avatar/" + user.Avatar + return "/avatar/" + user.Avatar } // NewGitSig generates and returns the signature of given user. diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go index 55d1e13d9..1a18d8a7e 100644 --- a/modules/avatar/avatar.go +++ b/modules/avatar/avatar.go @@ -1,3 +1,8 @@ +// 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. + +// for www.gravatar.com image cache package avatar import ( @@ -22,11 +27,17 @@ import ( ) var ( - gravatar = "http://www.gravatar.com/avatar" - defaultImagePath = "./default.jpg" + gravatar = "http://www.gravatar.com/avatar" ) +func debug(a ...interface{}) { + if true { + log.Println(a...) + } +} + // hash email to md5 string +// keep this func in order to make this package indenpent func HashEmail(email string) string { h := md5.New() h.Write([]byte(strings.ToLower(email))) @@ -35,6 +46,7 @@ func HashEmail(email string) string { type Avatar struct { Hash string + AlterImage string // image path cacheDir string // image save dir reqParams string imagePath string @@ -54,7 +66,7 @@ func New(hash string, cacheDir string) *Avatar { } } -func (this *Avatar) InCache() bool { +func (this *Avatar) HasCache() bool { fileInfo, err := os.Stat(this.imagePath) return err == nil && fileInfo.Mode().IsRegular() } @@ -68,11 +80,8 @@ func (this *Avatar) Modtime() (modtime time.Time, err error) { } func (this *Avatar) Expired() bool { - if !this.InCache() { - return true - } - fileInfo, err := os.Stat(this.imagePath) - return err != nil || time.Since(fileInfo.ModTime()) > this.expireDuration + modtime, err := this.Modtime() + return err != nil || time.Since(modtime) > this.expireDuration } // default image format: jpeg @@ -92,8 +101,11 @@ func (this *Avatar) Encode(wr io.Writer, size int) (err error) { return } imgPath := this.imagePath - if !this.InCache() { - imgPath = defaultImagePath + if !this.HasCache() { + if this.AlterImage == "" { + return errors.New("request image failed, and no alt image offered") + } + imgPath = this.AlterImage } img, err = decodeImageFile(imgPath) if err != nil { @@ -120,61 +132,66 @@ func (this *Avatar) UpdateTimeout(timeout time.Duration) error { return err } -func init() { - log.SetFlags(log.Lshortfile | log.LstdFlags) +type avatarHandler struct { + cacheDir string + altImage string +} + +func (this *avatarHandler) mustInt(r *http.Request, defaultValue int, keys ...string) int { + var v int + for _, k := range keys { + if _, err := fmt.Sscanf(r.FormValue(k), "%d", &v); err == nil { + defaultValue = v + } + } + return defaultValue +} + +func (this *avatarHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + urlPath := r.URL.Path + hash := urlPath[strings.LastIndex(urlPath, "/")+1:] + //hash = HashEmail(hash) + size := this.mustInt(r, 80, "s", "size") // size = 80*80 + + avatar := New(hash, this.cacheDir) + avatar.AlterImage = this.altImage + if avatar.Expired() { + err := avatar.UpdateTimeout(time.Millisecond * 500) + if err != nil { + debug(err) + //log.Trace("avatar update error: %v", err) + } + } + if modtime, err := avatar.Modtime(); err == nil { + etag := fmt.Sprintf("size(%d)", size) + if t, err := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); err == nil && modtime.Before(t.Add(1*time.Second)) && etag == r.Header.Get("If-None-Match") { + h := w.Header() + delete(h, "Content-Type") + delete(h, "Content-Length") + w.WriteHeader(http.StatusNotModified) + return + } + w.Header().Set("Last-Modified", modtime.UTC().Format(http.TimeFormat)) + w.Header().Set("ETag", etag) + } + w.Header().Set("Content-Type", "image/jpeg") + err := avatar.Encode(w, size) + if err != nil { + //log.Warn("avatar encode error: %v", err) // will panic when err != nil + debug(err) + w.WriteHeader(500) + } } // http.Handle("/avatar/", avatar.HttpHandler("./cache")) -func HttpHandler(cacheDir string) func(w http.ResponseWriter, r *http.Request) { - MustInt := func(r *http.Request, defaultValue int, keys ...string) int { - var v int - for _, k := range keys { - if _, err := fmt.Sscanf(r.FormValue(k), "%d", &v); err == nil { - defaultValue = v - } - } - return defaultValue - } - - return func(w http.ResponseWriter, r *http.Request) { - urlPath := r.URL.Path - hash := urlPath[strings.LastIndex(urlPath, "/")+1:] - hash = HashEmail(hash) - size := MustInt(r, 80, "s", "size") // size = 80*80 - - avatar := New(hash, cacheDir) - if avatar.Expired() { - err := avatar.UpdateTimeout(time.Millisecond * 500) - if err != nil { - log.Println(err) - } - } - if modtime, err := avatar.Modtime(); err == nil { - etag := fmt.Sprintf("size(%d)", size) - if t, err := time.Parse(http.TimeFormat, r.Header.Get("If-Modified-Since")); err == nil && modtime.Before(t.Add(1*time.Second)) && etag == r.Header.Get("If-None-Match") { - h := w.Header() - delete(h, "Content-Type") - delete(h, "Content-Length") - w.WriteHeader(http.StatusNotModified) - return - } - w.Header().Set("Last-Modified", modtime.UTC().Format(http.TimeFormat)) - w.Header().Set("ETag", etag) - } - w.Header().Set("Content-Type", "image/jpeg") - err := avatar.Encode(w, size) - if err != nil { - log.Println(err) - w.WriteHeader(500) - } +func HttpHandler(cacheDir string, defaultImgPath string) http.Handler { + return &avatarHandler{ + cacheDir: cacheDir, + altImage: defaultImgPath, } } -func init() { - http.HandleFunc("/", HttpHandler("./")) - log.Fatal(http.ListenAndServe(":8001", nil)) -} - +// thunder downloader var thunder = &Thunder{QueueSize: 10} type Thunder struct { @@ -234,7 +251,7 @@ func (this *thunderTask) Fetch() { var client = &http.Client{} func (this *thunderTask) fetch() error { - log.Println("thunder, fetch", this.Url) + //log.Println("thunder, fetch", this.Url) req, _ := http.NewRequest("GET", this.Url, nil) req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") req.Header.Set("Accept-Encoding", "gzip,deflate,sdch") diff --git a/modules/avatar/avatar_test.go b/modules/avatar/avatar_test.go index 49f8f91f3..a337959c6 100644 --- a/modules/avatar/avatar_test.go +++ b/modules/avatar/avatar_test.go @@ -1,29 +1,41 @@ -package avatar +// 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 avatar_test import ( "log" + "os" "strconv" "testing" "time" + + "github.com/gogits/gogs/modules/avatar" ) +const TMPDIR = "test-avatar" + func TestFetch(t *testing.T) { - hash := HashEmail("ssx205@gmail.com") - avatar := New(hash, "./") - //avatar.Update() - avatar.UpdateTimeout(time.Millisecond * 200) - time.Sleep(5 * time.Second) + os.Mkdir(TMPDIR, 0755) + defer os.RemoveAll(TMPDIR) + + hash := avatar.HashEmail("ssx205@gmail.com") + a := avatar.New(hash, TMPDIR) + a.UpdateTimeout(time.Millisecond * 200) } func TestFetchMany(t *testing.T) { + os.Mkdir(TMPDIR, 0755) + defer os.RemoveAll(TMPDIR) + log.Println("start") - var n = 50 + var n = 5 ch := make(chan bool, n) for i := 0; i < n; i++ { go func(i int) { - hash := HashEmail(strconv.Itoa(i) + "ssx205@gmail.com") - avatar := New(hash, "./") - avatar.Update() + hash := avatar.HashEmail(strconv.Itoa(i) + "ssx205@gmail.com") + a := avatar.New(hash, TMPDIR) + a.Update() log.Println("finish", hash) ch <- true }(i) @@ -33,3 +45,12 @@ func TestFetchMany(t *testing.T) { } log.Println("end") } + +// cat +// wget http://www.artsjournal.com/artfulmanager/wp/wp-content/uploads/2013/12/200x200xmirror_cat.jpg.pagespeed.ic.GOZSv6v1_H.jpg -O default.jpg +/* +func TestHttp(t *testing.T) { + http.Handle("/", avatar.HttpHandler("./", "default.jpg")) + http.ListenAndServe(":8001", nil) +} +*/ diff --git a/modules/base/tool.go b/modules/base/tool.go index 8fabb8c53..8d0d38216 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -98,7 +98,7 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string // AvatarLink returns avatar link by given e-mail. func AvatarLink(email string) string { - return "http://1.gravatar.com/avatar/" + EncodeMd5(email) + return "/avatar/" + EncodeMd5(email) } // Seconds-based time units diff --git a/public/img/avatar/default.jpg b/public/img/avatar/default.jpg new file mode 100644 index 0000000000000000000000000000000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PB{Ce(*S3wY7l$DTyLAf~gJ-TlvEXO--aE37aSt#c;KfCtSufSclCwI!*lTQy2&*Ft9A?P^T!L*ZX1aExtz-d zR4pHx&b}FIXG(P<<*rNs`q2nYe((V551p=WlU;8v$%AHT-AvMEz;(=aN&Yc5Y&-Df z_E_%S^$myu}s|1qzkXA;Etr=Bva2p$5?!OaM$Ix>khAR1^)mCz2;KR#slB06>@=| r6z@+r6fu?f1kjq3ue#n=PlQ9d2Cc+uB=6|S6?Uy3jL;>f{B!@=bPBAW literal 0 HcmV?d00001 diff --git a/web.go b/web.go index bb316a672..637ee7ce9 100644 --- a/web.go +++ b/web.go @@ -18,6 +18,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" + "github.com/gogits/gogs/modules/avatar" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" @@ -114,6 +115,9 @@ func runWeb(*cli.Context) { m.Get("/help", routers.Help) + avatarHandler := avatar.HttpHandler("public/img/avatar", "public/img/avatar/default.jpg") + m.Get("/avatar/:hash", avatarHandler.ServeHTTP) + adminReq := middleware.AdminRequire() m.Get("/admin", reqSignIn, adminReq, admin.Dashboard) m.Get("/admin/users", reqSignIn, adminReq, admin.Users) @@ -136,7 +140,6 @@ func runWeb(*cli.Context) { ignSignIn, middleware.RepoAssignment(true), repo.Single) m.Get("/:username/:reponame/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Single) m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Single) - m.Get("/:username/:reponame", ignSignIn, middleware.RepoAssignment(true), repo.Single) m.Any("/:username/:reponame/**", ignSignIn, repo.Http) From 0d39c18b6ad715a68144d3d9e7f9ea3893f07d4f Mon Sep 17 00:00:00 2001 From: Gogs Date: Sun, 23 Mar 2014 18:19:24 +0800 Subject: [PATCH 05/22] rollback conf/app.ini --- conf/app.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index 160aef0ff..ecb0d2511 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -7,7 +7,7 @@ RUN_USER = lunny RUN_MODE = dev [repository] -ROOT = /home/work/%(RUN_USER)s/git/gogs-repositories +ROOT = /Users/%(RUN_USER)s/git/gogs-repositories LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License @@ -15,7 +15,7 @@ LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0| DOMAIN = localhost ROOT_URL = http://%(DOMAIN)s:%(HTTP_PORT)s/ HTTP_ADDR = -HTTP_PORT = 8002 +HTTP_PORT = 3000 [database] ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice @@ -23,7 +23,7 @@ DB_TYPE = mysql HOST = NAME = gogs USER = root -PASSWD = toor +PASSWD = ; For "postgres" only, either "disable", "require" or "verify-full" SSL_MODE = disable ; For "sqlite3" only @@ -120,4 +120,4 @@ HOST = USER = PASSWD = ; Receivers, can be one or more, e.g. ["1@example.com","2@example.com"] -RECEIVERS = +RECEIVERS = \ No newline at end of file From 97debac18534e030924654befc6dc1eeb870a38b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 23 Mar 2014 08:40:40 -0400 Subject: [PATCH 06/22] SSL enable config option --- README.md | 4 ++-- README_ZH.md | 4 ++-- conf/app.ini | 2 ++ gogs.go | 2 +- models/user.go | 2 +- modules/base/conf.go | 4 ++++ modules/base/tool.go | 2 +- modules/middleware/repo.go | 6 +++++- routers/admin/admin.go | 1 + routers/dashboard.go | 2 +- templates/admin/config.tmpl | 1 + templates/status/404.tmpl | 1 + 12 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e947d7739..42eba6362 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language ![Demo](http://gowalker.org/public/gogs_demo.gif) -##### Current version: 0.1.6 Alpha +##### Current version: 0.1.7 Alpha #### Other language version @@ -27,7 +27,7 @@ More importantly, Gogs only needs one binary to setup your own project hosting o ## Features - Activity timeline -- SSH protocol support. +- SSH/HTTPS protocol support. - Register/delete account. - Create/delete/watch public repository. - User profile page. diff --git a/README_ZH.md b/README_ZH.md index 78e26fada..b405e0419 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。 ![Demo](http://gowalker.org/public/gogs_demo.gif) -##### 当前版本:0.1.6 Alpha +##### 当前版本:0.1.7 Alpha ## 开发目的 @@ -23,7 +23,7 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 ## 功能特性 - 活动时间线 -- SSH 协议支持 +- SSH/HTTPS 协议支持 - 注册/删除用户 - 创建/删除/关注公开仓库 - 用户个人信息页面 diff --git a/conf/app.ini b/conf/app.ini index b051557f4..ab9f6dc4b 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -32,6 +32,8 @@ PATH = data/gogs.db [admin] [security] +; Use HTTPS to clone repository, otherwise use HTTP. +ENABLE_HTTPS_CLONE = false ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! SECRET_KEY = !#@FDEWREWR&*( ; Auto-login remember days diff --git a/gogs.go b/gogs.go index 0bdbbc069..09b28f9b3 100644 --- a/gogs.go +++ b/gogs.go @@ -20,7 +20,7 @@ import ( // Test that go1.2 tag above is included in builds. main.go refers to this definition. const go12tag = true -const APP_VER = "0.1.6.0323.1" +const APP_VER = "0.1.7.0323.1" func init() { base.AppVer = APP_VER diff --git a/models/user.go b/models/user.go index 9333d1ee6..c9d6e6130 100644 --- a/models/user.go +++ b/models/user.go @@ -208,7 +208,7 @@ func UpdateUser(user *User) (err error) { user.Website = user.Website[:255] } - _, err = orm.Id(user.Id).UseBool().Cols("website", "location").Update(user) + _, err = orm.Id(user.Id).UseBool().Cols("website", "location", "is_active", "is_admin").Update(user) return err } diff --git a/modules/base/conf.go b/modules/base/conf.go index 19f587077..fba05e880 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -38,6 +38,8 @@ var ( RunUser string RepoRootPath string + EnableHttpsClone bool + LogInRememberDays int CookieUserName string CookieRememberName string @@ -260,6 +262,8 @@ func NewConfigContext() { SecretKey = Cfg.MustValue("security", "SECRET_KEY") RunUser = Cfg.MustValue("", "RUN_USER") + EnableHttpsClone = Cfg.MustBool("security", "ENABLE_HTTPS_CLONE", false) + LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS") CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME") CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME") diff --git a/modules/base/tool.go b/modules/base/tool.go index b48566f54..6d31b0525 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -519,7 +519,7 @@ func ActionDesc(act Actioner, avatarLink string) string { buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, actUserName, repoName, commit[0], commit[0][:7], commit[1]) + "\n") } if push.Len > 3 { - buf.WriteString(fmt.Sprintf(``, actUserName, repoName, push.Len)) + buf.WriteString(fmt.Sprintf(``, actUserName, repoName, branch, push.Len)) } return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, actUserName, repoName, branch, branch, actUserName, repoName, actUserName, repoName, buf.String()) diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 3864caaf8..eea2570ca 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -69,8 +69,12 @@ func RepoAssignment(redirect bool) martini.Handler { ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id) } ctx.Repo.Repository = repo + scheme := "http" + if base.EnableHttpsClone { + scheme = "https" + } ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName) - ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("https://%s/%s/%s.git", base.Domain, user.LowerName, repo.LowerName) + ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName) ctx.Data["IsRepositoryValid"] = true ctx.Data["Repository"] = repo diff --git a/routers/admin/admin.go b/routers/admin/admin.go index c0f39f715..f1f951ef2 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -141,6 +141,7 @@ func Config(ctx *middleware.Context) { ctx.Data["Domain"] = base.Domain ctx.Data["RunUser"] = base.RunUser ctx.Data["RunMode"] = strings.Title(martini.Env) + ctx.Data["EnableHttpsClone"] = base.EnableHttpsClone ctx.Data["RepoRootPath"] = base.RepoRootPath ctx.Data["Service"] = base.Service diff --git a/routers/dashboard.go b/routers/dashboard.go index dafe9f31e..76ecc3f67 100644 --- a/routers/dashboard.go +++ b/routers/dashboard.go @@ -26,6 +26,6 @@ func Help(ctx *middleware.Context) { func NotFound(ctx *middleware.Context) { ctx.Data["PageIsNotFound"] = true - ctx.Data["Title"] = 404 + ctx.Data["Title"] = "Page Not Found" ctx.Handle(404, "home.NotFound", nil) } diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 048740e61..915c9dc08 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -17,6 +17,7 @@
Run User: {{.RunUser}}
Run Mode: {{.RunMode}}

+
Enable HTTPS Clone
Repository Root Path: {{.RepoRootPath}}
diff --git a/templates/status/404.tmpl b/templates/status/404.tmpl index c2cafe0c9..b971f279a 100644 --- a/templates/status/404.tmpl +++ b/templates/status/404.tmpl @@ -4,5 +4,6 @@

404


Application Version: {{AppVer}}

+

If you think it is an error, please open an issue on GitHub.

{{template "base/footer" .}} \ No newline at end of file From 559cd63fc5feace32bb44c695207579609516f15 Mon Sep 17 00:00:00 2001 From: slene Date: Sun, 23 Mar 2014 20:58:12 +0800 Subject: [PATCH 07/22] fix code view indentation --- public/css/markdown.css | 5 ++-- public/js/app.js | 44 +++++++++++++++++++-------------- templates/repo/single_file.tmpl | 4 +-- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/public/css/markdown.css b/public/css/markdown.css index 9f4024ba8..d46fd9436 100644 --- a/public/css/markdown.css +++ b/public/css/markdown.css @@ -135,13 +135,12 @@ box-shadow: inset 40px 0 0 #f5f5f5, inset 41px 0 0 #ccc; } -.markdown > pre > code, -.markdown > pre > ol.linenums > li > code { +.markdown > pre > code { white-space: pre; word-wrap: normal; } -.markdown > pre > ol.linenums > li > code { +.markdown > pre > ol.linenums > li { padding: 0 10px; } diff --git a/public/js/app.js b/public/js/app.js index e0f92854f..3e995d5b0 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -110,25 +110,6 @@ var Gogits = { $pre.addClass('prettyprint linenums'); prettyPrint(); - var $lineNums = $pre.parent().siblings('.lines-num'); - if ($lineNums.length > 0) { - var nums = $pre.find('ol.linenums > li').length; - for (var i = 1; i <= nums; i++) { - $lineNums.append('' + i + ''); - } - - var last; - $(document).on('click', '.lines-num span', function () { - var $e = $(this); - if (last) { - last.removeClass('active'); - } - last = $e.parent().siblings('.lines-code').find('ol.linenums > ' + $e.attr('rel')); - last.addClass('active'); - window.location.href = '#' + $e.attr('id'); - }); - } - // Set anchor. var headers = {}; $md.find('h1, h2, h3, h4, h5, h6').each(function () { @@ -148,6 +129,30 @@ var Gogits = { }); } + Gogits.renderCodeView = function () { + $('.code-view .lines-code > pre').each(function(){ + var $pre = $(this); + var $lineNums = $pre.parent().siblings('.lines-num'); + if ($lineNums.length > 0) { + var nums = $pre.find('ol.linenums > li').length; + for (var i = 1; i <= nums; i++) { + $lineNums.append('' + i + ''); + } + + var last; + $(document).on('click', '.lines-num span', function () { + var $e = $(this); + if (last) { + last.removeClass('active'); + } + last = $e.parent().siblings('.lines-code').find('ol.linenums > ' + $e.attr('rel')); + last.addClass('active'); + window.location.href = '#' + $e.attr('id'); + }); + } + }); + }; + })(jQuery); // ajax utils @@ -177,6 +182,7 @@ function initCore() { Gogits.initModals(); Gogits.initDropDown(); Gogits.renderMarkdown(); + Gogits.renderCodeView(); } function initRegister() { diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 7bca626aa..40ef44eb1 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -16,12 +16,12 @@ {{.FileContent|str2html}} {{else}} -
+
- +
{{.FileContent}}
{{.FileContent}}
From f7f175a0793a53f3c50d20d89e324a610f94c442 Mon Sep 17 00:00:00 2001 From: slene Date: Sun, 23 Mar 2014 22:14:29 +0800 Subject: [PATCH 08/22] fix code select range --- public/js/app.js | 83 ++++++++++++++++++++++++++++++++++++++++-------- public/js/lib.js | 2 +- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 3e995d5b0..d5185580f 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -31,6 +31,23 @@ var Gogits = { } }; return ajax(url, options); + }, + + changeHash: function(hash) { + if(history.pushState) { + history.pushState(null, null, hash); + } + else { + location.hash = hash; + } + }, + + deSelect: function() { + if(window.getSelection) { + window.getSelection().removeAllRanges(); + } else { + document.selection.empty(); + } } }); }(jQuery)); @@ -130,27 +147,67 @@ var Gogits = { } Gogits.renderCodeView = function () { + function selectRange($list, $select, $from){ + $list.removeClass('active'); + if($from){ + var a = parseInt($select.attr('rel').substr(1)); + var b = parseInt($from.attr('rel').substr(1)); + var c; + if(a != b){ + if(a > b){ + c = a; + a = b; + b = c; + } + var classes = []; + for(i = a; i <= b; i++) { + classes.push('.L'+i); + } + $list.filter(classes.join(',')).addClass('active'); + $.changeHash('#L' + a + '-' + 'L' + b); + return + } + } + $select.addClass('active'); + $.changeHash('#' + $select.attr('rel')); + } + + $(document).on('click', '.lines-num span', function (e) { + var $select = $(this); + var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li'); + selectRange($list, $list.filter('[rel='+$select.attr('rel')+']'), (e.shiftKey?$list.filter('.active').eq(0):null)); + $.deSelect(); + }); + $('.code-view .lines-code > pre').each(function(){ var $pre = $(this); - var $lineNums = $pre.parent().siblings('.lines-num'); + var $lineCode = $pre.parent(); + var $lineNums = $lineCode.siblings('.lines-num'); if ($lineNums.length > 0) { var nums = $pre.find('ol.linenums > li').length; for (var i = 1; i <= nums; i++) { - $lineNums.append('' + i + ''); + $lineNums.append('' + i + ''); } - - var last; - $(document).on('click', '.lines-num span', function () { - var $e = $(this); - if (last) { - last.removeClass('active'); - } - last = $e.parent().siblings('.lines-code').find('ol.linenums > ' + $e.attr('rel')); - last.addClass('active'); - window.location.href = '#' + $e.attr('id'); - }); } }); + + $(window).on('hashchange', function(e) { + var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/); + var $list = $('.code-view ol.linenums > li'); + if(m){ + var $first = $list.filter('.'+m[1]); + selectRange($list, $first, $list.filter('.'+m[2])); + $("html, body").scrollTop($first.offset().top-200); + console.log($first.offset().top); + return; + } + m = window.location.hash.match(/^#(L\d+)$/); + if(m){ + var $first = $list.filter('.'+m[1]); + selectRange($list, $first); + $("html, body").scrollTop($first.offset().top-200); + } + }).trigger('hashchange'); }; })(jQuery); diff --git a/public/js/lib.js b/public/js/lib.js index b5cc41c04..8735ac9c1 100644 --- a/public/js/lib.js +++ b/public/js/lib.js @@ -340,7 +340,7 @@ q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(? s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/, q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d= c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"], From b9302749ddc0e0a10911a83bf80e165b792c8c1e Mon Sep 17 00:00:00 2001 From: skyblue Date: Sun, 23 Mar 2014 22:19:19 +0800 Subject: [PATCH 09/22] update default image --- public/img/avatar/default.jpg | Bin 17379 -> 6951 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/img/avatar/default.jpg b/public/img/avatar/default.jpg index c5a698da91f00405ca92b87252def7a5425ecd4b..728ec5af6c197ae10062f55331348756f9e52fc6 100644 GIT binary patch literal 6951 zcmbVxcT`i|x9y=93&lh!N)QxK1f&VlA}S!LAYEw@kQP*=Baj578k$N|M56G~OO)P& zR1uLP5Cj1edQYeUQf~NucicP1`|G{8b5_Pkvi8ZD`^>f1TJtbQ8GiwOBYi`CfQ1DB zSeP$>K?gK%nCa+#f0+|bBC+~}U3fq1|br3;tD zz5N{@d-y#U*A~BenU^sR+yK~ESq~59U}qj2+#DS2>>RvYT%6oTd5<1F!h7V%vEzdL z$BqjeKXQcsB)`B35Eu+T%6CfWBuGdQ1O^?RgoTYchn<6mgM$Zj?8q_D|MOt900P{= zH{cr^iv++bz``cL!e|E|OpqKb{|?~42Ma6n8acVRd3cX79jf>NRu(okR(7_-t7dv5 zn7;$;0vv*86?HjJm^yMvc!QL}Uw`73y#D1Y*ld7wPT9%l1rP7ZQ$oTb=cS}&E?iVm zy`rXmRpZ7@J$-{)hDPQVmR8pHAJ{lQa&dKY_kjEQ`3D3BJr9nEjEatleTjaPoRXTB z{`Or)cFsS!dHDr}MdcNhRn;}Mb@i=n?H!$6-@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+a`uu!#k#Nc0KfdPA{DkI{+5MXw%4`HGU?`|9=8y0-F8o zGwTW7ida^f;M2?#d7gX(eLgZKblS{cr~*&C0#~-&sB22NjTAavcrD&J-K>aU`qBDv z+@i9Gh^R-@9Ovy}5~B901J_)~V{HYGK!(CDC9o_AG!h2q<2tzr2(Si#d$m(}rOpTl zReY?*$%)g?yfA^uhKw_!HsgjSx z;?VEKn7{rOu0%YN=fNU&QsS~IPB{Ce(*S3wY7l$DTyLAf~gJ-TlvEXO--aE37aSt#c;KfCtSufSclCwI!*lTQy2&*Ft9A?P^T!L*ZX1aExtz-d zR4pHx&b}FIXG(P<<*rNs`q2nYe((V551p=WlU;8v$%AHT-AvMEz;(=aN&Yc5Y&-Df z_E_%S^$myu}s|1qzkXA;Etr=Bva2p$5?!OaM$Ix>khAR1^)mCz2;KR#slB06>@=| r6z@+r6fu?f1kjq3ue#n=PlQ9d2Cc+uB=6|S6?Uy3jL;>f{B!@=bPBAW From dd12d0cf8227d7a0706f62485b8b2f8783cfe09d Mon Sep 17 00:00:00 2001 From: slene Date: Sun, 23 Mar 2014 22:47:46 +0800 Subject: [PATCH 10/22] remove --- public/js/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/js/app.js b/public/js/app.js index d5185580f..4bf4b29e5 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -198,7 +198,6 @@ var Gogits = { var $first = $list.filter('.'+m[1]); selectRange($list, $first, $list.filter('.'+m[2])); $("html, body").scrollTop($first.offset().top-200); - console.log($first.offset().top); return; } m = window.location.hash.match(/^#(L\d+)$/); From 6bc7ae971a32b1ca6ce5332224de4023e1e6704c Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 23 Mar 2014 10:58:50 -0400 Subject: [PATCH 11/22] Mirror fix --- .gitignore | 3 ++- .gopmfile | 1 + conf/app.ini | 2 -- modules/base/conf.go | 4 +--- .../img/{avatar/default.jpg => avatar_default.jpg} | Bin routers/admin/admin.go | 1 - templates/admin/config.tmpl | 1 - web.go | 2 +- 8 files changed, 5 insertions(+), 9 deletions(-) rename public/img/{avatar/default.jpg => avatar_default.jpg} (100%) diff --git a/.gitignore b/.gitignore index d201223ef..425f227c1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ custom/ data/ .vendor/ .idea/ -*.iml \ No newline at end of file +*.iml +public/img/avatar/ \ No newline at end of file diff --git a/.gopmfile b/.gopmfile index 6e6b59c62..bd641a17c 100644 --- a/.gopmfile +++ b/.gopmfile @@ -8,6 +8,7 @@ github.com/Unknwon/com= github.com/Unknwon/cae= github.com/Unknwon/goconfig= github.com/dchest/scrypt= +github.com/nfnt/resize= github.com/lunny/xorm= github.com/gogits/logs= github.com/gogits/binding= diff --git a/conf/app.ini b/conf/app.ini index ab9f6dc4b..ee44dd408 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -105,8 +105,6 @@ SESSION_ID_HASHKEY = [picture] ; The place to picture data, either "server" or "qiniu", default is "server" SERVICE = server -; For "server" only, root path of picture data, default is "data/pictures" -PATH = data/pictures [log] ; Either "console", "file", "conn", "smtp" or "database", default is "console" diff --git a/modules/base/conf.go b/modules/base/conf.go index fba05e880..b243a6ad5 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -58,8 +58,7 @@ var ( SessionConfig *session.Config SessionManager *session.Manager - PictureService string - PictureRootPath string + PictureService string ) var Service struct { @@ -269,7 +268,6 @@ func NewConfigContext() { CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME") PictureService = Cfg.MustValue("picture", "SERVICE") - PictureRootPath = Cfg.MustValue("picture", "PATH") // Determine and create root git reposiroty path. RepoRootPath = Cfg.MustValue("repository", "ROOT") diff --git a/public/img/avatar/default.jpg b/public/img/avatar_default.jpg similarity index 100% rename from public/img/avatar/default.jpg rename to public/img/avatar_default.jpg diff --git a/routers/admin/admin.go b/routers/admin/admin.go index f1f951ef2..0b5e3d8e7 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -161,7 +161,6 @@ func Config(ctx *middleware.Context) { ctx.Data["SessionConfig"] = base.SessionConfig ctx.Data["PictureService"] = base.PictureService - ctx.Data["PictureRootPath"] = base.PictureRootPath ctx.Data["LogMode"] = base.LogMode ctx.Data["LogConfig"] = base.LogConfig diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 915c9dc08..d33a07cc3 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -104,7 +104,6 @@
Picture Service: {{.PictureService}}
-
Picture Root Path: {{.PictureRootPath}}
diff --git a/web.go b/web.go index d055c3940..4b7d4ef03 100644 --- a/web.go +++ b/web.go @@ -94,7 +94,7 @@ func runWeb(*cli.Context) { m.Get("/stars", reqSignIn, user.Stars) m.Get("/help", routers.Help) - avatarCache := avatar.HttpHandler("public/img/avatar/", "public/img/avatar/default.jpg") + avatarCache := avatar.HttpHandler("public/img/avatar/", "public/img/avatar_default.jpg") m.Get("/avatar/:hash", avatarCache.ServeHTTP) m.Group("/user", func(r martini.Router) { From f8cfb81fb027313e45b8ce505200f3d48b306fe2 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 23 Mar 2014 12:16:17 -0400 Subject: [PATCH 12/22] Mirror updates --- CONTRIBUTING.md | 40 +++++++++------------------------ models/user.go | 5 ++++- modules/log/log.go | 4 ++++ routers/repo/issue.go | 4 ++++ routers/repo/repo.go | 12 ++++++++-- templates/repo/nav.tmpl | 4 ++-- templates/repo/toolbar.tmpl | 12 +++++----- templates/user/dashboard.tmpl | 4 ++-- templates/user/issues.tmpl | 4 ++-- templates/user/setting_nav.tmpl | 4 ++-- 10 files changed, 46 insertions(+), 47 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 08013d370..1b71d5313 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,49 +1,29 @@ # Contributing to Gogs -Want to hack on Gogs? Awesome! Here are instructions to get you -started. They are probably not perfect, please let us know if anything -feels wrong or incomplete. +> Thanks [drone](https://github.com/drone/drone) because this guidelines sheet is forked from its [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md). + +Want to hack on Gogs? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete. ## Contribution guidelines ### Pull requests are always welcome -We are always thrilled to receive pull requests, and do our best to -process them as fast as possible. Not sure if that typo is worth a pull -request? Do it! We will appreciate it. +We are always thrilled to receive pull requests, and do our best to process them as fast as possible. Not sure if that typo is worth a pull request? Do it! We will appreciate it. -If your pull request is not accepted on the first try, don't be -discouraged! If there's a problem with the implementation, hopefully you -received feedback on what to improve. +If your pull request is not accepted on the first try, don't be discouraged! If there's a problem with the implementation, hopefully you received feedback on what to improve. -We're trying very hard to keep Gogs lean and focused. We don't want it -to do everything for everybody. This means that we might decide against -incorporating a new feature. +We're trying very hard to keep Gogs lean and focused. We don't want it to do everything for everybody. This means that we might decide against incorporating a new feature. ### Discuss your design on the mailing list -We recommend discussing your plans [on the mailing -list](https://groups.google.com/forum/#!forum/gogits) -before starting to code - especially for more ambitious contributions. -This gives other contributors a chance to point you in the right -direction, give feedback on your design, and maybe point out if someone -else is working on the same thing. +We recommend discussing your plans [on the mailing list](https://groups.google.com/forum/#!forum/gogits) before starting to code - especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give feedback on your design, and maybe point out if someone else is working on the same thing. -We may close your pull request if not first discussed on the mailing -list. We aren't doing this to be jerks. We are doing this to prevent -people from spending large amounts of time on changes that may need -to be designed or architected in a specific way, or may not align with -the vision of the project. +We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project. ### Create issues... -Any significant improvement should be documented as [a GitHub -issue](https://github.com/gogits/gogs/issues) before anybody -starts working on it. +Any significant improvement should be documented as [a GitHub issue](https://github.com/gogits/gogs/issues) before anybody starts working on it. ### ...but check for existing issues first! -Please take a moment to check that an issue doesn't already exist -documenting your bug report or improvement proposal. If it does, it -never hurts to add a quick "+1" or "I have this problem too". This will -help prioritize the most common problems and requests. \ No newline at end of file +Please take a moment to check that an issue doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests. \ No newline at end of file diff --git a/models/user.go b/models/user.go index 88bbabe6d..7fd7449ce 100644 --- a/models/user.go +++ b/models/user.go @@ -72,7 +72,10 @@ func (user *User) HomeLink() string { // AvatarLink returns the user gravatar link. func (user *User) AvatarLink() string { - return "/avatar/" + user.Avatar + if base.Service.EnableCacheAvatar { + return "/avatar/" + user.Avatar + } + return "http://1.gravatar.com/avatar/" + user.Avatar } // NewGitSig generates and returns the signature of given user. diff --git a/modules/log/log.go b/modules/log/log.go index 29782fb2b..80ade3d5b 100644 --- a/modules/log/log.go +++ b/modules/log/log.go @@ -20,6 +20,10 @@ func Trace(format string, v ...interface{}) { logger.Trace(format, v...) } +func Debug(format string, v ...interface{}) { + logger.Debug(format, v...) +} + func Info(format string, v ...interface{}) { logger.Info(format, v...) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 78fe4b25d..a9d879931 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -31,6 +31,10 @@ func Issues(ctx *middleware.Context, params martini.Params) { return } + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + ctx.Data["Branchname"] = params["branchname"] ctx.HTML(200, "repo/issues") } diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 82956098b..b05ce4a71 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -69,7 +69,10 @@ func Branches(ctx *middleware.Context, params martini.Params) { ctx.Data["Username"] = params["username"] ctx.Data["Reponame"] = params["reponame"] - ctx.Data["Branchname"] = brs[0] + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + ctx.Data["Branchname"] = params["branchname"] ctx.Data["Branches"] = brs ctx.Data["IsRepoToolbarBranches"] = true @@ -334,8 +337,13 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.HTML(200, "repo/commits") } -func Pulls(ctx *middleware.Context) { +func Pulls(ctx *middleware.Context, params martini.Params) { ctx.Data["IsRepoToolbarPulls"] = true + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + + ctx.Data["Branchname"] = params["branchname"] ctx.HTML(200, "repo/pulls") } diff --git a/templates/repo/nav.tmpl b/templates/repo/nav.tmpl index a3358fd89..080cb72e5 100644 --- a/templates/repo/nav.tmpl +++ b/templates/repo/nav.tmpl @@ -53,9 +53,9 @@
-
+ {{end}}
 {{.Repository.NumForks}} diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index b51768a3c..415023d17 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -6,27 +6,27 @@
  • Source
  • {{if not .IsBareRepo}}
  • Commits
  • -
  • Branches
  • -
  • Pull Requests
  • + +
  • Issues
  • -
    diff --git a/templates/user/issues.tmpl b/templates/user/issues.tmpl index 94f668945..e28af5bec 100644 --- a/templates/user/issues.tmpl +++ b/templates/user/issues.tmpl @@ -5,8 +5,8 @@

    Issues

    diff --git a/templates/user/setting_nav.tmpl b/templates/user/setting_nav.tmpl index 3a500fdaf..2905f2825 100644 --- a/templates/user/setting_nav.tmpl +++ b/templates/user/setting_nav.tmpl @@ -3,9 +3,9 @@ \ No newline at end of file From 003298ef1d53e1d9837bcac5aadb2e9e159a7497 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 23 Mar 2014 12:32:16 -0400 Subject: [PATCH 13/22] Add default behave of logger --- modules/log/log.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/log/log.go b/modules/log/log.go index 80ade3d5b..0c07c7c62 100644 --- a/modules/log/log.go +++ b/modules/log/log.go @@ -11,6 +11,11 @@ import ( var logger *logs.BeeLogger +func init() { + logger = logs.NewLogger(10000) + logger.SetLogger("console", `{"level": 0}`) +} + func NewLogger(bufLen int64, mode, config string) { logger = logs.NewLogger(bufLen) logger.SetLogger(mode, config) From b9b82cfe477bcbfd3541adfc969ff20210d56549 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 23 Mar 2014 19:09:11 -0400 Subject: [PATCH 14/22] Mirror updates --- .gobuild.yml | 3 ++- conf/app.ini | 2 ++ models/issue.go | 19 ++++++++++++++--- modules/base/conf.go | 13 ++++++++++++ routers/repo/issue.go | 40 +++++++++++++++++++++++++++++++++-- templates/admin/config.tmpl | 1 + templates/user/dashboard.tmpl | 2 +- templates/user/profile.tmpl | 2 +- web.go | 3 ++- 9 files changed, 76 insertions(+), 9 deletions(-) diff --git a/.gobuild.yml b/.gobuild.yml index d667c9308..78a38f2d3 100644 --- a/.gobuild.yml +++ b/.gobuild.yml @@ -4,4 +4,5 @@ filesets: - public - conf - LICENSE - - README.md \ No newline at end of file + - README.md + - README_ZH.md \ No newline at end of file diff --git a/conf/app.ini b/conf/app.ini index ee44dd408..809ea61c0 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -52,6 +52,8 @@ DISENABLE_REGISTERATION = false REQUIRE_SIGNIN_VIEW = false ; Cache avatar as picture ENABLE_CACHE_AVATAR = false +; Mail notification +ENABLE_NOTIFY_MAIL = false [mailer] ENABLED = false diff --git a/models/issue.go b/models/issue.go index 929567b1b..fe43a94b5 100644 --- a/models/issue.go +++ b/models/issue.go @@ -58,6 +58,7 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co Content: content, } _, err = orm.Insert(issue) + // TODO: newIssueAction return issue, err } @@ -67,9 +68,9 @@ func GetIssueCount(repoId int64) (int64, error) { } // GetIssueById returns issue object by given id. -func GetIssueById(id int64) (*Issue, error) { - issue := new(Issue) - has, err := orm.Id(id).Get(issue) +func GetIssueByIndex(repoId, index int64) (*Issue, error) { + issue := &Issue{RepoId: repoId, Index: index} + has, err := orm.Get(issue) if err != nil { return nil, err } else if !has { @@ -126,6 +127,18 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed, return issues, err } +// UpdateIssue updates information of issue. +func UpdateIssue(issue *Issue) error { + _, err := orm.Update(issue, &Issue{RepoId: issue.RepoId, Index: issue.Index}) + return err +} + +func CloseIssue() { +} + +func ReopenIssue() { +} + // Label represents a list of labels of repository for issues. type Label struct { Id int64 diff --git a/modules/base/conf.go b/modules/base/conf.go index b243a6ad5..2bf529d9d 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -66,6 +66,7 @@ var Service struct { DisenableRegisteration bool RequireSignInView bool EnableCacheAvatar bool + NotifyMail bool ActiveCodeLives int ResetPwdCodeLives int } @@ -230,6 +231,17 @@ func newRegisterMailService() { log.Info("Register Mail Service Enabled") } +func newNotifyMailService() { + if !Cfg.MustBool("service", "ENABLE_NOTIFY_MAIL") { + return + } else if MailService == nil { + log.Warn("Notify Mail Service: Mail Service is not enabled") + return + } + Service.NotifyMail = true + log.Info("Notify Mail Service Enabled") +} + func NewConfigContext() { var err error workDir, err := exeDir() @@ -284,4 +296,5 @@ func NewServices() { newSessionService() newMailService() newRegisterMailService() + newNotifyMailService() } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index a9d879931..e03f115e2 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -67,13 +67,13 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat } func ViewIssue(ctx *middleware.Context, params martini.Params) { - issueid, err := base.StrTo(params["issueid"]).Int() + index, err := base.StrTo(params["index"]).Int() if err != nil { ctx.Handle(404, "issue.ViewIssue", err) return } - issue, err := models.GetIssueById(int64(issueid)) + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) if err != nil { if err == models.ErrIssueNotExist { ctx.Handle(404, "issue.ViewIssue", err) @@ -87,3 +87,39 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["Issue"] = issue ctx.HTML(200, "issue/view") } + +func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "issue.UpdateIssue", nil) + return + } + + index, err := base.StrTo(params["index"]).Int() + if err != nil { + ctx.Handle(404, "issue.UpdateIssue", err) + return + } + + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) + if err != nil { + if err == models.ErrIssueNotExist { + ctx.Handle(404, "issue.UpdateIssue", err) + } else { + ctx.Handle(200, "issue.UpdateIssue", err) + } + return + } + + issue.Name = form.IssueName + issue.MilestoneId = form.MilestoneId + issue.AssigneeId = form.AssigneeId + issue.Labels = form.Labels + issue.Content = form.Content + if err = models.UpdateIssue(issue); err != nil { + ctx.Handle(200, "issue.UpdateIssue", err) + return + } + + ctx.Data["Title"] = issue.Name + ctx.Data["Issue"] = issue +} diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index d33a07cc3..1e2630460 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -46,6 +46,7 @@
    Register Email Confirmation:
    Disenable Registeration:
    Require Sign In View:
    +
    Mail Notification:
    Enable Cache Avatar:

    Active Code Lives: {{.Service.ActiveCodeLives}} minutes
    diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index 6594e5459..ca5fecf26 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -34,7 +34,7 @@
    diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 2d76d9bf0..342236147 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -50,7 +50,7 @@
      {{range .Repos}}
    • -
      {{.NumStars}} {{.NumForks}}
      +
      {{.NumForks}}

      {{.LowerName}}

      diff --git a/web.go b/web.go index 4b7d4ef03..9a613dceb 100644 --- a/web.go +++ b/web.go @@ -145,7 +145,8 @@ func runWeb(*cli.Context) { r.Get("/commits/:branchname", repo.Commits) r.Get("/issues", repo.Issues) r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue) - r.Get("/issues/:issueid", repo.ViewIssue) + r.Get("/issues/:index", repo.ViewIssue) + r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue) r.Get("/pulls", repo.Pulls) r.Get("/branches", repo.Branches) r.Get("/src/:branchname", repo.Single) From 137538e54b3aade46cf2ef947707f4e32ba8a382 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 24 Mar 2014 18:25:15 +0800 Subject: [PATCH 15/22] refactor repo.go --- routers/repo/branch.go | 38 +++++++++++++++++++++++++ routers/repo/commit.go | 35 +++++++++++++++++++++++ routers/repo/pull.go | 20 ++++++++++++++ routers/repo/repo.go | 63 +----------------------------------------- 4 files changed, 94 insertions(+), 62 deletions(-) create mode 100644 routers/repo/branch.go create mode 100644 routers/repo/commit.go create mode 100644 routers/repo/pull.go diff --git a/routers/repo/branch.go b/routers/repo/branch.go new file mode 100644 index 000000000..8c953f2ed --- /dev/null +++ b/routers/repo/branch.go @@ -0,0 +1,38 @@ +// 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 repo + +import ( + "github.com/codegangsta/martini" + "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/middleware" +) + +func Branches(ctx *middleware.Context, params martini.Params) { + if !ctx.Repo.IsValid { + return + } + + brs, err := models.GetBranches(params["username"], params["reponame"]) + if err != nil { + ctx.Handle(200, "repo.Branches", err) + return + } else if len(brs) == 0 { + ctx.Handle(404, "repo.Branches", nil) + return + } + + ctx.Data["Username"] = params["username"] + ctx.Data["Reponame"] = params["reponame"] + + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + ctx.Data["Branchname"] = params["branchname"] + ctx.Data["Branches"] = brs + ctx.Data["IsRepoToolbarBranches"] = true + + ctx.HTML(200, "repo/branches") +} diff --git a/routers/repo/commit.go b/routers/repo/commit.go new file mode 100644 index 000000000..60ee2177f --- /dev/null +++ b/routers/repo/commit.go @@ -0,0 +1,35 @@ +// 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 repo + +import ( + "github.com/codegangsta/martini" + "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/middleware" +) + +func Commits(ctx *middleware.Context, params martini.Params) { + brs, err := models.GetBranches(params["username"], params["reponame"]) + if err != nil { + ctx.Handle(200, "repo.Commits", err) + return + } else if len(brs) == 0 { + ctx.Handle(404, "repo.Commits", nil) + return + } + + ctx.Data["IsRepoToolbarCommits"] = true + commits, err := models.GetCommits(params["username"], + params["reponame"], params["branchname"]) + if err != nil { + ctx.Handle(404, "repo.Commits", nil) + return + } + ctx.Data["Username"] = params["username"] + ctx.Data["Reponame"] = params["reponame"] + ctx.Data["CommitCount"] = commits.Len() + ctx.Data["Commits"] = commits + ctx.HTML(200, "repo/commits") +} diff --git a/routers/repo/pull.go b/routers/repo/pull.go new file mode 100644 index 000000000..d4a12a4a8 --- /dev/null +++ b/routers/repo/pull.go @@ -0,0 +1,20 @@ +// 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 repo + +import ( + "github.com/codegangsta/martini" + "github.com/gogits/gogs/modules/middleware" +) + +func Pulls(ctx *middleware.Context, params martini.Params) { + ctx.Data["IsRepoToolbarPulls"] = true + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + + ctx.Data["Branchname"] = params["branchname"] + ctx.HTML(200, "repo/pulls") +} diff --git a/routers/repo/repo.go b/routers/repo/repo.go index b05ce4a71..a055b416c 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -52,33 +52,6 @@ func Create(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Handle(200, "repo.Create", err) } -func Branches(ctx *middleware.Context, params martini.Params) { - if !ctx.Repo.IsValid { - return - } - - brs, err := models.GetBranches(params["username"], params["reponame"]) - if err != nil { - ctx.Handle(200, "repo.Branches", err) - return - } else if len(brs) == 0 { - ctx.Handle(404, "repo.Branches", nil) - return - } - - ctx.Data["Username"] = params["username"] - ctx.Data["Reponame"] = params["reponame"] - - if len(params["branchname"]) == 0 { - params["branchname"] = "master" - } - ctx.Data["Branchname"] = params["branchname"] - ctx.Data["Branches"] = brs - ctx.Data["IsRepoToolbarBranches"] = true - - ctx.HTML(200, "repo/branches") -} - func Single(ctx *middleware.Context, params martini.Params) { if !ctx.Repo.IsValid { return @@ -279,7 +252,7 @@ func Setting(ctx *middleware.Context, params martini.Params) { ctx.HTML(200, "repo/setting") } -func SettingPost(ctx *middleware.Context, params martini.Params) { +func SettingPost(ctx *middleware.Context) { if !ctx.Repo.IsOwner { ctx.Error(404) return @@ -313,40 +286,6 @@ func SettingPost(ctx *middleware.Context, params martini.Params) { } } -func Commits(ctx *middleware.Context, params martini.Params) { - brs, err := models.GetBranches(params["username"], params["reponame"]) - if err != nil { - ctx.Handle(200, "repo.Commits", err) - return - } else if len(brs) == 0 { - ctx.Handle(404, "repo.Commits", nil) - return - } - - ctx.Data["IsRepoToolbarCommits"] = true - commits, err := models.GetCommits(params["username"], - params["reponame"], params["branchname"]) - if err != nil { - ctx.Handle(404, "repo.Commits", nil) - return - } - ctx.Data["Username"] = params["username"] - ctx.Data["Reponame"] = params["reponame"] - ctx.Data["CommitCount"] = commits.Len() - ctx.Data["Commits"] = commits - ctx.HTML(200, "repo/commits") -} - -func Pulls(ctx *middleware.Context, params martini.Params) { - ctx.Data["IsRepoToolbarPulls"] = true - if len(params["branchname"]) == 0 { - params["branchname"] = "master" - } - - ctx.Data["Branchname"] = params["branchname"] - ctx.HTML(200, "repo/pulls") -} - func Action(ctx *middleware.Context, params martini.Params) { var err error switch params["action"] { From d44c44987f704e2d4343db8c252281c86adb4a71 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 06:50:11 -0400 Subject: [PATCH 16/22] Fix dashboard auto-log bug --- modules/middleware/auth.go | 2 +- web.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 82c3367c4..64f75d75c 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -21,7 +21,7 @@ type ToggleOptions struct { func Toggle(options *ToggleOptions) martini.Handler { return func(ctx *Context) { - if options.SignOutRequire && ctx.IsSigned { + if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" { ctx.Redirect("/") return } diff --git a/web.go b/web.go index 9a613dceb..4236d8b31 100644 --- a/web.go +++ b/web.go @@ -88,7 +88,7 @@ func runWeb(*cli.Context) { reqSignOut := middleware.Toggle(&middleware.ToggleOptions{SignOutRequire: true}) // Routers. - m.Get("/", ignSignIn, routers.Home) + m.Get("/", reqSignIn, routers.Home) m.Get("/issues", reqSignIn, user.Issues) m.Get("/pulls", reqSignIn, user.Pulls) m.Get("/stars", reqSignIn, user.Stars) From 59bbddb3183c27cbb5fb7918cefd9bb3a763a410 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 07:36:38 -0400 Subject: [PATCH 17/22] Mirror fix --- CONTRIBUTING.md | 2 ++ README.md | 6 ++++-- README_ZH.md | 10 ++++++---- gogs.go | 2 +- models/repo.go | 2 +- models/user.go | 2 +- routers/repo/pull.go | 1 + web.go | 5 +++-- 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b71d5313..17a3ebe68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,8 @@ > Thanks [drone](https://github.com/drone/drone) because this guidelines sheet is forked from its [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md). +**This document is pre^3 release, we're not ready for receiving contribution until v0.5.0 release.** + Want to hack on Gogs? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete. ## Contribution guidelines diff --git a/README.md b/README.md index 42eba6362..104b7eab5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gogits/gogs/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) ===================== Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language. @@ -48,9 +48,11 @@ There are two ways to install Gogs: ## Acknowledgments -- Logo is inspired by [martini](https://github.com/martini-contrib). +- Logo is inspired by [martini-contrib](https://github.com/martini-contrib). +- Router and middleware mechanism of [martini](http://martini.codegangsta.io/). - Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk). - System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog). +- Usage and modification from [beego](http://beego.me) modules. ## Contributors diff --git a/README_ZH.md b/README_ZH.md index b405e0419..838e30a0e 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -1,4 +1,4 @@ -Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gogits/gogs/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) ===================== Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。 @@ -44,9 +44,11 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 ## 特别鸣谢 -- Logo 基于 [martini](https://github.com/martini-contrib) 修改而来。 -- 邮件服务、模块设计基于 [WeTalk](https://github.com/beego/wetalk) 修改而来。 -- 系统监视状态基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改而来。 +- Logo 基于 [martini-contrib](https://github.com/martini-contrib) 修改而来。 +- 基于 [WeTalk](https://github.com/beego/wetalk) 修改的邮件服务和模块设计。 +- 基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改的系统监视状态。 +- [beego](http://beego.me) 模块的使用与修改。 +- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。 ## 贡献成员 diff --git a/gogs.go b/gogs.go index 09b28f9b3..93b7231b7 100644 --- a/gogs.go +++ b/gogs.go @@ -20,7 +20,7 @@ import ( // Test that go1.2 tag above is included in builds. main.go refers to this definition. const go12tag = true -const APP_VER = "0.1.7.0323.1" +const APP_VER = "0.1.7.0324" func init() { base.AppVer = APP_VER diff --git a/models/repo.go b/models/repo.go index e27e99b05..f03d7683d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -387,7 +387,7 @@ func UpdateRepository(repo *Repository) error { repo.Website = repo.Website[:255] } - _, err := orm.Id(repo.Id).UseBool().Cols("description", "website").Update(repo) + _, err := orm.Id(repo.Id).UseBool().Cols("description", "website", "updated").Update(repo) return err } diff --git a/models/user.go b/models/user.go index 7fd7449ce..d2ed5a907 100644 --- a/models/user.go +++ b/models/user.go @@ -211,7 +211,7 @@ func UpdateUser(user *User) (err error) { user.Website = user.Website[:255] } - _, err = orm.Id(user.Id).UseBool().Cols("website", "location", "is_active", "is_admin").Update(user) + _, err = orm.Id(user.Id).UseBool().Cols("email", "passwd", "avatar", "avatar_email", "website", "location", "is_active", "is_admin", "updated").Update(user) return err } diff --git a/routers/repo/pull.go b/routers/repo/pull.go index d4a12a4a8..16c60389d 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -6,6 +6,7 @@ package repo import ( "github.com/codegangsta/martini" + "github.com/gogits/gogs/modules/middleware" ) diff --git a/web.go b/web.go index 4236d8b31..f0f811257 100644 --- a/web.go +++ b/web.go @@ -31,9 +31,10 @@ import ( var CmdWeb = cli.Command{ Name: "web", - Usage: "just run", + Usage: "Gogs web server", Description: ` -gogs web`, +gogs web server is the only thing you need to run, +and it takes care of all the other things for you`, Action: runWeb, Flags: []cli.Flag{}, } From ae92f92dee9007d1bef2db19331d9ee8f9883778 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 09:01:25 -0400 Subject: [PATCH 18/22] Locating issue --- models/action.go | 2 ++ models/repo.go | 2 +- models/user.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/models/action.go b/models/action.go index 117492935..9471e9810 100644 --- a/models/action.go +++ b/models/action.go @@ -92,10 +92,12 @@ func CommitRepoAction(userId int64, userName string, // Update repository last update time. repo, err := GetRepositoryByName(userId, repoName) if err != nil { + log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repo.LowerName) return err } repo.IsBare = false if err = UpdateRepository(repo); err != nil { + log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repo.LowerName) return err } diff --git a/models/repo.go b/models/repo.go index f03d7683d..a76966b05 100644 --- a/models/repo.go +++ b/models/repo.go @@ -387,7 +387,7 @@ func UpdateRepository(repo *Repository) error { repo.Website = repo.Website[:255] } - _, err := orm.Id(repo.Id).UseBool().Cols("description", "website", "updated").Update(repo) + _, err := orm.Id(repo.Id).AllCols().Update(repo) return err } diff --git a/models/user.go b/models/user.go index d2ed5a907..6ca16ec32 100644 --- a/models/user.go +++ b/models/user.go @@ -211,7 +211,7 @@ func UpdateUser(user *User) (err error) { user.Website = user.Website[:255] } - _, err = orm.Id(user.Id).UseBool().Cols("email", "passwd", "avatar", "avatar_email", "website", "location", "is_active", "is_admin", "updated").Update(user) + _, err = orm.Id(user.Id).AllCols().Update(user) return err } From 8376b0d53cae91af0e180c05b9cb92c3f3f30d58 Mon Sep 17 00:00:00 2001 From: shxsun Date: Mon, 24 Mar 2014 21:16:00 +0800 Subject: [PATCH 19/22] use modeles/log instead log --- modules/avatar/avatar.go | 28 +++++++++++++--------------- modules/avatar/avatar_test.go | 13 +++++++++---- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go index 1a18d8a7e..0ba20294a 100644 --- a/modules/avatar/avatar.go +++ b/modules/avatar/avatar.go @@ -3,6 +3,14 @@ // license that can be found in the LICENSE file. // for www.gravatar.com image cache + +/* +It is recommend to use this way + + cacheDir := "./cache" + defaultImg := "./default.jpg" + http.Handle("/avatar/", avatar.HttpHandler(cacheDir, defaultImg)) +*/ package avatar import ( @@ -14,7 +22,6 @@ import ( "image/jpeg" "image/png" "io" - "log" "net/http" "net/url" "os" @@ -23,6 +30,7 @@ import ( "sync" "time" + "github.com/gogits/gogs/modules/log" "github.com/nfnt/resize" ) @@ -30,12 +38,6 @@ var ( gravatar = "http://www.gravatar.com/avatar" ) -func debug(a ...interface{}) { - if true { - log.Println(a...) - } -} - // hash email to md5 string // keep this func in order to make this package indenpent func HashEmail(email string) string { @@ -125,7 +127,7 @@ func (this *Avatar) UpdateTimeout(timeout time.Duration) error { var err error select { case <-time.After(timeout): - err = errors.New("get gravatar image timeout") + err = fmt.Errorf("get gravatar image %s timeout", this.Hash) case err = <-thunder.GoFetch(gravatar+"/"+this.Hash+"?"+this.reqParams, this.imagePath): } @@ -150,16 +152,14 @@ func (this *avatarHandler) mustInt(r *http.Request, defaultValue int, keys ...st func (this *avatarHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { urlPath := r.URL.Path hash := urlPath[strings.LastIndex(urlPath, "/")+1:] - //hash = HashEmail(hash) - size := this.mustInt(r, 80, "s", "size") // size = 80*80 + size := this.mustInt(r, 80, "s", "size") // default size = 80*80 avatar := New(hash, this.cacheDir) avatar.AlterImage = this.altImage if avatar.Expired() { err := avatar.UpdateTimeout(time.Millisecond * 500) if err != nil { - debug(err) - //log.Trace("avatar update error: %v", err) + log.Trace("avatar update error: %v", err) } } if modtime, err := avatar.Modtime(); err == nil { @@ -177,8 +177,7 @@ func (this *avatarHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "image/jpeg") err := avatar.Encode(w, size) if err != nil { - //log.Warn("avatar encode error: %v", err) // will panic when err != nil - debug(err) + log.Warn("avatar encode error: %v", err) w.WriteHeader(500) } } @@ -251,7 +250,6 @@ func (this *thunderTask) Fetch() { var client = &http.Client{} func (this *thunderTask) fetch() error { - //log.Println("thunder, fetch", this.Url) req, _ := http.NewRequest("GET", this.Url, nil) req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") req.Header.Set("Accept-Encoding", "gzip,deflate,sdch") diff --git a/modules/avatar/avatar_test.go b/modules/avatar/avatar_test.go index a337959c6..4656d6f0f 100644 --- a/modules/avatar/avatar_test.go +++ b/modules/avatar/avatar_test.go @@ -4,13 +4,14 @@ package avatar_test import ( - "log" + "errors" "os" "strconv" "testing" "time" "github.com/gogits/gogs/modules/avatar" + "github.com/gogits/gogs/modules/log" ) const TMPDIR = "test-avatar" @@ -28,7 +29,7 @@ func TestFetchMany(t *testing.T) { os.Mkdir(TMPDIR, 0755) defer os.RemoveAll(TMPDIR) - log.Println("start") + t.Log("start") var n = 5 ch := make(chan bool, n) for i := 0; i < n; i++ { @@ -36,14 +37,14 @@ func TestFetchMany(t *testing.T) { hash := avatar.HashEmail(strconv.Itoa(i) + "ssx205@gmail.com") a := avatar.New(hash, TMPDIR) a.Update() - log.Println("finish", hash) + t.Log("finish", hash) ch <- true }(i) } for i := 0; i < n; i++ { <-ch } - log.Println("end") + t.Log("end") } // cat @@ -54,3 +55,7 @@ func TestHttp(t *testing.T) { http.ListenAndServe(":8001", nil) } */ + +func TestLogTrace(t *testing.T) { + log.Trace("%v", errors.New("console log test")) +} From 5e22f1437ac2466d599c242fd5e256180fa7b68e Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 24 Mar 2014 21:27:19 +0800 Subject: [PATCH 20/22] diff page ui --- public/css/gogs.css | 131 +++++++++++- public/js/app.js | 73 ++++--- routers/repo/commit.go | 6 + templates/repo/diff.tmpl | 418 +++++++++++++++++++++++++++++++++++++++ web.go | 4 +- 5 files changed, 599 insertions(+), 33 deletions(-) create mode 100644 templates/repo/diff.tmpl diff --git a/public/css/gogs.css b/public/css/gogs.css index 65a6c03d7..ec37721fd 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -798,7 +798,7 @@ html, body { margin-left: .5em; } -.commit-box .avatar { +.commit-box .avatar, .diff-head-box .avatar { width: 20px; height: 20px; margin-right: 8px; @@ -831,10 +831,137 @@ html, body { background-color: #FFF; } -.guide-box { +.guide-box, .diff-head-box { margin-top: 20px; } +.diff-head-box h4 { + margin-top: 0; + margin-bottom: 0; + line-height: 26px; +} + +.diff-head-box p { + margin-bottom: 0; +} + +.diff-head-box .sha { + margin-left: 8px; +} + +.diff-head-box a.name { + color: #444; + margin-right: 8px; +} + +.diff-head-box span.time { + color: #888; +} + +.diff-detail-box { + margin-bottom: 16px; + line-height: 30px; +} + +.diff-detail-box span.status { + display: inline-block; + width: 12px; + height: 12px; + margin-right: 8px; + vertical-align: middle; +} + +.diff-detail-box ol { + padding-left: 0; + margin-bottom: 28px; +} + +.diff-detail-box li { + list-style: none; + padding-bottom: 4px; + margin-bottom: 4px; + border-bottom: 1px dashed #DDD; + padding-left: 6px; +} + +.diff-detail-box span.status.modify { + background-color: #f0db88; +} + +.diff-detail-box span.status.add { + background-color: #b4e2b4; +} + +.diff-detail-box span.status.del { + background-color: #e9aeae; +} + +.diff-detail-box span.status.rename{ + background-color: #dad8ff; +} + +.diff-file-box .panel-heading { + padding: 10px 20px; + line-height: 26px; +} + +.diff-box .count { + margin-right: 12px; +} + +.diff-box .count .bar { + width: 40px; + display: inline-block; + margin: 2px 4px 0 4px; + vertical-align: text-top; +} + +.diff-box .file { + color: #888; +} + +#gogs-source .file-content.diff-file-box { + margin-bottom: 20px; +} + +.diff-box .count .bar .add { + background-color: #77c64a; + height: 12px; +} + +.diff-box .count .bar .del, .diff-box .count .bar { + background-color: #e75316; + height: 12px; +} + +.diff-file-box .file-body.file-code .lines-code > pre { + margin: 0; + padding: 3px; +} + +.diff-file-box .file-body.file-code .lines-num-old { + border-right: 1px solid #DDD; +} + +.diff-file-box .code-bin td { + padding: 20px; +} + +.diff-file-box .code-diff tbody tr.add-code td, .diff-file-box .code-diff tbody tr.add-code pre { + background-color: #d1ffd6 !important; + border-color: #b4e2b4 !important; +} + +.diff-file-box .code-diff tbody tr.del-code td, .diff-file-box .code-diff tbody tr.del-code pre { + background-color: #ffe2dd !important; + border-color: #e9aeae !important; +} + +.diff-file-box .code-diff tbody tr:hover td, .diff-file-box .code-diff tbody tr:hover pre { + background-color: #fff8d2 !important; + border-color: #f0db88 !important; +} + /* wrapper and footer */ #wrapper { diff --git a/public/js/app.js b/public/js/app.js index 4bf4b29e5..9a58a6f2f 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -2,11 +2,11 @@ var Gogits = { "PageIsSignup": false }; -(function($){ +(function ($) { // extend jQuery ajax, set csrf token value var ajax = $.ajax; $.extend({ - ajax: function(url, options) { + ajax: function (url, options) { if (typeof url === 'object') { options = url; url = undefined; @@ -17,24 +17,24 @@ var Gogits = { var headers = options.headers || {}; var domain = document.domain.replace(/\./ig, '\\.'); if (!/^(http:|https:).*/.test(url) || eval('/^(http:|https:)\\/\\/(.+\\.)*' + domain + '.*/').test(url)) { - headers = $.extend(headers, {'X-Csrf-Token':csrftoken}); + headers = $.extend(headers, {'X-Csrf-Token': csrftoken}); } options.headers = headers; var callback = options.success; - options.success = function(data){ - if(data.once){ + options.success = function (data) { + if (data.once) { // change all _once value if ajax data.once exist $('[name=_once]').val(data.once); } - if(callback){ + if (callback) { callback.apply(this, arguments); } }; return ajax(url, options); }, - changeHash: function(hash) { - if(history.pushState) { + changeHash: function (hash) { + if (history.pushState) { history.pushState(null, null, hash); } else { @@ -42,8 +42,8 @@ var Gogits = { } }, - deSelect: function() { - if(window.getSelection) { + deSelect: function () { + if (window.getSelection) { window.getSelection().removeAllRanges(); } else { document.selection.empty(); @@ -114,8 +114,8 @@ var Gogits = { $tabs.find("li:eq(0) a").tab("show"); }; // fix dropdown inside click - Gogits.initDropDown = function(){ - $('.dropdown-menu.no-propagation').on('click',function(e){ + Gogits.initDropDown = function () { + $('.dropdown-menu.no-propagation').on('click', function (e) { e.stopPropagation(); }); }; @@ -144,24 +144,24 @@ var Gogits = { node = node.wrap('
      '); node.append(''); }); - } + }; Gogits.renderCodeView = function () { - function selectRange($list, $select, $from){ + function selectRange($list, $select, $from) { $list.removeClass('active'); - if($from){ + if ($from) { var a = parseInt($select.attr('rel').substr(1)); var b = parseInt($from.attr('rel').substr(1)); var c; - if(a != b){ - if(a > b){ + if (a != b) { + if (a > b) { c = a; a = b; b = c; } var classes = []; - for(i = a; i <= b; i++) { - classes.push('.L'+i); + for (i = a; i <= b; i++) { + classes.push('.L' + i); } $list.filter(classes.join(',')).addClass('active'); $.changeHash('#L' + a + '-' + 'L' + b); @@ -175,11 +175,11 @@ var Gogits = { $(document).on('click', '.lines-num span', function (e) { var $select = $(this); var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li'); - selectRange($list, $list.filter('[rel='+$select.attr('rel')+']'), (e.shiftKey?$list.filter('.active').eq(0):null)); + selectRange($list, $list.filter('[rel=' + $select.attr('rel') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null)); $.deSelect(); }); - $('.code-view .lines-code > pre').each(function(){ + $('.code-view .lines-code > pre').each(function () { var $pre = $(this); var $lineCode = $pre.parent(); var $lineNums = $lineCode.siblings('.lines-num'); @@ -191,20 +191,20 @@ var Gogits = { } }); - $(window).on('hashchange', function(e) { + $(window).on('hashchange',function (e) { var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/); var $list = $('.code-view ol.linenums > li'); - if(m){ - var $first = $list.filter('.'+m[1]); - selectRange($list, $first, $list.filter('.'+m[2])); - $("html, body").scrollTop($first.offset().top-200); + if (m) { + var $first = $list.filter('.' + m[1]); + selectRange($list, $first, $list.filter('.' + m[2])); + $("html, body").scrollTop($first.offset().top - 200); return; } m = window.location.hash.match(/^#(L\d+)$/); - if(m){ - var $first = $list.filter('.'+m[1]); + if (m) { + var $first = $list.filter('.' + m[1]); selectRange($list, $first); - $("html, body").scrollTop($first.offset().top-200); + $("html, body").scrollTop($first.offset().top - 200); } }).trigger('hashchange'); }; @@ -334,6 +334,21 @@ function initRepository() { return false; }); })(); + + // repo diff counter + (function () { + var $counter = $('.diff-counter'); + if ($counter.length < 1) { + return; + } + $counter.each(function (i, item) { + var $item = $(item); + var addLine = $item.find('span[data-line].add').data("line"); + var delLine = $item.find('span[data-line].del').data("line"); + var addPercent = parseFloat(addLine) / (parseFloat(addLine) + parseFloat(delLine)) * 100; + $item.find(".bar .add").css("width", addPercent + "%"); + }); + }()); } (function ($) { diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 60ee2177f..e038998f9 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -33,3 +33,9 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["Commits"] = commits ctx.HTML(200, "repo/commits") } + +func Diff(ctx *middleware.Context,params martini.Params){ + ctx.Data["Title"] = "commit-sha" + ctx.Data["IsRepoToolbarCommits"] = true + ctx.HTML(200,"repo/diff") +} diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl new file mode 100644 index 000000000..0c6f4febc --- /dev/null +++ b/templates/repo/diff.tmpl @@ -0,0 +1,418 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
      +
      +
      +
      + Browse Source +

      bsongen: support for custom tags

      +
      +
      + + commit commit-sha + +

      + + author-name + times-ago +

      +
      +
      + +
      + Show Diff Files +

      + + 5 changed files with 25 additions and 9 deletions. +

      +
        +
      1. +
        + 2 + + + + + 4 +
        + +   + gopmweb.go +
      2. +
      3. +
        + 666 + + + + + 44 +
        +   + static/img/favicon.png +
      4. +
      5. +   + static/img/favicon.png +
      6. +
      7. +   + static/img/favicon.png +
      8. +
      +
      + +
      +
      +
      + BIN + + + + + +
      + View File + data/test/bson_test/simple_type.png +
      +
      + + + + +
      +
      +
      + +
      +
      +
      + + 30 + + + + + - 4 +
      + View File + data/test/bson_test/simple_type.go +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + 1 + + 1 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 2 + + 2 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 3 + + 3 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + + + + 4 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + + + + 5 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 4 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 5 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 6 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 7 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 8 + + 6 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 9 + + 7 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 10 + + 8 + +
      	"github.com/youtube/vitess/go/bson"
      +
      +
      +
      + +
      +
      +
      + + 2 + + + + + - 4 +
      + View File + data/test/bson_test/simple_type.go +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + 1 + + 1 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 2 + + 2 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 3 + + 3 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + + + + 4 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + + + + 5 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 4 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 5 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 6 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 7 + + - + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 8 + + 6 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 9 + + 7 + +
      	"github.com/youtube/vitess/go/bson"
      +
      + 10 + + 8 + +
      	"github.com/youtube/vitess/go/bson"
      +
      +
      +
      + +
      +
      +
      + BIN + + + + + +
      + View File + data/test/bson_test/simple_type.png +
      +
      + + + + +
      +
      +
      +
      +
      +{{template "base/footer" .}} \ No newline at end of file diff --git a/web.go b/web.go index 9a613dceb..be9378f18 100644 --- a/web.go +++ b/web.go @@ -156,8 +156,8 @@ func runWeb(*cli.Context) { }, ignSignIn, middleware.RepoAssignment(true)) // TODO: implement single commit page - // m.Get("/:username/:reponame/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Single) - // m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Single) + m.Get("/:username/:reponame/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Diff) + m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Diff) m.Group("/:username", func(r martini.Router) { r.Get("/:reponame", middleware.RepoAssignment(true), repo.Single) From 8aec5e16c4cb7fb045088b04781ef307558a33c3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 24 Mar 2014 09:32:24 -0400 Subject: [PATCH 21/22] Locating issue of git push not update repo last updated time --- models/action.go | 13 +++++++++---- modules/base/conf.go | 27 ++++++++++++++++----------- serve.go | 1 + 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/models/action.go b/models/action.go index 9471e9810..44d7aea8c 100644 --- a/models/action.go +++ b/models/action.go @@ -59,14 +59,18 @@ func (a Action) GetContent() string { // CommitRepoAction records action for commit repository. func CommitRepoAction(userId int64, userName string, repoId int64, repoName string, refName string, commits *base.PushCommits) error { + log.Trace("action.CommitRepoAction: %d/%s", userId, repoName) + bs, err := json.Marshal(commits) if err != nil { + log.Error("action.CommitRepoAction(json): %d/%s", userId, repoName) return err } // Add feeds for user self and all watchers. watches, err := GetWatches(repoId) if err != nil { + log.Error("action.CommitRepoAction(get watches): %d/%s", userId, repoName) return err } watches = append(watches, Watch{UserId: userId}) @@ -86,22 +90,23 @@ func CommitRepoAction(userId int64, userName string, RepoName: repoName, RefName: refName, }) + if err != nil { + log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName) + } return err } // Update repository last update time. repo, err := GetRepositoryByName(userId, repoName) if err != nil { - log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repo.LowerName) + log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repoName) return err } repo.IsBare = false if err = UpdateRepository(repo); err != nil { - log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repo.LowerName) + log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName) return err } - - log.Trace("action.CommitRepoAction: %d/%s", userId, repo.LowerName) return nil } diff --git a/modules/base/conf.go b/modules/base/conf.go index 2bf529d9d..b4e0de97b 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -100,7 +100,7 @@ func newService() { Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false) } -func newLogService() { +func NewLogService() { // Get and check log mode. LogMode = Cfg.MustValue("log", "MODE", "console") modeSec := "log." + LogMode @@ -125,7 +125,7 @@ func newLogService() { logPath := Cfg.MustValue(modeSec, "FILE_NAME", "log/gogs.log") os.MkdirAll(path.Dir(logPath), os.ModePerm) LogConfig = fmt.Sprintf( - `{"level":%s,"filename":%s,"rotate":%v,"maxlines":%d,"maxsize",%d,"daily":%v,"maxdays":%d}`, level, + `{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level, logPath, Cfg.MustBool(modeSec, "LOG_ROTATE", true), Cfg.MustInt(modeSec, "MAX_LINES", 1000000), @@ -133,20 +133,20 @@ func newLogService() { Cfg.MustBool(modeSec, "DAILY_ROTATE", true), Cfg.MustInt(modeSec, "MAX_DAYS", 7)) case "conn": - LogConfig = fmt.Sprintf(`{"level":%s,"reconnectOnMsg":%v,"reconnect":%v,"net":%s,"addr":%s}`, level, + LogConfig = fmt.Sprintf(`{"level":"%s","reconnectOnMsg":%v,"reconnect":%v,"net":"%s","addr":"%s"}`, level, Cfg.MustBool(modeSec, "RECONNECT_ON_MSG", false), Cfg.MustBool(modeSec, "RECONNECT", false), Cfg.MustValue(modeSec, "PROTOCOL", "tcp"), Cfg.MustValue(modeSec, "ADDR", ":7020")) case "smtp": - LogConfig = fmt.Sprintf(`{"level":%s,"username":%s,"password":%s,"host":%s,"sendTos":%s,"subject":%s}`, level, + LogConfig = fmt.Sprintf(`{"level":"%s","username":"%s","password":"%s","host":"%s","sendTos":"%s","subject":"%s"}`, level, Cfg.MustValue(modeSec, "USER", "example@example.com"), Cfg.MustValue(modeSec, "PASSWD", "******"), Cfg.MustValue(modeSec, "HOST", "127.0.0.1:25"), Cfg.MustValue(modeSec, "RECEIVERS", "[]"), Cfg.MustValue(modeSec, "SUBJECT", "Diagnostic message from serve")) case "database": - LogConfig = fmt.Sprintf(`{"level":%s,"driver":%s,"conn":%s}`, level, + LogConfig = fmt.Sprintf(`{"level":"%s","driver":"%s","conn":"%s"}`, level, Cfg.MustValue(modeSec, "Driver"), Cfg.MustValue(modeSec, "CONN")) } @@ -259,11 +259,16 @@ func NewConfigContext() { Cfg.BlockMode = false cfgPath = filepath.Join(workDir, "custom/conf/app.ini") - if com.IsFile(cfgPath) { - if err = Cfg.AppendFiles(cfgPath); err != nil { - fmt.Printf("Cannot load config file '%s'\n", cfgPath) - os.Exit(2) - } + if !com.IsFile(cfgPath) { + fmt.Println("Custom configuration not found(custom/conf/app.ini)\n" + + "Please create it and make your own configuration!") + os.Exit(2) + + } + + if err = Cfg.AppendFiles(cfgPath); err != nil { + fmt.Printf("Cannot load config file '%s'\n", cfgPath) + os.Exit(2) } AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service") @@ -291,7 +296,7 @@ func NewConfigContext() { func NewServices() { newService() - newLogService() + NewLogService() newCacheService() newSessionService() newMailService() diff --git a/serve.go b/serve.go index b84fa2a4e..5b2f2e972 100644 --- a/serve.go +++ b/serve.go @@ -68,6 +68,7 @@ func runServ(k *cli.Context) { base.NewConfigContext() models.LoadModelsConfig() models.NewEngine() + base.NewLogService() keys := strings.Split(os.Args[2], "-") if len(keys) != 2 { From c9e1eb0a0d9e6bdafa158442158c762b7f188177 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 24 Mar 2014 22:23:55 +0800 Subject: [PATCH 22/22] diff page ui --- public/css/gogs.css | 12 +++++++++++- templates/repo/diff.tmpl | 30 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index ec37721fd..434af0359 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -711,6 +711,12 @@ html, body { width: 1%; } +.file-content .file-body.file-code .lines-ellipsis { + background-color: #FAFAFA; + color: #999; + width: 1%; +} + .file-content .file-body.file-code .lines-num span { font-family: Menlo, Monaco, Consolas, "Courier New", monospace; line-height: 1.6; @@ -896,7 +902,7 @@ html, body { background-color: #e9aeae; } -.diff-detail-box span.status.rename{ +.diff-detail-box span.status.rename { background-color: #dad8ff; } @@ -962,6 +968,10 @@ html, body { border-color: #f0db88 !important; } +.diff-file-box .ellipsis-code pre { + color: #AAA; +} + /* wrapper and footer */ #wrapper { diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 0c6f4febc..b0836127f 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -387,6 +387,36 @@
      	"github.com/youtube/vitess/go/bson"
      + + + + + +
      	"github.com/youtube/vitess/go/bson"
      + + + + + 10 + + + 8 + + +
      	"github.com/youtube/vitess/go/bson"
      + + + + + 10 + + + 8 + + +
      	"github.com/youtube/vitess/go/bson"
      + +