merge
This commit is contained in:
commit
9e8e910bd6
7
.gobuild.yml
Normal file
7
.gobuild.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
filesets:
|
||||||
|
includes:
|
||||||
|
- templates
|
||||||
|
- public
|
||||||
|
- conf
|
||||||
|
- LICENSE
|
||||||
|
- README.md
|
@ -15,6 +15,7 @@ There are some very good products in this category such as [gitlab](http://gitla
|
|||||||
|
|
||||||
- Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, develop specification, change log and road map.
|
- Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, develop specification, change log and road map.
|
||||||
- See [Trello Broad](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team.
|
- See [Trello Broad](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team.
|
||||||
|
- Try it before anything? Go down to **Installation -> Install from binary** section!.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ Make sure you install [Prerequirements](https://github.com/gogits/gogs/wiki/Prer
|
|||||||
|
|
||||||
There are two ways to install Gogs:
|
There are two ways to install Gogs:
|
||||||
|
|
||||||
- [Install from binary](https://github.com/gogits/gogs/wiki/Install-from-binary)
|
- [Install from binary](https://github.com/gogits/gogs/wiki/Install-from-binary): **STRONGLY RECOMMENDED** for just try and deployment!
|
||||||
- [Install from source](https://github.com/gogits/gogs/wiki/Install-from-source)
|
- [Install from source](https://github.com/gogits/gogs/wiki/Install-from-source)
|
||||||
|
|
||||||
## Acknowledgments
|
## Acknowledgments
|
||||||
|
22
conf/app.ini
22
conf/app.ini
@ -1,7 +1,9 @@
|
|||||||
# App name that shows on every page title
|
; App name that shows on every page title
|
||||||
APP_NAME = Gogs: Go Git Service
|
APP_NAME = Gogs: Go Git Service
|
||||||
# !!MUST CHANGE TO YOUR USER NAME!!
|
; !!MUST CHANGE TO YOUR USER NAME!!
|
||||||
RUN_USER = lunny
|
RUN_USER = lunny
|
||||||
|
; Either "dev", "prod" or "test", based on martini
|
||||||
|
RUN_MODE = dev
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories
|
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories
|
||||||
@ -14,15 +16,25 @@ HTTP_ADDR =
|
|||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
# Either "mysql" or "postgres", it's your choice
|
; Either "mysql" or "postgres", it's your choice
|
||||||
DB_TYPE = mysql
|
DB_TYPE = mysql
|
||||||
HOST =
|
HOST =
|
||||||
NAME = gogs
|
NAME = gogs
|
||||||
USER = root
|
USER = root
|
||||||
PASSWD =
|
PASSWD =
|
||||||
# For "postgres" only, either "disable" or "verify-full"
|
; For "postgres" only, either "disable", "require" or "verify-full"
|
||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
# !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
|
; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
|
||||||
USER_PASSWD_SALT = !#@FDEWREWR&*(
|
USER_PASSWD_SALT = !#@FDEWREWR&*(
|
||||||
|
|
||||||
|
[mailer]
|
||||||
|
ENABLED = false
|
||||||
|
; Name displayed in mail title
|
||||||
|
NAME = %(APP_NAME)s
|
||||||
|
; Mail server
|
||||||
|
HOST =
|
||||||
|
; Mailer user name and password
|
||||||
|
USER =
|
||||||
|
PASSWD =
|
2
gogs.go
2
gogs.go
@ -20,7 +20,7 @@ import (
|
|||||||
// Test that go1.1 tag above is included in builds. main.go refers to this definition.
|
// Test that go1.1 tag above is included in builds. main.go refers to this definition.
|
||||||
const go11tag = true
|
const go11tag = true
|
||||||
|
|
||||||
const APP_VER = "0.1.0.0317.1"
|
const APP_VER = "0.1.0.0318.1"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
base.AppVer = APP_VER
|
base.AppVer = APP_VER
|
||||||
|
@ -23,7 +23,7 @@ const (
|
|||||||
type Action struct {
|
type Action struct {
|
||||||
Id int64
|
Id int64
|
||||||
UserId int64 // Receiver user id.
|
UserId int64 // Receiver user id.
|
||||||
OpType int
|
OpType int // Operations: CREATE DELETE STAR ...
|
||||||
ActUserId int64 // Action user id.
|
ActUserId int64 // Action user id.
|
||||||
ActUserName string // Action user name.
|
ActUserName string // Action user name.
|
||||||
RepoId int64
|
RepoId int64
|
||||||
|
@ -401,15 +401,6 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit represents a git commit.
|
|
||||||
type Commit struct {
|
|
||||||
Author string
|
|
||||||
Email string
|
|
||||||
Date time.Time
|
|
||||||
SHA string
|
|
||||||
Message string
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrRepoFileNotLoaded = fmt.Errorf("repo file not loaded")
|
ErrRepoFileNotLoaded = fmt.Errorf("repo file not loaded")
|
||||||
)
|
)
|
||||||
@ -569,38 +560,6 @@ func GetCommit(userName, repoName, branchname, commitid string) (*git.Commit, er
|
|||||||
return r.LastCommit()
|
return r.LastCommit()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// GetLastestCommit returns the latest commit of given repository.
|
|
||||||
func GetLastestCommit(userName, repoName string) (*Commit, error) {
|
|
||||||
stdout, _, err := com.ExecCmd("git", "--git-dir="+RepoPath(userName, repoName), "log", "-1")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
commit := new(Commit)
|
|
||||||
for _, line := range strings.Split(stdout, "\n") {
|
|
||||||
if len(line) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch {
|
|
||||||
case line[0] == 'c':
|
|
||||||
commit.SHA = line[7:]
|
|
||||||
case line[0] == 'A':
|
|
||||||
infos := strings.SplitN(line, " ", 3)
|
|
||||||
commit.Author = infos[1]
|
|
||||||
commit.Email = infos[2][1 : len(infos[2])-1]
|
|
||||||
case line[0] == 'D':
|
|
||||||
commit.Date, err = time.Parse("Mon Jan 02 15:04:05 2006 -0700", line[8:])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
case line[:4] == " ":
|
|
||||||
commit.Message = line[4:]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return commit, nil
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// GetCommits returns all commits of given branch of repository.
|
// GetCommits returns all commits of given branch of repository.
|
||||||
func GetCommits(userName, reposName, branchname string) (*list.List, error) {
|
func GetCommits(userName, reposName, branchname string) (*list.List, error) {
|
||||||
repo, err := git.OpenRepository(RepoPath(userName, reposName))
|
repo, err := git.OpenRepository(RepoPath(userName, reposName))
|
||||||
|
@ -252,7 +252,7 @@ func LoginUserPlain(name, passwd string) (*User, error) {
|
|||||||
} else if !has {
|
} else if !has {
|
||||||
err = ErrUserNotExist
|
err = ErrUserNotExist
|
||||||
}
|
}
|
||||||
return &user, nil
|
return &user, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// FollowUser marks someone be another's follower.
|
// FollowUser marks someone be another's follower.
|
||||||
|
@ -13,13 +13,23 @@ import (
|
|||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
"github.com/Unknwon/goconfig"
|
"github.com/Unknwon/goconfig"
|
||||||
|
|
||||||
|
"github.com/gogits/gogs/modules/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Mailer represents a mail service.
|
||||||
|
type Mailer struct {
|
||||||
|
Name string
|
||||||
|
Host string
|
||||||
|
User, Passwd string
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
AppVer string
|
AppVer string
|
||||||
AppName string
|
AppName string
|
||||||
Domain string
|
Domain string
|
||||||
Cfg *goconfig.ConfigFile
|
Cfg *goconfig.ConfigFile
|
||||||
|
MailService *Mailer
|
||||||
)
|
)
|
||||||
|
|
||||||
func exeDir() (string, error) {
|
func exeDir() (string, error) {
|
||||||
@ -59,6 +69,17 @@ func init() {
|
|||||||
}
|
}
|
||||||
Cfg.BlockMode = false
|
Cfg.BlockMode = false
|
||||||
|
|
||||||
AppName = Cfg.MustValue("", "APP_NAME")
|
AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service")
|
||||||
Domain = Cfg.MustValue("server", "DOMAIN")
|
Domain = Cfg.MustValue("server", "DOMAIN")
|
||||||
|
|
||||||
|
// Check mailer setting.
|
||||||
|
if Cfg.MustBool("mailer", "ENABLED") {
|
||||||
|
MailService = &Mailer{
|
||||||
|
Name: Cfg.MustValue("mailer", "NAME", AppName),
|
||||||
|
Host: Cfg.MustValue("mailer", "HOST", "127.0.0.1:25"),
|
||||||
|
User: Cfg.MustValue("mailer", "USER", "example@example.com"),
|
||||||
|
Passwd: Cfg.MustValue("mailer", "PASSWD", "******"),
|
||||||
|
}
|
||||||
|
log.Info("Mail Service Enabled")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ func Home(ctx *middleware.Context) {
|
|||||||
ctx.Render.HTML(200, "home", ctx.Data)
|
ctx.Render.HTML(200, "home", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Help(ctx *middleware.Context) string {
|
func Help(ctx *middleware.Context) {
|
||||||
return "This is help page"
|
ctx.Data["PageIsHelp"] = true
|
||||||
|
ctx.Render.HTML(200, "help", ctx.Data)
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func Single(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.Render.Error(404)
|
ctx.Render.Error(404)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["CurrentCommit"] = commit
|
ctx.Data["LastCommit"] = commit
|
||||||
|
|
||||||
var readmeFile *models.RepoFile
|
var readmeFile *models.RepoFile
|
||||||
|
|
||||||
@ -182,10 +182,12 @@ func Commits(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.Render.HTML(200, "repo/commits", ctx.Data)
|
ctx.Render.HTML(200, "repo/commits", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Issues(ctx *middleware.Context) string {
|
func Issues(ctx *middleware.Context) {
|
||||||
return "This is issues page"
|
ctx.Data["IsRepoToolbarIssues"] = true
|
||||||
|
ctx.Render.HTML(200, "repo/issues", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pulls(ctx *middleware.Context) string {
|
func Pulls(ctx *middleware.Context) {
|
||||||
return "This is pulls page"
|
ctx.Data["IsRepoToolbarPulls"] = true
|
||||||
|
ctx.Render.HTML(200, "repo/pulls", ctx.Data)
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,11 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Render user setting page (email, website modify)
|
||||||
func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
||||||
ctx.Data["Title"] = "Setting"
|
ctx.Data["Title"] = "Setting"
|
||||||
ctx.Data["PageIsUserSetting"] = true
|
ctx.Data["PageIsUserSetting"] = true // For navbar arrow.
|
||||||
|
ctx.Data["IsUserPageSetting"] = true // For setting nav highlight.
|
||||||
|
|
||||||
user := ctx.User
|
user := ctx.User
|
||||||
ctx.Data["Owner"] = user
|
ctx.Data["Owner"] = user
|
||||||
@ -26,6 +28,7 @@ func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// below is for POST requests
|
||||||
if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) {
|
if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) {
|
||||||
ctx.Render.HTML(200, "user/setting", ctx.Data)
|
ctx.Render.HTML(200, "user/setting", ctx.Data)
|
||||||
return
|
return
|
||||||
@ -48,6 +51,7 @@ func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) {
|
|||||||
func SettingPassword(ctx *middleware.Context, form auth.UpdatePasswdForm) {
|
func SettingPassword(ctx *middleware.Context, form auth.UpdatePasswdForm) {
|
||||||
ctx.Data["Title"] = "Password"
|
ctx.Data["Title"] = "Password"
|
||||||
ctx.Data["PageIsUserSetting"] = true
|
ctx.Data["PageIsUserSetting"] = true
|
||||||
|
ctx.Data["IsUserPageSettingPasswd"] = true
|
||||||
|
|
||||||
if ctx.Req.Method == "GET" {
|
if ctx.Req.Method == "GET" {
|
||||||
ctx.Render.HTML(200, "user/password", ctx.Data)
|
ctx.Render.HTML(200, "user/password", ctx.Data)
|
||||||
@ -147,20 +151,23 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["PageIsUserSetting"] = true
|
ctx.Data["PageIsUserSetting"] = true
|
||||||
|
ctx.Data["IsUserPageSettingSSH"] = true
|
||||||
ctx.Data["Keys"] = keys
|
ctx.Data["Keys"] = keys
|
||||||
ctx.Render.HTML(200, "user/publickey", ctx.Data)
|
ctx.Render.HTML(200, "user/publickey", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingNotification(ctx *middleware.Context) {
|
func SettingNotification(ctx *middleware.Context) {
|
||||||
// todo user setting notification
|
// TODO: user setting notification
|
||||||
ctx.Data["Title"] = "Notification"
|
ctx.Data["Title"] = "Notification"
|
||||||
ctx.Data["PageIsUserSetting"] = true
|
ctx.Data["PageIsUserSetting"] = true
|
||||||
|
ctx.Data["IsUserPageSettingNotify"] = true
|
||||||
ctx.Render.HTML(200, "user/notification", ctx.Data)
|
ctx.Render.HTML(200, "user/notification", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingSecurity(ctx *middleware.Context) {
|
func SettingSecurity(ctx *middleware.Context) {
|
||||||
// todo user setting security
|
// TODO: user setting security
|
||||||
ctx.Data["Title"] = "Security"
|
ctx.Data["Title"] = "Security"
|
||||||
ctx.Data["PageIsUserSetting"] = true
|
ctx.Data["PageIsUserSetting"] = true
|
||||||
|
ctx.Data["IsUserPageSettingSecurity"] = true
|
||||||
ctx.Render.HTML(200, "user/security", ctx.Data)
|
ctx.Render.HTML(200, "user/security", ctx.Data)
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,8 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) {
|
|||||||
|
|
||||||
func Delete(ctx *middleware.Context) {
|
func Delete(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Delete Account"
|
ctx.Data["Title"] = "Delete Account"
|
||||||
|
ctx.Data["PageIsUserSetting"] = true
|
||||||
|
ctx.Data["IsUserPageSettingDelete"] = true
|
||||||
|
|
||||||
if ctx.Req.Method == "GET" {
|
if ctx.Req.Method == "GET" {
|
||||||
ctx.Render.HTML(200, "user/delete", ctx.Data)
|
ctx.Render.HTML(200, "user/delete", ctx.Data)
|
||||||
@ -182,7 +184,7 @@ func Delete(ctx *middleware.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
feedTpl = `<i class="icon fa fa-%s"></i>
|
TPL_FEED = `<i class="icon fa fa-%s"></i>
|
||||||
<div class="info"><span class="meta">%s</span><br>%s</div>`
|
<div class="info"><span class="meta">%s</span><br>%s</div>`
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -194,20 +196,20 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) {
|
|||||||
|
|
||||||
feeds := make([]string, len(actions))
|
feeds := make([]string, len(actions))
|
||||||
for i := range actions {
|
for i := range actions {
|
||||||
feeds[i] = fmt.Sprintf(feedTpl, base.ActionIcon(actions[i].OpType),
|
feeds[i] = fmt.Sprintf(TPL_FEED, base.ActionIcon(actions[i].OpType),
|
||||||
base.TimeSince(actions[i].Created), base.ActionDesc(actions[i], ctx.User.AvatarLink()))
|
base.TimeSince(actions[i].Created), base.ActionDesc(actions[i], ctx.User.AvatarLink()))
|
||||||
}
|
}
|
||||||
ctx.Render.JSON(200, &feeds)
|
ctx.Render.JSON(200, &feeds)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Issues(ctx *middleware.Context) string {
|
func Issues(ctx *middleware.Context) {
|
||||||
return "This is issues page"
|
ctx.Render.HTML(200, "user/issues", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Pulls(ctx *middleware.Context) string {
|
func Pulls(ctx *middleware.Context) {
|
||||||
return "This is pulls page"
|
ctx.Render.HTML(200, "user/pulls", ctx.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stars(ctx *middleware.Context) string {
|
func Stars(ctx *middleware.Context) {
|
||||||
return "This is stars page"
|
ctx.Render.HTML(200, "user/stars", ctx.Data)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<nav class="gogs-nav">
|
<nav class="gogs-nav">
|
||||||
<a id="gogs-nav-logo" class="gogs-nav-item{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="gogs-logo"></a>
|
<a id="gogs-nav-logo" class="gogs-nav-item{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="gogs-logo"></a>
|
||||||
<a class="gogs-nav-item{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a>
|
<a class="gogs-nav-item{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a>
|
||||||
<a class="gogs-nav-item" href="/help">Help</a>{{if .IsSigned}}
|
<a class="gogs-nav-item{{if .PageIsHelp}} active{{end}}" href="/help">Help</a>{{if .IsSigned}}
|
||||||
<a id="gogs-nav-out" class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/user/logout/"><i class="fa fa-power-off fa-lg"></i></a>
|
<a id="gogs-nav-out" class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/user/logout/"><i class="fa fa-power-off fa-lg"></i></a>
|
||||||
<a id="gogs-nav-avatar" class="gogs-nav-item navbar-right" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}">
|
<a id="gogs-nav-avatar" class="gogs-nav-item navbar-right" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}">
|
||||||
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/>
|
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/>
|
||||||
|
11
templates/help.tmpl
Normal file
11
templates/help.tmpl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
<div id="gogs-body-nav">
|
||||||
|
<div class="container">
|
||||||
|
<h3>Help</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
|
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
@ -1,6 +1,6 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container">
|
<div id="gogs-body" class="container">
|
||||||
Website is still in the progress of building...please come back later!
|
Welcome to the land of Gogs! There will be some indroduction!
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "base/footer" .}}
|
9
templates/repo/issues.tmpl
Normal file
9
templates/repo/issues.tmpl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
{{template "repo/nav" .}}
|
||||||
|
{{template "repo/toolbar" .}}
|
||||||
|
<div id="gogs-body" class="container">
|
||||||
|
<div id="gogs-source">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
9
templates/repo/pulls.tmpl
Normal file
9
templates/repo/pulls.tmpl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
{{template "repo/nav" .}}
|
||||||
|
{{template "repo/toolbar" .}}
|
||||||
|
<div id="gogs-body" class="container">
|
||||||
|
<div id="gogs-source">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
@ -42,10 +42,10 @@
|
|||||||
|
|
||||||
<div class="panel panel-default info-box">
|
<div class="panel panel-default info-box">
|
||||||
<div class="panel-heading info-head">
|
<div class="panel-heading info-head">
|
||||||
<a href="/{{$username}}/{{$reponame}}/commit/{{.LatestCommit.SHA}}">{{.LatestCommit.Message}}</a>
|
<a href="/{{$username}}/{{$reponame}}/commit/{{.LastCommit.Oid.String}}">{{.LastCommit.Message}}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body info-content">
|
<div class="panel-body info-content">
|
||||||
<a href="/user/{{.LatestCommit.Author}}">{{.LatestCommit.Author}}</a> <span class="text-muted">{{TimeSince .CurrentCommit.Committer.When}}</span>
|
<a href="/user/{{.LastCommit.Author.Name}}">{{.LastCommit.Author.Name}}</a> <span class="text-muted">{{TimeSince .LastCommit.Author.When}}</span>
|
||||||
</div>
|
</div>
|
||||||
<table class="panel-footer table file-list">
|
<table class="panel-footer table file-list">
|
||||||
<thead class="hidden">
|
<thead class="hidden">
|
||||||
@ -57,7 +57,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{$currentCommit := .CurrentCommit}}
|
|
||||||
{{range .Files}}
|
{{range .Files}}
|
||||||
<tr
|
<tr
|
||||||
{{if .IsDir}}class="is-dir"{{end}}>
|
{{if .IsDir}}class="is-dir"{{end}}>
|
||||||
|
17
templates/user/issues.tmpl
Normal file
17
templates/user/issues.tmpl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
<div id="gogs-body-nav">
|
||||||
|
<div class="container">
|
||||||
|
<ul class="nav nav-pills pull-right">
|
||||||
|
<li><a href="/">Feed</a></li>
|
||||||
|
<li class="active"><a href="/issues">Issues</a></li>
|
||||||
|
<li><a href="/pulls">Pull Requests</a></li>
|
||||||
|
<li><a href="/stars">Stars</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Issues</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
|
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
@ -1,17 +1,7 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container" data-page="user">
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
<div id="gogs-user-setting-nav" class="col-md-3">
|
{{template "user/setting_nav" .}}
|
||||||
<h4>Account Setting</h4>
|
|
||||||
<ul class="list-group">
|
|
||||||
<li class="list-group-item"><a href="/user/setting">Account Profile</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/password">Password</a></li>
|
|
||||||
<li class="list-group-item list-group-item-success"><a href="/user/setting/notification">Notifications</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/security">Security</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/delete">Delete Account</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="gogs-user-setting-container" class="col-md-9">
|
<div id="gogs-user-setting-container" class="col-md-9">
|
||||||
<h4>Notification</h4>
|
<h4>Notification</h4>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,45 +1,35 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container" data-page="user">
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
<div id="gogs-user-setting-nav" class="col-md-3">
|
{{template "user/setting_nav" .}}
|
||||||
<h4>Account Setting</h4>
|
|
||||||
<ul class="list-group">
|
|
||||||
<li class="list-group-item"><a href="/user/setting">Account Profile</a></li>
|
|
||||||
<li class="list-group-item list-group-item-success"><a href="/user/setting/password">Password</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/security">Security</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/delete">Delete Account</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="gogs-user-setting-container" class="col-md-9">
|
<div id="gogs-user-setting-container" class="col-md-9">
|
||||||
<div id="gogs-setting-pwd">
|
<div id="gogs-setting-pwd">
|
||||||
<h4>Password</h4>
|
<h4>Password</h4>
|
||||||
<form class="form-horizontal" id="gogs-password-form" method="post" action="/user/setting/password">{{if .IsSuccess}}
|
<form class="form-horizontal" id="gogs-password-form" method="post" action="/user/setting/password">{{if .IsSuccess}}
|
||||||
<p class="alert alert-success">Password is changed successfully. You can now sign in via new password.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}}
|
<p class="alert alert-success">Password is changed successfully. You can now sign in via new password.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">Old Password<strong class="text-danger">*</strong></label>
|
<label class="col-md-3 control-label">Old Password<strong class="text-danger">*</strong></label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-7">
|
||||||
<input type="password" name="oldpasswd" class="form-control" placeholder="Type your current password" required="required">
|
<input type="password" name="oldpasswd" class="form-control" placeholder="Type your current password" required="required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">New Password<strong class="text-danger">*</strong></label>
|
<label class="col-md-3 control-label">New Password<strong class="text-danger">*</strong></label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-7">
|
||||||
<input type="password" name="newpasswd" class="form-control" placeholder="Type your new password" required="required">
|
<input type="password" name="newpasswd" class="form-control" placeholder="Type your new password" required="required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">Re-Type<strong class="text-danger">*</strong></label>
|
<label class="col-md-3 control-label">Re-Type<strong class="text-danger">*</strong></label>
|
||||||
<div class="col-md-8">
|
<div class="col-md-7">
|
||||||
<input type="password" name="retypepasswd" class="form-control" placeholder="Re-type your new password" required="required">
|
<input type="password" name="retypepasswd" class="form-control" placeholder="Re-type your new password" required="required">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-offset-2 col-md-8">
|
<div class="col-md-offset-3 col-md-7">
|
||||||
<button type="submit" class="btn btn-primary">Change Password</button>
|
<button type="submit" class="btn btn-primary">Change Password</button>
|
||||||
<a href="/forget-password/">Forgot your password?</a>
|
<a href="/forget-password/">Forgot your password?</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,18 +1,7 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container" data-page="user">
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
<div id="gogs-user-setting-nav" class="col-md-3">
|
{{template "user/setting_nav" .}}
|
||||||
<h4>Account Setting</h4>
|
|
||||||
<ul class="list-group">
|
|
||||||
<li class="list-group-item"><a href="/user/setting">Account Profile</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/password">Password</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li>
|
|
||||||
<li class="list-group-item list-group-item-success"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/security">Security</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/delete">Delete Account</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="gogs-user-setting-container" class="col-md-9">
|
<div id="gogs-user-setting-container" class="col-md-9">
|
||||||
<div id="gogs-ssh-keys">
|
<div id="gogs-ssh-keys">
|
||||||
<h4>SSH Keys</h4>{{if .AddSSHKeySuccess}}
|
<h4>SSH Keys</h4>{{if .AddSSHKeySuccess}}
|
||||||
|
17
templates/user/pulls.tmpl
Normal file
17
templates/user/pulls.tmpl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
<div id="gogs-body-nav">
|
||||||
|
<div class="container">
|
||||||
|
<ul class="nav nav-pills pull-right">
|
||||||
|
<li><a href="/">Feed</a></li>
|
||||||
|
<li><a href="/issues">Issues</a></li>
|
||||||
|
<li class="active"><a href="/pulls">Pull Requests</a></li>
|
||||||
|
<li><a href="/stars">Stars</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Pull Requests</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
|
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
@ -1,17 +1,7 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container" data-page="user">
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
<div id="gogs-user-setting-nav" class="col-md-3">
|
{{template "user/setting_nav" .}}
|
||||||
<h4>Account Setting</h4>
|
|
||||||
<ul class="list-group">
|
|
||||||
<li class="list-group-item"><a href="/user/setting">Account Profile</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/password">Password</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
|
||||||
<li class="list-group-item list-group-item-success"><a href="/user/setting/security">Security</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/delete">Delete Account</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="gogs-user-setting-container" class="col-md-9">
|
<div id="gogs-user-setting-container" class="col-md-9">
|
||||||
<h4>Security</h4>
|
<h4>Security</h4>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "base/navbar" .}}
|
{{template "base/navbar" .}}
|
||||||
<div id="gogs-body" class="container" data-page="user">
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
<div id="gogs-user-setting-nav" class="col-md-3">
|
{{template "user/setting_nav" .}}
|
||||||
<h4>Account Setting</h4>
|
|
||||||
<ul class="list-group">
|
|
||||||
<li class="list-group-item list-group-item-success"><a href="/user/setting">Account Profile</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/password">Password</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/setting/security">Security</a></li>
|
|
||||||
<li class="list-group-item"><a href="/user/delete">Delete Account</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="gogs-user-setting-container" class="col-md-9">
|
<div id="gogs-user-setting-container" class="col-md-9">
|
||||||
<div id="gogs-setting-pwd">
|
<div id="gogs-setting-pwd">
|
||||||
<h4>Account Profile</h4>
|
<h4>Account Profile</h4>
|
||||||
|
11
templates/user/setting_nav.tmpl
Normal file
11
templates/user/setting_nav.tmpl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<div id="gogs-user-setting-nav" class="col-md-3">
|
||||||
|
<h4>Account Setting</h4>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item{{if .IsUserPageSetting}} list-group-item-success{{end}}"><a href="/user/setting">Account Profile</a></li>
|
||||||
|
<li class="list-group-item{{if .IsUserPageSettingPasswd}} list-group-item-success{{end}}"><a href="/user/setting/password">Password</a></li>
|
||||||
|
<li class="list-group-item{{if .IsUserPageSettingNotify}} list-group-item-success{{end}}"><a href="/user/setting/notification">Notifications</a></li>
|
||||||
|
<li class="list-group-item{{if .IsUserPageSettingSSH}} list-group-item-success{{end}}"><a href="/user/setting/ssh/">SSH Keys</a></li>
|
||||||
|
<li class="list-group-item{{if .IsUserPageSettingSecurity}} list-group-item-success{{end}}"><a href="/user/setting/security">Security</a></li>
|
||||||
|
<li class="list-group-item{{if .IsUserPageSettingDelete}} list-group-item-success{{end}}"><a href="/user/delete">Delete Account</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
17
templates/user/stars.tmpl
Normal file
17
templates/user/stars.tmpl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{template "base/head" .}}
|
||||||
|
{{template "base/navbar" .}}
|
||||||
|
<div id="gogs-body-nav">
|
||||||
|
<div class="container">
|
||||||
|
<ul class="nav nav-pills pull-right">
|
||||||
|
<li><a href="/">Feed</a></li>
|
||||||
|
<li><a href="/issues">Issues</a></li>
|
||||||
|
<li><a href="/pulls">Pull Requests</a></li>
|
||||||
|
<li class="active"><a href="/stars">Stars</a></li>
|
||||||
|
</ul>
|
||||||
|
<h3>Stars</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="gogs-body" class="container" data-page="user">
|
||||||
|
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
@ -10,8 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
|
||||||
git "github.com/gogits/git"
|
"github.com/gogits/git"
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
)
|
)
|
||||||
@ -25,6 +24,7 @@ gogs serv provide access auth for repositories`,
|
|||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for command: ./gogs update
|
||||||
func runUpdate(*cli.Context) {
|
func runUpdate(*cli.Context) {
|
||||||
userName := os.Getenv("userName")
|
userName := os.Getenv("userName")
|
||||||
userId := os.Getenv("userId")
|
userId := os.Getenv("userId")
|
||||||
|
71
web.go
71
web.go
@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
"github.com/codegangsta/martini"
|
"github.com/codegangsta/martini"
|
||||||
@ -34,12 +35,20 @@ gogs web`,
|
|||||||
Flags: []cli.Flag{},
|
Flags: []cli.Flag{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func Range(l int) []int {
|
// Check run mode(Default of martini is Dev).
|
||||||
return make([]int, l)
|
func checkRunMode() {
|
||||||
|
switch base.Cfg.MustValue("", "RUN_MODE") {
|
||||||
|
case "prod":
|
||||||
|
martini.Env = martini.Prod
|
||||||
|
case "test":
|
||||||
|
martini.Env = martini.Test
|
||||||
|
}
|
||||||
|
log.Info("Run Mode: %s", strings.Title(martini.Env))
|
||||||
}
|
}
|
||||||
|
|
||||||
func runWeb(*cli.Context) {
|
func runWeb(*cli.Context) {
|
||||||
log.Info("%s %s", base.AppName, base.AppVer)
|
log.Info("%s %s", base.AppName, base.AppVer)
|
||||||
|
checkRunMode()
|
||||||
|
|
||||||
m := martini.Classic()
|
m := martini.Classic()
|
||||||
|
|
||||||
@ -52,48 +61,52 @@ func runWeb(*cli.Context) {
|
|||||||
|
|
||||||
m.Use(middleware.InitContext())
|
m.Use(middleware.InitContext())
|
||||||
|
|
||||||
|
ignSignIn := middleware.SignInRequire(false)
|
||||||
|
reqSignIn, reqSignOut := middleware.SignInRequire(true), middleware.SignOutRequire()
|
||||||
// Routers.
|
// Routers.
|
||||||
m.Get("/", middleware.SignInRequire(false), routers.Home)
|
m.Get("/", ignSignIn, routers.Home)
|
||||||
m.Get("/issues", middleware.SignInRequire(true), user.Issues)
|
m.Get("/issues", reqSignIn, user.Issues)
|
||||||
m.Get("/pulls", middleware.SignInRequire(true), user.Pulls)
|
m.Get("/pulls", reqSignIn, user.Pulls)
|
||||||
m.Get("/stars", middleware.SignInRequire(true), user.Stars)
|
m.Get("/stars", reqSignIn, user.Stars)
|
||||||
m.Any("/user/login", middleware.SignOutRequire(), binding.BindIgnErr(auth.LogInForm{}), user.SignIn)
|
m.Any("/user/login", reqSignOut, binding.BindIgnErr(auth.LogInForm{}), user.SignIn)
|
||||||
m.Any("/user/logout", middleware.SignInRequire(true), user.SignOut)
|
m.Any("/user/logout", reqSignIn, user.SignOut)
|
||||||
m.Any("/user/sign_up", middleware.SignOutRequire(), binding.BindIgnErr(auth.RegisterForm{}), user.SignUp)
|
m.Any("/user/sign_up", reqSignOut, binding.BindIgnErr(auth.RegisterForm{}), user.SignUp)
|
||||||
m.Any("/user/delete", middleware.SignInRequire(true), user.Delete)
|
m.Any("/user/delete", reqSignIn, user.Delete)
|
||||||
m.Get("/user/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
m.Get("/user/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
|
||||||
|
|
||||||
m.Any("/user/setting", middleware.SignInRequire(true), binding.BindIgnErr(auth.UpdateProfileForm{}), user.Setting)
|
m.Any("/user/setting", reqSignIn, binding.BindIgnErr(auth.UpdateProfileForm{}), user.Setting)
|
||||||
m.Any("/user/setting/password", middleware.SignInRequire(true), binding.BindIgnErr(auth.UpdatePasswdForm{}), user.SettingPassword)
|
m.Any("/user/setting/password", reqSignIn, binding.BindIgnErr(auth.UpdatePasswdForm{}), user.SettingPassword)
|
||||||
m.Any("/user/setting/ssh", middleware.SignInRequire(true), binding.BindIgnErr(auth.AddSSHKeyForm{}), user.SettingSSHKeys)
|
m.Any("/user/setting/ssh", reqSignIn, binding.BindIgnErr(auth.AddSSHKeyForm{}), user.SettingSSHKeys)
|
||||||
m.Any("/user/setting/notification", middleware.SignInRequire(true), user.SettingNotification)
|
m.Any("/user/setting/notification", reqSignIn, user.SettingNotification)
|
||||||
m.Any("/user/setting/security", middleware.SignInRequire(true), user.SettingSecurity)
|
m.Any("/user/setting/security", reqSignIn, user.SettingSecurity)
|
||||||
|
|
||||||
m.Get("/user/:username", middleware.SignInRequire(false), user.Profile)
|
m.Get("/user/:username", ignSignIn, user.Profile)
|
||||||
|
|
||||||
m.Any("/repo/create", middleware.SignInRequire(true), binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create)
|
m.Any("/repo/create", reqSignIn, binding.BindIgnErr(auth.CreateRepoForm{}), repo.Create)
|
||||||
|
|
||||||
m.Get("/help", routers.Help)
|
m.Get("/help", routers.Help)
|
||||||
|
|
||||||
m.Post("/:username/:reponame/settings", middleware.SignInRequire(true), middleware.RepoAssignment(true), repo.SettingPost)
|
m.Post("/:username/:reponame/settings", reqSignIn, middleware.RepoAssignment(true), repo.SettingPost)
|
||||||
m.Get("/:username/:reponame/settings", middleware.SignInRequire(true), middleware.RepoAssignment(true), repo.Setting)
|
m.Get("/:username/:reponame/settings", reqSignIn, middleware.RepoAssignment(true), repo.Setting)
|
||||||
|
|
||||||
m.Get("/:username/:reponame/commits/:branchname", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Commits)
|
m.Get("/:username/:reponame/commits/:branchname", ignSignIn, middleware.RepoAssignment(true), repo.Commits)
|
||||||
m.Get("/:username/:reponame/issues", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Issues)
|
m.Get("/:username/:reponame/issues", ignSignIn, middleware.RepoAssignment(true), repo.Issues)
|
||||||
m.Get("/:username/:reponame/pulls", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Pulls)
|
m.Get("/:username/:reponame/pulls", ignSignIn, middleware.RepoAssignment(true), repo.Pulls)
|
||||||
m.Get("/:username/:reponame/branches", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Branches)
|
m.Get("/:username/:reponame/branches", ignSignIn, middleware.RepoAssignment(true), repo.Branches)
|
||||||
m.Get("/:username/:reponame/tree/:branchname/**",
|
m.Get("/:username/:reponame/tree/:branchname/**",
|
||||||
middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Single)
|
ignSignIn, middleware.RepoAssignment(true), repo.Single)
|
||||||
m.Get("/:username/:reponame/tree/:branchname",
|
m.Get("/:username/:reponame/tree/:branchname",
|
||||||
middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Single)
|
ignSignIn, middleware.RepoAssignment(true), repo.Single)
|
||||||
m.Get("/:username/:reponame/commit/:commitid/**", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Single)
|
m.Get("/:username/:reponame/commit/:commitid/**", ignSignIn, middleware.RepoAssignment(true), repo.Single)
|
||||||
m.Get("/:username/:reponame/commit/:commitid", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Single)
|
m.Get("/:username/:reponame/commit/:commitid", ignSignIn, middleware.RepoAssignment(true), repo.Single)
|
||||||
|
|
||||||
m.Get("/:username/:reponame", middleware.SignInRequire(false), middleware.RepoAssignment(true), repo.Single)
|
m.Get("/:username/:reponame", ignSignIn, middleware.RepoAssignment(true), repo.Single)
|
||||||
|
|
||||||
listenAddr := fmt.Sprintf("%s:%s",
|
listenAddr := fmt.Sprintf("%s:%s",
|
||||||
base.Cfg.MustValue("server", "HTTP_ADDR"),
|
base.Cfg.MustValue("server", "HTTP_ADDR"),
|
||||||
base.Cfg.MustValue("server", "HTTP_PORT", "3000"))
|
base.Cfg.MustValue("server", "HTTP_PORT", "3000"))
|
||||||
log.Info("Listen: %s", listenAddr)
|
log.Info("Listen: %s", listenAddr)
|
||||||
http.ListenAndServe(listenAddr, m)
|
if err := http.ListenAndServe(listenAddr, m); err != nil {
|
||||||
|
log.Critical(err.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user