From 514382e2ebfe6869268aeb919c1fa4d224687e13 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 11 Mar 2016 11:56:52 -0500 Subject: [PATCH] Rename module: middleware -> context --- README.md | 2 +- cmd/web.go | 64 +-- gogs.go | 2 +- modules/bindata/bindata.go | 432 ++++++++++----------- modules/{middleware => context}/auth.go | 65 +--- modules/{middleware => context}/context.go | 54 +-- modules/{middleware => context}/org.go | 2 +- modules/{middleware => context}/repo.go | 2 +- routers/admin/admin.go | 10 +- routers/admin/auths.go | 14 +- routers/admin/notice.go | 8 +- routers/admin/orgs.go | 14 +- routers/admin/repos.go | 6 +- routers/admin/users.go | 16 +- routers/api/v1/admin/orgs.go | 4 +- routers/api/v1/admin/repos.go | 4 +- routers/api/v1/admin/users.go | 12 +- routers/api/v1/api.go | 18 +- routers/api/v1/misc/markdown.go | 6 +- routers/api/v1/org/org.go | 12 +- routers/api/v1/repo/branch.go | 6 +- routers/api/v1/repo/file.go | 6 +- routers/api/v1/repo/hooks.go | 8 +- routers/api/v1/repo/keys.go | 14 +- routers/api/v1/repo/repo.go | 20 +- routers/api/v1/user/app.go | 6 +- routers/api/v1/user/email.go | 8 +- routers/api/v1/user/followers.go | 26 +- routers/api/v1/user/keys.go | 20 +- routers/api/v1/user/user.go | 6 +- routers/dev/template.go | 4 +- routers/home.go | 8 +- routers/install.go | 8 +- routers/org/members.go | 8 +- routers/org/org.go | 6 +- routers/org/setting.go | 16 +- routers/org/teams.go | 22 +- routers/repo/branch.go | 4 +- routers/repo/commit.go | 14 +- routers/repo/download.go | 8 +- routers/repo/http.go | 8 +- routers/repo/issue.go | 70 ++-- routers/repo/pull.go | 30 +- routers/repo/release.go | 16 +- routers/repo/repo.go | 20 +- routers/repo/setting.go | 28 +- routers/repo/view.go | 12 +- routers/repo/webhook.go | 26 +- routers/repo/wiki.go | 20 +- routers/user/auth.go | 66 +++- routers/user/home.go | 18 +- routers/user/profile.go | 16 +- routers/user/setting.go | 38 +- templates/.VERSION | 2 +- 54 files changed, 666 insertions(+), 669 deletions(-) rename modules/{middleware => context}/auth.go (55%) rename modules/{middleware => context}/context.go (95%) rename modules/{middleware => context}/org.go (99%) rename modules/{middleware => context}/repo.go (99%) diff --git a/README.md b/README.md index dff0393c6a..213b877ec0 100644 --- a/README.md +++ b/README.md @@ -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) -##### Current version: 0.9.4 +##### Current version: 0.9.5 | Web | UI | Preview | |:-------------:|:-------:|:-------:| diff --git a/cmd/web.go b/cmd/web.go index ec2486acbe..59a1fb5cd4 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -34,8 +34,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/bindata" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/template" "github.com/gogits/gogs/routers" @@ -169,7 +169,7 @@ func newMacaron() *macaron.Macaron { }, }, })) - m.Use(middleware.Contexter()) + m.Use(context.Contexter()) return m } @@ -182,10 +182,10 @@ func runWeb(ctx *cli.Context) { m := newMacaron() - reqSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true}) - ignSignIn := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: setting.Service.RequireSignInView}) - ignSignInAndCsrf := middleware.Toggle(&middleware.ToggleOptions{DisableCsrf: true}) - reqSignOut := middleware.Toggle(&middleware.ToggleOptions{SignOutRequire: true}) + reqSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: true}) + ignSignIn := context.Toggle(&context.ToggleOptions{SignInRequired: setting.Service.RequireSignInView}) + ignSignInAndCsrf := context.Toggle(&context.ToggleOptions{DisableCSRF: true}) + reqSignOut := context.Toggle(&context.ToggleOptions{SignOutRequired: true}) bindIgnErr := binding.BindIgnErr @@ -231,7 +231,7 @@ func runWeb(ctx *cli.Context) { Post(bindIgnErr(auth.NewAccessTokenForm{}), user.SettingsApplicationsPost) m.Post("/applications/delete", user.SettingsDeleteApplication) m.Route("/delete", "GET,POST", user.SettingsDelete) - }, reqSignIn, func(ctx *middleware.Context) { + }, reqSignIn, func(ctx *context.Context) { ctx.Data["PageIsUserSettings"] = true }) @@ -246,7 +246,7 @@ func runWeb(ctx *cli.Context) { }) // ***** END: User ***** - adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true}) + adminReq := context.Toggle(&context.ToggleOptions{SignInRequired: true, AdminRequired: true}) // ***** START: Admin ***** m.Group("/admin", func() { @@ -295,7 +295,7 @@ func runWeb(ctx *cli.Context) { m.Get("/stars", user.Stars) }) - m.Get("/attachments/:uuid", func(ctx *middleware.Context) { + m.Get("/attachments/:uuid", func(ctx *context.Context) { attach, err := models.GetAttachmentByUUID(ctx.Params(":uuid")) if err != nil { if models.IsErrAttachmentNotExist(err) { @@ -332,8 +332,8 @@ func runWeb(ctx *cli.Context) { m.Get("/template/*", dev.TemplatePreview) } - reqRepoAdmin := middleware.RequireRepoAdmin() - reqRepoWriter := middleware.RequireRepoWriter() + reqRepoAdmin := context.RequireRepoAdmin() + reqRepoWriter := context.RequireRepoWriter() // ***** START: Organization ***** m.Group("/org", func() { @@ -347,14 +347,14 @@ func runWeb(ctx *cli.Context) { m.Get("/members/action/:action", org.MembersAction) m.Get("/teams", org.Teams) - }, middleware.OrgAssignment(true)) + }, context.OrgAssignment(true)) m.Group("/:org", func() { m.Get("/teams/:team", org.TeamMembers) m.Get("/teams/:team/repositories", org.TeamRepositories) m.Route("/teams/:team/action/:action", "GET,POST", org.TeamsAction) m.Route("/teams/:team/action/repo/:action", "GET,POST", org.TeamsRepoAction) - }, middleware.OrgAssignment(true, false, true)) + }, context.OrgAssignment(true, false, true)) m.Group("/:org", func() { m.Get("/teams/new", org.NewTeam) @@ -384,7 +384,7 @@ func runWeb(ctx *cli.Context) { }) m.Route("/invitations/new", "GET,POST", org.Invitation) - }, middleware.OrgAssignment(true, true)) + }, context.OrgAssignment(true, true)) }, reqSignIn) // ***** END: Organization ***** @@ -423,7 +423,7 @@ func runWeb(ctx *cli.Context) { m.Get("", repo.GitHooks) m.Combo("/:name").Get(repo.GitHooksEdit). Post(repo.GitHooksEditPost) - }, middleware.GitHookService()) + }, context.GitHookService()) }) m.Group("/keys", func() { @@ -432,15 +432,15 @@ func runWeb(ctx *cli.Context) { m.Post("/delete", repo.DeleteDeployKey) }) - }, func(ctx *middleware.Context) { + }, func(ctx *context.Context) { ctx.Data["PageIsSettings"] = true }) - }, reqSignIn, middleware.RepoAssignment(), reqRepoAdmin, middleware.RepoRef()) + }, reqSignIn, context.RepoAssignment(), reqRepoAdmin, context.RepoRef()) - m.Get("/:username/:reponame/action/:action", reqSignIn, middleware.RepoAssignment(), repo.Action) + m.Get("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), repo.Action) m.Group("/:username/:reponame", func() { m.Group("/issues", func() { - m.Combo("/new", repo.MustEnableIssues).Get(middleware.RepoRef(), repo.NewIssue). + m.Combo("/new", repo.MustEnableIssues).Get(context.RepoRef(), repo.NewIssue). Post(bindIgnErr(auth.CreateIssueForm{}), repo.NewIssuePost) m.Combo("/:index/comments").Post(bindIgnErr(auth.CreateCommentForm{}), repo.NewComment) @@ -460,7 +460,7 @@ func runWeb(ctx *cli.Context) { m.Post("/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel) m.Post("/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel) m.Post("/delete", repo.DeleteLabel) - }, reqRepoWriter, middleware.RepoRef()) + }, reqRepoWriter, context.RepoRef()) m.Group("/milestones", func() { m.Combo("/new").Get(repo.NewMilestone). Post(bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost) @@ -468,7 +468,7 @@ func runWeb(ctx *cli.Context) { m.Post("/:id/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.EditMilestonePost) m.Get("/:id/:action", repo.ChangeMilestonStatus) m.Post("/delete", repo.DeleteMilestone) - }, reqRepoWriter, middleware.RepoRef()) + }, reqRepoWriter, context.RepoRef()) m.Group("/releases", func() { m.Get("/new", repo.NewRelease) @@ -476,11 +476,11 @@ func runWeb(ctx *cli.Context) { m.Get("/edit/:tagname", repo.EditRelease) m.Post("/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost) m.Post("/delete", repo.DeleteRelease) - }, reqRepoWriter, middleware.RepoRef()) + }, reqRepoWriter, context.RepoRef()) m.Combo("/compare/*", repo.MustAllowPulls).Get(repo.CompareAndPullRequest). Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost) - }, reqSignIn, middleware.RepoAssignment(), repo.MustBeNotBare) + }, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare) m.Group("/:username/:reponame", func() { m.Group("", func() { @@ -489,7 +489,7 @@ func runWeb(ctx *cli.Context) { m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/milestones", repo.Milestones) - }, middleware.RepoRef()) + }, context.RepoRef()) // m.Get("/branches", repo.Branches) @@ -504,13 +504,13 @@ func runWeb(ctx *cli.Context) { Post(bindIgnErr(auth.NewWikiForm{}), repo.EditWikiPost) m.Post("/:page/delete", repo.DeleteWikiPagePost) }, reqSignIn, reqRepoWriter) - }, repo.MustEnableWiki, middleware.RepoRef()) + }, repo.MustEnableWiki, context.RepoRef()) m.Get("/archive/*", repo.Download) m.Group("/pulls/:index", func() { - m.Get("/commits", middleware.RepoRef(), repo.ViewPullCommits) - m.Get("/files", middleware.RepoRef(), repo.ViewPullFiles) + m.Get("/commits", context.RepoRef(), repo.ViewPullCommits) + m.Get("/files", context.RepoRef(), repo.ViewPullFiles) m.Post("/merge", reqRepoWriter, repo.MergePullRequest) }, repo.MustAllowPulls) @@ -520,20 +520,20 @@ func runWeb(ctx *cli.Context) { m.Get("/commits/*", repo.RefCommits) m.Get("/commit/*", repo.Diff) m.Get("/forks", repo.Forks) - }, middleware.RepoRef()) + }, context.RepoRef()) m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.CompareDiff) - }, ignSignIn, middleware.RepoAssignment(), repo.MustBeNotBare) + }, ignSignIn, context.RepoAssignment(), repo.MustBeNotBare) m.Group("/:username/:reponame", func() { m.Get("/stars", repo.Stars) m.Get("/watchers", repo.Watchers) - }, ignSignIn, middleware.RepoAssignment(), middleware.RepoRef()) + }, ignSignIn, context.RepoAssignment(), context.RepoRef()) m.Group("/:username", func() { m.Group("/:reponame", func() { m.Get("", repo.Home) m.Get("\\.git$", repo.Home) - }, ignSignIn, middleware.RepoAssignment(true), middleware.RepoRef()) + }, ignSignIn, context.RepoAssignment(true), context.RepoRef()) m.Group("/:reponame", func() { m.Any("/*", ignSignInAndCsrf, repo.HTTP) @@ -543,7 +543,7 @@ func runWeb(ctx *cli.Context) { // ***** END: Repository ***** // robots.txt - m.Get("/robots.txt", func(ctx *middleware.Context) { + m.Get("/robots.txt", func(ctx *context.Context) { if setting.HasRobotsTxt { ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt")) } else { diff --git a/gogs.go b/gogs.go index 3616431cf9..0a72555437 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.4.0311" +const APP_VER = "0.9.5.0311" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/bindata/bindata.go b/modules/bindata/bindata.go index 1026f45848..82998754fd 100644 --- a/modules/bindata/bindata.go +++ b/modules/bindata/bindata.go @@ -298,7 +298,7 @@ func confAppIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/app.ini", size: 11124, mode: os.FileMode(420), modTime: time.Unix(1457230221, 0)} + info := bindataFileInfo{name: "conf/app.ini", size: 11124, mode: os.FileMode(420), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -318,7 +318,7 @@ func confGitignoreActionscript() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Actionscript", size: 300, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Actionscript", size: 300, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -338,7 +338,7 @@ func confGitignoreAda() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Ada", size: 51, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Ada", size: 51, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -358,7 +358,7 @@ func confGitignoreAgda() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Agda", size: 8, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Agda", size: 8, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -378,7 +378,7 @@ func confGitignoreAndroid() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Android", size: 394, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Android", size: 394, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -398,7 +398,7 @@ func confGitignoreAnjuta() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Anjuta", size: 78, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Anjuta", size: 78, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -418,7 +418,7 @@ func confGitignoreAppengine() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/AppEngine", size: 58, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/AppEngine", size: 58, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -438,7 +438,7 @@ func confGitignoreAppceleratortitanium() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/AppceleratorTitanium", size: 45, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/AppceleratorTitanium", size: 45, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -458,7 +458,7 @@ func confGitignoreArchlinuxpackages() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ArchLinuxPackages", size: 75, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ArchLinuxPackages", size: 75, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -478,7 +478,7 @@ func confGitignoreArchives() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Archives", size: 295, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Archives", size: 295, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -498,7 +498,7 @@ func confGitignoreAutotools() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Autotools", size: 181, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Autotools", size: 181, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -518,7 +518,7 @@ func confGitignoreBricxcc() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/BricxCC", size: 72, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/BricxCC", size: 72, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -538,7 +538,7 @@ func confGitignoreC() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/C", size: 246, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/C", size: 246, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -558,7 +558,7 @@ func confGitignoreCSharp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/C Sharp", size: 1521, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/C Sharp", size: 1521, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -578,7 +578,7 @@ func confGitignoreC2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/C++", size: 242, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/C++", size: 242, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -598,7 +598,7 @@ func confGitignoreCfwheels() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CFWheels", size: 205, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CFWheels", size: 205, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -618,7 +618,7 @@ func confGitignoreCmake() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CMake", size: 89, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CMake", size: 89, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -638,7 +638,7 @@ func confGitignoreCuda() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CUDA", size: 38, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CUDA", size: 38, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -658,7 +658,7 @@ func confGitignoreCvs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CVS", size: 39, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CVS", size: 39, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -678,7 +678,7 @@ func confGitignoreCakephp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CakePHP", size: 136, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CakePHP", size: 136, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -698,7 +698,7 @@ func confGitignoreChefcookbook() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ChefCookbook", size: 77, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ChefCookbook", size: 77, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -718,7 +718,7 @@ func confGitignoreCloud9() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Cloud9", size: 45, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Cloud9", size: 45, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -738,7 +738,7 @@ func confGitignoreCodeigniter() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CodeIgniter", size: 106, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CodeIgniter", size: 106, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -758,7 +758,7 @@ func confGitignoreCodekit() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CodeKit", size: 54, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CodeKit", size: 54, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -778,7 +778,7 @@ func confGitignoreCommonlisp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CommonLisp", size: 26, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CommonLisp", size: 26, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -798,7 +798,7 @@ func confGitignoreComposer() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Composer", size: 250, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Composer", size: 250, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -818,7 +818,7 @@ func confGitignoreConcrete5() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Concrete5", size: 42, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Concrete5", size: 42, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -838,7 +838,7 @@ func confGitignoreCoq() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Coq", size: 18, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Coq", size: 18, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -858,7 +858,7 @@ func confGitignoreCraftcms() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/CraftCMS", size: 120, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/CraftCMS", size: 120, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -878,7 +878,7 @@ func confGitignoreDm() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/DM", size: 29, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/DM", size: 29, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -898,7 +898,7 @@ func confGitignoreDart() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Dart", size: 234, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Dart", size: 234, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -918,7 +918,7 @@ func confGitignoreDarteditor() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/DartEditor", size: 19, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/DartEditor", size: 19, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -938,7 +938,7 @@ func confGitignoreDelphi() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Delphi", size: 1347, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Delphi", size: 1347, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -958,7 +958,7 @@ func confGitignoreDreamweaver() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Dreamweaver", size: 47, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Dreamweaver", size: 47, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -978,7 +978,7 @@ func confGitignoreDrupal() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Drupal", size: 605, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Drupal", size: 605, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -998,7 +998,7 @@ func confGitignoreEpiserver() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/EPiServer", size: 81, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/EPiServer", size: 81, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1018,7 +1018,7 @@ func confGitignoreEagle() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Eagle", size: 401, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Eagle", size: 401, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1038,7 +1038,7 @@ func confGitignoreEclipse() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Eclipse", size: 458, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Eclipse", size: 458, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1058,7 +1058,7 @@ func confGitignoreEiffelstudio() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/EiffelStudio", size: 35, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/EiffelStudio", size: 35, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1078,7 +1078,7 @@ func confGitignoreElisp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Elisp", size: 36, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Elisp", size: 36, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1098,7 +1098,7 @@ func confGitignoreElixir() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Elixir", size: 34, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Elixir", size: 34, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1118,7 +1118,7 @@ func confGitignoreEmacs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Emacs", size: 320, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Emacs", size: 320, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1138,7 +1138,7 @@ func confGitignoreEnsime() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Ensime", size: 57, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Ensime", size: 57, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1158,7 +1158,7 @@ func confGitignoreErlang() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Erlang", size: 95, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Erlang", size: 95, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1178,7 +1178,7 @@ func confGitignoreEspresso() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Espresso", size: 9, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Espresso", size: 9, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1198,7 +1198,7 @@ func confGitignoreExpressionengine() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ExpressionEngine", size: 342, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ExpressionEngine", size: 342, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1218,7 +1218,7 @@ func confGitignoreExtjs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ExtJs", size: 38, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ExtJs", size: 38, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1238,7 +1238,7 @@ func confGitignoreFancy() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Fancy", size: 12, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Fancy", size: 12, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1258,7 +1258,7 @@ func confGitignoreFinale() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Finale", size: 184, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Finale", size: 184, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1278,7 +1278,7 @@ func confGitignoreFlexbuilder() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/FlexBuilder", size: 29, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/FlexBuilder", size: 29, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1298,7 +1298,7 @@ func confGitignoreForcedotcom() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ForceDotCom", size: 57, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ForceDotCom", size: 57, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1318,7 +1318,7 @@ func confGitignoreFuelphp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/FuelPHP", size: 39, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/FuelPHP", size: 39, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1338,7 +1338,7 @@ func confGitignoreGwt() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/GWT", size: 395, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/GWT", size: 395, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1358,7 +1358,7 @@ func confGitignoreGcov() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Gcov", size: 56, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Gcov", size: 56, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1378,7 +1378,7 @@ func confGitignoreGitbook() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/GitBook", size: 353, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/GitBook", size: 353, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1398,7 +1398,7 @@ func confGitignoreGo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Go", size: 266, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Go", size: 266, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1418,7 +1418,7 @@ func confGitignoreGradle() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Gradle", size: 157, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Gradle", size: 157, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1438,7 +1438,7 @@ func confGitignoreGrails() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Grails", size: 583, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Grails", size: 583, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1458,7 +1458,7 @@ func confGitignoreHaskell() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Haskell", size: 135, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Haskell", size: 135, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1478,7 +1478,7 @@ func confGitignoreIgorpro() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/IGORPro", size: 121, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/IGORPro", size: 121, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1498,7 +1498,7 @@ func confGitignoreIpythonnotebook() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/IPythonNotebook", size: 37, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/IPythonNotebook", size: 37, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1518,7 +1518,7 @@ func confGitignoreIdris() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Idris", size: 10, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Idris", size: 10, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1538,7 +1538,7 @@ func confGitignoreJdeveloper() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/JDeveloper", size: 255, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/JDeveloper", size: 255, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1558,7 +1558,7 @@ func confGitignoreJava() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Java", size: 189, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Java", size: 189, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1578,7 +1578,7 @@ func confGitignoreJboss() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Jboss", size: 509, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Jboss", size: 509, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1598,7 +1598,7 @@ func confGitignoreJekyll() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Jekyll", size: 37, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Jekyll", size: 37, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1618,7 +1618,7 @@ func confGitignoreJetbrains() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/JetBrains", size: 860, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/JetBrains", size: 860, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1638,7 +1638,7 @@ func confGitignoreJoomla() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Joomla", size: 22387, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Joomla", size: 22387, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1658,7 +1658,7 @@ func confGitignoreKdevelop4() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/KDevelop4", size: 16, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/KDevelop4", size: 16, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1678,7 +1678,7 @@ func confGitignoreKate() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Kate", size: 34, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Kate", size: 34, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1698,7 +1698,7 @@ func confGitignoreKicad() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/KiCAD", size: 208, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/KiCAD", size: 208, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1718,7 +1718,7 @@ func confGitignoreKohana() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Kohana", size: 39, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Kohana", size: 39, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1738,7 +1738,7 @@ func confGitignoreLabview() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/LabVIEW", size: 142, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/LabVIEW", size: 142, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1758,7 +1758,7 @@ func confGitignoreLaravel() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Laravel", size: 49, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Laravel", size: 49, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1778,7 +1778,7 @@ func confGitignoreLazarus() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Lazarus", size: 407, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Lazarus", size: 407, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1798,7 +1798,7 @@ func confGitignoreLeiningen() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Leiningen", size: 138, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Leiningen", size: 138, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1818,7 +1818,7 @@ func confGitignoreLemonstand() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/LemonStand", size: 348, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/LemonStand", size: 348, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1838,7 +1838,7 @@ func confGitignoreLibreoffice() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/LibreOffice", size: 30, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/LibreOffice", size: 30, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1858,7 +1858,7 @@ func confGitignoreLilypond() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Lilypond", size: 33, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Lilypond", size: 33, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1878,7 +1878,7 @@ func confGitignoreLinux() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Linux", size: 118, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Linux", size: 118, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1898,7 +1898,7 @@ func confGitignoreLithium() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Lithium", size: 28, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Lithium", size: 28, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1918,7 +1918,7 @@ func confGitignoreLua() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Lua", size: 324, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Lua", size: 324, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1938,7 +1938,7 @@ func confGitignoreLyx() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/LyX", size: 75, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/LyX", size: 75, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1958,7 +1958,7 @@ func confGitignoreMagento() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Magento", size: 2599, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Magento", size: 2599, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1978,7 +1978,7 @@ func confGitignoreMatlab() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Matlab", size: 360, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Matlab", size: 360, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -1998,7 +1998,7 @@ func confGitignoreMaven() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Maven", size: 170, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Maven", size: 170, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2018,7 +2018,7 @@ func confGitignoreMercurial() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Mercurial", size: 50, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Mercurial", size: 50, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2038,7 +2038,7 @@ func confGitignoreMercury() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Mercury", size: 93, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Mercury", size: 93, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2058,7 +2058,7 @@ func confGitignoreMetaprogrammingsystem() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/MetaProgrammingSystem", size: 391, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/MetaProgrammingSystem", size: 391, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2078,7 +2078,7 @@ func confGitignoreMicrosoftoffice() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/MicrosoftOffice", size: 88, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/MicrosoftOffice", size: 88, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2098,7 +2098,7 @@ func confGitignoreModelsim() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ModelSim", size: 282, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ModelSim", size: 282, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2118,7 +2118,7 @@ func confGitignoreMomentics() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Momentics", size: 76, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Momentics", size: 76, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2138,7 +2138,7 @@ func confGitignoreMonodevelop() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/MonoDevelop", size: 93, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/MonoDevelop", size: 93, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2158,7 +2158,7 @@ func confGitignoreNanoc() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Nanoc", size: 197, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Nanoc", size: 197, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2178,7 +2178,7 @@ func confGitignoreNetbeans() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/NetBeans", size: 96, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/NetBeans", size: 96, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2198,7 +2198,7 @@ func confGitignoreNim() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Nim", size: 10, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Nim", size: 10, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2218,7 +2218,7 @@ func confGitignoreNinja() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Ninja", size: 23, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Ninja", size: 23, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2238,7 +2238,7 @@ func confGitignoreNode() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Node", size: 529, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Node", size: 529, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2258,7 +2258,7 @@ func confGitignoreNotepadpp() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/NotepadPP", size: 30, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/NotepadPP", size: 30, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2278,7 +2278,7 @@ func confGitignoreOcaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/OCaml", size: 178, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/OCaml", size: 178, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2298,7 +2298,7 @@ func confGitignoreOsx() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/OSX", size: 356, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/OSX", size: 356, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2318,7 +2318,7 @@ func confGitignoreObjectiveC() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Objective-C", size: 837, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Objective-C", size: 837, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2338,7 +2338,7 @@ func confGitignoreOpa() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Opa", size: 90, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Opa", size: 90, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2358,7 +2358,7 @@ func confGitignoreOpencart() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/OpenCart", size: 115, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/OpenCart", size: 115, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2378,7 +2378,7 @@ func confGitignoreOracleforms() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/OracleForms", size: 100, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/OracleForms", size: 100, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2398,7 +2398,7 @@ func confGitignorePacker() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Packer", size: 55, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Packer", size: 55, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2418,7 +2418,7 @@ func confGitignorePerl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Perl", size: 191, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Perl", size: 191, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2438,7 +2438,7 @@ func confGitignorePhalcon() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Phalcon", size: 29, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Phalcon", size: 29, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2458,7 +2458,7 @@ func confGitignorePlayframework() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/PlayFramework", size: 170, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/PlayFramework", size: 170, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2478,7 +2478,7 @@ func confGitignorePlone() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Plone", size: 137, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Plone", size: 137, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2498,7 +2498,7 @@ func confGitignorePrestashop() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Prestashop", size: 483, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Prestashop", size: 483, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2518,7 +2518,7 @@ func confGitignoreProcessing() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Processing", size: 120, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Processing", size: 120, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2538,7 +2538,7 @@ func confGitignorePython() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Python", size: 713, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Python", size: 713, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2558,7 +2558,7 @@ func confGitignoreQooxdoo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Qooxdoo", size: 58, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Qooxdoo", size: 58, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2578,7 +2578,7 @@ func confGitignoreQt() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Qt", size: 292, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Qt", size: 292, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2598,7 +2598,7 @@ func confGitignoreR() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/R", size: 255, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/R", size: 255, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2618,7 +2618,7 @@ func confGitignoreRos() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ROS", size: 493, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ROS", size: 493, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2638,7 +2638,7 @@ func confGitignoreRails() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Rails", size: 707, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Rails", size: 707, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2658,7 +2658,7 @@ func confGitignoreRedcar() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Redcar", size: 8, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Redcar", size: 8, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2678,7 +2678,7 @@ func confGitignoreRedis() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Redis", size: 51, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Redis", size: 51, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2698,7 +2698,7 @@ func confGitignoreRhodesrhomobile() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/RhodesRhomobile", size: 77, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/RhodesRhomobile", size: 77, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2718,7 +2718,7 @@ func confGitignoreRuby() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Ruby", size: 607, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Ruby", size: 607, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2738,7 +2738,7 @@ func confGitignoreRust() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Rust", size: 91, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Rust", size: 91, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2758,7 +2758,7 @@ func confGitignoreSbt() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SBT", size: 186, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SBT", size: 186, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2778,7 +2778,7 @@ func confGitignoreScons() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SCons", size: 90, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SCons", size: 90, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2798,7 +2798,7 @@ func confGitignoreSvn() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SVN", size: 6, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SVN", size: 6, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2818,7 +2818,7 @@ func confGitignoreSass() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Sass", size: 23, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Sass", size: 23, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2838,7 +2838,7 @@ func confGitignoreScala() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Scala", size: 185, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Scala", size: 185, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2858,7 +2858,7 @@ func confGitignoreScrivener() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Scrivener", size: 140, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Scrivener", size: 140, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2878,7 +2878,7 @@ func confGitignoreSdcc() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Sdcc", size: 55, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Sdcc", size: 55, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2898,7 +2898,7 @@ func confGitignoreSeamgen() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SeamGen", size: 961, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SeamGen", size: 961, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2918,7 +2918,7 @@ func confGitignoreSketchup() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SketchUp", size: 6, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SketchUp", size: 6, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2938,7 +2938,7 @@ func confGitignoreSlickedit() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SlickEdit", size: 323, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SlickEdit", size: 323, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2958,7 +2958,7 @@ func confGitignoreStella() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Stella", size: 207, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Stella", size: 207, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2978,7 +2978,7 @@ func confGitignoreSublimetext() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SublimeText", size: 354, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SublimeText", size: 354, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -2998,7 +2998,7 @@ func confGitignoreSugarcrm() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SugarCRM", size: 734, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SugarCRM", size: 734, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3018,7 +3018,7 @@ func confGitignoreSwift() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Swift", size: 837, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Swift", size: 837, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3038,7 +3038,7 @@ func confGitignoreSymfony() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Symfony", size: 531, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Symfony", size: 531, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3058,7 +3058,7 @@ func confGitignoreSymphonycms() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SymphonyCMS", size: 90, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SymphonyCMS", size: 90, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3078,7 +3078,7 @@ func confGitignoreSynopsysvcs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/SynopsysVCS", size: 971, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/SynopsysVCS", size: 971, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3098,7 +3098,7 @@ func confGitignoreTags() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Tags", size: 177, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Tags", size: 177, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3118,7 +3118,7 @@ func confGitignoreTex() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/TeX", size: 1328, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/TeX", size: 1328, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3138,7 +3138,7 @@ func confGitignoreTextmate() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/TextMate", size: 28, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/TextMate", size: 28, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3158,7 +3158,7 @@ func confGitignoreTextpattern() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Textpattern", size: 177, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Textpattern", size: 177, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3178,7 +3178,7 @@ func confGitignoreTortoisegit() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/TortoiseGit", size: 38, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/TortoiseGit", size: 38, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3198,7 +3198,7 @@ func confGitignoreTurbogears2() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/TurboGears2", size: 202, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/TurboGears2", size: 202, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3218,7 +3218,7 @@ func confGitignoreTypo3() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Typo3", size: 466, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Typo3", size: 466, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3238,7 +3238,7 @@ func confGitignoreUmbraco() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Umbraco", size: 536, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Umbraco", size: 536, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3258,7 +3258,7 @@ func confGitignoreUnity() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Unity", size: 267, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Unity", size: 267, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3278,7 +3278,7 @@ func confGitignoreVvvv() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/VVVV", size: 57, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/VVVV", size: 57, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3298,7 +3298,7 @@ func confGitignoreVagrant() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Vagrant", size: 10, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Vagrant", size: 10, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3318,7 +3318,7 @@ func confGitignoreVim() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Vim", size: 66, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Vim", size: 66, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3338,7 +3338,7 @@ func confGitignoreVirtualenv() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/VirtualEnv", size: 151, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/VirtualEnv", size: 151, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3358,7 +3358,7 @@ func confGitignoreVisualstudio() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/VisualStudio", size: 3412, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/VisualStudio", size: 3412, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3378,7 +3378,7 @@ func confGitignoreVisualstudiocode() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/VisualStudioCode", size: 11, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/VisualStudioCode", size: 11, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3398,7 +3398,7 @@ func confGitignoreWaf() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Waf", size: 87, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Waf", size: 87, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3418,7 +3418,7 @@ func confGitignoreWebmethods() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/WebMethods", size: 424, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/WebMethods", size: 424, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3438,7 +3438,7 @@ func confGitignoreWindows() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Windows", size: 211, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Windows", size: 211, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3458,7 +3458,7 @@ func confGitignoreWordpress() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/WordPress", size: 297, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/WordPress", size: 297, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3478,7 +3478,7 @@ func confGitignoreXcode() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Xcode", size: 361, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Xcode", size: 361, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3498,7 +3498,7 @@ func confGitignoreXilinxise() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/XilinxISE", size: 566, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/XilinxISE", size: 566, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3518,7 +3518,7 @@ func confGitignoreXojo() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Xojo", size: 160, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Xojo", size: 160, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3538,7 +3538,7 @@ func confGitignoreYeoman() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Yeoman", size: 52, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Yeoman", size: 52, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3558,7 +3558,7 @@ func confGitignoreYii() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Yii", size: 120, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Yii", size: 120, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3578,7 +3578,7 @@ func confGitignoreZendframework() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/ZendFramework", size: 217, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/ZendFramework", size: 217, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3598,7 +3598,7 @@ func confGitignoreZephir() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/gitignore/Zephir", size: 387, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/gitignore/Zephir", size: 387, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3618,7 +3618,7 @@ func confLicenseAbstylesLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Abstyles License", size: 730, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Abstyles License", size: 730, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3638,7 +3638,7 @@ func confLicenseAcademicFreeLicenseV11() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Academic Free License v1.1", size: 4660, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Academic Free License v1.1", size: 4660, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3658,7 +3658,7 @@ func confLicenseAcademicFreeLicenseV12() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Academic Free License v1.2", size: 4949, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Academic Free License v1.2", size: 4949, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3678,7 +3678,7 @@ func confLicenseAcademicFreeLicenseV20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Academic Free License v2.0", size: 8937, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Academic Free License v2.0", size: 8937, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3698,7 +3698,7 @@ func confLicenseAcademicFreeLicenseV21() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Academic Free License v2.1", size: 8922, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Academic Free License v2.1", size: 8922, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3718,7 +3718,7 @@ func confLicenseAcademicFreeLicenseV30() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Academic Free License v3.0", size: 10306, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Academic Free License v3.0", size: 10306, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3738,7 +3738,7 @@ func confLicenseAfferoGeneralPublicLicenseV10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Affero General Public License v1.0", size: 15837, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Affero General Public License v1.0", size: 15837, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3758,7 +3758,7 @@ func confLicenseApacheLicense10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Apache License 1.0", size: 2475, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Apache License 1.0", size: 2475, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3778,7 +3778,7 @@ func confLicenseApacheLicense11() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Apache License 1.1", size: 2508, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Apache License 1.1", size: 2508, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3798,7 +3798,7 @@ func confLicenseApacheLicense20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Apache License 2.0", size: 10261, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Apache License 2.0", size: 10261, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3818,7 +3818,7 @@ func confLicenseArtisticLicense10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Artistic License 1.0", size: 4789, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Artistic License 1.0", size: 4789, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3838,7 +3838,7 @@ func confLicenseArtisticLicense20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Artistic License 2.0", size: 8661, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Artistic License 2.0", size: 8661, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3858,7 +3858,7 @@ func confLicenseBsd2ClauseLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/BSD 2-clause License", size: 1286, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/BSD 2-clause License", size: 1286, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3878,7 +3878,7 @@ func confLicenseBsd3ClauseLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/BSD 3-clause License", size: 1480, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/BSD 3-clause License", size: 1480, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3898,7 +3898,7 @@ func confLicenseBsd4ClauseLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/BSD 4-clause License", size: 1624, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/BSD 4-clause License", size: 1624, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3918,7 +3918,7 @@ func confLicenseCreativeCommonsCc010Universal() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Creative Commons CC0 1.0 Universal", size: 6894, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Creative Commons CC0 1.0 Universal", size: 6894, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3938,7 +3938,7 @@ func confLicenseEclipsePublicLicense10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Eclipse Public License 1.0", size: 11248, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Eclipse Public License 1.0", size: 11248, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3958,7 +3958,7 @@ func confLicenseEducationalCommunityLicenseV10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Educational Community License v1.0", size: 2394, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Educational Community License v1.0", size: 2394, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3978,7 +3978,7 @@ func confLicenseEducationalCommunityLicenseV20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Educational Community License v2.0", size: 11085, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Educational Community License v2.0", size: 11085, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -3998,7 +3998,7 @@ func confLicenseGnuAfferoGeneralPublicLicenseV30() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Affero General Public License v3.0", size: 33818, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Affero General Public License v3.0", size: 33818, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4018,7 +4018,7 @@ func confLicenseGnuFreeDocumentationLicenseV11() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.1", size: 17912, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.1", size: 17912, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4038,7 +4038,7 @@ func confLicenseGnuFreeDocumentationLicenseV12() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.2", size: 20209, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.2", size: 20209, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4058,7 +4058,7 @@ func confLicenseGnuFreeDocumentationLicenseV13() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.3", size: 22732, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Free Documentation License v1.3", size: 22732, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4078,7 +4078,7 @@ func confLicenseGnuGeneralPublicLicenseV10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU General Public License v1.0", size: 12165, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU General Public License v1.0", size: 12165, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4098,7 +4098,7 @@ func confLicenseGnuGeneralPublicLicenseV20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU General Public License v2.0", size: 17277, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU General Public License v2.0", size: 17277, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4118,7 +4118,7 @@ func confLicenseGnuGeneralPublicLicenseV30() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU General Public License v3.0", size: 34570, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU General Public License v3.0", size: 34570, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4138,7 +4138,7 @@ func confLicenseGnuLesserGeneralPublicLicenseV21() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Lesser General Public License v2.1", size: 25885, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Lesser General Public License v2.1", size: 25885, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4158,7 +4158,7 @@ func confLicenseGnuLesserGeneralPublicLicenseV30() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Lesser General Public License v3.0", size: 7355, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Lesser General Public License v3.0", size: 7355, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4178,7 +4178,7 @@ func confLicenseGnuLibraryGeneralPublicLicenseV20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/GNU Library General Public License v2.0", size: 24758, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/GNU Library General Public License v2.0", size: 24758, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4198,7 +4198,7 @@ func confLicenseIscLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/ISC license", size: 823, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/ISC license", size: 823, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4218,7 +4218,7 @@ func confLicenseMitLicense() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/MIT License", size: 1077, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/MIT License", size: 1077, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4238,7 +4238,7 @@ func confLicenseMozillaPublicLicense10() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Mozilla Public License 1.0", size: 18026, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Mozilla Public License 1.0", size: 18026, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4258,7 +4258,7 @@ func confLicenseMozillaPublicLicense11() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Mozilla Public License 1.1", size: 23361, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Mozilla Public License 1.1", size: 23361, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4278,7 +4278,7 @@ func confLicenseMozillaPublicLicense20() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/license/Mozilla Public License 2.0", size: 14827, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/license/Mozilla Public License 2.0", size: 14827, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4298,7 +4298,7 @@ func confLocaleLocale_bgBgIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_bg-BG.ini", size: 77956, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_bg-BG.ini", size: 77956, mode: os.FileMode(493), modTime: time.Unix(1457471078, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4318,7 +4318,7 @@ func confLocaleLocale_deDeIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_de-DE.ini", size: 54304, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_de-DE.ini", size: 54304, mode: os.FileMode(493), modTime: time.Unix(1457471078, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4338,7 +4338,7 @@ func confLocaleLocale_enUsIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 50827, mode: os.FileMode(420), modTime: time.Unix(1457228752, 0)} + info := bindataFileInfo{name: "conf/locale/locale_en-US.ini", size: 50827, mode: os.FileMode(420), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4358,7 +4358,7 @@ func confLocaleLocale_esEsIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_es-ES.ini", size: 55308, mode: os.FileMode(493), modTime: time.Unix(1457322332, 0)} + info := bindataFileInfo{name: "conf/locale/locale_es-ES.ini", size: 55308, mode: os.FileMode(493), modTime: time.Unix(1457471078, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4378,7 +4378,7 @@ func confLocaleLocale_fiFiIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_fi-FI.ini", size: 52346, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_fi-FI.ini", size: 52346, mode: os.FileMode(493), modTime: time.Unix(1457471078, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4398,7 +4398,7 @@ func confLocaleLocale_frFrIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_fr-FR.ini", size: 54780, mode: os.FileMode(493), modTime: time.Unix(1457322332, 0)} + info := bindataFileInfo{name: "conf/locale/locale_fr-FR.ini", size: 54780, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4418,7 +4418,7 @@ func confLocaleLocale_itItIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_it-IT.ini", size: 52464, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_it-IT.ini", size: 52464, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4438,7 +4438,7 @@ func confLocaleLocale_jaJpIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_ja-JP.ini", size: 59868, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_ja-JP.ini", size: 59868, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4458,7 +4458,7 @@ func confLocaleLocale_lvLvIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_lv-LV.ini", size: 55144, mode: os.FileMode(493), modTime: time.Unix(1457322336, 0)} + info := bindataFileInfo{name: "conf/locale/locale_lv-LV.ini", size: 55144, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4478,7 +4478,7 @@ func confLocaleLocale_nlNlIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_nl-NL.ini", size: 51453, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_nl-NL.ini", size: 51453, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4498,7 +4498,7 @@ func confLocaleLocale_plPlIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_pl-PL.ini", size: 52869, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_pl-PL.ini", size: 52869, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4518,7 +4518,7 @@ func confLocaleLocale_ptBrIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_pt-BR.ini", size: 53475, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_pt-BR.ini", size: 53475, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4538,7 +4538,7 @@ func confLocaleLocale_ruRuIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_ru-RU.ini", size: 78374, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_ru-RU.ini", size: 78374, mode: os.FileMode(493), modTime: time.Unix(1457471078, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4558,7 +4558,7 @@ func confLocaleLocale_zhCnIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_zh-CN.ini", size: 48570, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_zh-CN.ini", size: 48570, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4578,7 +4578,7 @@ func confLocaleLocale_zhHkIni() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/locale/locale_zh-HK.ini", size: 48605, mode: os.FileMode(493), modTime: time.Unix(1457322334, 0)} + info := bindataFileInfo{name: "conf/locale/locale_zh-HK.ini", size: 48605, mode: os.FileMode(493), modTime: time.Unix(1457238869, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -4598,7 +4598,7 @@ func confReadmeDefault() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "conf/readme/Default", size: 23, mode: os.FileMode(420), modTime: time.Unix(1444419364, 0)} + info := bindataFileInfo{name: "conf/readme/Default", size: 23, mode: os.FileMode(420), modTime: time.Unix(1441006036, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/modules/middleware/auth.go b/modules/context/auth.go similarity index 55% rename from modules/middleware/auth.go rename to modules/context/auth.go index 4e549a0782..41c8b9eb01 100644 --- a/modules/middleware/auth.go +++ b/modules/context/auth.go @@ -2,66 +2,23 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package middleware +package context import ( - "fmt" "net/url" "github.com/go-macaron/csrf" "gopkg.in/macaron.v1" - "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" - "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/setting" ) type ToggleOptions struct { - SignInRequire bool - SignOutRequire bool - AdminRequire bool - DisableCsrf bool -} - -// AutoSignIn reads cookie and try to auto-login. -func AutoSignIn(ctx *Context) (bool, error) { - if !models.HasEngine { - return false, nil - } - - uname := ctx.GetCookie(setting.CookieUserName) - if len(uname) == 0 { - return false, nil - } - - isSucceed := false - defer func() { - if !isSucceed { - log.Trace("auto-login cookie cleared: %s", uname) - ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) - ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) - } - }() - - u, err := models.GetUserByName(uname) - if err != nil { - if !models.IsErrUserNotExist(err) { - return false, fmt.Errorf("GetUserByName: %v", err) - } - return false, nil - } - - if val, _ := ctx.GetSuperSecureCookie( - base.EncodeMD5(u.Rands+u.Passwd), setting.CookieRememberName); val != u.Name { - return false, nil - } - - isSucceed = true - ctx.Session.Set("uid", u.Id) - ctx.Session.Set("uname", u.Name) - return true, nil + SignInRequired bool + SignOutRequired bool + AdminRequired bool + DisableCSRF bool } func Toggle(options *ToggleOptions) macaron.Handler { @@ -79,19 +36,19 @@ func Toggle(options *ToggleOptions) macaron.Handler { } // Redirect to dashboard if user tries to visit any non-login page. - if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" { + if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" { ctx.Redirect(setting.AppSubUrl + "/") return } - if !options.SignOutRequire && !options.DisableCsrf && ctx.Req.Method == "POST" && !auth.IsAPIPath(ctx.Req.URL.Path) { + if !options.SignOutRequired && !options.DisableCSRF && ctx.Req.Method == "POST" && !auth.IsAPIPath(ctx.Req.URL.Path) { csrf.Validate(ctx.Context, ctx.csrf) if ctx.Written() { return } } - if options.SignInRequire { + if options.SignInRequired { if !ctx.IsSigned { // Restrict API calls with error message. if auth.IsAPIPath(ctx.Req.URL.Path) { @@ -109,15 +66,15 @@ func Toggle(options *ToggleOptions) macaron.Handler { } } - // Auto-signin info is provided and has not signed in. - if !options.SignOutRequire && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && + // Redirect to log in page if auto-signin info is provided and has not signed in. + if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && len(ctx.GetCookie(setting.CookieUserName)) > 0 { ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubUrl+ctx.Req.RequestURI), 0, setting.AppSubUrl) ctx.Redirect(setting.AppSubUrl + "/user/login") return } - if options.AdminRequire { + if options.AdminRequired { if !ctx.User.IsAdmin { ctx.Error(403) return diff --git a/modules/middleware/context.go b/modules/context/context.go similarity index 95% rename from modules/middleware/context.go rename to modules/context/context.go index d2b7de4a27..0c1ec520c1 100644 --- a/modules/middleware/context.go +++ b/modules/context/context.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package middleware +package context import ( "fmt" @@ -27,14 +27,14 @@ import ( "github.com/gogits/gogs/modules/setting" ) -type PullRequestContext struct { +type PullRequest struct { BaseRepo *models.Repository Allowed bool SameRepo bool HeadInfo string // [:] } -type RepoContext struct { +type Repository struct { AccessMode models.AccessMode IsWatching bool IsViewBranch bool @@ -54,7 +54,27 @@ type RepoContext struct { CommitsCount int64 Mirror *models.Mirror - PullRequest *PullRequestContext + PullRequest *PullRequest +} + +// IsOwner returns true if current user is the owner of repository. +func (r *Repository) IsOwner() bool { + return r.AccessMode >= models.ACCESS_MODE_OWNER +} + +// IsAdmin returns true if current user has admin or higher access of repository. +func (r *Repository) IsAdmin() bool { + return r.AccessMode >= models.ACCESS_MODE_ADMIN +} + +// IsWriter returns true if current user has write or higher access of repository. +func (r *Repository) IsWriter() bool { + return r.AccessMode >= models.ACCESS_MODE_WRITE +} + +// HasAccess returns true if the current user has at least read access for this repository +func (r *Repository) HasAccess() bool { + return r.AccessMode >= models.ACCESS_MODE_READ } // Context represents context of a request. @@ -69,7 +89,7 @@ type Context struct { IsSigned bool IsBasicAuth bool - Repo *RepoContext + Repo *Repository Org struct { IsOwner bool @@ -83,26 +103,6 @@ type Context struct { } } -// IsOwner returns true if current user is the owner of repository. -func (r *RepoContext) IsOwner() bool { - return r.AccessMode >= models.ACCESS_MODE_OWNER -} - -// IsAdmin returns true if current user has admin or higher access of repository. -func (r *RepoContext) IsAdmin() bool { - return r.AccessMode >= models.ACCESS_MODE_ADMIN -} - -// IsWriter returns true if current user has write or higher access of repository. -func (r *RepoContext) IsWriter() bool { - return r.AccessMode >= models.ACCESS_MODE_WRITE -} - -// HasAccess returns true if the current user has at least read access for this repository -func (r *RepoContext) HasAccess() bool { - return r.AccessMode >= models.ACCESS_MODE_READ -} - // HasError returns true if error occurs in form validation. func (ctx *Context) HasApiError() bool { hasErr, ok := ctx.Data["HasError"] @@ -220,8 +220,8 @@ func Contexter() macaron.Handler { csrf: x, Flash: f, Session: sess, - Repo: &RepoContext{ - PullRequest: &PullRequestContext{}, + Repo: &Repository{ + PullRequest: &PullRequest{}, }, } // Compute current URL for real-time change language. diff --git a/modules/middleware/org.go b/modules/context/org.go similarity index 99% rename from modules/middleware/org.go rename to modules/context/org.go index eec2b556fd..0f691fcdd1 100644 --- a/modules/middleware/org.go +++ b/modules/context/org.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package middleware +package context import ( "strings" diff --git a/modules/middleware/repo.go b/modules/context/repo.go similarity index 99% rename from modules/middleware/repo.go rename to modules/context/repo.go index f96b87d437..228ddbb92e 100644 --- a/modules/middleware/repo.go +++ b/modules/context/repo.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package middleware +package context import ( "fmt" diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 35d40bf2bc..1608b73b11 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -15,9 +15,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/cron" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/process" "github.com/gogits/gogs/modules/setting" ) @@ -124,7 +124,7 @@ const ( REINIT_MISSING_REPOSITORY ) -func Dashboard(ctx *middleware.Context) { +func Dashboard(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.dashboard") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminDashboard"] = true @@ -175,7 +175,7 @@ func Dashboard(ctx *middleware.Context) { ctx.HTML(200, DASHBOARD) } -func SendTestMail(ctx *middleware.Context) { +func SendTestMail(ctx *context.Context) { email := ctx.Query("email") // Send a test email to the user's email address and redirect back to Config if err := mailer.SendTestMail(email); err != nil { @@ -187,7 +187,7 @@ func SendTestMail(ctx *middleware.Context) { ctx.Redirect(setting.AppSubUrl + "/admin/config") } -func Config(ctx *middleware.Context) { +func Config(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.config") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminConfig"] = true @@ -236,7 +236,7 @@ func Config(ctx *middleware.Context) { ctx.HTML(200, CONFIG) } -func Monitor(ctx *middleware.Context) { +func Monitor(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.monitor") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminMonitor"] = true diff --git a/routers/admin/auths.go b/routers/admin/auths.go index b9e86a1ef5..4a26532bf4 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auths.go @@ -14,8 +14,8 @@ import ( "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/auth/ldap" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -25,7 +25,7 @@ const ( AUTH_EDIT base.TplName = "admin/auth/edit" ) -func Authentications(ctx *middleware.Context) { +func Authentications(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.authentication") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -53,7 +53,7 @@ var authSources = []AuthSource{ {models.LoginNames[models.LOGIN_PAM], models.LOGIN_PAM}, } -func NewAuthSource(ctx *middleware.Context) { +func NewAuthSource(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.auths.new") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -102,7 +102,7 @@ func parseSMTPConfig(form auth.AuthenticationForm) *models.SMTPConfig { } } -func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { +func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) { ctx.Data["Title"] = ctx.Tr("admin.auths.new") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -147,7 +147,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { ctx.Redirect(setting.AppSubUrl + "/admin/auths") } -func EditAuthSource(ctx *middleware.Context) { +func EditAuthSource(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.auths.edit") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -163,7 +163,7 @@ func EditAuthSource(ctx *middleware.Context) { ctx.HTML(200, AUTH_EDIT) } -func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { +func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) { ctx.Data["Title"] = ctx.Tr("admin.auths.edit") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminAuthentications"] = true @@ -210,7 +210,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + com.ToStr(form.ID)) } -func DeleteAuthSource(ctx *middleware.Context) { +func DeleteAuthSource(ctx *context.Context) { source, err := models.GetLoginSourceByID(ctx.ParamsInt64(":authid")) if err != nil { ctx.Handle(500, "GetLoginSourceByID", err) diff --git a/routers/admin/notice.go b/routers/admin/notice.go index 39d0abc736..09222eb84e 100644 --- a/routers/admin/notice.go +++ b/routers/admin/notice.go @@ -10,8 +10,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -19,7 +19,7 @@ const ( NOTICES base.TplName = "admin/notice" ) -func Notices(ctx *middleware.Context) { +func Notices(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.notices") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminNotices"] = true @@ -42,7 +42,7 @@ func Notices(ctx *middleware.Context) { ctx.HTML(200, NOTICES) } -func DeleteNotices(ctx *middleware.Context) { +func DeleteNotices(ctx *context.Context) { strs := ctx.QueryStrings("ids[]") ids := make([]int64, 0, len(strs)) for i := range strs { @@ -61,7 +61,7 @@ func DeleteNotices(ctx *middleware.Context) { } } -func EmptyNotices(ctx *middleware.Context) { +func EmptyNotices(ctx *context.Context) { if err := models.DeleteNotices(0, 0); err != nil { ctx.Handle(500, "DeleteNotices", err) return diff --git a/routers/admin/orgs.go b/routers/admin/orgs.go index ae68b872d0..829e78e83c 100644 --- a/routers/admin/orgs.go +++ b/routers/admin/orgs.go @@ -9,7 +9,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" ) @@ -17,7 +17,7 @@ const ( ORGS base.TplName = "admin/org/list" ) -func Organizations(ctx *middleware.Context) { +func Organizations(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.organizations") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminOrganizations"] = true @@ -28,15 +28,15 @@ func Organizations(ctx *middleware.Context) { page = 1 } ctx.Data["Page"] = paginater.New(int(total), setting.AdminOrgPagingNum, page, 5) - - orgs, err := models.Organizations(page, setting.AdminOrgPagingNum) - + + orgs, err := models.Organizations(page, setting.AdminOrgPagingNum) + if err != nil { ctx.Handle(500, "Organizations", err) return } - - ctx.Data["Orgs"] = orgs + + ctx.Data["Orgs"] = orgs ctx.Data["Total"] = total ctx.HTML(200, ORGS) diff --git a/routers/admin/repos.go b/routers/admin/repos.go index a16a9adec6..47b6032a65 100644 --- a/routers/admin/repos.go +++ b/routers/admin/repos.go @@ -9,8 +9,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -18,7 +18,7 @@ const ( REPOS base.TplName = "admin/repo/list" ) -func Repos(ctx *middleware.Context) { +func Repos(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.repositories") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminRepositories"] = true @@ -41,7 +41,7 @@ func Repos(ctx *middleware.Context) { ctx.HTML(200, REPOS) } -func DeleteRepo(ctx *middleware.Context) { +func DeleteRepo(ctx *context.Context) { repo, err := models.GetRepositoryByID(ctx.QueryInt64("id")) if err != nil { ctx.Handle(500, "GetRepositoryByID", err) diff --git a/routers/admin/users.go b/routers/admin/users.go index ada0df5905..274effc4b6 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -13,9 +13,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -25,7 +25,7 @@ const ( USER_EDIT base.TplName = "admin/user/edit" ) -func Users(ctx *middleware.Context) { +func Users(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.users") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -48,7 +48,7 @@ func Users(ctx *middleware.Context) { ctx.HTML(200, USERS) } -func NewUser(ctx *middleware.Context) { +func NewUser(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.users.new_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -66,7 +66,7 @@ func NewUser(ctx *middleware.Context) { ctx.HTML(200, USER_NEW) } -func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) { +func NewUserPost(ctx *context.Context, form auth.AdminCrateUserForm) { ctx.Data["Title"] = ctx.Tr("admin.users.new_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -132,7 +132,7 @@ func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) { ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id)) } -func prepareUserInfo(ctx *middleware.Context) *models.User { +func prepareUserInfo(ctx *context.Context) *models.User { u, err := models.GetUserByID(ctx.ParamsInt64(":userid")) if err != nil { ctx.Handle(500, "GetUserByID", err) @@ -160,7 +160,7 @@ func prepareUserInfo(ctx *middleware.Context) *models.User { return u } -func EditUser(ctx *middleware.Context) { +func EditUser(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -173,7 +173,7 @@ func EditUser(ctx *middleware.Context) { ctx.HTML(200, USER_EDIT) } -func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) { +func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { ctx.Data["Title"] = ctx.Tr("admin.users.edit_account") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true @@ -231,7 +231,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) { ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid")) } -func DeleteUser(ctx *middleware.Context) { +func DeleteUser(ctx *context.Context) { u, err := models.GetUserByID(ctx.ParamsInt64(":userid")) if err != nil { ctx.Handle(500, "GetUserByID", err) diff --git a/routers/api/v1/admin/orgs.go b/routers/api/v1/admin/orgs.go index 5b5302ca15..fbfcd400ae 100644 --- a/routers/api/v1/admin/orgs.go +++ b/routers/api/v1/admin/orgs.go @@ -8,13 +8,13 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" "github.com/gogits/gogs/routers/api/v1/user" ) // https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization -func CreateOrg(ctx *middleware.Context, form api.CreateOrgOption) { +func CreateOrg(ctx *context.Context, form api.CreateOrgOption) { u := user.GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/api/v1/admin/repos.go b/routers/api/v1/admin/repos.go index 7a6b2af20b..27f46c51c5 100644 --- a/routers/api/v1/admin/repos.go +++ b/routers/api/v1/admin/repos.go @@ -7,13 +7,13 @@ package admin import ( api "github.com/gogits/go-gogs-client" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/repo" "github.com/gogits/gogs/routers/api/v1/user" ) // https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository -func CreateRepo(ctx *middleware.Context, form api.CreateRepoOption) { +func CreateRepo(ctx *context.Context, form api.CreateRepoOption) { owner := user.GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/api/v1/admin/users.go b/routers/api/v1/admin/users.go index 9a8c906f29..f0a6c293e5 100644 --- a/routers/api/v1/admin/users.go +++ b/routers/api/v1/admin/users.go @@ -8,15 +8,15 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" "github.com/gogits/gogs/routers/api/v1/user" ) -func parseLoginSource(ctx *middleware.Context, u *models.User, sourceID int64, loginName string) { +func parseLoginSource(ctx *context.Context, u *models.User, sourceID int64, loginName string) { if sourceID == 0 { return } @@ -37,7 +37,7 @@ func parseLoginSource(ctx *middleware.Context, u *models.User, sourceID int64, l } // https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user -func CreateUser(ctx *middleware.Context, form api.CreateUserOption) { +func CreateUser(ctx *context.Context, form api.CreateUserOption) { u := &models.User{ Name: form.Username, Email: form.Email, @@ -73,7 +73,7 @@ func CreateUser(ctx *middleware.Context, form api.CreateUserOption) { } // https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user -func EditUser(ctx *middleware.Context, form api.EditUserOption) { +func EditUser(ctx *context.Context, form api.EditUserOption) { u := user.GetUserByParams(ctx) if ctx.Written() { return @@ -122,7 +122,7 @@ func EditUser(ctx *middleware.Context, form api.EditUserOption) { } // https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user -func DeleteUser(ctx *middleware.Context) { +func DeleteUser(ctx *context.Context) { u := user.GetUserByParams(ctx) if ctx.Written() { return @@ -143,7 +143,7 @@ func DeleteUser(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user -func CreatePublicKey(ctx *middleware.Context, form api.CreateKeyOption) { +func CreatePublicKey(ctx *context.Context, form api.CreateKeyOption) { u := user.GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 04b392fc9b..c314d7a036 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -14,7 +14,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/admin" "github.com/gogits/gogs/routers/api/v1/misc" "github.com/gogits/gogs/routers/api/v1/org" @@ -23,7 +23,7 @@ import ( ) func RepoAssignment() macaron.Handler { - return func(ctx *middleware.Context) { + return func(ctx *context.Context) { userName := ctx.Params(":username") repoName := ctx.Params(":reponame") @@ -82,7 +82,7 @@ func RepoAssignment() macaron.Handler { // Contexter middleware already checks token for user sign in process. func ReqToken() macaron.Handler { - return func(ctx *middleware.Context) { + return func(ctx *context.Context) { if !ctx.IsSigned { ctx.Error(401) return @@ -91,7 +91,7 @@ func ReqToken() macaron.Handler { } func ReqBasicAuth() macaron.Handler { - return func(ctx *middleware.Context) { + return func(ctx *context.Context) { if !ctx.IsBasicAuth { ctx.Error(401) return @@ -100,7 +100,7 @@ func ReqBasicAuth() macaron.Handler { } func ReqAdmin() macaron.Handler { - return func(ctx *middleware.Context) { + return func(ctx *context.Context) { if !ctx.User.IsAdmin { ctx.Error(403) return @@ -181,11 +181,11 @@ func RegisterRoutes(m *macaron.Macaron) { m.Combo("/hooks").Get(repo.ListHooks). Post(bind(api.CreateHookOption{}), repo.CreateHook) m.Patch("/hooks/:id:int", bind(api.EditHookOption{}), repo.EditHook) - m.Get("/raw/*", middleware.RepoRef(), repo.GetRawFile) + m.Get("/raw/*", context.RepoRef(), repo.GetRawFile) m.Get("/archive/*", repo.GetArchive) m.Group("/branches", func() { - m.Get("",repo.ListBranches) - m.Get("/:branchname",repo.GetBranch) + m.Get("", repo.ListBranches) + m.Get("/:branchname", repo.GetBranch) }) m.Group("/keys", func() { m.Combo("").Get(repo.ListDeployKeys). @@ -201,7 +201,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/users/:username/orgs", org.ListUserOrgs) m.Combo("/orgs/:orgname").Get(org.Get).Patch(bind(api.EditOrgOption{}), org.Edit) - m.Any("/*", func(ctx *middleware.Context) { + m.Any("/*", func(ctx *context.Context) { ctx.Error(404) }) diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go index b98a362c3d..658f495ee5 100644 --- a/routers/api/v1/misc/markdown.go +++ b/routers/api/v1/misc/markdown.go @@ -7,12 +7,12 @@ package misc import ( api "github.com/gogits/go-gogs-client" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" ) // https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document -func Markdown(ctx *middleware.Context, form api.MarkdownOption) { +func Markdown(ctx *context.Context, form api.MarkdownOption) { if ctx.HasApiError() { ctx.APIError(422, "", ctx.GetErrMsg()) return @@ -32,7 +32,7 @@ func Markdown(ctx *middleware.Context, form api.MarkdownOption) { } // https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-a-markdown-document-in-raw-mode -func MarkdownRaw(ctx *middleware.Context) { +func MarkdownRaw(ctx *context.Context) { body, err := ctx.Req.Body().Bytes() if err != nil { ctx.APIError(422, "", err) diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index 2c6d6fd3f8..fe99f10548 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -8,12 +8,12 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" "github.com/gogits/gogs/routers/api/v1/user" ) -func listUserOrgs(ctx *middleware.Context, u *models.User, all bool) { +func listUserOrgs(ctx *context.Context, u *models.User, all bool) { if err := u.GetOrganizations(all); err != nil { ctx.APIError(500, "GetOrganizations", err) return @@ -27,12 +27,12 @@ func listUserOrgs(ctx *middleware.Context, u *models.User, all bool) { } // https://github.com/gogits/go-gogs-client/wiki/Organizations#list-your-organizations -func ListMyOrgs(ctx *middleware.Context) { +func ListMyOrgs(ctx *context.Context) { listUserOrgs(ctx, ctx.User, true) } // https://github.com/gogits/go-gogs-client/wiki/Organizations#list-user-organizations -func ListUserOrgs(ctx *middleware.Context) { +func ListUserOrgs(ctx *context.Context) { u := user.GetUserByParams(ctx) if ctx.Written() { return @@ -41,7 +41,7 @@ func ListUserOrgs(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Organizations#get-an-organization -func Get(ctx *middleware.Context) { +func Get(ctx *context.Context) { org := user.GetUserByParamsName(ctx, ":orgname") if ctx.Written() { return @@ -50,7 +50,7 @@ func Get(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Organizations#edit-an-organization -func Edit(ctx *middleware.Context, form api.EditOrgOption) { +func Edit(ctx *context.Context, form api.EditOrgOption) { org := user.GetUserByParamsName(ctx, ":orgname") if ctx.Written() { return diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go index e2f15ff5e5..511f50057d 100644 --- a/routers/api/v1/repo/branch.go +++ b/routers/api/v1/repo/branch.go @@ -7,12 +7,12 @@ package repo import ( api "github.com/gogits/go-gogs-client" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" ) // https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch -func GetBranch(ctx *middleware.Context) { +func GetBranch(ctx *context.Context) { branch, err := ctx.Repo.Repository.GetBranch(ctx.Params(":branchname")) if err != nil { ctx.APIError(500, "GetBranch", err) @@ -29,7 +29,7 @@ func GetBranch(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#list-branches -func ListBranches(ctx *middleware.Context) { +func ListBranches(ctx *context.Context) { branches, err := ctx.Repo.Repository.GetBranches() if err != nil { ctx.APIError(500, "GetBranches", err) diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index f64e663466..7939a58424 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -8,12 +8,12 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/repo" ) // https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-raw-content -func GetRawFile(ctx *middleware.Context) { +func GetRawFile(ctx *context.Context) { if !ctx.Repo.HasAccess() { ctx.Error(404) return @@ -34,7 +34,7 @@ func GetRawFile(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-archive -func GetArchive(ctx *middleware.Context) { +func GetArchive(ctx *context.Context) { repoPath := models.RepoPath(ctx.Params(":username"), ctx.Params(":reponame")) gitRepo, err := git.OpenRepository(repoPath) if err != nil { diff --git a/routers/api/v1/repo/hooks.go b/routers/api/v1/repo/hooks.go index e0893a014c..954e36be62 100644 --- a/routers/api/v1/repo/hooks.go +++ b/routers/api/v1/repo/hooks.go @@ -12,12 +12,12 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" ) // https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks -func ListHooks(ctx *middleware.Context) { +func ListHooks(ctx *context.Context) { hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) if err != nil { ctx.APIError(500, "GetWebhooksByRepoID", err) @@ -33,7 +33,7 @@ func ListHooks(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#create-a-hook -func CreateHook(ctx *middleware.Context, form api.CreateHookOption) { +func CreateHook(ctx *context.Context, form api.CreateHookOption) { if !models.IsValidHookTaskType(form.Type) { ctx.APIError(422, "", "Invalid hook type") return @@ -98,7 +98,7 @@ func CreateHook(ctx *middleware.Context, form api.CreateHookOption) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook -func EditHook(ctx *middleware.Context, form api.EditHookOption) { +func EditHook(ctx *context.Context, form api.EditHookOption) { w, err := models.GetWebhookByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrWebhookNotExist(err) { diff --git a/routers/api/v1/repo/keys.go b/routers/api/v1/repo/keys.go index 2ec0b754f2..9de16ff0b4 100644 --- a/routers/api/v1/repo/keys.go +++ b/routers/api/v1/repo/keys.go @@ -10,7 +10,7 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" ) @@ -20,7 +20,7 @@ func composeDeployKeysAPILink(repoPath string) string { } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys -func ListDeployKeys(ctx *middleware.Context) { +func ListDeployKeys(ctx *context.Context) { keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID) if err != nil { ctx.Handle(500, "ListDeployKeys", err) @@ -41,7 +41,7 @@ func ListDeployKeys(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key -func GetDeployKey(ctx *middleware.Context) { +func GetDeployKey(ctx *context.Context) { key, err := models.GetDeployKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrDeployKeyNotExist(err) { @@ -61,7 +61,7 @@ func GetDeployKey(ctx *middleware.Context) { ctx.JSON(200, convert.ToApiDeployKey(apiLink, key)) } -func HandleCheckKeyStringError(ctx *middleware.Context, err error) { +func HandleCheckKeyStringError(ctx *context.Context, err error) { if models.IsErrKeyUnableVerify(err) { ctx.APIError(422, "", "Unable to verify key content") } else { @@ -69,7 +69,7 @@ func HandleCheckKeyStringError(ctx *middleware.Context, err error) { } } -func HandleAddKeyError(ctx *middleware.Context, err error) { +func HandleAddKeyError(ctx *context.Context, err error) { switch { case models.IsErrKeyAlreadyExist(err): ctx.APIError(422, "", "Key content has been used as non-deploy key") @@ -81,7 +81,7 @@ func HandleAddKeyError(ctx *middleware.Context, err error) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#add-a-new-deploy-key -func CreateDeployKey(ctx *middleware.Context, form api.CreateKeyOption) { +func CreateDeployKey(ctx *context.Context, form api.CreateKeyOption) { content, err := models.CheckPublicKeyString(form.Key) if err != nil { HandleCheckKeyStringError(ctx, err) @@ -100,7 +100,7 @@ func CreateDeployKey(ctx *middleware.Context, form api.CreateKeyOption) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key -func DeleteDeploykey(ctx *middleware.Context) { +func DeleteDeploykey(ctx *context.Context) { if err := models.DeleteDeployKey(ctx.User, ctx.ParamsInt64(":id")); err != nil { if models.IsErrKeyAccessDenied(err) { ctx.APIError(403, "", "You do not have access to this key") diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index eb00aa886f..fc7a9cd442 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -13,14 +13,14 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" ) // https://github.com/gogits/go-gogs-client/wiki/Repositories#search-repositories -func Search(ctx *middleware.Context) { +func Search(ctx *context.Context) { opt := models.SearchOption{ Keyword: path.Base(ctx.Query("q")), Uid: com.StrTo(ctx.Query("uid")).MustInt64(), @@ -81,7 +81,7 @@ func Search(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#list-your-repositories -func ListMyRepos(ctx *middleware.Context) { +func ListMyRepos(ctx *context.Context) { ownRepos, err := models.GetRepositories(ctx.User.Id, true) if err != nil { ctx.APIError(500, "GetRepositories", err) @@ -113,7 +113,7 @@ func ListMyRepos(ctx *middleware.Context) { ctx.JSON(200, &repos) } -func CreateUserRepo(ctx *middleware.Context, owner *models.User, opt api.CreateRepoOption) { +func CreateUserRepo(ctx *context.Context, owner *models.User, opt api.CreateRepoOption) { repo, err := models.CreateRepository(owner, models.CreateRepoOptions{ Name: opt.Name, Description: opt.Description, @@ -143,7 +143,7 @@ func CreateUserRepo(ctx *middleware.Context, owner *models.User, opt api.CreateR } // https://github.com/gogits/go-gogs-client/wiki/Repositories#create -func Create(ctx *middleware.Context, opt api.CreateRepoOption) { +func Create(ctx *context.Context, opt api.CreateRepoOption) { // Shouldn't reach this condition, but just in case. if ctx.User.IsOrganization() { ctx.APIError(422, "", "not allowed creating repository for organization") @@ -152,7 +152,7 @@ func Create(ctx *middleware.Context, opt api.CreateRepoOption) { CreateUserRepo(ctx, ctx.User, opt) } -func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { +func CreateOrgRepo(ctx *context.Context, opt api.CreateRepoOption) { org, err := models.GetOrgByName(ctx.Params(":org")) if err != nil { if models.IsErrUserNotExist(err) { @@ -171,7 +171,7 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#migrate -func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) { +func Migrate(ctx *context.Context, form auth.MigrateRepoForm) { ctxUser := ctx.User // Not equal means context user is an organization, // or is another user/organization if current user is admin. @@ -242,7 +242,7 @@ func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.JSON(201, convert.ToApiRepository(ctxUser, repo, api.Permission{true, true, true})) } -func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repository) { +func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository) { owner, err := models.GetUserByName(ctx.Params(":username")) if err != nil { if models.IsErrUserNotExist(err) { @@ -267,7 +267,7 @@ func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repositor } // https://github.com/gogits/go-gogs-client/wiki/Repositories#get -func Get(ctx *middleware.Context) { +func Get(ctx *context.Context) { owner, repo := parseOwnerAndRepo(ctx) if ctx.Written() { return @@ -277,7 +277,7 @@ func Get(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Repositories#delete -func Delete(ctx *middleware.Context) { +func Delete(ctx *context.Context) { owner, repo := parseOwnerAndRepo(ctx) if ctx.Written() { return diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 00aacbdc1b..87413becf0 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -8,11 +8,11 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" ) // https://github.com/gogits/go-gogs-client/wiki/Users#list-access-tokens-for-a-user -func ListAccessTokens(ctx *middleware.Context) { +func ListAccessTokens(ctx *context.Context) { tokens, err := models.ListAccessTokens(ctx.User.Id) if err != nil { ctx.APIError(500, "ListAccessTokens", err) @@ -27,7 +27,7 @@ func ListAccessTokens(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users#create-a-access-token -func CreateAccessToken(ctx *middleware.Context, form api.CreateAccessTokenOption) { +func CreateAccessToken(ctx *context.Context, form api.CreateAccessTokenOption) { t := &models.AccessToken{ UID: ctx.User.Id, Name: form.Name, diff --git a/routers/api/v1/user/email.go b/routers/api/v1/user/email.go index fd9193bd74..66bddd24cf 100644 --- a/routers/api/v1/user/email.go +++ b/routers/api/v1/user/email.go @@ -8,13 +8,13 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" ) // https://github.com/gogits/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user -func ListEmails(ctx *middleware.Context) { +func ListEmails(ctx *context.Context) { emails, err := models.GetEmailAddresses(ctx.User.Id) if err != nil { ctx.Handle(500, "GetEmailAddresses", err) @@ -28,7 +28,7 @@ func ListEmails(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Emails#add-email-addresses -func AddEmail(ctx *middleware.Context, form api.CreateEmailOption) { +func AddEmail(ctx *context.Context, form api.CreateEmailOption) { if len(form.Emails) == 0 { ctx.Status(422) return @@ -60,7 +60,7 @@ func AddEmail(ctx *middleware.Context, form api.CreateEmailOption) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Emails#delete-email-addresses -func DeleteEmail(ctx *middleware.Context, form api.CreateEmailOption) { +func DeleteEmail(ctx *context.Context, form api.CreateEmailOption) { if len(form.Emails) == 0 { ctx.Status(204) return diff --git a/routers/api/v1/user/followers.go b/routers/api/v1/user/followers.go index 0a28979647..b7166abb3e 100644 --- a/routers/api/v1/user/followers.go +++ b/routers/api/v1/user/followers.go @@ -8,11 +8,11 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/routers/api/v1/convert" ) -func responseApiUsers(ctx *middleware.Context, users []*models.User) { +func responseApiUsers(ctx *context.Context, users []*models.User) { apiUsers := make([]*api.User, len(users)) for i := range users { apiUsers[i] = convert.ToApiUser(users[i]) @@ -20,7 +20,7 @@ func responseApiUsers(ctx *middleware.Context, users []*models.User) { ctx.JSON(200, &apiUsers) } -func listUserFollowers(ctx *middleware.Context, u *models.User) { +func listUserFollowers(ctx *context.Context, u *models.User) { users, err := u.GetFollowers(ctx.QueryInt("page")) if err != nil { ctx.APIError(500, "GetUserFollowers", err) @@ -29,12 +29,12 @@ func listUserFollowers(ctx *middleware.Context, u *models.User) { responseApiUsers(ctx, users) } -func ListMyFollowers(ctx *middleware.Context) { +func ListMyFollowers(ctx *context.Context) { listUserFollowers(ctx, ctx.User) } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-followers-of-a-user -func ListFollowers(ctx *middleware.Context) { +func ListFollowers(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return @@ -42,7 +42,7 @@ func ListFollowers(ctx *middleware.Context) { listUserFollowers(ctx, u) } -func listUserFollowing(ctx *middleware.Context, u *models.User) { +func listUserFollowing(ctx *context.Context, u *models.User) { users, err := u.GetFollowing(ctx.QueryInt("page")) if err != nil { ctx.APIError(500, "GetFollowing", err) @@ -51,12 +51,12 @@ func listUserFollowing(ctx *middleware.Context, u *models.User) { responseApiUsers(ctx, users) } -func ListMyFollowing(ctx *middleware.Context) { +func ListMyFollowing(ctx *context.Context) { listUserFollowing(ctx, ctx.User) } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-users-followed-by-another-user -func ListFollowing(ctx *middleware.Context) { +func ListFollowing(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return @@ -64,7 +64,7 @@ func ListFollowing(ctx *middleware.Context) { listUserFollowing(ctx, u) } -func checkUserFollowing(ctx *middleware.Context, u *models.User, followID int64) { +func checkUserFollowing(ctx *context.Context, u *models.User, followID int64) { if u.IsFollowing(followID) { ctx.Status(204) } else { @@ -73,7 +73,7 @@ func checkUserFollowing(ctx *middleware.Context, u *models.User, followID int64) } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-you-are-following-a-user -func CheckMyFollowing(ctx *middleware.Context) { +func CheckMyFollowing(ctx *context.Context) { target := GetUserByParams(ctx) if ctx.Written() { return @@ -82,7 +82,7 @@ func CheckMyFollowing(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-one-user-follows-another -func CheckFollowing(ctx *middleware.Context) { +func CheckFollowing(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return @@ -95,7 +95,7 @@ func CheckFollowing(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#follow-a-user -func Follow(ctx *middleware.Context) { +func Follow(ctx *context.Context) { target := GetUserByParams(ctx) if ctx.Written() { return @@ -108,7 +108,7 @@ func Follow(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#unfollow-a-user -func Unfollow(ctx *middleware.Context) { +func Unfollow(ctx *context.Context) { target := GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/api/v1/user/keys.go b/routers/api/v1/user/keys.go index 8ba73d9934..6f387edcb1 100644 --- a/routers/api/v1/user/keys.go +++ b/routers/api/v1/user/keys.go @@ -8,13 +8,13 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" "github.com/gogits/gogs/routers/api/v1/repo" ) -func GetUserByParamsName(ctx *middleware.Context, name string) *models.User { +func GetUserByParamsName(ctx *context.Context, name string) *models.User { user, err := models.GetUserByName(ctx.Params(name)) if err != nil { if models.IsErrUserNotExist(err) { @@ -28,7 +28,7 @@ func GetUserByParamsName(ctx *middleware.Context, name string) *models.User { } // GetUserByParams returns user whose name is presented in URL paramenter. -func GetUserByParams(ctx *middleware.Context) *models.User { +func GetUserByParams(ctx *context.Context) *models.User { return GetUserByParamsName(ctx, ":username") } @@ -36,7 +36,7 @@ func composePublicKeysAPILink() string { return setting.AppUrl + "api/v1/user/keys/" } -func listPublicKeys(ctx *middleware.Context, uid int64) { +func listPublicKeys(ctx *context.Context, uid int64) { keys, err := models.ListPublicKeys(uid) if err != nil { ctx.APIError(500, "ListPublicKeys", err) @@ -53,12 +53,12 @@ func listPublicKeys(ctx *middleware.Context, uid int64) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#list-your-public-keys -func ListMyPublicKeys(ctx *middleware.Context) { +func ListMyPublicKeys(ctx *context.Context) { listPublicKeys(ctx, ctx.User.Id) } // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#list-public-keys-for-a-user -func ListPublicKeys(ctx *middleware.Context) { +func ListPublicKeys(ctx *context.Context) { user := GetUserByParams(ctx) if ctx.Written() { return @@ -67,7 +67,7 @@ func ListPublicKeys(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#get-a-single-public-key -func GetPublicKey(ctx *middleware.Context) { +func GetPublicKey(ctx *context.Context) { key, err := models.GetPublicKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrKeyNotExist(err) { @@ -83,7 +83,7 @@ func GetPublicKey(ctx *middleware.Context) { } // CreateUserPublicKey creates new public key to given user by ID. -func CreateUserPublicKey(ctx *middleware.Context, form api.CreateKeyOption, uid int64) { +func CreateUserPublicKey(ctx *context.Context, form api.CreateKeyOption, uid int64) { content, err := models.CheckPublicKeyString(form.Key) if err != nil { repo.HandleCheckKeyStringError(ctx, err) @@ -100,12 +100,12 @@ func CreateUserPublicKey(ctx *middleware.Context, form api.CreateKeyOption, uid } // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#create-a-public-key -func CreatePublicKey(ctx *middleware.Context, form api.CreateKeyOption) { +func CreatePublicKey(ctx *context.Context, form api.CreateKeyOption) { CreateUserPublicKey(ctx, form, ctx.User.Id) } // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#delete-a-public-key -func DeletePublicKey(ctx *middleware.Context) { +func DeletePublicKey(ctx *context.Context) { if err := models.DeletePublicKey(ctx.User, ctx.ParamsInt64(":id")); err != nil { if models.IsErrKeyAccessDenied(err) { ctx.APIError(403, "", "You do not have access to this key") diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index 6d4b52ffdb..d08fd20241 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -10,11 +10,11 @@ import ( api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" ) // https://github.com/gogits/go-gogs-client/wiki/Users#search-users -func Search(ctx *middleware.Context) { +func Search(ctx *context.Context) { opt := models.SearchOption{ Keyword: ctx.Query("q"), Limit: com.StrTo(ctx.Query("limit")).MustInt(), @@ -52,7 +52,7 @@ func Search(ctx *middleware.Context) { } // https://github.com/gogits/go-gogs-client/wiki/Users#get-a-single-user -func GetInfo(ctx *middleware.Context) { +func GetInfo(ctx *context.Context) { u, err := models.GetUserByName(ctx.Params(":username")) if err != nil { if models.IsErrUserNotExist(err) { diff --git a/routers/dev/template.go b/routers/dev/template.go index 5548f51478..ee81f3804a 100644 --- a/routers/dev/template.go +++ b/routers/dev/template.go @@ -7,11 +7,11 @@ package dev import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" ) -func TemplatePreview(ctx *middleware.Context) { +func TemplatePreview(ctx *context.Context) { ctx.Data["User"] = models.User{Name: "Unknown"} ctx.Data["AppName"] = setting.AppName ctx.Data["AppVer"] = setting.AppVer diff --git a/routers/home.go b/routers/home.go index 4e1ebe9896..298b4f409b 100644 --- a/routers/home.go +++ b/routers/home.go @@ -11,7 +11,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/user" ) @@ -21,7 +21,7 @@ const ( EXPLORE_REPOS base.TplName = "explore/repos" ) -func Home(ctx *middleware.Context) { +func Home(ctx *context.Context) { if ctx.IsSigned { if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { ctx.Data["Title"] = ctx.Tr("auth.active_your_account") @@ -43,7 +43,7 @@ func Home(ctx *middleware.Context) { ctx.HTML(200, HOME) } -func Explore(ctx *middleware.Context) { +func Explore(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("explore") ctx.Data["PageIsExplore"] = true ctx.Data["PageIsExploreRepositories"] = true @@ -71,7 +71,7 @@ func Explore(ctx *middleware.Context) { ctx.HTML(200, EXPLORE_REPOS) } -func NotFound(ctx *middleware.Context) { +func NotFound(ctx *context.Context) { ctx.Data["Title"] = "Page Not Found" ctx.Handle(404, "home.NotFound", nil) } diff --git a/routers/install.go b/routers/install.go index 844f48bd04..99380e1b92 100644 --- a/routers/install.go +++ b/routers/install.go @@ -22,11 +22,11 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/cron" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/ssh" "github.com/gogits/gogs/modules/template/highlight" @@ -97,7 +97,7 @@ func GlobalInit() { markdown.BuildSanitizer() } -func InstallInit(ctx *middleware.Context) { +func InstallInit(ctx *context.Context) { if setting.InstallLock { ctx.Handle(404, "Install", errors.New("Installation is prohibited")) return @@ -116,7 +116,7 @@ func InstallInit(ctx *middleware.Context) { ctx.Data["DbOptions"] = dbOpts } -func Install(ctx *middleware.Context) { +func Install(ctx *context.Context) { form := auth.InstallForm{} // Database settings @@ -177,7 +177,7 @@ func Install(ctx *middleware.Context) { ctx.HTML(200, INSTALL) } -func InstallPost(ctx *middleware.Context, form auth.InstallForm) { +func InstallPost(ctx *context.Context, form auth.InstallForm) { ctx.Data["CurDbOption"] = form.DbType if ctx.HasError() { diff --git a/routers/org/members.go b/routers/org/members.go index a0a3051d4e..1d720ce617 100644 --- a/routers/org/members.go +++ b/routers/org/members.go @@ -9,8 +9,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -19,7 +19,7 @@ const ( MEMBER_INVITE base.TplName = "org/member/invite" ) -func Members(ctx *middleware.Context) { +func Members(ctx *context.Context) { org := ctx.Org.Organization ctx.Data["Title"] = org.FullName ctx.Data["PageIsOrgMembers"] = true @@ -33,7 +33,7 @@ func Members(ctx *middleware.Context) { ctx.HTML(200, MEMBERS) } -func MembersAction(ctx *middleware.Context) { +func MembersAction(ctx *context.Context) { uid := com.StrTo(ctx.Query("uid")).MustInt64() if uid == 0 { ctx.Redirect(ctx.Org.OrgLink + "/members") @@ -91,7 +91,7 @@ func MembersAction(ctx *middleware.Context) { } } -func Invitation(ctx *middleware.Context) { +func Invitation(ctx *context.Context) { org := ctx.Org.Organization ctx.Data["Title"] = org.FullName ctx.Data["PageIsOrgMembers"] = true diff --git a/routers/org/org.go b/routers/org/org.go index dff11be47f..1257c108d0 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -8,8 +8,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -17,12 +17,12 @@ const ( CREATE base.TplName = "org/create" ) -func Create(ctx *middleware.Context) { +func Create(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("new_org") ctx.HTML(200, CREATE) } -func CreatePost(ctx *middleware.Context, form auth.CreateOrgForm) { +func CreatePost(ctx *context.Context, form auth.CreateOrgForm) { ctx.Data["Title"] = ctx.Tr("new_org") if ctx.HasError() { diff --git a/routers/org/setting.go b/routers/org/setting.go index 29ce34f5d9..c50e18d7c9 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -12,8 +12,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/user" ) @@ -24,13 +24,13 @@ const ( SETTINGS_HOOKS base.TplName = "org/settings/hooks" ) -func Settings(ctx *middleware.Context) { +func Settings(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsOptions"] = true ctx.HTML(200, SETTINGS_OPTIONS) } -func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { +func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsOptions"] = true @@ -85,7 +85,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) { ctx.Redirect(ctx.Org.OrgLink + "/settings") } -func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { +func SettingsAvatar(ctx *context.Context, form auth.UploadAvatarForm) { form.Enable = true if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil { ctx.Flash.Error(err.Error()) @@ -96,7 +96,7 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { ctx.Redirect(ctx.Org.OrgLink + "/settings") } -func SettingsDeleteAvatar(ctx *middleware.Context) { +func SettingsDeleteAvatar(ctx *context.Context) { if err := ctx.Org.Organization.DeleteAvatar(); err != nil { ctx.Flash.Error(err.Error()) } @@ -104,7 +104,7 @@ func SettingsDeleteAvatar(ctx *middleware.Context) { ctx.Redirect(ctx.Org.OrgLink + "/settings") } -func SettingsDelete(ctx *middleware.Context) { +func SettingsDelete(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsDelete"] = true @@ -136,7 +136,7 @@ func SettingsDelete(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_DELETE) } -func Webhooks(ctx *middleware.Context) { +func Webhooks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("org.settings") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = ctx.Org.OrgLink @@ -164,7 +164,7 @@ func Webhooks(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_HOOKS) } -func DeleteWebhook(ctx *middleware.Context) { +func DeleteWebhook(ctx *context.Context) { if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteWebhook: " + err.Error()) } else { diff --git a/routers/org/teams.go b/routers/org/teams.go index e4a6afcf45..e8ae8291b7 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -12,8 +12,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" ) const ( @@ -23,7 +23,7 @@ const ( TEAM_REPOSITORIES base.TplName = "org/team/repositories" ) -func Teams(ctx *middleware.Context) { +func Teams(ctx *context.Context) { org := ctx.Org.Organization ctx.Data["Title"] = org.FullName ctx.Data["PageIsOrgTeams"] = true @@ -39,7 +39,7 @@ func Teams(ctx *middleware.Context) { ctx.HTML(200, TEAMS) } -func TeamsAction(ctx *middleware.Context) { +func TeamsAction(ctx *context.Context) { uid := com.StrTo(ctx.Query("uid")).MustInt64() if uid == 0 { ctx.Redirect(ctx.Org.OrgLink + "/teams") @@ -107,7 +107,7 @@ func TeamsAction(ctx *middleware.Context) { } } -func TeamsRepoAction(ctx *middleware.Context) { +func TeamsRepoAction(ctx *context.Context) { if !ctx.Org.IsOwner { ctx.Error(404) return @@ -141,7 +141,7 @@ func TeamsRepoAction(ctx *middleware.Context) { ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories") } -func NewTeam(ctx *middleware.Context) { +func NewTeam(ctx *context.Context) { ctx.Data["Title"] = ctx.Org.Organization.FullName ctx.Data["PageIsOrgTeams"] = true ctx.Data["PageIsOrgTeamsNew"] = true @@ -149,7 +149,7 @@ func NewTeam(ctx *middleware.Context) { ctx.HTML(200, TEAM_NEW) } -func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) { +func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) { ctx.Data["Title"] = ctx.Org.Organization.FullName ctx.Data["PageIsOrgTeams"] = true ctx.Data["PageIsOrgTeamsNew"] = true @@ -195,7 +195,7 @@ func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) { ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName) } -func TeamMembers(ctx *middleware.Context) { +func TeamMembers(ctx *context.Context) { ctx.Data["Title"] = ctx.Org.Team.Name ctx.Data["PageIsOrgTeams"] = true if err := ctx.Org.Team.GetMembers(); err != nil { @@ -205,7 +205,7 @@ func TeamMembers(ctx *middleware.Context) { ctx.HTML(200, TEAM_MEMBERS) } -func TeamRepositories(ctx *middleware.Context) { +func TeamRepositories(ctx *context.Context) { ctx.Data["Title"] = ctx.Org.Team.Name ctx.Data["PageIsOrgTeams"] = true if err := ctx.Org.Team.GetRepositories(); err != nil { @@ -215,7 +215,7 @@ func TeamRepositories(ctx *middleware.Context) { ctx.HTML(200, TEAM_REPOSITORIES) } -func EditTeam(ctx *middleware.Context) { +func EditTeam(ctx *context.Context) { ctx.Data["Title"] = ctx.Org.Organization.FullName ctx.Data["PageIsOrgTeams"] = true ctx.Data["team_name"] = ctx.Org.Team.Name @@ -223,7 +223,7 @@ func EditTeam(ctx *middleware.Context) { ctx.HTML(200, TEAM_NEW) } -func EditTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) { +func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) { t := ctx.Org.Team ctx.Data["Title"] = ctx.Org.Organization.FullName ctx.Data["PageIsOrgTeams"] = true @@ -270,7 +270,7 @@ func EditTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) { ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName) } -func DeleteTeam(ctx *middleware.Context) { +func DeleteTeam(ctx *context.Context) { if err := models.DeleteTeam(ctx.Org.Team); err != nil { ctx.Flash.Error("DeleteTeam: " + err.Error()) } else { diff --git a/routers/repo/branch.go b/routers/repo/branch.go index c340b2bf6b..00f30b0f13 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -6,14 +6,14 @@ package repo import ( "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" ) const ( BRANCH base.TplName = "repo/branch" ) -func Branches(ctx *middleware.Context) { +func Branches(ctx *context.Context) { ctx.Data["Title"] = "Branches" ctx.Data["IsRepoToolbarBranches"] = true diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 781c3da946..97584c4d1a 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -14,7 +14,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" ) @@ -23,7 +23,7 @@ const ( DIFF base.TplName = "repo/diff" ) -func RefCommits(ctx *middleware.Context) { +func RefCommits(ctx *context.Context) { switch { case len(ctx.Repo.TreeName) == 0: Commits(ctx) @@ -43,7 +43,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List { return newCommits } -func Commits(ctx *middleware.Context) { +func Commits(ctx *context.Context) { ctx.Data["PageIsCommits"] = true commitsCount, err := ctx.Repo.Commit.CommitsCount() @@ -75,7 +75,7 @@ func Commits(ctx *middleware.Context) { ctx.HTML(200, COMMITS) } -func SearchCommits(ctx *middleware.Context) { +func SearchCommits(ctx *context.Context) { ctx.Data["PageIsCommits"] = true keyword := ctx.Query("q") @@ -101,7 +101,7 @@ func SearchCommits(ctx *middleware.Context) { ctx.HTML(200, COMMITS) } -func FileHistory(ctx *middleware.Context) { +func FileHistory(ctx *context.Context) { ctx.Data["IsRepoToolbarCommits"] = true fileName := ctx.Repo.TreeName @@ -143,7 +143,7 @@ func FileHistory(ctx *middleware.Context) { ctx.HTML(200, COMMITS) } -func Diff(ctx *middleware.Context) { +func Diff(ctx *context.Context) { ctx.Data["PageIsDiff"] = true userName := ctx.Repo.Owner.Name @@ -187,7 +187,7 @@ func Diff(ctx *middleware.Context) { ctx.HTML(200, DIFF) } -func CompareDiff(ctx *middleware.Context) { +func CompareDiff(ctx *context.Context) { ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["IsDiffCompare"] = true userName := ctx.Repo.Owner.Name diff --git a/routers/repo/download.go b/routers/repo/download.go index a10792b87f..3329073e0c 100644 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -11,10 +11,10 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" ) -func ServeData(ctx *middleware.Context, name string, reader io.Reader) error { +func ServeData(ctx *context.Context, name string, reader io.Reader) error { buf := make([]byte, 1024) n, _ := reader.Read(buf) if n > 0 { @@ -36,7 +36,7 @@ func ServeData(ctx *middleware.Context, name string, reader io.Reader) error { return err } -func ServeBlob(ctx *middleware.Context, blob *git.Blob) error { +func ServeBlob(ctx *context.Context, blob *git.Blob) error { dataRc, err := blob.Data() if err != nil { return err @@ -45,7 +45,7 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error { return ServeData(ctx, ctx.Repo.TreeName, dataRc) } -func SingleDownload(ctx *middleware.Context) { +func SingleDownload(ctx *context.Context) { blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName) if err != nil { if git.IsErrNotExist(err) { diff --git a/routers/repo/http.go b/routers/repo/http.go index f9600c94de..b273b2334e 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -23,18 +23,18 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) -func authRequired(ctx *middleware.Context) { +func authRequired(ctx *context.Context) { ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"") ctx.Data["ErrorMsg"] = "no basic auth and digit auth" ctx.Error(401) } -func HTTP(ctx *middleware.Context) { +func HTTP(ctx *context.Context) { username := ctx.Params(":username") reponame := strings.TrimSuffix(ctx.Params(":reponame"), ".git") @@ -293,7 +293,7 @@ func getGitDir(config *Config, fPath string) (string, error) { } // Request handling function -func HTTPBackend(ctx *middleware.Context, config *Config) http.HandlerFunc { +func HTTPBackend(ctx *context.Context, config *Config) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { for _, route := range routes { r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 3a1049e65d..d66123f912 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -20,10 +20,10 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -52,14 +52,14 @@ var ( } ) -func MustEnableIssues(ctx *middleware.Context) { +func MustEnableIssues(ctx *context.Context) { if !ctx.Repo.Repository.EnableIssues { ctx.Handle(404, "MustEnableIssues", nil) return } } -func MustAllowPulls(ctx *middleware.Context) { +func MustAllowPulls(ctx *context.Context) { if !ctx.Repo.Repository.AllowsPulls() { ctx.Handle(404, "MustAllowPulls", nil) return @@ -72,7 +72,7 @@ func MustAllowPulls(ctx *middleware.Context) { } } -func RetrieveLabels(ctx *middleware.Context) { +func RetrieveLabels(ctx *context.Context) { labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID) if err != nil { ctx.Handle(500, "RetrieveLabels.GetLabels: %v", err) @@ -85,7 +85,7 @@ func RetrieveLabels(ctx *middleware.Context) { ctx.Data["NumLabels"] = len(labels) } -func Issues(ctx *middleware.Context) { +func Issues(ctx *context.Context) { isPullList := ctx.Params(":type") == "pulls" if isPullList { MustAllowPulls(ctx) @@ -250,7 +250,7 @@ func Issues(ctx *middleware.Context) { ctx.HTML(200, ISSUES) } -func renderAttachmentSettings(ctx *middleware.Context) { +func renderAttachmentSettings(ctx *context.Context) { ctx.Data["RequireDropzone"] = true ctx.Data["IsAttachmentEnabled"] = setting.AttachmentEnabled ctx.Data["AttachmentAllowedTypes"] = setting.AttachmentAllowedTypes @@ -258,7 +258,7 @@ func renderAttachmentSettings(ctx *middleware.Context) { ctx.Data["AttachmentMaxFiles"] = setting.AttachmentMaxFiles } -func RetrieveRepoMilestonesAndAssignees(ctx *middleware.Context, repo *models.Repository) { +func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *models.Repository) { var err error ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false) if err != nil { @@ -278,7 +278,7 @@ func RetrieveRepoMilestonesAndAssignees(ctx *middleware.Context, repo *models.Re } } -func RetrieveRepoMetas(ctx *middleware.Context, repo *models.Repository) []*models.Label { +func RetrieveRepoMetas(ctx *context.Context, repo *models.Repository) []*models.Label { if !ctx.Repo.IsWriter() { return nil } @@ -298,7 +298,7 @@ func RetrieveRepoMetas(ctx *middleware.Context, repo *models.Repository) []*mode return labels } -func getFileContentFromDefaultBranch(ctx *middleware.Context, filename string) (string, bool) { +func getFileContentFromDefaultBranch(ctx *context.Context, filename string) (string, bool) { var r io.Reader var bytes []byte @@ -325,7 +325,7 @@ func getFileContentFromDefaultBranch(ctx *middleware.Context, filename string) ( return string(bytes), true } -func setTemplateIfExists(ctx *middleware.Context, ctxDataKey string, possibleFiles []string) { +func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles []string) { for _, filename := range possibleFiles { content, found := getFileContentFromDefaultBranch(ctx, filename) if found { @@ -335,7 +335,7 @@ func setTemplateIfExists(ctx *middleware.Context, ctxDataKey string, possibleFil } } -func NewIssue(ctx *middleware.Context) { +func NewIssue(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true setTemplateIfExists(ctx, ISSUE_TEMPLATE_KEY, IssueTemplateCandidates) @@ -351,7 +351,7 @@ func NewIssue(ctx *middleware.Context) { ctx.HTML(200, ISSUE_NEW) } -func ValidateRepoMetas(ctx *middleware.Context, form auth.CreateIssueForm) ([]int64, int64, int64) { +func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm) ([]int64, int64, int64) { var ( repo = ctx.Repo.Repository err error @@ -405,7 +405,7 @@ func ValidateRepoMetas(ctx *middleware.Context, form auth.CreateIssueForm) ([]in return labelIDs, milestoneID, assigneeID } -func notifyWatchersAndMentions(ctx *middleware.Context, issue *models.Issue) { +func notifyWatchersAndMentions(ctx *context.Context, issue *models.Issue) { // Update mentions mentions := markdown.MentionPattern.FindAllString(issue.Content, -1) if len(mentions) > 0 { @@ -446,7 +446,7 @@ func notifyWatchersAndMentions(ctx *middleware.Context, issue *models.Issue) { } } -func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) { +func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true renderAttachmentSettings(ctx) @@ -494,7 +494,7 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) { ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + com.ToStr(issue.Index)) } -func UploadIssueAttachment(ctx *middleware.Context) { +func UploadIssueAttachment(ctx *context.Context) { if !setting.AttachmentEnabled { ctx.Error(404, "attachment is not enabled") return @@ -541,7 +541,7 @@ func UploadIssueAttachment(ctx *middleware.Context) { }) } -func ViewIssue(ctx *middleware.Context) { +func ViewIssue(ctx *context.Context) { ctx.Data["RequireDropzone"] = true renderAttachmentSettings(ctx) @@ -706,7 +706,7 @@ func ViewIssue(ctx *middleware.Context) { ctx.HTML(200, ISSUE_VIEW) } -func getActionIssue(ctx *middleware.Context) *models.Issue { +func getActionIssue(ctx *context.Context) *models.Issue { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if models.IsErrIssueNotExist(err) { @@ -719,7 +719,7 @@ func getActionIssue(ctx *middleware.Context) *models.Issue { return issue } -func UpdateIssueTitle(ctx *middleware.Context) { +func UpdateIssueTitle(ctx *context.Context) { issue := getActionIssue(ctx) if ctx.Written() { return @@ -746,7 +746,7 @@ func UpdateIssueTitle(ctx *middleware.Context) { }) } -func UpdateIssueContent(ctx *middleware.Context) { +func UpdateIssueContent(ctx *context.Context) { issue := getActionIssue(ctx) if ctx.Written() { return @@ -768,7 +768,7 @@ func UpdateIssueContent(ctx *middleware.Context) { }) } -func UpdateIssueLabel(ctx *middleware.Context) { +func UpdateIssueLabel(ctx *context.Context) { issue := getActionIssue(ctx) if ctx.Written() { return @@ -809,7 +809,7 @@ func UpdateIssueLabel(ctx *middleware.Context) { }) } -func UpdateIssueMilestone(ctx *middleware.Context) { +func UpdateIssueMilestone(ctx *context.Context) { issue := getActionIssue(ctx) if ctx.Written() { return @@ -836,7 +836,7 @@ func UpdateIssueMilestone(ctx *middleware.Context) { }) } -func UpdateIssueAssignee(ctx *middleware.Context) { +func UpdateIssueAssignee(ctx *context.Context) { issue := getActionIssue(ctx) if ctx.Written() { return @@ -862,7 +862,7 @@ func UpdateIssueAssignee(ctx *middleware.Context) { }) } -func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) { +func NewComment(ctx *context.Context, form auth.CreateCommentForm) { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if models.IsErrIssueNotExist(err) { @@ -968,7 +968,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) { log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID) } -func UpdateCommentContent(ctx *middleware.Context) { +func UpdateCommentContent(ctx *context.Context) { comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrCommentNotExist(err) { @@ -1004,7 +1004,7 @@ func UpdateCommentContent(ctx *middleware.Context) { }) } -func Labels(ctx *middleware.Context) { +func Labels(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.labels") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsLabels"] = true @@ -1012,7 +1012,7 @@ func Labels(ctx *middleware.Context) { ctx.HTML(200, LABELS) } -func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) { +func NewLabel(ctx *context.Context, form auth.CreateLabelForm) { ctx.Data["Title"] = ctx.Tr("repo.labels") ctx.Data["PageIsLabels"] = true @@ -1034,7 +1034,7 @@ func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) { ctx.Redirect(ctx.Repo.RepoLink + "/labels") } -func UpdateLabel(ctx *middleware.Context, form auth.CreateLabelForm) { +func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) { l, err := models.GetLabelByID(form.ID) if err != nil { switch { @@ -1056,7 +1056,7 @@ func UpdateLabel(ctx *middleware.Context, form auth.CreateLabelForm) { ctx.Redirect(ctx.Repo.RepoLink + "/labels") } -func DeleteLabel(ctx *middleware.Context) { +func DeleteLabel(ctx *context.Context) { if err := models.DeleteLabel(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteLabel: " + err.Error()) } else { @@ -1069,7 +1069,7 @@ func DeleteLabel(ctx *middleware.Context) { return } -func Milestones(ctx *middleware.Context) { +func Milestones(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.milestones") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true @@ -1113,7 +1113,7 @@ func Milestones(ctx *middleware.Context) { ctx.HTML(200, MILESTONE) } -func NewMilestone(ctx *middleware.Context) { +func NewMilestone(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.milestones.new") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true @@ -1122,7 +1122,7 @@ func NewMilestone(ctx *middleware.Context) { ctx.HTML(200, MILESTONE_NEW) } -func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { +func NewMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) { ctx.Data["Title"] = ctx.Tr("repo.milestones.new") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true @@ -1158,7 +1158,7 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { ctx.Redirect(ctx.Repo.RepoLink + "/milestones") } -func EditMilestone(ctx *middleware.Context) { +func EditMilestone(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.milestones.edit") ctx.Data["PageIsMilestones"] = true ctx.Data["PageIsEditMilestone"] = true @@ -1182,7 +1182,7 @@ func EditMilestone(ctx *middleware.Context) { ctx.HTML(200, MILESTONE_NEW) } -func EditMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { +func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) { ctx.Data["Title"] = ctx.Tr("repo.milestones.edit") ctx.Data["PageIsMilestones"] = true ctx.Data["PageIsEditMilestone"] = true @@ -1225,7 +1225,7 @@ func EditMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { ctx.Redirect(ctx.Repo.RepoLink + "/milestones") } -func ChangeMilestonStatus(ctx *middleware.Context) { +func ChangeMilestonStatus(ctx *context.Context) { m, err := models.GetMilestoneByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrMilestoneNotExist(err) { @@ -1259,7 +1259,7 @@ func ChangeMilestonStatus(ctx *middleware.Context) { } } -func DeleteMilestone(ctx *middleware.Context) { +func DeleteMilestone(ctx *context.Context) { if err := models.DeleteMilestoneByID(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteMilestoneByID: " + err.Error()) } else { diff --git a/routers/repo/pull.go b/routers/repo/pull.go index fd4f6f69c5..c2147bbaf5 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -16,8 +16,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -38,7 +38,7 @@ var ( } ) -func getForkRepository(ctx *middleware.Context) *models.Repository { +func getForkRepository(ctx *context.Context) *models.Repository { forkRepo, err := models.GetRepositoryByID(ctx.ParamsInt64(":repoid")) if err != nil { if models.IsErrRepoNotExist(err) { @@ -73,7 +73,7 @@ func getForkRepository(ctx *middleware.Context) *models.Repository { return forkRepo } -func Fork(ctx *middleware.Context) { +func Fork(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("new_fork") getForkRepository(ctx) @@ -85,7 +85,7 @@ func Fork(ctx *middleware.Context) { ctx.HTML(200, FORK) } -func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) { +func ForkPost(ctx *context.Context, form auth.CreateRepoForm) { ctx.Data["Title"] = ctx.Tr("new_fork") forkRepo := getForkRepository(ctx) @@ -138,7 +138,7 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name) } -func checkPullInfo(ctx *middleware.Context) *models.Issue { +func checkPullInfo(ctx *context.Context) *models.Issue { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if models.IsErrIssueNotExist(err) { @@ -178,7 +178,7 @@ func checkPullInfo(ctx *middleware.Context) *models.Issue { return issue } -func PrepareMergedViewPullInfo(ctx *middleware.Context, pull *models.Issue) { +func PrepareMergedViewPullInfo(ctx *context.Context, pull *models.Issue) { ctx.Data["HasMerged"] = true var err error @@ -203,7 +203,7 @@ func PrepareMergedViewPullInfo(ctx *middleware.Context, pull *models.Issue) { } } -func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullRequestInfo { +func PrepareViewPullInfo(ctx *context.Context, pull *models.Issue) *git.PullRequestInfo { repo := ctx.Repo.Repository ctx.Data["HeadTarget"] = pull.HeadUserName + "/" + pull.HeadBranch @@ -246,7 +246,7 @@ func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullR return prInfo } -func ViewPullCommits(ctx *middleware.Context) { +func ViewPullCommits(ctx *context.Context) { ctx.Data["PageIsPullCommits"] = true pull := checkPullInfo(ctx) @@ -296,7 +296,7 @@ func ViewPullCommits(ctx *middleware.Context) { ctx.HTML(200, PULL_COMMITS) } -func ViewPullFiles(ctx *middleware.Context) { +func ViewPullFiles(ctx *context.Context) { ctx.Data["PageIsPullFiles"] = true pull := checkPullInfo(ctx) @@ -377,7 +377,7 @@ func ViewPullFiles(ctx *middleware.Context) { ctx.HTML(200, PULL_FILES) } -func MergePullRequest(ctx *middleware.Context) { +func MergePullRequest(ctx *context.Context) { issue := checkPullInfo(ctx) if ctx.Written() { return @@ -413,7 +413,7 @@ func MergePullRequest(ctx *middleware.Context) { ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index)) } -func ParseCompareInfo(ctx *middleware.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) { +func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) { baseRepo := ctx.Repo.Repository // Get compared branches information @@ -520,7 +520,7 @@ func ParseCompareInfo(ctx *middleware.Context) (*models.User, *models.Repository } func PrepareCompareDiff( - ctx *middleware.Context, + ctx *context.Context, headUser *models.User, headRepo *models.Repository, headGitRepo *git.Repository, @@ -576,7 +576,7 @@ func PrepareCompareDiff( return false } -func CompareAndPullRequest(ctx *middleware.Context) { +func CompareAndPullRequest(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes") ctx.Data["PageIsComparePull"] = true ctx.Data["IsDiffCompare"] = true @@ -618,7 +618,7 @@ func CompareAndPullRequest(ctx *middleware.Context) { ctx.HTML(200, COMPARE_PULL) } -func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueForm) { +func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm) { ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes") ctx.Data["PageIsComparePull"] = true ctx.Data["IsDiffCompare"] = true @@ -693,7 +693,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index)) } -func TriggerTask(ctx *middleware.Context) { +func TriggerTask(ctx *context.Context) { branch := ctx.Query("branch") secret := ctx.Query("secret") if len(branch) == 0 || len(secret) == 0 { diff --git a/routers/repo/release.go b/routers/repo/release.go index 4073fde82e..8985cdb8f5 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -10,9 +10,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" ) const ( @@ -21,7 +21,7 @@ const ( ) // calReleaseNumCommitsBehind calculates given release has how many commits behind default branch. -func calReleaseNumCommitsBehind(repoCtx *middleware.RepoContext, release *models.Release, countCache map[string]int64) error { +func calReleaseNumCommitsBehind(repoCtx *context.Repository, release *models.Release, countCache map[string]int64) error { // Fast return if release target is same as default branch. if repoCtx.BranchName == release.Target { release.NumCommitsBehind = repoCtx.CommitsCount - release.NumCommits @@ -43,7 +43,7 @@ func calReleaseNumCommitsBehind(repoCtx *middleware.RepoContext, release *models return nil } -func Releases(ctx *middleware.Context) { +func Releases(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.releases") ctx.Data["PageIsReleaseList"] = true @@ -141,14 +141,14 @@ func Releases(ctx *middleware.Context) { ctx.HTML(200, RELEASES) } -func NewRelease(ctx *middleware.Context) { +func NewRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.new_release") ctx.Data["PageIsReleaseList"] = true ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch ctx.HTML(200, RELEASE_NEW) } -func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { +func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) { ctx.Data["Title"] = ctx.Tr("repo.release.new_release") ctx.Data["PageIsReleaseList"] = true @@ -201,7 +201,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { ctx.Redirect(ctx.Repo.RepoLink + "/releases") } -func EditRelease(ctx *middleware.Context) { +func EditRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") ctx.Data["PageIsReleaseList"] = true ctx.Data["PageIsEditRelease"] = true @@ -226,7 +226,7 @@ func EditRelease(ctx *middleware.Context) { ctx.HTML(200, RELEASE_NEW) } -func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) { +func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) { ctx.Data["Title"] = ctx.Tr("repo.release.edit_release") ctx.Data["PageIsReleaseList"] = true ctx.Data["PageIsEditRelease"] = true @@ -263,7 +263,7 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) { ctx.Redirect(ctx.Repo.RepoLink + "/releases") } -func DeleteRelease(ctx *middleware.Context) { +func DeleteRelease(ctx *context.Context) { if err := models.DeleteReleaseByID(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteReleaseByID: " + err.Error()) } else { diff --git a/routers/repo/repo.go b/routers/repo/repo.go index eb944acebc..f9835bd2f9 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -17,8 +17,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -27,13 +27,13 @@ const ( MIGRATE base.TplName = "repo/migrate" ) -func MustBeNotBare(ctx *middleware.Context) { +func MustBeNotBare(ctx *context.Context) { if ctx.Repo.Repository.IsBare { ctx.Handle(404, "MustBeNotBare", nil) } } -func checkContextUser(ctx *middleware.Context, uid int64) *models.User { +func checkContextUser(ctx *context.Context, uid int64) *models.User { orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated_unix") if err != nil { ctx.Handle(500, "GetOwnedOrgsByUserIDDesc", err) @@ -64,7 +64,7 @@ func checkContextUser(ctx *middleware.Context, uid int64) *models.User { return org } -func Create(ctx *middleware.Context) { +func Create(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("new_repo") // Give default value for template to render. @@ -84,7 +84,7 @@ func Create(ctx *middleware.Context) { ctx.HTML(200, CREATE) } -func handleCreateError(ctx *middleware.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) { +func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) { switch { case models.IsErrReachLimitOfRepo(err): ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.RepoCreationNum()), tpl, form) @@ -102,7 +102,7 @@ func handleCreateError(ctx *middleware.Context, owner *models.User, err error, n } } -func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { +func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { ctx.Data["Title"] = ctx.Tr("new_repo") ctx.Data["Gitignores"] = models.Gitignores @@ -144,7 +144,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { handleCreateError(ctx, ctxUser, err, "CreatePost", CREATE, &form) } -func Migrate(ctx *middleware.Context) { +func Migrate(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("new_migrate") ctx.Data["private"] = ctx.User.LastRepoVisibility ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate @@ -159,7 +159,7 @@ func Migrate(ctx *middleware.Context) { ctx.HTML(200, MIGRATE) } -func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { +func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) { ctx.Data["Title"] = ctx.Tr("new_migrate") ctxUser := checkContextUser(ctx, form.Uid) @@ -227,7 +227,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { handleCreateError(ctx, ctxUser, err, "MigratePost", MIGRATE, &form) } -func Action(ctx *middleware.Context) { +func Action(ctx *context.Context) { var err error switch ctx.Params(":action") { case "watch": @@ -261,7 +261,7 @@ func Action(ctx *middleware.Context) { ctx.Redirect(redirectTo) } -func Download(ctx *middleware.Context) { +func Download(ctx *context.Context) { var ( uri = ctx.Params("*") refName string diff --git a/routers/repo/setting.go b/routers/repo/setting.go index cf6f6a11c7..6785722422 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -13,9 +13,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -27,13 +27,13 @@ const ( DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys" ) -func Settings(ctx *middleware.Context) { +func Settings(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true ctx.HTML(200, SETTINGS_OPTIONS) } -func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { +func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsOptions"] = true @@ -271,7 +271,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { } } -func Collaboration(ctx *middleware.Context) { +func Collaboration(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsCollaboration"] = true @@ -285,7 +285,7 @@ func Collaboration(ctx *middleware.Context) { ctx.HTML(200, COLLABORATION) } -func CollaborationPost(ctx *middleware.Context) { +func CollaborationPost(ctx *context.Context) { name := strings.ToLower(ctx.Query("collaborator")) if len(name) == 0 || ctx.Repo.Owner.LowerName == name { ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) @@ -333,7 +333,7 @@ func CollaborationPost(ctx *middleware.Context) { ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path) } -func ChangeCollaborationAccessMode(ctx *middleware.Context) { +func ChangeCollaborationAccessMode(ctx *context.Context) { if err := ctx.Repo.Repository.ChangeCollaborationAccessMode( ctx.QueryInt64("uid"), models.AccessMode(ctx.QueryInt("mode"))); err != nil { @@ -341,7 +341,7 @@ func ChangeCollaborationAccessMode(ctx *middleware.Context) { } } -func DeleteCollaboration(ctx *middleware.Context) { +func DeleteCollaboration(ctx *context.Context) { if err := ctx.Repo.Repository.DeleteCollaboration(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteCollaboration: " + err.Error()) } else { @@ -353,7 +353,7 @@ func DeleteCollaboration(ctx *middleware.Context) { }) } -func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repository) { +func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository) { owner, err := models.GetUserByName(ctx.Params(":username")) if err != nil { if models.IsErrUserNotExist(err) { @@ -377,7 +377,7 @@ func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repositor return owner, repo } -func GitHooks(ctx *middleware.Context) { +func GitHooks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.githooks") ctx.Data["PageIsSettingsGitHooks"] = true @@ -391,7 +391,7 @@ func GitHooks(ctx *middleware.Context) { ctx.HTML(200, GITHOOKS) } -func GitHooksEdit(ctx *middleware.Context) { +func GitHooksEdit(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.githooks") ctx.Data["PageIsSettingsGitHooks"] = true @@ -409,7 +409,7 @@ func GitHooksEdit(ctx *middleware.Context) { ctx.HTML(200, GITHOOK_EDIT) } -func GitHooksEditPost(ctx *middleware.Context) { +func GitHooksEditPost(ctx *context.Context) { name := ctx.Params(":name") hook, err := ctx.Repo.GitRepo.GetHook(name) if err != nil { @@ -428,7 +428,7 @@ func GitHooksEditPost(ctx *middleware.Context) { ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks/git") } -func DeployKeys(ctx *middleware.Context) { +func DeployKeys(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") ctx.Data["PageIsSettingsKeys"] = true @@ -442,7 +442,7 @@ func DeployKeys(ctx *middleware.Context) { ctx.HTML(200, DEPLOY_KEYS) } -func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { +func DeployKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) { ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") ctx.Data["PageIsSettingsKeys"] = true @@ -492,7 +492,7 @@ func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys") } -func DeleteDeployKey(ctx *middleware.Context) { +func DeleteDeployKey(ctx *context.Context) { if err := models.DeleteDeployKey(ctx.User, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteDeployKey: " + err.Error()) } else { diff --git a/routers/repo/view.go b/routers/repo/view.go index efff31a9a0..f4242cd52d 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -16,9 +16,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/template" "github.com/gogits/gogs/modules/template/highlight" ) @@ -29,7 +29,7 @@ const ( FORKS base.TplName = "repo/forks" ) -func Home(ctx *middleware.Context) { +func Home(ctx *context.Context) { ctx.Data["Title"] = ctx.Repo.Repository.Name ctx.Data["PageIsViewCode"] = true ctx.Data["RequireHighlightJS"] = true @@ -219,7 +219,7 @@ func Home(ctx *middleware.Context) { ctx.HTML(200, HOME) } -func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) { +func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) { page := ctx.QueryInt("page") if page <= 0 { page = 1 @@ -237,21 +237,21 @@ func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) ( ctx.HTML(200, tpl) } -func Watchers(ctx *middleware.Context) { +func Watchers(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.watchers") ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers") ctx.Data["PageIsWatchers"] = true RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS) } -func Stars(ctx *middleware.Context) { +func Stars(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.stargazers") ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers") ctx.Data["PageIsStargazers"] = true RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS) } -func Forks(ctx *middleware.Context) { +func Forks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repos.forks") forks, err := ctx.Repo.Repository.GetForks() diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index 6d271a4fe0..16aa3821a8 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -18,7 +18,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" ) @@ -28,7 +28,7 @@ const ( ORG_HOOK_NEW base.TplName = "org/settings/hook_new" ) -func Webhooks(ctx *middleware.Context) { +func Webhooks(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.hooks") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["BaseLink"] = ctx.Repo.RepoLink @@ -52,7 +52,7 @@ type OrgRepoCtx struct { } // getOrgRepoCtx determines whether this is a repo context or organization context. -func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) { +func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) { if len(ctx.Repo.RepoLink) > 0 { return &OrgRepoCtx{ RepoID: ctx.Repo.Repository.ID, @@ -72,7 +72,7 @@ func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) { return nil, errors.New("Unable to set OrgRepo context") } -func checkHookType(ctx *middleware.Context) string { +func checkHookType(ctx *context.Context) string { hookType := strings.ToLower(ctx.Params(":type")) if !com.IsSliceContainsStr(setting.Webhook.Types, hookType) { ctx.Handle(404, "checkHookType", nil) @@ -81,7 +81,7 @@ func checkHookType(ctx *middleware.Context) string { return hookType } -func WebhooksNew(ctx *middleware.Context) { +func WebhooksNew(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true @@ -114,7 +114,7 @@ func ParseHookEvent(form auth.WebhookForm) *models.HookEvent { } } -func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) { +func WebHooksNewPost(ctx *context.Context, form auth.NewWebhookForm) { ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true @@ -160,7 +160,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) { ctx.Redirect(orCtx.Link + "/settings/hooks") } -func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) { +func SlackHooksNewPost(ctx *context.Context, form auth.NewSlackHookForm) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksNew"] = true @@ -210,7 +210,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) { ctx.Redirect(orCtx.Link + "/settings/hooks") } -func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) { +func checkWebhook(ctx *context.Context) (*OrgRepoCtx, *models.Webhook) { ctx.Data["RequireHighlightJS"] = true orCtx, err := getOrgRepoCtx(ctx) @@ -245,7 +245,7 @@ func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) { return orCtx, w } -func WebHooksEdit(ctx *middleware.Context) { +func WebHooksEdit(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksEdit"] = true @@ -259,7 +259,7 @@ func WebHooksEdit(ctx *middleware.Context) { ctx.HTML(200, orCtx.NewTemplate) } -func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) { +func WebHooksEditPost(ctx *context.Context, form auth.NewWebhookForm) { ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksEdit"] = true @@ -297,7 +297,7 @@ func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) { ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID)) } -func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) { +func SlackHooksEditPost(ctx *context.Context, form auth.NewSlackHookForm) { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsHooks"] = true ctx.Data["PageIsSettingsHooksEdit"] = true @@ -340,7 +340,7 @@ func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) { ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID)) } -func TestWebhook(ctx *middleware.Context) { +func TestWebhook(ctx *context.Context) { p := &api.PushPayload{ Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch, Before: ctx.Repo.CommitID, @@ -378,7 +378,7 @@ func TestWebhook(ctx *middleware.Context) { } } -func DeleteWebhook(ctx *middleware.Context) { +func DeleteWebhook(ctx *context.Context) { if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteWebhook: " + err.Error()) } else { diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index 4975080d20..e0b3e692c1 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -14,8 +14,8 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/markdown" - "github.com/gogits/gogs/modules/middleware" ) const ( @@ -25,7 +25,7 @@ const ( WIKI_PAGES base.TplName = "repo/wiki/pages" ) -func MustEnableWiki(ctx *middleware.Context) { +func MustEnableWiki(ctx *context.Context) { if !ctx.Repo.Repository.EnableWiki { ctx.Handle(404, "MustEnableWiki", nil) return @@ -43,7 +43,7 @@ type PageMeta struct { Updated time.Time } -func renderWikiPage(ctx *middleware.Context, isViewPage bool) (*git.Repository, string) { +func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, string) { wikiRepo, err := git.OpenRepository(ctx.Repo.Repository.WikiPath()) if err != nil { ctx.Handle(500, "OpenRepository", err) @@ -115,7 +115,7 @@ func renderWikiPage(ctx *middleware.Context, isViewPage bool) (*git.Repository, return wikiRepo, pageName } -func Wiki(ctx *middleware.Context) { +func Wiki(ctx *context.Context) { ctx.Data["PageIsWiki"] = true if !ctx.Repo.Repository.HasWiki() { @@ -140,7 +140,7 @@ func Wiki(ctx *middleware.Context) { ctx.HTML(200, WIKI_VIEW) } -func WikiPages(ctx *middleware.Context) { +func WikiPages(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.wiki.pages") ctx.Data["PageIsWiki"] = true @@ -186,7 +186,7 @@ func WikiPages(ctx *middleware.Context) { ctx.HTML(200, WIKI_PAGES) } -func NewWiki(ctx *middleware.Context) { +func NewWiki(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true ctx.Data["RequireSimpleMDE"] = true @@ -198,7 +198,7 @@ func NewWiki(ctx *middleware.Context) { ctx.HTML(200, WIKI_NEW) } -func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { +func NewWikiPost(ctx *context.Context, form auth.NewWikiForm) { ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true ctx.Data["RequireSimpleMDE"] = true @@ -221,7 +221,7 @@ func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title)) } -func EditWiki(ctx *middleware.Context) { +func EditWiki(ctx *context.Context) { ctx.Data["PageIsWiki"] = true ctx.Data["PageIsWikiEdit"] = true ctx.Data["RequireSimpleMDE"] = true @@ -239,7 +239,7 @@ func EditWiki(ctx *middleware.Context) { ctx.HTML(200, WIKI_NEW) } -func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { +func EditWikiPost(ctx *context.Context, form auth.NewWikiForm) { ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page") ctx.Data["PageIsWiki"] = true ctx.Data["RequireSimpleMDE"] = true @@ -257,7 +257,7 @@ func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) { ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title)) } -func DeleteWikiPagePost(ctx *middleware.Context) { +func DeleteWikiPagePost(ctx *context.Context) { pageURL := ctx.Params(":page") if len(pageURL) == 0 { pageURL = "Home" diff --git a/routers/user/auth.go b/routers/user/auth.go index 3f37b09059..3af87c5844 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -5,6 +5,7 @@ package user import ( + "fmt" "net/url" "github.com/go-macaron/captcha" @@ -12,9 +13,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -26,11 +27,50 @@ const ( RESET_PASSWORD base.TplName = "user/auth/reset_passwd" ) -func SignIn(ctx *middleware.Context) { +// AutoSignIn reads cookie and try to auto-login. +func AutoSignIn(ctx *context.Context) (bool, error) { + if !models.HasEngine { + return false, nil + } + + uname := ctx.GetCookie(setting.CookieUserName) + if len(uname) == 0 { + return false, nil + } + + isSucceed := false + defer func() { + if !isSucceed { + log.Trace("auto-login cookie cleared: %s", uname) + ctx.SetCookie(setting.CookieUserName, "", -1, setting.AppSubUrl) + ctx.SetCookie(setting.CookieRememberName, "", -1, setting.AppSubUrl) + } + }() + + u, err := models.GetUserByName(uname) + if err != nil { + if !models.IsErrUserNotExist(err) { + return false, fmt.Errorf("GetUserByName: %v", err) + } + return false, nil + } + + if val, _ := ctx.GetSuperSecureCookie( + base.EncodeMD5(u.Rands+u.Passwd), setting.CookieRememberName); val != u.Name { + return false, nil + } + + isSucceed = true + ctx.Session.Set("uid", u.Id) + ctx.Session.Set("uname", u.Name) + return true, nil +} + +func SignIn(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("sign_in") // Check auto-login. - isSucceed, err := middleware.AutoSignIn(ctx) + isSucceed, err := AutoSignIn(ctx) if err != nil { ctx.Handle(500, "AutoSignIn", err) return @@ -49,7 +89,7 @@ func SignIn(ctx *middleware.Context) { ctx.HTML(200, SIGNIN) } -func SignInPost(ctx *middleware.Context, form auth.SignInForm) { +func SignInPost(ctx *context.Context, form auth.SignInForm) { ctx.Data["Title"] = ctx.Tr("sign_in") if ctx.HasError() { @@ -85,7 +125,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) { ctx.Redirect(setting.AppSubUrl + "/") } -func SignOut(ctx *middleware.Context) { +func SignOut(ctx *context.Context) { ctx.Session.Delete("uid") ctx.Session.Delete("uname") ctx.Session.Delete("socialId") @@ -96,7 +136,7 @@ func SignOut(ctx *middleware.Context) { ctx.Redirect(setting.AppSubUrl + "/") } -func SignUp(ctx *middleware.Context) { +func SignUp(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("sign_up") ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha @@ -110,7 +150,7 @@ func SignUp(ctx *middleware.Context) { ctx.HTML(200, SIGNUP) } -func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.RegisterForm) { +func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterForm) { ctx.Data["Title"] = ctx.Tr("sign_up") ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha @@ -191,7 +231,7 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe ctx.Redirect(setting.AppSubUrl + "/user/login") } -func Activate(ctx *middleware.Context) { +func Activate(ctx *context.Context) { code := ctx.Query("code") if len(code) == 0 { ctx.Data["IsActivatePage"] = true @@ -243,7 +283,7 @@ func Activate(ctx *middleware.Context) { ctx.HTML(200, ACTIVATE) } -func ActivateEmail(ctx *middleware.Context) { +func ActivateEmail(ctx *context.Context) { code := ctx.Query("code") email_string := ctx.Query("email") @@ -261,7 +301,7 @@ func ActivateEmail(ctx *middleware.Context) { return } -func ForgotPasswd(ctx *middleware.Context) { +func ForgotPasswd(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.forgot_password") if setting.MailService == nil { @@ -274,7 +314,7 @@ func ForgotPasswd(ctx *middleware.Context) { ctx.HTML(200, FORGOT_PASSWORD) } -func ForgotPasswdPost(ctx *middleware.Context) { +func ForgotPasswdPost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.forgot_password") if setting.MailService == nil { @@ -313,7 +353,7 @@ func ForgotPasswdPost(ctx *middleware.Context) { ctx.HTML(200, FORGOT_PASSWORD) } -func ResetPasswd(ctx *middleware.Context) { +func ResetPasswd(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.reset_password") code := ctx.Query("code") @@ -326,7 +366,7 @@ func ResetPasswd(ctx *middleware.Context) { ctx.HTML(200, RESET_PASSWORD) } -func ResetPasswdPost(ctx *middleware.Context) { +func ResetPasswdPost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("auth.reset_password") code := ctx.Query("code") diff --git a/routers/user/home.go b/routers/user/home.go index e021a6142b..2a7f219e49 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -13,7 +13,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" ) @@ -24,7 +24,7 @@ const ( ORG_HOME base.TplName = "org/home" ) -func getDashboardContextUser(ctx *middleware.Context) *models.User { +func getDashboardContextUser(ctx *context.Context) *models.User { ctxUser := ctx.User orgName := ctx.Params(":org") if len(orgName) > 0 { @@ -51,7 +51,7 @@ func getDashboardContextUser(ctx *middleware.Context) *models.User { return ctxUser } -func retrieveFeeds(ctx *middleware.Context, ctxUserID, userID, offset int64, isProfile bool) { +func retrieveFeeds(ctx *context.Context, ctxUserID, userID, offset int64, isProfile bool) { actions, err := models.GetFeeds(ctxUserID, userID, offset, isProfile) if err != nil { ctx.Handle(500, "GetFeeds", err) @@ -82,7 +82,7 @@ func retrieveFeeds(ctx *middleware.Context, ctxUserID, userID, offset int64, isP ctx.Data["Feeds"] = feeds } -func Dashboard(ctx *middleware.Context) { +func Dashboard(ctx *context.Context) { ctxUser := getDashboardContextUser(ctx) ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard") ctx.Data["PageIsDashboard"] = true @@ -147,7 +147,7 @@ func Dashboard(ctx *middleware.Context) { ctx.HTML(200, DASHBOARD) } -func Issues(ctx *middleware.Context) { +func Issues(ctx *context.Context) { isPullList := ctx.Params(":type") == "pulls" if isPullList { ctx.Data["Title"] = ctx.Tr("pull_requests") @@ -306,7 +306,7 @@ func Issues(ctx *middleware.Context) { ctx.HTML(200, ISSUES) } -func ShowSSHKeys(ctx *middleware.Context, uid int64) { +func ShowSSHKeys(ctx *context.Context, uid int64) { keys, err := models.ListPublicKeys(uid) if err != nil { ctx.Handle(500, "ListPublicKeys", err) @@ -321,9 +321,9 @@ func ShowSSHKeys(ctx *middleware.Context, uid int64) { ctx.PlainText(200, buf.Bytes()) } -func showOrgProfile(ctx *middleware.Context) { +func showOrgProfile(ctx *context.Context) { ctx.SetParams(":org", ctx.Params(":username")) - middleware.HandleOrgAssignment(ctx) + context.HandleOrgAssignment(ctx) if ctx.Written() { return } @@ -366,7 +366,7 @@ func showOrgProfile(ctx *middleware.Context) { ctx.HTML(200, ORG_HOME) } -func Email2User(ctx *middleware.Context) { +func Email2User(ctx *context.Context) { u, err := models.GetUserByEmail(ctx.Query("email")) if err != nil { if models.IsErrUserNotExist(err) { diff --git a/routers/user/profile.go b/routers/user/profile.go index d0f41262d1..847cffdd4e 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -11,7 +11,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" - "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/repo" ) @@ -21,7 +21,7 @@ const ( STARS base.TplName = "user/meta/stars" ) -func GetUserByName(ctx *middleware.Context, name string) *models.User { +func GetUserByName(ctx *context.Context, name string) *models.User { user, err := models.GetUserByName(name) if err != nil { if models.IsErrUserNotExist(err) { @@ -35,11 +35,11 @@ func GetUserByName(ctx *middleware.Context, name string) *models.User { } // GetUserByParams returns user whose name is presented in URL paramenter. -func GetUserByParams(ctx *middleware.Context) *models.User { +func GetUserByParams(ctx *context.Context) *models.User { return GetUserByName(ctx, ctx.Params(":username")) } -func Profile(ctx *middleware.Context) { +func Profile(ctx *context.Context) { uname := ctx.Params(":username") // Special handle for FireFox requests favicon.ico. if uname == "favicon.ico" { @@ -103,7 +103,7 @@ func Profile(ctx *middleware.Context) { ctx.HTML(200, PROFILE) } -func Followers(ctx *middleware.Context) { +func Followers(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return @@ -115,7 +115,7 @@ func Followers(ctx *middleware.Context) { repo.RenderUserCards(ctx, u.NumFollowers, u.GetFollowers, FOLLOWERS) } -func Following(ctx *middleware.Context) { +func Following(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return @@ -127,11 +127,11 @@ func Following(ctx *middleware.Context) { repo.RenderUserCards(ctx, u.NumFollowing, u.GetFollowing, FOLLOWERS) } -func Stars(ctx *middleware.Context) { +func Stars(ctx *context.Context) { } -func Action(ctx *middleware.Context) { +func Action(ctx *context.Context) { u := GetUserByParams(ctx) if ctx.Written() { return diff --git a/routers/user/setting.go b/routers/user/setting.go index c704b67ce0..4b62bb11cc 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -15,9 +15,9 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/mailer" - "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -33,13 +33,13 @@ const ( SECURITY base.TplName = "user/security" ) -func Settings(ctx *middleware.Context) { +func Settings(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsProfile"] = true ctx.HTML(200, SETTINGS_PROFILE) } -func handleUsernameChange(ctx *middleware.Context, newName string) { +func handleUsernameChange(ctx *context.Context, newName string) { // Non-local users are not allowed to change their username. if len(newName) == 0 || !ctx.User.IsLocal() { return @@ -74,7 +74,7 @@ func handleUsernameChange(ctx *middleware.Context, newName string) { ctx.User.LowerName = strings.ToLower(newName) } -func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { +func SettingsPost(ctx *context.Context, form auth.UpdateProfileForm) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsProfile"] = true @@ -107,7 +107,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) { } // FIXME: limit size. -func UpdateAvatarSetting(ctx *middleware.Context, form auth.UploadAvatarForm, ctxUser *models.User) error { +func UpdateAvatarSetting(ctx *context.Context, form auth.UploadAvatarForm, ctxUser *models.User) error { ctxUser.UseCustomAvatar = form.Enable if form.Avatar != nil { @@ -144,7 +144,7 @@ func UpdateAvatarSetting(ctx *middleware.Context, form auth.UploadAvatarForm, ct return nil } -func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { +func SettingsAvatar(ctx *context.Context, form auth.UploadAvatarForm) { if err := UpdateAvatarSetting(ctx, form, ctx.User); err != nil { ctx.Flash.Error(err.Error()) } else { @@ -154,7 +154,7 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) { ctx.Redirect(setting.AppSubUrl + "/user/settings") } -func SettingsDeleteAvatar(ctx *middleware.Context) { +func SettingsDeleteAvatar(ctx *context.Context) { if err := ctx.User.DeleteAvatar(); err != nil { ctx.Flash.Error(err.Error()) } @@ -162,13 +162,13 @@ func SettingsDeleteAvatar(ctx *middleware.Context) { ctx.Redirect(setting.AppSubUrl + "/user/settings") } -func SettingsPassword(ctx *middleware.Context) { +func SettingsPassword(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsPassword"] = true ctx.HTML(200, SETTINGS_PASSWORD) } -func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) { +func SettingsPasswordPost(ctx *context.Context, form auth.ChangePasswordForm) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsPassword"] = true @@ -196,7 +196,7 @@ func SettingsPasswordPost(ctx *middleware.Context, form auth.ChangePasswordForm) ctx.Redirect(setting.AppSubUrl + "/user/settings/password") } -func SettingsEmails(ctx *middleware.Context) { +func SettingsEmails(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsEmails"] = true @@ -210,7 +210,7 @@ func SettingsEmails(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_EMAILS) } -func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) { +func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsEmails"] = true @@ -269,7 +269,7 @@ func SettingsEmailPost(ctx *middleware.Context, form auth.AddEmailForm) { ctx.Redirect(setting.AppSubUrl + "/user/settings/email") } -func DeleteEmail(ctx *middleware.Context) { +func DeleteEmail(ctx *context.Context) { if err := models.DeleteEmailAddress(&models.EmailAddress{ID: ctx.QueryInt64("id")}); err != nil { ctx.Handle(500, "DeleteEmail", err) return @@ -282,7 +282,7 @@ func DeleteEmail(ctx *middleware.Context) { }) } -func SettingsSSHKeys(ctx *middleware.Context) { +func SettingsSSHKeys(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsSSHKeys"] = true @@ -296,7 +296,7 @@ func SettingsSSHKeys(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_SSH_KEYS) } -func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { +func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsSSHKeys"] = true @@ -342,7 +342,7 @@ func SettingsSSHKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) { ctx.Redirect(setting.AppSubUrl + "/user/settings/ssh") } -func DeleteSSHKey(ctx *middleware.Context) { +func DeleteSSHKey(ctx *context.Context) { if err := models.DeletePublicKey(ctx.User, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeletePublicKey: " + err.Error()) } else { @@ -354,7 +354,7 @@ func DeleteSSHKey(ctx *middleware.Context) { }) } -func SettingsApplications(ctx *middleware.Context) { +func SettingsApplications(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsApplications"] = true @@ -368,7 +368,7 @@ func SettingsApplications(ctx *middleware.Context) { ctx.HTML(200, SETTINGS_APPLICATIONS) } -func SettingsApplicationsPost(ctx *middleware.Context, form auth.NewAccessTokenForm) { +func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsApplications"] = true @@ -398,7 +398,7 @@ func SettingsApplicationsPost(ctx *middleware.Context, form auth.NewAccessTokenF ctx.Redirect(setting.AppSubUrl + "/user/settings/applications") } -func SettingsDeleteApplication(ctx *middleware.Context) { +func SettingsDeleteApplication(ctx *context.Context) { if err := models.DeleteAccessTokenByID(ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error()) } else { @@ -410,7 +410,7 @@ func SettingsDeleteApplication(ctx *middleware.Context) { }) } -func SettingsDelete(ctx *middleware.Context) { +func SettingsDelete(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsDelete"] = true diff --git a/templates/.VERSION b/templates/.VERSION index c0c0b96224..45796557fa 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.4.0311 \ No newline at end of file +0.9.5.0311 \ No newline at end of file