parent
9df5c39bca
commit
149d62a648
9 changed files with 99 additions and 41 deletions
|
@ -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.9.9
|
##### Current version: 0.9.10
|
||||||
|
|
||||||
| Web | UI | Preview |
|
| Web | UI | Preview |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
|
25
glide.lock
generated
25
glide.lock
generated
|
@ -1,5 +1,5 @@
|
||||||
hash: 81254bce31966708f508a845836851efb77d96d8c522e745e67d0daeffd76cc5
|
hash: f2fa73b9a379e1fa12f2b48fb0b9942a545b4518a2d71cbd956ee81093347773
|
||||||
updated: 2016-03-12T14:42:55.945562115-05:00
|
updated: 2016-03-15T13:58:01.074601588-04:00
|
||||||
imports:
|
imports:
|
||||||
- name: github.com/bradfitz/gomemcache
|
- name: github.com/bradfitz/gomemcache
|
||||||
version: fb1f79c6b65acda83063cbc69f6bba1522558bfc
|
version: fb1f79c6b65acda83063cbc69f6bba1522558bfc
|
||||||
|
@ -46,8 +46,10 @@ imports:
|
||||||
version: 788ec59749df076b98e208909b44fdef02779deb
|
version: 788ec59749df076b98e208909b44fdef02779deb
|
||||||
- name: github.com/issue9/identicon
|
- name: github.com/issue9/identicon
|
||||||
version: f8c0d2ce04db79c663b1da33d3a9f62be753ee88
|
version: f8c0d2ce04db79c663b1da33d3a9f62be753ee88
|
||||||
|
- name: github.com/kardianos/minwinsvc
|
||||||
|
version: cad6b2b879b0970e4245a20ebf1a81a756e2bb70
|
||||||
- name: github.com/klauspost/compress
|
- name: github.com/klauspost/compress
|
||||||
version: 2d3d403f37d2e70b722590bc286076a17422e1f2
|
version: 006acde2c5d283d2f8b8aa03d8f0cd2891c680cf
|
||||||
subpackages:
|
subpackages:
|
||||||
- gzip
|
- gzip
|
||||||
- flate
|
- flate
|
||||||
|
@ -59,10 +61,14 @@ imports:
|
||||||
version: 165a3529e799da61ab10faed1fabff3662d6193f
|
version: 165a3529e799da61ab10faed1fabff3662d6193f
|
||||||
subpackages:
|
subpackages:
|
||||||
- oid
|
- oid
|
||||||
|
- name: github.com/mattn/go-sqlite3
|
||||||
|
version: 76e335f60bbcee20755df9864f0153af1a80ad2d
|
||||||
- name: github.com/mcuadros/go-version
|
- name: github.com/mcuadros/go-version
|
||||||
version: d52711f8d6bea8dc01efafdb68ad95a4e2606630
|
version: d52711f8d6bea8dc01efafdb68ad95a4e2606630
|
||||||
- name: github.com/microcosm-cc/bluemonday
|
- name: github.com/microcosm-cc/bluemonday
|
||||||
version: 4ac6f27528d0a3f2a59e0b0a6f6b3ff0bb89fe20
|
version: 4ac6f27528d0a3f2a59e0b0a6f6b3ff0bb89fe20
|
||||||
|
- name: github.com/msteinert/pam
|
||||||
|
version: 02ccfbfaf0cc627aa3aec8ef7ed5cfeec5b43f63
|
||||||
- name: github.com/nfnt/resize
|
- name: github.com/nfnt/resize
|
||||||
version: 4d93a29130b1b6aba503e2aa8b50f516213ea80e
|
version: 4d93a29130b1b6aba503e2aa8b50f516213ea80e
|
||||||
- name: github.com/russross/blackfriday
|
- name: github.com/russross/blackfriday
|
||||||
|
@ -86,18 +92,23 @@ imports:
|
||||||
- name: github.com/Unknwon/paginater
|
- name: github.com/Unknwon/paginater
|
||||||
version: 7748a72e01415173a27d79866b984328e7b0c12b
|
version: 7748a72e01415173a27d79866b984328e7b0c12b
|
||||||
- name: golang.org/x/crypto
|
- name: golang.org/x/crypto
|
||||||
version: de93d05161db39bcbd84d3da2e54c4a18f37f0b1
|
version: 6025851c7c2bf210daf74d22300c699b16541847
|
||||||
subpackages:
|
subpackages:
|
||||||
- ssh
|
- ssh
|
||||||
- curve25519
|
- curve25519
|
||||||
- name: golang.org/x/net
|
- name: golang.org/x/net
|
||||||
version: e7da8edaa52631091740908acaf2c2d4c9b3ce90
|
version: 35b06af0720201bc2f326773a80767387544f8c4
|
||||||
subpackages:
|
subpackages:
|
||||||
- html
|
- html
|
||||||
- html/charset
|
- html/charset
|
||||||
- html/atom
|
- html/atom
|
||||||
|
- name: golang.org/x/sys
|
||||||
|
version: 9d4e42a20653790449273b3c85e67d6d8bae6e2e
|
||||||
|
subpackages:
|
||||||
|
- windows/svc
|
||||||
|
- windows
|
||||||
- name: golang.org/x/text
|
- name: golang.org/x/text
|
||||||
version: a71fd10341b064c10f4a81ceac72bcf70f26ea34
|
version: c20b6f20120f3c96689c10ffa47eee07776b9fe1
|
||||||
subpackages:
|
subpackages:
|
||||||
- transform
|
- transform
|
||||||
- encoding
|
- encoding
|
||||||
|
@ -121,7 +132,7 @@ imports:
|
||||||
- name: gopkg.in/bufio.v1
|
- name: gopkg.in/bufio.v1
|
||||||
version: 567b2bfa514e796916c4747494d6ff5132a1dfce
|
version: 567b2bfa514e796916c4747494d6ff5132a1dfce
|
||||||
- name: gopkg.in/gomail.v2
|
- name: gopkg.in/gomail.v2
|
||||||
version: 5ceb8e65415e45e1262fb385212b8193b55c0f99
|
version: afff51fd8cbc246672451a1b0b67e8f4a507bad8
|
||||||
- name: gopkg.in/ini.v1
|
- name: gopkg.in/ini.v1
|
||||||
version: 776aa739ce9373377cd16f526cdf06cb4c89b40f
|
version: 776aa739ce9373377cd16f526cdf06cb4c89b40f
|
||||||
- name: gopkg.in/ldap.v2
|
- name: gopkg.in/ldap.v2
|
||||||
|
|
|
@ -28,9 +28,12 @@ import:
|
||||||
- package: github.com/gogits/git-module
|
- package: github.com/gogits/git-module
|
||||||
- package: github.com/gogits/go-gogs-client
|
- package: github.com/gogits/go-gogs-client
|
||||||
- package: github.com/issue9/identicon
|
- package: github.com/issue9/identicon
|
||||||
|
- package: github.com/kardianos/minwinsvc
|
||||||
- package: github.com/lib/pq
|
- package: github.com/lib/pq
|
||||||
|
- package: github.com/mattn/go-sqlite3
|
||||||
- package: github.com/mcuadros/go-version
|
- package: github.com/mcuadros/go-version
|
||||||
- package: github.com/microcosm-cc/bluemonday
|
- package: github.com/microcosm-cc/bluemonday
|
||||||
|
- package: github.com/msteinert/pam
|
||||||
- package: github.com/nfnt/resize
|
- package: github.com/nfnt/resize
|
||||||
- package: github.com/russross/blackfriday
|
- package: github.com/russross/blackfriday
|
||||||
- package: github.com/satori/go.uuid
|
- package: github.com/satori/go.uuid
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.9.9.0313"
|
const APP_VER = "0.9.10.0315"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -21,6 +21,12 @@ func Organizations(ctx *context.Context) {
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminOrganizations"] = true
|
ctx.Data["PageIsAdminOrganizations"] = true
|
||||||
|
|
||||||
routers.RenderUserSearch(ctx, models.USER_TYPE_ORGANIZATION, models.CountOrganizations, models.Organizations,
|
routers.RenderUserSearch(ctx, &routers.UserSearchOptions{
|
||||||
setting.AdminOrgPagingNum, "id ASC", ORGS)
|
Type: models.USER_TYPE_ORGANIZATION,
|
||||||
|
Counter: models.CountOrganizations,
|
||||||
|
Ranger: models.Organizations,
|
||||||
|
PageSize: setting.AdminOrgPagingNum,
|
||||||
|
OrderBy: "id ASC",
|
||||||
|
TplName: ORGS,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,14 @@ func Repos(ctx *context.Context) {
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminRepositories"] = true
|
ctx.Data["PageIsAdminRepositories"] = true
|
||||||
|
|
||||||
routers.RenderRepoSearch(ctx, models.CountRepositories, models.Repositories,
|
routers.RenderRepoSearch(ctx, &routers.RepoSearchOptions{
|
||||||
setting.AdminRepoPagingNum, "id ASC", REPOS)
|
Counter: models.CountRepositories,
|
||||||
|
Ranger: models.Repositories,
|
||||||
|
Private: true,
|
||||||
|
PageSize: setting.AdminRepoPagingNum,
|
||||||
|
OrderBy: "id ASC",
|
||||||
|
TplName: REPOS,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteRepo(ctx *context.Context) {
|
func DeleteRepo(ctx *context.Context) {
|
||||||
|
|
|
@ -30,8 +30,14 @@ func Users(ctx *context.Context) {
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminUsers"] = true
|
ctx.Data["PageIsAdminUsers"] = true
|
||||||
|
|
||||||
routers.RenderUserSearch(ctx, models.USER_TYPE_INDIVIDUAL, models.CountUsers, models.Users,
|
routers.RenderUserSearch(ctx, &routers.UserSearchOptions{
|
||||||
setting.AdminUserPagingNum, "id ASC", USERS)
|
Type: models.USER_TYPE_INDIVIDUAL,
|
||||||
|
Counter: models.CountUsers,
|
||||||
|
Ranger: models.Users,
|
||||||
|
PageSize: setting.AdminUserPagingNum,
|
||||||
|
OrderBy: "id ASC",
|
||||||
|
TplName: USERS,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUser(ctx *context.Context) {
|
func NewUser(ctx *context.Context) {
|
||||||
|
|
|
@ -44,9 +44,16 @@ func Home(ctx *context.Context) {
|
||||||
ctx.HTML(200, HOME)
|
ctx.HTML(200, HOME)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderRepoSearch(ctx *context.Context,
|
type RepoSearchOptions struct {
|
||||||
counter func() int64, ranger func(int, int) ([]*models.Repository, error),
|
Counter func() int64
|
||||||
pagingNum int, orderBy string, tplName base.TplName) {
|
Ranger func(int, int) ([]*models.Repository, error)
|
||||||
|
Private bool
|
||||||
|
PageSize int
|
||||||
|
OrderBy string
|
||||||
|
TplName base.TplName
|
||||||
|
}
|
||||||
|
|
||||||
|
func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 1 {
|
if page <= 1 {
|
||||||
page = 1
|
page = 1
|
||||||
|
@ -60,18 +67,19 @@ func RenderRepoSearch(ctx *context.Context,
|
||||||
|
|
||||||
keyword := ctx.Query("q")
|
keyword := ctx.Query("q")
|
||||||
if len(keyword) == 0 {
|
if len(keyword) == 0 {
|
||||||
repos, err = ranger(page, pagingNum)
|
repos, err = opts.Ranger(page, opts.PageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "ranger", err)
|
ctx.Handle(500, "opts.Ranger", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
count = counter()
|
count = opts.Counter()
|
||||||
} else {
|
} else {
|
||||||
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
||||||
Keyword: keyword,
|
Keyword: keyword,
|
||||||
OrderBy: orderBy,
|
OrderBy: opts.OrderBy,
|
||||||
|
Private: opts.Private,
|
||||||
Page: page,
|
Page: page,
|
||||||
PageSize: pagingNum,
|
PageSize: opts.PageSize,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "SearchRepositoryByName", err)
|
ctx.Handle(500, "SearchRepositoryByName", err)
|
||||||
|
@ -80,7 +88,7 @@ func RenderRepoSearch(ctx *context.Context,
|
||||||
}
|
}
|
||||||
ctx.Data["Keyword"] = keyword
|
ctx.Data["Keyword"] = keyword
|
||||||
ctx.Data["Total"] = count
|
ctx.Data["Total"] = count
|
||||||
ctx.Data["Page"] = paginater.New(int(count), pagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
|
||||||
|
|
||||||
for _, repo := range repos {
|
for _, repo := range repos {
|
||||||
if err = repo.GetOwner(); err != nil {
|
if err = repo.GetOwner(); err != nil {
|
||||||
|
@ -90,7 +98,7 @@ func RenderRepoSearch(ctx *context.Context,
|
||||||
}
|
}
|
||||||
ctx.Data["Repos"] = repos
|
ctx.Data["Repos"] = repos
|
||||||
|
|
||||||
ctx.HTML(200, tplName)
|
ctx.HTML(200, opts.TplName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExploreRepos(ctx *context.Context) {
|
func ExploreRepos(ctx *context.Context) {
|
||||||
|
@ -98,13 +106,25 @@ func ExploreRepos(ctx *context.Context) {
|
||||||
ctx.Data["PageIsExplore"] = true
|
ctx.Data["PageIsExplore"] = true
|
||||||
ctx.Data["PageIsExploreRepositories"] = true
|
ctx.Data["PageIsExploreRepositories"] = true
|
||||||
|
|
||||||
RenderRepoSearch(ctx, models.CountPublicRepositories, models.GetRecentUpdatedRepositories,
|
RenderRepoSearch(ctx, &RepoSearchOptions{
|
||||||
setting.ExplorePagingNum, "updated_unix DESC", EXPLORE_REPOS)
|
Counter: models.CountPublicRepositories,
|
||||||
|
Ranger: models.GetRecentUpdatedRepositories,
|
||||||
|
PageSize: setting.ExplorePagingNum,
|
||||||
|
OrderBy: "updated_unix DESC",
|
||||||
|
TplName: EXPLORE_REPOS,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderUserSearch(ctx *context.Context, userType models.UserType,
|
type UserSearchOptions struct {
|
||||||
counter func() int64, ranger func(int, int) ([]*models.User, error),
|
Type models.UserType
|
||||||
pagingNum int, orderBy string, tplName base.TplName) {
|
Counter func() int64
|
||||||
|
Ranger func(int, int) ([]*models.User, error)
|
||||||
|
PageSize int
|
||||||
|
OrderBy string
|
||||||
|
TplName base.TplName
|
||||||
|
}
|
||||||
|
|
||||||
|
func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 1 {
|
if page <= 1 {
|
||||||
page = 1
|
page = 1
|
||||||
|
@ -118,19 +138,19 @@ func RenderUserSearch(ctx *context.Context, userType models.UserType,
|
||||||
|
|
||||||
keyword := ctx.Query("q")
|
keyword := ctx.Query("q")
|
||||||
if len(keyword) == 0 {
|
if len(keyword) == 0 {
|
||||||
users, err = ranger(page, pagingNum)
|
users, err = opts.Ranger(page, opts.PageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "ranger", err)
|
ctx.Handle(500, "opts.Ranger", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
count = counter()
|
count = opts.Counter()
|
||||||
} else {
|
} else {
|
||||||
users, count, err = models.SearchUserByName(&models.SearchUserOptions{
|
users, count, err = models.SearchUserByName(&models.SearchUserOptions{
|
||||||
Keyword: keyword,
|
Keyword: keyword,
|
||||||
Type: userType,
|
Type: opts.Type,
|
||||||
OrderBy: orderBy,
|
OrderBy: opts.OrderBy,
|
||||||
Page: page,
|
Page: page,
|
||||||
PageSize: pagingNum,
|
PageSize: opts.PageSize,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "SearchUserByName", err)
|
ctx.Handle(500, "SearchUserByName", err)
|
||||||
|
@ -139,10 +159,10 @@ func RenderUserSearch(ctx *context.Context, userType models.UserType,
|
||||||
}
|
}
|
||||||
ctx.Data["Keyword"] = keyword
|
ctx.Data["Keyword"] = keyword
|
||||||
ctx.Data["Total"] = count
|
ctx.Data["Total"] = count
|
||||||
ctx.Data["Page"] = paginater.New(int(count), pagingNum, page, 5)
|
ctx.Data["Page"] = paginater.New(int(count), opts.PageSize, page, 5)
|
||||||
ctx.Data["Users"] = users
|
ctx.Data["Users"] = users
|
||||||
|
|
||||||
ctx.HTML(200, tplName)
|
ctx.HTML(200, opts.TplName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExploreUsers(ctx *context.Context) {
|
func ExploreUsers(ctx *context.Context) {
|
||||||
|
@ -150,8 +170,14 @@ func ExploreUsers(ctx *context.Context) {
|
||||||
ctx.Data["PageIsExplore"] = true
|
ctx.Data["PageIsExplore"] = true
|
||||||
ctx.Data["PageIsExploreUsers"] = true
|
ctx.Data["PageIsExploreUsers"] = true
|
||||||
|
|
||||||
RenderUserSearch(ctx, models.USER_TYPE_INDIVIDUAL, models.CountUsers, models.Users,
|
RenderUserSearch(ctx, &UserSearchOptions{
|
||||||
setting.ExplorePagingNum, "updated_unix DESC", EXPLORE_USERS)
|
Type: models.USER_TYPE_INDIVIDUAL,
|
||||||
|
Counter: models.CountUsers,
|
||||||
|
Ranger: models.Users,
|
||||||
|
PageSize: setting.ExplorePagingNum,
|
||||||
|
OrderBy: "updated_unix DESC",
|
||||||
|
TplName: EXPLORE_USERS,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func NotFound(ctx *context.Context) {
|
func NotFound(ctx *context.Context) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.9.9.0313
|
0.9.10.0315
|
Loading…
Reference in a new issue