Remove cache avatar support and add its tests

This commit is contained in:
Unknwon committed 2016-02-14 23:14:55 -05:00
1 parent fd92d91da3
commit 58e004f7da
14 files changed
+45 -390

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ watch_dirs = [
"$WORKDIR/routers" "$WORKDIR/routers"
] ]
watch_exts = [".go"] watch_exts = [".go"]
ignore_files = [".+_test.go"]
build_delay = 1500 build_delay = 1500
cmds = [ cmds = [
["make", "build-dev"], # sqlite cert pam tidb ["make", "build-dev"], # sqlite cert pam tidb
+5 -5
View File
@@ -19,13 +19,13 @@ build: $(GENERATED)
go install -v -ldflags '$(LDFLAGS)' -tags '$(TAGS)' go install -v -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
cp '$(GOPATH)/bin/gogs' . cp '$(GOPATH)/bin/gogs' .
build-dev: $(GENERATED)
go install -v -race -tags '$(TAGS)'
cp '$(GOPATH)/bin/gogs' .
govet: govet:
go tool vet -composites=false -methods=false -structtags=false . go tool vet -composites=false -methods=false -structtags=false .
build-dev: $(GENERATED) govet
go install -v -race -tags '$(TAGS)'
cp '$(GOPATH)/bin/gogs' .
pack: pack:
rm -rf $(RELEASE_GOGS) rm -rf $(RELEASE_GOGS)
mkdir -p $(RELEASE_GOGS) mkdir -p $(RELEASE_GOGS)
@@ -52,4 +52,4 @@ clean-mac: clean
find . -name ".DS_Store" -print0 | xargs -0 rm find . -name ".DS_Store" -print0 | xargs -0 rm
test: test:
go test ./... go test -cover -race ./...
+1 -1
View File
@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current version: 0.8.35 ##### Current version: 0.8.36
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|
-6
View File
@@ -34,7 +34,6 @@ import (
"github.com/gogits/gogs/models" "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/bindata" "github.com/gogits/gogs/modules/bindata"
"github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware"
@@ -245,11 +244,6 @@ func runWeb(ctx *cli.Context) {
}) })
// ***** END: User ***** // ***** END: User *****
// Gravatar service.
avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg")
os.MkdirAll("public/img/avatar/", os.ModePerm)
m.Get("/avatar/:hash", avt.ServeHTTP)
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true}) adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
// ***** START: Admin ***** // ***** START: Admin *****
-2
View File
@@ -120,8 +120,6 @@ REGISTER_EMAIL_CONFIRM = false
DISABLE_REGISTRATION = false DISABLE_REGISTRATION = false
; User must sign in to view anything. ; User must sign in to view anything.
REQUIRE_SIGNIN_VIEW = false REQUIRE_SIGNIN_VIEW = false
; Cache avatar as picture
ENABLE_CACHE_AVATAR = false
; Mail notification ; Mail notification
ENABLE_NOTIFY_MAIL = false ENABLE_NOTIFY_MAIL = false
; More detail: https://github.com/gogits/gogs/issues/165 ; More detail: https://github.com/gogits/gogs/issues/165
+1 -1
View File
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.8.35.0214" const APP_VER = "0.8.36.0214"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
+2 -4
View File
@@ -247,8 +247,6 @@ func (u *User) RelAvatarLink() string {
} }
return "/avatars/" + com.ToStr(u.Id) return "/avatars/" + com.ToStr(u.Id)
case setting.Service.EnableCacheAvatar:
return "/avatar/" + u.Avatar
} }
return setting.GravatarSource + u.Avatar return setting.GravatarSource + u.Avatar
} }
@@ -493,7 +491,7 @@ func CreateUser(u *User) (err error) {
u.LowerName = strings.ToLower(u.Name) u.LowerName = strings.ToLower(u.Name)
u.AvatarEmail = u.Email u.AvatarEmail = u.Email
u.Avatar = avatar.HashEmail(u.AvatarEmail) u.Avatar = base.HashEmail(u.AvatarEmail)
u.Rands = GetUserSalt() u.Rands = GetUserSalt()
u.Salt = GetUserSalt() u.Salt = GetUserSalt()
u.EncodePasswd() u.EncodePasswd()
@@ -628,7 +626,7 @@ func updateUser(e Engine, u *User) error {
if len(u.AvatarEmail) == 0 { if len(u.AvatarEmail) == 0 {
u.AvatarEmail = u.Email u.AvatarEmail = u.Email
} }
u.Avatar = avatar.HashEmail(u.AvatarEmail) u.Avatar = base.HashEmail(u.AvatarEmail)
} }
u.LowerName = strings.ToLower(u.Name) u.LowerName = strings.ToLower(u.Name)
+8 -306
View File
@@ -2,74 +2,21 @@
// Use of this source code is governed by a MIT-style // Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file. // 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.CacheServer(cacheDir, defaultImg))
*/
package avatar package avatar
import ( import (
"crypto/md5"
"encoding/hex"
"errors"
"fmt" "fmt"
"image" "image"
"image/color/palette" "image/color/palette"
"image/jpeg"
"image/png"
"io"
"math/rand" "math/rand"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
"sync"
"time" "time"
"github.com/issue9/identicon" "github.com/issue9/identicon"
"github.com/nfnt/resize"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting"
) )
//FIXME: remove cache module
var gravatarSource string
func UpdateGravatarSource() {
gravatarSource = setting.GravatarSource
if strings.HasPrefix(gravatarSource, "//") {
gravatarSource = "http:" + gravatarSource
} else if !strings.HasPrefix(gravatarSource, "http://") &&
!strings.HasPrefix(gravatarSource, "https://") {
gravatarSource = "http://" + gravatarSource
}
log.Debug("avatar.UpdateGravatarSource(update gavatar source): %s", gravatarSource)
}
// hash email to md5 string
// keep this func in order to make this package independent
func HashEmail(email string) string {
// https://en.gravatar.com/site/implement/hash/
email = strings.TrimSpace(email)
email = strings.ToLower(email)
h := md5.New()
h.Write([]byte(email))
return hex.EncodeToString(h.Sum(nil))
}
const _RANDOM_AVATAR_SIZE = 200 const _RANDOM_AVATAR_SIZE = 200
// RandomImage generates and returns a random avatar image. func RandomImageSize(size int, data []byte) (image.Image, error) {
func RandomImage(data []byte) (image.Image, error) {
randExtent := len(palette.WebSafe) - 32 randExtent := len(palette.WebSafe) - 32
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
colorIndex := rand.Intn(randExtent) colorIndex := rand.Intn(randExtent)
@@ -78,262 +25,17 @@ func RandomImage(data []byte) (image.Image, error) {
backColorIndex = randExtent - 1 backColorIndex = randExtent - 1
} }
// Size, background, forecolor // Define size, background, and forecolor
imgMaker, err := identicon.New(_RANDOM_AVATAR_SIZE, imgMaker, err := identicon.New(size,
palette.WebSafe[backColorIndex], palette.WebSafe[colorIndex:colorIndex+32]...) palette.WebSafe[backColorIndex], palette.WebSafe[colorIndex:colorIndex+32]...)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("identicon.New: %v", err)
} }
return imgMaker.Make(data), nil return imgMaker.Make(data), nil
} }
// Avatar represents the avatar object. // RandomImage generates and returns a random avatar image.
type Avatar struct { // The data should normally be the []byte type of email address.
Hash string func RandomImage(data []byte) (image.Image, error) {
AlterImage string // image path return RandomImageSize(_RANDOM_AVATAR_SIZE, data)
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,
expireDuration: time.Minute * 10,
reqParams: url.Values{
"d": {"retro"},
"size": {"290"},
"r": {"pg"}}.Encode(),
imagePath: filepath.Join(cacheDir, hash+".image"), //maybe png or jpeg
}
}
func (this *Avatar) HasCache() 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 {
modtime, err := this.Modtime()
return err != nil || time.Since(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()
if img, err = jpeg.Decode(fd); err != nil {
fd.Seek(0, os.SEEK_SET)
img, err = png.Decode(fd)
}
return
}
imgPath := this.imagePath
if !this.HasCache() {
if this.AlterImage == "" {
return errors.New("request image failed, and no alt image offered")
}
imgPath = this.AlterImage
}
if img, err = decodeImageFile(imgPath); 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() {
UpdateGravatarSource()
thunder.Fetch(gravatarSource+this.Hash+"?"+this.reqParams,
this.imagePath)
}
func (this *Avatar) UpdateTimeout(timeout time.Duration) (err error) {
UpdateGravatarSource()
select {
case <-time.After(timeout):
err = fmt.Errorf("get gravatar image %s timeout", this.Hash)
case err = <-thunder.GoFetch(gravatarSource+this.Hash+"?"+this.reqParams,
this.imagePath):
}
return err
}
type service struct {
cacheDir string
altImage string
}
func (this *service) mustInt(r *http.Request, defaultValue int, keys ...string) (v int) {
for _, k := range keys {
if _, err := fmt.Sscanf(r.FormValue(k), "%d", &v); err == nil {
defaultValue = v
}
}
return defaultValue
}
func (this *service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
urlPath := r.URL.Path
hash := urlPath[strings.LastIndex(urlPath, "/")+1:]
size := this.mustInt(r, 290, "s", "size") // default size = 290*290
avatar := New(hash, this.cacheDir)
avatar.AlterImage = this.altImage
if avatar.Expired() {
if err := avatar.UpdateTimeout(time.Millisecond * 1000); err != nil {
log.Trace("avatar update error: %v", err)
return
}
}
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")
if err := avatar.Encode(w, size); err != nil {
log.Warn("avatar encode error: %v", err)
w.WriteHeader(500)
}
}
// http.Handle("/avatar/", avatar.CacheServer("./cache"))
func CacheServer(cacheDir string, defaultImgPath string) http.Handler {
return &service{
cacheDir: cacheDir,
altImage: defaultImgPath,
}
}
// thunder downloader
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()
}
var client = &http.Client{}
func (this *thunderTask) fetch() error {
log.Debug("avatar.fetch(fetch new avatar): %s", this.Url)
req, _ := http.NewRequest("GET", this.Url, nil)
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/jpeg,image/png,*/*;q=0.8")
req.Header.Set("Accept-Encoding", "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
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return fmt.Errorf("status code: %d", resp.StatusCode)
}
/*
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
}
_, err = io.Copy(fd, resp.Body)
fd.Close()
if err != nil {
os.Remove(tmpFile)
return err
}
return os.Rename(tmpFile, this.SaveFile)
} }
+13 -51
View File
@@ -1,61 +1,23 @@
// Copyright 2014 The Gogs Authors. All rights reserved. // Copyright 2016 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style // Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package avatar_test
package avatar
import ( import (
"errors"
"os"
"strconv"
"testing" "testing"
"time"
"github.com/gogits/gogs/modules/avatar" . "github.com/smartystreets/goconvey/convey"
"github.com/gogits/gogs/modules/log"
) )
const TMPDIR = "test-avatar" func Test_RandomImage(t *testing.T) {
Convey("Generate a random avatar from email", t, func() {
_, err := RandomImage([]byte("gogs@local"))
So(err, ShouldBeNil)
func TestFetch(t *testing.T) { Convey("Try to generate an image with size zero", func() {
os.Mkdir(TMPDIR, 0755) _, err := RandomImageSize(0, []byte("gogs@local"))
defer os.RemoveAll(TMPDIR) So(err, ShouldNotBeNil)
})
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)
t.Log("start")
var n = 5
ch := make(chan bool, n)
for i := 0; i < n; i++ {
go func(i int) {
hash := avatar.HashEmail(strconv.Itoa(i) + "ssx205@gmail.com")
a := avatar.New(hash, TMPDIR)
a.Update()
t.Log("finish", hash)
ch <- true
}(i)
}
for i := 0; i < n; i++ {
<-ch
}
t.Log("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.CacheServer("./", "default.jpg"))
http.ListenAndServe(":8001", nil)
}
*/
func TestLogTrace(t *testing.T) {
log.Trace("%v", errors.New("console log test"))
} }
+11 -7
View File
@@ -26,7 +26,6 @@ import (
"github.com/gogits/chardet" "github.com/gogits/chardet"
"github.com/gogits/gogs/modules/avatar"
"github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
@@ -209,17 +208,22 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
return code return code
} }
// AvatarLink returns avatar link by given e-mail. // HashEmail hashes email address to MD5 string.
// https://en.gravatar.com/site/implement/hash/
func HashEmail(email string) string {
email = strings.ToLower(strings.TrimSpace(email))
h := md5.New()
h.Write([]byte(email))
return hex.EncodeToString(h.Sum(nil))
}
// AvatarLink returns avatar link by given email.
func AvatarLink(email string) string { func AvatarLink(email string) string {
if setting.DisableGravatar || setting.OfflineMode { if setting.DisableGravatar || setting.OfflineMode {
return setting.AppSubUrl + "/img/avatar_default.jpg" return setting.AppSubUrl + "/img/avatar_default.jpg"
} }
gravatarHash := avatar.HashEmail(email) return setting.GravatarSource + HashEmail(email)
if setting.Service.EnableCacheAvatar {
return setting.AppSubUrl + "/avatar/" + gravatarHash
}
return setting.GravatarSource + gravatarHash
} }
// Seconds-based time units // Seconds-based time units
+2 -2
View File
@@ -282,7 +282,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil return nil
} }
var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x5a\x4b\x6f\x23\x49\x72\xbe\xd7\xaf\xc8\xd1\x78\x3d\xdd\x06\x49\xbd\x5a\xdd\x3d\xda\xd5\x7a\x28\xb2\x28\x71\x9b\xaf\xa9\xa2\xba\xa7\xa7\x21\x94\x4a\xac\x24\x99\xa3\x62\x15\xbb\xb2\x4a\x6a\x0d\x7c\xd8\x81\x0f\x06\x7c\xb5\x61\x5f\x0c\xc3\x3e\x18\x06\xd6\x0f\x78\xe1\xcb\xae\x0d\x9f\x06\xbe\xf7\xfc\x87\xc5\xac\xfd\x2f\xfc\x45\x64\x16\x59\x54\x6b\x04\x2f\x60\xcf\x43\x2c\x66\x65\x46\x66\x46\x46\x7c\xf1\x45\x24\x3f\x16\x03\xf7\xa5\xeb\x09\xfe\xd3\x1f\xb6\xbb\x9d\xd7\x62\x7c\xda\xf5\x45\xa7\xdb\x73\x9d\x8f\xc5\xa8\xe7\x36\x7d\x57\xf4\x9b\x2f\x5c\xd1\x3a\x6d\x0e\x4e\x5c\x5f\x0c\x07\xa2\x35\xf4\x3c\xd7\x1f\x0d\x07\xed\xee\xe0\x44\xb4\xce\xfc\xf1\xb0\x8f\xc6\x41\xa7\x7b\x62\x46\x3a\x3f\x16\xcd\xe5\x52\x24\xe1\x42\x8a\x7c\x1e\xe6\x42\xcf\xd3\x1b\x2d\xd2\x44\xc8\x6b\x99\xdd\x8a\x65\x38\xc3\x0b\x95\xc7\xd2\x69\x8e\x46\xc1\xa0\xd9\x77\xc5\x91\x38\x49\x67\xfa\x10\x7f\xc5\x89\xca\x85\x2f\xb3\x6b\x35\x91\x90\xd4\x9a\x87\x09\xba\xa3\x4d\x4d\xc5\x6d\x5a\x88\xac\x48\x44\x9c\x4e\xc2\x38\xbe\x75\xbc\xb3\x41\x70\xe6\x63\xf5\x47\x62\xa6\x72\xf4\x76\x55\x3e\x97\x99\xd8\x8a\xe4\xf5\x56\x4d\x6c\x2d\xb3\x34\xda\x12\x29\x1a\x72\xa9\x73\xb4\x44\x72\x1a\x16\x31\x64\x69\xd3\x87\x25\x60\xeb\xb4\x00\x7c\x77\x9c\x37\x99\x5c\xa6\x5a\xe5\x69\x76\x7b\xee\x78\xc3\xe1\x58\x1c\x39\x7e\xcb\xeb\x8e\xc6\xc1\xf8\xf5\x88\xba\x5d\x86\x7a\x8e\x99\xda\x56\x52\x73\xe0\x77\xc5\x64\x1e\x66\x5a\xe6\x0e\x7d\x09\xa0\x2a\xcf\x77\x31\x50\xa0\x5b\x27\xcd\x26\xd2\xee\x3b\x91\x37\x62\x2d\x5e\xe4\xa9\xb8\x94\x62\x99\xa9\xeb\x30\x97\x4e\x67\xe8\xb5\xdc\x60\xe4\x75\x5f\x36\xc7\x34\xcd\x34\x8c\x35\xed\xff\x24\x4e\x2f\xc3\x58\x2c\xc2\x77\x6a\x51\x2c\xc4\x24\x93\x61\xae\xa0\xca\x58\x2d\xa0\x93\x74\x5a\x95\xb8\xc4\xd6\x0b\x2d\xb3\x9a\xa8\xef\x8a\x85\x0c\x13\x2d\x92\xd4\xf4\x74\xfa\xcd\x2f\x82\x96\xe7\x36\xc7\xdd\xe1\x20\xe8\x75\xfb\x5d\x5a\x60\x7d\x17\x33\x8c\xc2\x7c\x32\x17\xa4\x20\xf1\xb6\x90\x85\x14\xb1\x4c\x66\xf9\xbc\x86\x39\xaf\x58\xf1\xa1\x16\x71\x98\xe1\x10\xf0\x80\xb9\xb4\xba\xc4\xc9\x8d\xce\x7a\xbd\xc0\x73\x3f\x3f\x73\xfd\x71\x80\xbf\x67\x6e\xd0\x73\x07\x27\xe3\x53\x88\xdd\xdd\xc1\x3f\xd0\x65\xa1\xce\x21\x7f\x50\x2c\x2e\xb1\xb0\xea\x52\x95\xd4\xc6\x32\xc2\x4c\xb2\x75\xc8\x48\xa8\x04\x16\x02\x55\xbd\x5b\xc6\x29\x5a\xc9\x48\x1c\xf7\x8b\x51\x6f\xe8\x41\x2d\xcd\x13\xd8\x5a\x30\x38\xeb\x43\xfa\xde\xce\x86\x50\xa5\x75\xf1\xc3\xe2\x58\x4c\xd7\xf7\xcf\xee\x08\xd9\xdd\x14\xb2\x52\x6f\xba\x80\xb2\xf4\x1d\x21\xe1\x24\x57\xd7\x2a\xbf\x15\x53\x29\x23\xa7\xe3\xba\xed\x80\xd5\x39\xec\x43\x8d\x56\xe0\x01\xe4\xbd\x0c\x63\xa8\x0f\xe2\x2e\x60\x85\x0b\x59\x9f\xa4\xd8\xca\x05\x4e\x22\x0f\x45\x1e\xce\x6a\x74\x38\x91\xb8\xbc\x15\xcd\x24\xca\x52\x15\x89\x9f\x62\x5c\x83\x56\xd2\x4c\x30\xd7\x75\x18\xa3\x8d\x07\xe1\xd0\xa0\xfb\xad\x04\xb3\x1b\xfb\x8d\x94\x0e\xa1\xf6\x2d\x71\xa3\xe2\x58\xcc\xc3\x6b\x72\x2d\xb9\xb2\x67\x9d\xdf\xc6\x64\x2d\x7d\x52\x9d\x4a\xa6\xe9\xa1\x98\xe7\xf9\x52\x1f\x6e\x6f\xc3\xac\x65\x9c\xc2\x34\x74\x63\x96\xa6\xb3\x58\x36\xb0\xc9\xed\x1b\x79\xb9\x5d\x2c\x23\x58\x9e\xde\xde\xdb\xd9\x7d\xb2\xbd\xbb\xbb\xed\x17\xcb\x65\x9a\xe5\xf5\x69\x9a\xd5\x2b\x1b\xa8\xab\xa4\xde\x9a\x67\x29\xbe\xef\x7f\xca\x2f\xed\xf2\x9d\xf1\xa9\xdb\x77\xa1\x06\x9c\x51\xd0\x77\xc7\xcd\x60\xdc\x3c\x81\x2a\x2e\x3e\x9e\x4e\x0f\xf6\x9f\xec\x5f\xb0\x09\x34\xc2\x68\xa1\x92\x4d\x43\x20\x23\x7d\xf8\xc8\xc8\xab\x37\x4f\xec\x60\xe7\x43\x5b\x7a\x50\x84\xe7\x8e\x86\x0f\x8a\x48\xd2\x1c\x18\xf3\xb0\x90\xc1\x70\xdc\x6d\xdd\x35\xc0\x83\x0d\x31\x69\x36\x0b\x13\xf5\xb5\x71\xcb\x87\x64\x0d\xbd\x93\x0f\xd6\xe3\xbc\x59\x84\xd9\x55\x94\xde\xb0\x86\xdc\x84\x0e\x19\xc7\x9b\x45\xb0\x00\x8c\xbb\x84\xbb\x5f\xc1\x27\x72\x99\x68\x88\x77\xdc\x41\xf3\xb8\xe7\x06\x40\x98\x36\x9c\x78\xe0\x06\xc7\x70\xe9\x17\x15\xb8\xe8\x29\xcd\xa8\x30\x29\x74\x9e\x2e\xc4\x99\xd7\xab\xfb\x13\x3a\xcb\xca\x36\x01\x9d\xbc\x36\xf2\x6b\x95\x5c\x69\x71\x33\x97\x09\x14\x9a\x44\x32\x53\xc9\x4c\xf4\xed\x8a\x20\x0e\xa7\x8d\xd9\xc3\xc5\x12\xab\x02\xc2\xd6\x16\xe1\x2c\x01\xce\x19\xd0\x0f\x20\x3d\xf0\x5b\x64\x04\x3e\x60\xd2\x79\x83\x53\x05\xd0\x9d\x3b\x23\x6f\x38\x1e\xc2\x2c\xb0\x2e\xb2\x42\xa7\x3d\xec\x37\xbb\x03\x7c\x63\xdc\x9e\xa7\x3a\x67\x68\xa5\xf1\x68\xfc\xd1\xa3\xb2\xff\x63\xb2\xd7\x1f\x3d\x32\xdd\xf1\xe5\x47\x8f\x4e\xc7\xe3\x51\x30\x1a\x7a\xe3\xc7\x7a\xdb\xe1\x2f\xcd\x76\x1b\x70\xef\xac\x5e\x40\xc0\x3e\xa1\x0d\xb6\x4e\xc2\xc5\xa3\x76\xff\xcb\xc7\xb4\x6f\x5e\x3b\x05\x15\x71\x93\x66\x57\x64\x6f\x8f\x74\x01\xa0\xc3\xae\x7d\xff\x54\x18\xe3\x7f\x0c\xdf\x86\x09\x68\xda\x36\x5c\x42\x68\x13\x77\x1a\x10\xd7\x4d\xc4\x02\x2b\x15\x93\x50\x43\x79\x14\x79\xa2\x94\x4c\x06\x30\x0e\xdd\x01\xbc\x27\x26\x32\x55\xdd\xf0\x9a\x00\x80\x06\x37\xe3\x1c\xc6\x41\x00\x9d\xc4\xb7\x36\x72\x65\x3c\xaf\xd1\x11\x04\x45\x92\xa2\x10\x09\x24\x09\x9a\x82\x25\x96\x46\xfb\xe2\x97\x0d\xa7\x37\x6c\x35\x01\xb1\x6b\x45\x91\x2e\xa1\xa0\x95\x12\xef\xea\x07\x41\xc9\xa0\x04\x4f\x34\x45\xa0\x28\x70\xda\x7c\xb8\x34\x4d\x78\x1d\xaa\x98\x5e\x3b\xed\xae\xcf\x66\x44\xdd\xd6\xa6\xf3\x6a\x2e\x39\x78\xc2\x39\xc5\x65\xa1\xe2\x1c\xb6\x5b\x59\Line truncated var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x5a\x4b\x6f\x23\x49\x72\xbe\xd7\xaf\xc8\xd1\x78\x3d\xdd\x06\x49\xbd\x5a\xdd\x3d\xda\xd5\x7a\x28\xb2\x28\x71\x9b\xaf\xa9\xa2\xba\xa7\xa7\x21\x94\x4a\xac\x24\x99\xa3\x62\x15\xbb\xb2\x4a\x6a\x0d\x7c\xd8\x81\x0f\x06\x7c\xb5\x61\x5f\x0c\xc3\x3e\x18\x06\xd6\x0f\x78\xe1\xcb\xae\x0d\x9f\x06\xbe\xf7\xfc\x87\xc5\xac\xfd\x2f\xfc\x45\x64\x16\x59\x54\x6b\x04\x2f\x60\xcf\x43\x2c\x66\x65\x46\x66\x46\x46\x7c\xf1\x45\x24\x3f\x16\x03\xf7\xa5\xeb\x09\xfe\xd3\x1f\xb6\xbb\x9d\xd7\x62\x7c\xda\xf5\x45\xa7\xdb\x73\x9d\x8f\xc5\xa8\xe7\x36\x7d\x57\xf4\x9b\x2f\x5c\xd1\x3a\x6d\x0e\x4e\x5c\x5f\x0c\x07\xa2\x35\xf4\x3c\xd7\x1f\x0d\x07\xed\xee\xe0\x44\xb4\xce\xfc\xf1\xb0\x8f\xc6\x41\xa7\x7b\x62\x46\x3a\x3f\x16\xcd\xe5\x52\x24\xe1\x42\x8a\x7c\x1e\xe6\x42\xcf\xd3\x1b\x2d\xd2\x44\xc8\x6b\x99\xdd\x8a\x65\x38\xc3\x0b\x95\xc7\xd2\x69\x8e\x46\xc1\xa0\xd9\x77\xc5\x91\x38\x49\x67\xfa\x10\x7f\xc5\x89\xca\x85\x2f\xb3\x6b\x35\x91\x90\xd4\x9a\x87\x09\xba\xa3\x4d\x4d\xc5\x6d\x5a\x88\xac\x48\x44\x9c\x4e\xc2\x38\xbe\x75\xbc\xb3\x41\x70\xe6\x63\xf5\x47\x62\xa6\x72\xf4\x76\x55\x3e\x97\x99\xd8\x8a\xe4\xf5\x56\x4d\x6c\x2d\xb3\x34\xda\x12\x29\x1a\x72\xa9\x73\xb4\x44\x72\x1a\x16\x31\x64\x69\xd3\x87\x25\x60\xeb\xb4\x00\x7c\x77\x9c\x37\x99\x5c\xa6\x5a\xe5\x69\x76\x7b\xee\x78\xc3\xe1\x58\x1c\x39\x7e\xcb\xeb\x8e\xc6\xc1\xf8\xf5\x88\xba\x5d\x86\x7a\x8e\x99\xda\x56\x52\x73\xe0\x77\xc5\x64\x1e\x66\x5a\xe6\x0e\x7d\x09\xa0\x2a\xcf\x77\x31\x50\xa0\x5b\x27\xcd\x26\xd2\xee\x3b\x91\x37\x62\x2d\x5e\xe4\xa9\xb8\x94\x62\x99\xa9\xeb\x30\x97\x4e\x67\xe8\xb5\xdc\x60\xe4\x75\x5f\x36\xc7\x34\xcd\x34\x8c\x35\xed\xff\x24\x4e\x2f\xc3\x58\x2c\xc2\x77\x6a\x51\x2c\xc4\x24\x93\x61\xae\xa0\xca\x58\x2d\xa0\x93\x74\x5a\x95\xb8\xc4\xd6\x0b\x2d\xb3\x9a\xa8\xef\x8a\x85\x0c\x13\x2d\x92\xd4\xf4\x74\xfa\xcd\x2f\x82\x96\xe7\x36\xc7\xdd\xe1\x20\xe8\x75\xfb\x5d\x5a\x60\x7d\x17\x33\x8c\xc2\x7c\x32\x17\xa4\x20\xf1\xb6\x90\x85\x14\xb1\x4c\x66\xf9\xbc\x86\x39\xaf\x58\xf1\xa1\x16\x71\x98\xe1\x10\xf0\x80\xb9\xb4\xba\xc4\xc9\x8d\xce\x7a\xbd\xc0\x73\x3f\x3f\x73\xfd\x71\x80\xbf\x67\x6e\xd0\x73\x07\x27\xe3\x53\x88\xdd\xdd\xc1\x3f\xd0\x65\xa1\xce\x21\x7f\x50\x2c\x2e\xb1\xb0\xea\x52\x95\xd4\xc6\x32\xc2\x4c\xb2\x75\xc8\x48\xa8\x04\x16\x02\x55\xbd\x5b\xc6\x29\x5a\xc9\x48\x1c\xf7\x8b\x51\x6f\xe8\x41\x2d\xcd\x13\xd8\x5a\x30\x38\xeb\x43\xfa\xde\xce\x86\x50\xa5\x75\xf1\xc3\xe2\x58\x4c\xd7\xf7\xcf\xee\x08\xd9\xdd\x14\xb2\x52\x6f\xba\x80\xb2\xf4\x1d\x21\xe1\x24\x57\xd7\x2a\xbf\x15\x53\x29\x23\xa7\xe3\xba\xed\x80\xd5\x39\xec\x43\x8d\x56\xe0\x01\xe4\xbd\x0c\x63\xa8\x0f\xe2\x2e\x60\x85\x0b\x59\x9f\xa4\xd8\xca\x05\x4e\x22\x0f\x45\x1e\xce\x6a\x74\x38\x91\xb8\xbc\x15\xcd\x24\xca\x52\x15\x89\x9f\x62\x5c\x83\x56\xd2\x4c\x30\xd7\x75\x18\xa3\x8d\x07\xe1\xd0\xa0\xfb\xad\x04\xb3\x1b\xfb\x8d\x94\x0e\xa1\xf6\x2d\x71\xa3\xe2\x58\xcc\xc3\x6b\x72\x2d\xb9\xb2\x67\x9d\xdf\xc6\x64\x2d\x7d\x52\x9d\x4a\xa6\xe9\xa1\x98\xe7\xf9\x52\x1f\x6e\x6f\xc3\xac\x65\x9c\xc2\x34\x74\x63\x96\xa6\xb3\x58\x36\xb0\xc9\xed\x1b\x79\xb9\x5d\x2c\x23\x58\x9e\xde\xde\xdb\xd9\x7d\xb2\xbd\xbb\xbb\xed\x17\xcb\x65\x9a\xe5\xf5\x69\x9a\xd5\x2b\x1b\xa8\xab\xa4\xde\x9a\x67\x29\xbe\xef\x7f\xca\x2f\xed\xf2\x9d\xf1\xa9\xdb\x77\xa1\x06\x9c\x51\xd0\x77\xc7\xcd\x60\xdc\x3c\x81\x2a\x2e\x3e\x9e\x4e\x0f\xf6\x9f\xec\x5f\xb0\x09\x34\xc2\x68\xa1\x92\x4d\x43\x20\x23\x7d\xf8\xc8\xc8\xab\x37\x4f\xec\x60\xe7\x43\x5b\x7a\x50\x84\xe7\x8e\x86\x0f\x8a\x48\xd2\x1c\x18\xf3\xb0\x90\xc1\x70\xdc\x6d\xdd\x35\xc0\x83\x0d\x31\x69\x36\x0b\x13\xf5\xb5\x71\xcb\x87\x64\x0d\xbd\x93\x0f\xd6\xe3\xbc\x59\x84\xd9\x55\x94\xde\xb0\x86\xdc\x84\x0e\x19\xc7\x9b\x45\xb0\x00\x8c\xbb\x84\xbb\x5f\xc1\x27\x72\x99\x68\x88\x77\xdc\x41\xf3\xb8\xe7\x06\x40\x98\x36\x9c\x78\xe0\x06\xc7\x70\xe9\x17\x15\xb8\xe8\x29\xcd\xa8\x30\x29\x74\x9e\x2e\xc4\x99\xd7\xab\xfb\x13\x3a\xcb\xca\x36\x01\x9d\xbc\x36\xf2\x6b\x95\x5c\x69\x71\x33\x97\x09\x14\x9a\x44\x32\x53\xc9\x4c\xf4\xed\x8a\x20\x0e\xa7\x8d\xd9\xc3\xc5\x12\xab\x02\xc2\xd6\x16\xe1\x2c\x01\xce\x19\xd0\x0f\x20\x3d\xf0\x5b\x64\x04\x3e\x60\xd2\x79\x83\x53\x05\xd0\x9d\x3b\x23\x6f\x38\x1e\xc2\x2c\xb0\x2e\xb2\x42\xa7\x3d\xec\x37\xbb\x03\x7c\x63\xdc\x9e\xa7\x3a\x67\x68\xa5\xf1\x68\xfc\xd1\xa3\xb2\xff\x63\xb2\xd7\x1f\x3d\x32\xdd\xf1\xe5\x47\x8f\x4e\xc7\xe3\x51\x30\x1a\x7a\xe3\xc7\x7a\xdb\xe1\x2f\xcd\x76\x1b\x70\xef\xac\x5e\x40\xc0\x3e\xa1\x0d\xb6\x4e\xc2\xc5\xa3\x76\xff\xcb\xc7\xb4\x6f\x5e\x3b\x05\x15\x71\x93\x66\x57\x64\x6f\x8f\x74\x01\xa0\xc3\xae\x7d\xff\x54\x18\xe3\x7f\x0c\xdf\x86\x09\x68\xda\x36\x5c\x42\x68\x13\x77\x1a\x10\xd7\x4d\xc4\x02\x2b\x15\x93\x50\x43\x79\x14\x79\xa2\x94\x4c\x06\x30\x0e\xdd\x01\xbc\x27\x26\x32\x55\xdd\xf0\x9a\x00\x80\x06\x37\xe3\x1c\xc6\x41\x00\x9d\xc4\xb7\x36\x72\x65\x3c\xaf\xd1\x11\x04\x45\x92\xa2\x10\x09\x24\x09\x9a\x82\x25\x96\x46\xfb\xe2\x97\x0d\xa7\x37\x6c\x35\x01\xb1\x6b\x45\x91\x2e\xa1\xa0\x95\x12\xef\xea\x07\x41\xc9\xa0\x04\x4f\x34\x45\xa0\x28\x70\xda\x7c\xb8\x34\x4d\x78\x1d\xaa\x98\x5e\x3b\xed\xae\xcf\x66\x44\xdd\xd6\xa6\xf3\x6a\x2e\x39\x78\xc2\x39\xc5\x65\xa1\xe2\x1c\xb6\x5b\x59\Line truncated
func confAppIniBytes() ([]byte, error) { func confAppIniBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@@ -297,7 +297,7 @@ func confAppIni() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "conf/app.ini", size: 10383, mode: os.FileMode(420), modTime: time.Unix(1454961797, 0)} info := bindataFileInfo{name: "conf/app.ini", size: 10329, mode: os.FileMode(420), modTime: time.Unix(1455507054, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
-2
View File
@@ -455,7 +455,6 @@ var Service struct {
DisableRegistration bool DisableRegistration bool
ShowRegistrationButton bool ShowRegistrationButton bool
RequireSignInView bool RequireSignInView bool
EnableCacheAvatar bool
EnableNotifyMail bool EnableNotifyMail bool
EnableReverseProxyAuth bool EnableReverseProxyAuth bool
EnableReverseProxyAutoRegister bool EnableReverseProxyAutoRegister bool
@@ -469,7 +468,6 @@ func newService() {
Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool() Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool()
Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration) Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration)
Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool() Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool()
Service.EnableCacheAvatar = sec.Key("ENABLE_CACHE_AVATAR").MustBool()
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool() Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool() Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool() Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool()
-2
View File
@@ -145,8 +145,6 @@ func listen(config *ssh.ServerConfig, port int) {
go handleServerConn(sConn.Permissions.Extensions["key-id"], chans) go handleServerConn(sConn.Permissions.Extensions["key-id"], chans)
}() }()
} }
panic("SSH: Unexpected exit of listen loop")
} }
// Listen starts a SSH server listens on given port. // Listen starts a SSH server listens on given port.
+1 -1
View File
@@ -1 +1 @@
0.8.35.0214 0.8.36.0214