Huge updates!!!!! Be careful to merge!!!!
This commit is contained in:
152
cmd/web.go
152
cmd/web.go
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/gogits/gogs/routers/admin"
|
"github.com/gogits/gogs/routers/admin"
|
||||||
"github.com/gogits/gogs/routers/api/v1"
|
"github.com/gogits/gogs/routers/api/v1"
|
||||||
"github.com/gogits/gogs/routers/dev"
|
"github.com/gogits/gogs/routers/dev"
|
||||||
// "github.com/gogits/gogs/routers/org"
|
"github.com/gogits/gogs/routers/org"
|
||||||
"github.com/gogits/gogs/routers/repo"
|
"github.com/gogits/gogs/routers/repo"
|
||||||
"github.com/gogits/gogs/routers/user"
|
"github.com/gogits/gogs/routers/user"
|
||||||
)
|
)
|
||||||
@ -101,8 +101,8 @@ func runWeb(*cli.Context) {
|
|||||||
|
|
||||||
// Routers.
|
// Routers.
|
||||||
m.Get("/", ignSignIn, routers.Home)
|
m.Get("/", ignSignIn, routers.Home)
|
||||||
// m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
||||||
// m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||||
m.Group("", func(r *macaron.Router) {
|
m.Group("", func(r *macaron.Router) {
|
||||||
r.Get("/issues", user.Issues)
|
r.Get("/issues", user.Issues)
|
||||||
r.Get("/pulls", user.Pulls)
|
r.Get("/pulls", user.Pulls)
|
||||||
@ -151,6 +151,7 @@ func runWeb(*cli.Context) {
|
|||||||
r.Get("/ssh", user.SettingsSSHKeys)
|
r.Get("/ssh", user.SettingsSSHKeys)
|
||||||
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||||
r.Get("/social", user.SettingsSocial)
|
r.Get("/social", user.SettingsSocial)
|
||||||
|
r.Get("/orgs", user.SettingsOrgs)
|
||||||
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||||
})
|
})
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
@ -173,8 +174,8 @@ func runWeb(*cli.Context) {
|
|||||||
m.Group("/repo", func(r *macaron.Router) {
|
m.Group("/repo", func(r *macaron.Router) {
|
||||||
r.Get("/create", repo.Create)
|
r.Get("/create", repo.Create)
|
||||||
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||||
// r.Get("/migrate", repo.Migrate)
|
r.Get("/migrate", repo.Migrate)
|
||||||
// r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
||||||
@ -210,91 +211,92 @@ func runWeb(*cli.Context) {
|
|||||||
dev.RegisterDebugRoutes(m)
|
dev.RegisterDebugRoutes(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reqTrueOwner := middleware.RequireTrueOwner()
|
reqTrueOwner := middleware.RequireTrueOwner()
|
||||||
|
|
||||||
// m.Group("/org", func(r *macaron.Router) {
|
// Organization routers.
|
||||||
// r.Get("/create", org.New)
|
m.Group("/org", func(r *macaron.Router) {
|
||||||
// r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost)
|
r.Get("/create", org.New)
|
||||||
// r.Get("/:org", org.Home)
|
r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost)
|
||||||
// r.Get("/:org/dashboard", org.Dashboard)
|
r.Get("/:org", org.Home)
|
||||||
// r.Get("/:org/members", org.Members)
|
r.Get("/:org/dashboard", org.Dashboard)
|
||||||
|
r.Get("/:org/members", org.Members)
|
||||||
|
|
||||||
// r.Get("/:org/teams", org.Teams)
|
r.Get("/:org/teams", org.Teams)
|
||||||
// r.Get("/:org/teams/new", org.NewTeam)
|
r.Get("/:org/teams/new", org.NewTeam)
|
||||||
// r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||||
// r.Get("/:org/teams/:team/edit", org.EditTeam)
|
r.Get("/:org/teams/:team/edit", org.EditTeam)
|
||||||
|
|
||||||
// r.Get("/:org/team/:team", org.SingleTeam)
|
r.Get("/:org/team/:team", org.SingleTeam)
|
||||||
|
|
||||||
// r.Get("/:org/settings", org.Settings)
|
r.Get("/:org/settings", org.Settings)
|
||||||
// r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
|
r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
|
||||||
// r.Post("/:org/settings/delete", org.DeletePost)
|
r.Post("/:org/settings/delete", org.DeletePost)
|
||||||
// }, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/settings", repo.Setting)
|
r.Get("/settings", repo.Setting)
|
||||||
// r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
||||||
|
|
||||||
// m.Group("/settings", func(r *macaron.Router) {
|
m.Group("/settings", func(r *macaron.Router) {
|
||||||
// r.Get("/collaboration", repo.Collaboration)
|
r.Get("/collaboration", repo.Collaboration)
|
||||||
// r.Post("/collaboration", repo.CollaborationPost)
|
r.Post("/collaboration", repo.CollaborationPost)
|
||||||
// r.Get("/hooks", repo.WebHooks)
|
r.Get("/hooks", repo.WebHooks)
|
||||||
// r.Get("/hooks/add", repo.WebHooksAdd)
|
r.Get("/hooks/add", repo.WebHooksAdd)
|
||||||
// r.Post("/hooks/add", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksAddPost)
|
r.Post("/hooks/add", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksAddPost)
|
||||||
// r.Get("/hooks/:id", repo.WebHooksEdit)
|
r.Get("/hooks/:id", repo.WebHooksEdit)
|
||||||
// r.Post("/hooks/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
r.Post("/hooks/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||||
// })
|
})
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/action/:action", repo.Action)
|
// r.Get("/action/:action", repo.Action)
|
||||||
|
|
||||||
// m.Group("/issues", func(r *macaron.Router) {
|
m.Group("/issues", func(r *macaron.Router) {
|
||||||
// r.Get("/new", repo.CreateIssue)
|
r.Get("/new", repo.CreateIssue)
|
||||||
// r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
||||||
// r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
||||||
// r.Post("/:index/label", repo.UpdateIssueLabel)
|
r.Post("/:index/label", repo.UpdateIssueLabel)
|
||||||
// r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
||||||
// r.Post("/:index/assignee", repo.UpdateAssignee)
|
r.Post("/:index/assignee", repo.UpdateAssignee)
|
||||||
// r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
||||||
// r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
||||||
// r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
||||||
// r.Post("/labels/delete", repo.DeleteLabel)
|
r.Post("/labels/delete", repo.DeleteLabel)
|
||||||
// r.Get("/milestones", repo.Milestones)
|
r.Get("/milestones", repo.Milestones)
|
||||||
// r.Get("/milestones/new", repo.NewMilestone)
|
r.Get("/milestones/new", repo.NewMilestone)
|
||||||
// r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
||||||
// r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
||||||
// r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
||||||
// r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
||||||
// })
|
})
|
||||||
|
|
||||||
// r.Post("/comment/:action", repo.Comment)
|
r.Post("/comment/:action", repo.Comment)
|
||||||
// r.Get("/releases/new", repo.NewRelease)
|
r.Get("/releases/new", repo.NewRelease)
|
||||||
// r.Get("/releases/edit/:tagname", repo.EditRelease)
|
r.Get("/releases/edit/:tagname", repo.EditRelease)
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true))
|
}, reqSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||||
// r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true, true))
|
}, reqSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/issues", repo.Issues)
|
r.Get("/issues", repo.Issues)
|
||||||
// r.Get("/issues/:index", repo.ViewIssue)
|
r.Get("/issues/:index", repo.ViewIssue)
|
||||||
// r.Get("/pulls", repo.Pulls)
|
r.Get("/pulls", repo.Pulls)
|
||||||
// r.Get("/branches", repo.Branches)
|
r.Get("/branches", repo.Branches)
|
||||||
// }, ignSignIn, middleware.RepoAssignment(true))
|
}, ignSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
r.Get("/src/:branchname", repo.Home)
|
r.Get("/src/:branchname", repo.Home)
|
||||||
r.Get("/src/:branchname/*", repo.Home)
|
r.Get("/src/:branchname/*", repo.Home)
|
||||||
r.Get("/raw/:branchname/**", repo.SingleDownload)
|
r.Get("/raw/:branchname/*", repo.SingleDownload)
|
||||||
// r.Get("/commits/:branchname", repo.Commits)
|
r.Get("/commits/:branchname", repo.Commits)
|
||||||
// r.Get("/commits/:branchname/search", repo.SearchCommits)
|
r.Get("/commits/:branchname/search", repo.SearchCommits)
|
||||||
// r.Get("/commits/:branchname/**", repo.FileHistory)
|
r.Get("/commits/:branchname/*", repo.FileHistory)
|
||||||
// r.Get("/commit/:branchname", repo.Diff)
|
r.Get("/commit/:branchname", repo.Diff)
|
||||||
// r.Get("/commit/:branchname/**", repo.Diff)
|
r.Get("/commit/:branchname/*", repo.Diff)
|
||||||
// r.Get("/releases", repo.Releases)
|
r.Get("/releases", repo.Releases)
|
||||||
r.Get("/archive/*.*", repo.Download)
|
r.Get("/archive/*.*", repo.Download)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true, true))
|
}, ignSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ profile = Profile
|
|||||||
password = Password
|
password = Password
|
||||||
ssh_keys = SSH Keys
|
ssh_keys = SSH Keys
|
||||||
social = Social Accounts
|
social = Social Accounts
|
||||||
|
orgs = Organizations
|
||||||
delete = Delete Accoount
|
delete = Delete Accoount
|
||||||
|
|
||||||
public_profile = Public Profile
|
public_profile = Public Profile
|
||||||
@ -118,6 +119,7 @@ add_on = Added on
|
|||||||
last_used = Last used on
|
last_used = Last used on
|
||||||
no_activity = No recent activity
|
no_activity = No recent activity
|
||||||
|
|
||||||
|
manage_orgs = Manage Organizations
|
||||||
manage_social = Manage Associated Social Accounts
|
manage_social = Manage Associated Social Accounts
|
||||||
|
|
||||||
delete_account = Delete Your Account
|
delete_account = Delete Your Account
|
||||||
|
@ -89,6 +89,7 @@ profile = 个人信息
|
|||||||
password = 修改密码
|
password = 修改密码
|
||||||
ssh_keys = 管理 SSH 密钥
|
ssh_keys = 管理 SSH 密钥
|
||||||
social = 社交帐号绑定
|
social = 社交帐号绑定
|
||||||
|
orgs = 管理组织
|
||||||
delete = 删除帐户
|
delete = 删除帐户
|
||||||
|
|
||||||
public_profile = 公开信息
|
public_profile = 公开信息
|
||||||
@ -118,6 +119,7 @@ add_on = 增加于
|
|||||||
last_used = 上次使用在
|
last_used = 上次使用在
|
||||||
no_activity = 没有最近活动
|
no_activity = 没有最近活动
|
||||||
|
|
||||||
|
manage_orgs = 管理我的组织
|
||||||
manage_social = 管理关联社交帐户
|
manage_social = 管理关联社交帐户
|
||||||
|
|
||||||
delete_account = 删除当前帐户
|
delete_account = 删除当前帐户
|
||||||
|
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.4.7.0725 Alpha"
|
const APP_VER = "0.4.7.0726 Alpha"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gogits/git"
|
"github.com/gogits/gogs/modules/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -106,7 +106,6 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
|
|||||||
"CreateCaptcha": func() string { return "" },
|
"CreateCaptcha": func() string { return "" },
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Legacy
|
|
||||||
type Actioner interface {
|
type Actioner interface {
|
||||||
GetOpType() int
|
GetOpType() int
|
||||||
GetActUserName() string
|
GetActUserName() string
|
||||||
|
@ -73,6 +73,14 @@ func (c *Commit) CommitsCount() (int, error) {
|
|||||||
return c.repo.commitsCount(c.Id)
|
return c.repo.commitsCount(c.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Commit) SearchCommits(keyword string) (*list.List, error) {
|
||||||
|
return c.repo.searchCommits(c.Id, keyword)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Commit) CommitsByRange(page int) (*list.List, error) {
|
||||||
|
return c.repo.commitsByRange(c.Id, page)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Commit) GetCommitOfRelPath(relPath string) (*Commit, error) {
|
func (c *Commit) GetCommitOfRelPath(relPath string) (*Commit, error) {
|
||||||
return c.repo.getCommitOfRelPath(c.Id, relPath)
|
return c.repo.getCommitOfRelPath(c.Id, relPath)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,18 @@ func (repo *Repository) GetCommitOfBranch(branchName string) (*Commit, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
return repo.GetCommit(commitId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error) {
|
||||||
|
return repo.getCommitIdOfRef("refs/tags/" + tagName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error) {
|
||||||
|
commitId, err := repo.GetCommitIdOfTag(tagName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return repo.GetCommit(commitId)
|
return repo.GetCommit(commitId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,6 +223,32 @@ func (repo *Repository) commitsBefore(lock *sync.Mutex, l *list.List, parent *li
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CommitsCount(commitId string) (int, error) {
|
||||||
|
id, err := NewIdFromString(commitId)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return repo.commitsCount(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) FileCommitsCount(branch, file string) (int, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "rev-list", "--count",
|
||||||
|
branch, "--", file)
|
||||||
|
if err != nil {
|
||||||
|
return 0, errors.New(stderr)
|
||||||
|
}
|
||||||
|
return com.StrTo(strings.TrimSpace(stdout)).Int()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CommitsByFileAndRange(branch, file string, page int) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", branch,
|
||||||
|
"--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat, "--", file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
||||||
l := list.New()
|
l := list.New()
|
||||||
lock := new(sync.Mutex)
|
lock := new(sync.Mutex)
|
||||||
@ -219,6 +256,26 @@ func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
|||||||
return l, err
|
return l, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(), "-100",
|
||||||
|
"-i", "--grep="+keyword, prettyLogFormat)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if len(stderr) > 0 {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(),
|
||||||
|
"--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getCommitOfRelPath(id sha1, relPath string) (*Commit, error) {
|
func (repo *Repository) getCommitOfRelPath(id sha1, relPath string) (*Commit, error) {
|
||||||
stdout, _, err := com.ExecCmdDir(repo.Path, "git", "log", "-1", prettyLogFormat, id.String(), "--", relPath)
|
stdout, _, err := com.ExecCmdDir(repo.Path, "git", "log", "-1", prettyLogFormat, id.String(), "--", relPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -30,6 +30,14 @@ func (repo *Repository) GetTags() ([]string, error) {
|
|||||||
return tags[:len(tags)-1], nil
|
return tags[:len(tags)-1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CreateTag(tagName, idStr string) error {
|
||||||
|
_, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", tagName, idStr)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New(stderr)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getTag(id sha1) (*Tag, error) {
|
func (repo *Repository) getTag(id sha1) (*Tag, error) {
|
||||||
if repo.tagCache != nil {
|
if repo.tagCache != nil {
|
||||||
if t, ok := repo.tagCache[id]; ok {
|
if t, ok := repo.tagCache[id]; ok {
|
||||||
|
@ -44,3 +44,16 @@ func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
|
|||||||
}
|
}
|
||||||
return nil, fmt.Errorf("GetTreeEntryByPath: %v", ErrNotExist)
|
return nil, fmt.Errorf("GetTreeEntryByPath: %v", ErrNotExist)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Tree) GetBlobByPath(rpath string) (*Blob, error) {
|
||||||
|
entry, err := t.GetTreeEntryByPath(rpath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !entry.IsDir() {
|
||||||
|
return entry.Blob(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, ErrNotExist
|
||||||
|
}
|
||||||
|
@ -5,12 +5,33 @@
|
|||||||
package git
|
package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"container/list"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const prettyLogFormat = `--pretty=format:%H`
|
const prettyLogFormat = `--pretty=format:%H`
|
||||||
|
|
||||||
|
func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error) {
|
||||||
|
l := list.New()
|
||||||
|
if len(logByts) == 0 {
|
||||||
|
return l, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := bytes.Split(logByts, []byte{'\n'})
|
||||||
|
|
||||||
|
for _, commitId := range parts {
|
||||||
|
commit, err := repo.GetCommit(string(commitId))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l.PushBack(commit)
|
||||||
|
}
|
||||||
|
|
||||||
|
return l, nil
|
||||||
|
}
|
||||||
|
|
||||||
func RefEndName(refStr string) string {
|
func RefEndName(refStr string) string {
|
||||||
index := strings.LastIndex(refStr, "/")
|
index := strings.LastIndex(refStr, "/")
|
||||||
if index != -1 {
|
if index != -1 {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
4
public/ng/css/font-awesome.min.css
vendored
4
public/ng/css/font-awesome.min.css
vendored
File diff suppressed because one or more lines are too long
@ -373,7 +373,7 @@ img.avatar-30 {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
margin-right: 8px;
|
margin-left: 30px;
|
||||||
}
|
}
|
||||||
.markdown a span.octicon-link {
|
.markdown a span.octicon-link {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -1058,6 +1058,9 @@ The register and sign-in page style
|
|||||||
}
|
}
|
||||||
#repo-bare-start pre {
|
#repo-bare-start pre {
|
||||||
margin: 0 40px;
|
margin: 0 40px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
background: #f8f8f8;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-bare-start h2 {
|
.repo-bare #repo-bare-start h2 {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
@ -1073,6 +1076,7 @@ The register and sign-in page style
|
|||||||
margin-right: 200px;
|
margin-right: 200px;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-clone-help {
|
.repo-bare #repo-clone-help {
|
||||||
|
clear: both;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-clone-url {
|
.repo-bare #repo-clone-url {
|
||||||
|
@ -5,12 +5,10 @@
|
|||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Members(ctx *middleware.Context, params martini.Params) {
|
func Members(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Members"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Members"
|
||||||
ctx.HTML(200, "org/members")
|
ctx.HTML(200, "org/members")
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
"github.com/gogits/gogs/models"
|
||||||
|
|
||||||
"github.com/gogits/gogs-ng/models"
|
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
@ -21,10 +19,10 @@ const (
|
|||||||
SETTINGS base.TplName = "org/settings"
|
SETTINGS base.TplName = "org/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Home(ctx *middleware.Context, params martini.Params) {
|
func Home(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"]
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org")
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Home(GetUserByName)", err)
|
ctx.Handle(404, "org.Home(GetUserByName)", err)
|
||||||
@ -99,12 +97,12 @@ func NewPost(ctx *middleware.Context, form auth.CreateOrgForm) {
|
|||||||
ctx.Redirect("/org/" + form.OrgName + "/dashboard")
|
ctx.Redirect("/org/" + form.OrgName + "/dashboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dashboard(ctx *middleware.Context, params martini.Params) {
|
func Dashboard(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Dashboard"
|
ctx.Data["Title"] = "Dashboard"
|
||||||
ctx.Data["PageIsUserDashboard"] = true
|
ctx.Data["PageIsUserDashboard"] = true
|
||||||
ctx.Data["PageIsOrgDashboard"] = true
|
ctx.Data["PageIsOrgDashboard"] = true
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Dashboard(GetUserByName)", err)
|
ctx.Handle(404, "org.Dashboard(GetUserByName)", err)
|
||||||
@ -114,11 +112,11 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
ctx.Data["ContextUser"] = org
|
ctx.Data["ContextUser"] = org
|
||||||
|
|
||||||
ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true)
|
ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true)
|
||||||
@ -137,10 +135,10 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.HTML(200, user.DASHBOARD)
|
ctx.HTML(200, user.DASHBOARD)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Settings(ctx *middleware.Context, params martini.Params) {
|
func Settings(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Settings(GetUserByName)", err)
|
ctx.Handle(404, "org.Settings(GetUserByName)", err)
|
||||||
@ -154,10 +152,10 @@ func Settings(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.HTML(200, SETTINGS)
|
ctx.HTML(200, SETTINGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgSettingForm) {
|
func SettingsPost(ctx *middleware.Context, form auth.OrgSettingForm) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.SettingsPost(GetUserByName)", err)
|
ctx.Handle(404, "org.SettingsPost(GetUserByName)", err)
|
||||||
@ -187,10 +185,10 @@ func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgS
|
|||||||
ctx.Redirect("/org/" + org.Name + "/settings")
|
ctx.Redirect("/org/" + org.Name + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeletePost(ctx *middleware.Context, params martini.Params) {
|
func DeletePost(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.DeletePost(GetUserByName)", err)
|
ctx.Handle(404, "org.DeletePost(GetUserByName)", err)
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
|
||||||
|
|
||||||
"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/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
@ -19,10 +17,10 @@ const (
|
|||||||
TEAM_NEW base.TplName = "org/team_new"
|
TEAM_NEW base.TplName = "org/team_new"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Teams(ctx *middleware.Context, params martini.Params) {
|
func Teams(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Teams"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Teams"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Teams(GetUserByName)", err)
|
ctx.Handle(404, "org.Teams(GetUserByName)", err)
|
||||||
@ -48,8 +46,8 @@ func Teams(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.HTML(200, TEAMS)
|
ctx.HTML(200, TEAMS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTeam(ctx *middleware.Context, params martini.Params) {
|
func NewTeam(ctx *middleware.Context) {
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.NewTeam(GetUserByName)", err)
|
ctx.Handle(404, "org.NewTeam(GetUserByName)", err)
|
||||||
@ -69,8 +67,8 @@ func NewTeam(ctx *middleware.Context, params martini.Params) {
|
|||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, TEAM_NEW)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.CreateTeamForm) {
|
func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.NewTeamPost(GetUserByName)", err)
|
ctx.Handle(404, "org.NewTeamPost(GetUserByName)", err)
|
||||||
@ -125,12 +123,12 @@ func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.Creat
|
|||||||
ctx.Redirect("/org/" + org.LowerName + "/teams/" + t.LowerName)
|
ctx.Redirect("/org/" + org.LowerName + "/teams/" + t.LowerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditTeam(ctx *middleware.Context, params martini.Params) {
|
func EditTeam(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Edit Team"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Edit Team"
|
||||||
ctx.HTML(200, "org/edit_team")
|
ctx.HTML(200, "org/edit_team")
|
||||||
}
|
}
|
||||||
|
|
||||||
func SingleTeam(ctx *middleware.Context,params martini.Params){
|
func SingleTeam(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "single-team"+params["org"]
|
ctx.Data["Title"] = "single-team" + ctx.Params(":org")
|
||||||
ctx.HTML(200,"org/team")
|
ctx.HTML(200, "org/team")
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,50 +5,41 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "io"
|
"io"
|
||||||
// "os"
|
"path"
|
||||||
// "path/filepath"
|
|
||||||
|
|
||||||
// "github.com/Unknwon/com"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
|
||||||
// "github.com/gogits/git"
|
|
||||||
|
|
||||||
// "github.com/gogits/gogs/modules/base"
|
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SingleDownload(ctx *middleware.Context) {
|
func SingleDownload(ctx *middleware.Context) {
|
||||||
// treename := params["_1"]
|
treename := ctx.Params("*")
|
||||||
|
|
||||||
// blob, err := ctx.Repo.Commit.GetBlobByPath(treename)
|
blob, err := ctx.Repo.Commit.GetBlobByPath(treename)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.SingleDownload(GetBlobByPath)", err)
|
ctx.Handle(500, "GetBlobByPath", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// dataRc, err := blob.Data()
|
dataRc, err := blob.Data()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.SingleDownload(Data)", err)
|
ctx.Handle(500, "repo.SingleDownload(Data)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// buf := make([]byte, 1024)
|
buf := make([]byte, 1024)
|
||||||
// n, _ := dataRc.Read(buf)
|
n, _ := dataRc.Read(buf)
|
||||||
// if n > 0 {
|
if n > 0 {
|
||||||
// buf = buf[:n]
|
buf = buf[:n]
|
||||||
// }
|
}
|
||||||
|
|
||||||
// defer func() {
|
contentType, isTextFile := base.IsTextFile(buf)
|
||||||
// dataRc.Close()
|
_, isImageFile := base.IsImageFile(buf)
|
||||||
// }()
|
ctx.Resp.Header().Set("Content-Type", contentType)
|
||||||
|
if !isTextFile && !isImageFile {
|
||||||
// contentType, isTextFile := base.IsTextFile(buf)
|
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(treename))
|
||||||
// _, isImageFile := base.IsImageFile(buf)
|
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
|
||||||
// ctx.Res.Header().Set("Content-Type", contentType)
|
}
|
||||||
// if !isTextFile && !isImageFile {
|
ctx.Resp.Write(buf)
|
||||||
// ctx.Res.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(treename))
|
io.Copy(ctx.Resp, dataRc)
|
||||||
// ctx.Res.Header().Set("Content-Transfer-Encoding", "binary")
|
|
||||||
// }
|
|
||||||
// ctx.Res.Write(buf)
|
|
||||||
// io.Copy(ctx.Res, dataRc)
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,10 @@
|
|||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
@ -34,22 +36,22 @@ func Create(ctx *middleware.Context) {
|
|||||||
ctx.Data["Licenses"] = models.Licenses
|
ctx.Data["Licenses"] = models.Licenses
|
||||||
|
|
||||||
ctxUser := ctx.User
|
ctxUser := ctx.User
|
||||||
// orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
||||||
// if orgId > 0 {
|
if orgId > 0 {
|
||||||
// org, err := models.GetUserById(orgId)
|
org, err := models.GetUserById(orgId)
|
||||||
// if err != nil && err != models.ErrUserNotExist {
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctxUser = org
|
ctxUser = org
|
||||||
// }
|
}
|
||||||
ctx.Data["ContextUser"] = ctxUser
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["AllUsers"] = append([]*models.User{ctx.User}, ctx.User.Orgs...)
|
ctx.Data["AllUsers"] = append([]*models.User{ctx.User}, ctx.User.Orgs...)
|
||||||
|
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, CREATE)
|
||||||
}
|
}
|
||||||
@ -62,22 +64,22 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||||||
ctx.Data["Licenses"] = models.Licenses
|
ctx.Data["Licenses"] = models.Licenses
|
||||||
|
|
||||||
ctxUser := ctx.User
|
ctxUser := ctx.User
|
||||||
// orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
||||||
// if orgId > 0 {
|
if orgId > 0 {
|
||||||
// org, err := models.GetUserById(orgId)
|
org, err := models.GetUserById(orgId)
|
||||||
// if err != nil && err != models.ErrUserNotExist {
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctxUser = org
|
ctxUser = org
|
||||||
// }
|
}
|
||||||
ctx.Data["ContextUser"] = ctxUser
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.CreatePost(GetOrganizations)", err)
|
ctx.Handle(500, "home.CreatePost(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, CREATE)
|
||||||
@ -127,78 +129,78 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||||||
ctx.Handle(500, "CreateRepository", err)
|
ctx.Handle(500, "CreateRepository", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Migrate(ctx *middleware.Context) {
|
func Migrate(ctx *middleware.Context) {
|
||||||
// ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = "Migrate repository"
|
||||||
// ctx.Data["PageIsNewRepo"] = true
|
ctx.Data["PageIsNewRepo"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Migrate(GetOrganizations)", err)
|
ctx.Handle(500, "home.Migrate(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
// ctx.HTML(200, MIGRATE)
|
ctx.HTML(200, MIGRATE)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
// ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = "Migrate repository"
|
||||||
// ctx.Data["PageIsNewRepo"] = true
|
ctx.Data["PageIsNewRepo"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.MigratePost(GetOrganizations)", err)
|
ctx.Handle(500, "home.MigratePost(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, MIGRATE)
|
ctx.HTML(200, MIGRATE)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// u := ctx.User
|
u := ctx.User
|
||||||
// // Not equal means current user is an organization.
|
// Not equal means current user is an organization.
|
||||||
// if u.Id != form.Uid {
|
if u.Id != form.Uid {
|
||||||
// var err error
|
var err error
|
||||||
// u, err = models.GetUserById(form.Uid)
|
u, err = models.GetUserById(form.Uid)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
// ctx.Handle(404, "home.MigratePost(GetUserById)", err)
|
ctx.Handle(404, "home.MigratePost(GetUserById)", err)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "home.MigratePost(GetUserById)", err)
|
ctx.Handle(500, "home.MigratePost(GetUserById)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
||||||
// form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
||||||
// url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
||||||
// repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private,
|
repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private,
|
||||||
// form.Mirror, url)
|
form.Mirror, url)
|
||||||
// if err == nil {
|
if err == nil {
|
||||||
// log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName)
|
log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName)
|
||||||
// ctx.Redirect("/" + u.Name + "/" + form.RepoName)
|
ctx.Redirect("/" + u.Name + "/" + form.RepoName)
|
||||||
// return
|
return
|
||||||
// } else if err == models.ErrRepoAlreadyExist {
|
} else if err == models.ErrRepoAlreadyExist {
|
||||||
// ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form)
|
ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// } else if err == models.ErrRepoNameIllegal {
|
} else if err == models.ErrRepoNameIllegal {
|
||||||
// ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form)
|
ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if repo != nil {
|
if repo != nil {
|
||||||
// if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil {
|
||||||
// log.Error("repo.MigratePost(DeleteRepository): %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if strings.Contains(err.Error(), "Authentication failed") {
|
if strings.Contains(err.Error(), "Authentication failed") {
|
||||||
// ctx.RenderWithErr(err.Error(), MIGRATE, &form)
|
ctx.RenderWithErr(err.Error(), MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Handle(500, "repo.Migrate(MigrateRepository)", err)
|
ctx.Handle(500, "MigrateRepository", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func Action(ctx *middleware.Context, params martini.Params) {
|
// func Action(ctx *middleware.Context, params martini.Params) {
|
||||||
// var err error
|
// var err error
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -28,11 +28,11 @@ func Dashboard(ctx *middleware.Context) {
|
|||||||
ctx.Data["PageIsDashboard"] = true
|
ctx.Data["PageIsDashboard"] = true
|
||||||
ctx.Data["PageIsNews"] = true
|
ctx.Data["PageIsNews"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
ctx.Data["ContextUser"] = ctx.User
|
ctx.Data["ContextUser"] = ctx.User
|
||||||
|
|
||||||
repos, err := models.GetRepositories(ctx.User.Id, true)
|
repos, err := models.GetRepositories(ctx.User.Id, true)
|
||||||
@ -40,13 +40,16 @@ func Dashboard(ctx *middleware.Context) {
|
|||||||
ctx.Handle(500, "GetRepositories", err)
|
ctx.Handle(500, "GetRepositories", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, repo := range repos {
|
||||||
|
repo.Owner = ctx.User
|
||||||
|
}
|
||||||
ctx.Data["Repos"] = repos
|
ctx.Data["Repos"] = repos
|
||||||
|
|
||||||
// ctx.Data["CollaborativeRepos"], err = models.GetCollaborativeRepos(ctx.User.Name)
|
ctx.Data["CollaborativeRepos"], err = models.GetCollaborativeRepos(ctx.User.Name)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetCollaborativeRepos)", err)
|
ctx.Handle(500, "GetCollaborativeRepos", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
actions, err := models.GetFeeds(ctx.User.Id, 0, true)
|
actions, err := models.GetFeeds(ctx.User.Id, 0, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,6 +19,7 @@ const (
|
|||||||
SETTINGS_PASSWORD base.TplName = "user/settings/password"
|
SETTINGS_PASSWORD base.TplName = "user/settings/password"
|
||||||
SETTINGS_SSH_KEYS base.TplName = "user/settings/sshkeys"
|
SETTINGS_SSH_KEYS base.TplName = "user/settings/sshkeys"
|
||||||
SETTINGS_SOCIAL base.TplName = "user/settings/social"
|
SETTINGS_SOCIAL base.TplName = "user/settings/social"
|
||||||
|
SETTINGS_ORGS base.TplName = "user/settings/orgs"
|
||||||
SETTINGS_DELETE base.TplName = "user/settings/delete"
|
SETTINGS_DELETE base.TplName = "user/settings/delete"
|
||||||
NOTIFICATION base.TplName = "user/notification"
|
NOTIFICATION base.TplName = "user/notification"
|
||||||
SECURITY base.TplName = "user/security"
|
SECURITY base.TplName = "user/security"
|
||||||
@ -232,6 +233,13 @@ func SettingsSocial(ctx *middleware.Context) {
|
|||||||
ctx.HTML(200, SETTINGS_SOCIAL)
|
ctx.HTML(200, SETTINGS_SOCIAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SettingsOrgs(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
|
ctx.Data["PageIsSettingsOrgs"] = true
|
||||||
|
ctx.HTML(200, SETTINGS_ORGS)
|
||||||
|
}
|
||||||
|
|
||||||
func SettingsDelete(ctx *middleware.Context) {
|
func SettingsDelete(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsUserSettings"] = true
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
|
@ -1 +1 @@
|
|||||||
0.4.7.0725 Alpha
|
0.4.7.0726 Alpha
|
@ -176,11 +176,11 @@
|
|||||||
<dt>Enable Set Cookie</dt>
|
<dt>Enable Set Cookie</dt>
|
||||||
<dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>GC Interval Time</dt>
|
<dt>GC Interval Time</dt>
|
||||||
<dd>{{.SessionConfig.GcIntervalTime}} seconds</dd>
|
<dd>{{.SessionConfig.Gclifetime}} seconds</dd>
|
||||||
<dt>Session Life Time</dt>
|
<dt>Session Life Time</dt>
|
||||||
<dd>{{.SessionConfig.SessionLifeTime}} seconds</dd>
|
<dd>{{.SessionConfig.Maxlifetime}} seconds</dd>
|
||||||
<dt>HTTPS Only</dt>
|
<dt>HTTPS Only</dt>
|
||||||
<dd><i class="fa fa{{if .SessionConfig.CookieSecure}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .SessionConfig.Secure}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>Cookie Life Time</dt>
|
<dt>Cookie Life Time</dt>
|
||||||
<dd>{{.SessionConfig.CookieLifeTime}} seconds</dd>
|
<dd>{{.SessionConfig.CookieLifeTime}} seconds</dd>
|
||||||
<dt>Session ID Hash Function</dt>
|
<dt>Session ID Hash Function</dt>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user