Browse Source

*: rename "gogits" to "gogs"

pull/5246/merge
Unknwon 7 years ago
parent
commit
aff4208244
No known key found for this signature in database
GPG Key ID: 7A02C406FAC875A2
  1. 4
      cmd/admin.go
  2. 4
      cmd/backup.go
  3. 18
      cmd/hook.go
  4. 2
      cmd/import.go
  5. 4
      cmd/restore.go
  6. 8
      cmd/serv.go
  7. 28
      cmd/web.go
  8. 6
      docker/build.sh
  9. 4
      gogs.go
  10. 2
      models/access.go
  11. 10
      models/action.go
  12. 4
      models/admin.go
  13. 2
      models/attachment.go
  14. 6
      models/comment.go
  15. 8
      models/git_diff.go
  16. 2
      models/git_diff_test.go
  17. 8
      models/issue.go
  18. 4
      models/issue_label.go
  19. 6
      models/issue_mail.go
  20. 8
      models/login_source.go
  21. 6
      models/migrations/migrations.go
  22. 2
      models/migrations/v15.go
  23. 4
      models/migrations/v16.go
  24. 4
      models/milestone.go
  25. 10
      models/mirror.go
  26. 4
      models/models.go
  27. 2
      models/org_team.go
  28. 12
      models/pull.go
  29. 8
      models/release.go
  30. 18
      models/repo.go
  31. 6
      models/repo_branch.go
  32. 2
      models/repo_collaboration.go
  33. 8
      models/repo_editor.go
  34. 4
      models/repo_test.go
  35. 6
      models/ssh_key.go
  36. 2
      models/ssh_key_test.go
  37. 2
      models/token.go
  38. 6
      models/two_factor.go
  39. 2
      models/update.go
  40. 12
      models/user.go
  41. 2
      models/user_mail.go
  42. 10
      models/webhook.go
  43. 4
      models/webhook_dingtalk.go
  44. 6
      models/webhook_discord.go
  45. 6
      models/webhook_slack.go
  46. 6
      models/wiki.go
  47. 8
      pkg/auth/auth.go
  48. 6
      pkg/context/api.go
  49. 2
      pkg/context/api_org.go
  50. 4
      pkg/context/auth.go
  51. 10
      pkg/context/context.go
  52. 6
      pkg/context/org.go
  53. 8
      pkg/context/repo.go
  54. 6
      pkg/cron/cron.go
  55. 2
      pkg/form/repo.go
  56. 4
      pkg/mailer/mail.go
  57. 2
      pkg/mailer/mailer.go
  58. 4
      pkg/markup/markdown.go
  59. 4
      pkg/markup/markdown_test.go
  60. 6
      pkg/markup/markup.go
  61. 4
      pkg/markup/markup_test.go
  62. 2
      pkg/markup/sanitizer.go
  63. 2
      pkg/markup/sanitizer_test.go
  64. 2
      pkg/setting/miniwinsvc.go
  65. 14
      pkg/setting/setting.go
  66. 4
      pkg/ssh/ssh.go
  67. 6
      pkg/template/highlight/highlight.go
  68. 8
      pkg/template/template.go
  69. 4
      pkg/tool/tool.go
  70. 14
      routes/admin/admin.go
  71. 10
      routes/admin/auths.go
  72. 6
      routes/admin/notice.go
  73. 8
      routes/admin/orgs.go
  74. 6
      routes/admin/repos.go
  75. 12
      routes/admin/users.go
  76. 10
      routes/api/v1/admin/org.go
  77. 6
      routes/api/v1/admin/org_repo.go
  78. 10
      routes/api/v1/admin/org_team.go
  79. 10
      routes/api/v1/admin/repo.go
  80. 24
      routes/api/v1/admin/user.go
  81. 22
      routes/api/v1/api.go
  82. 6
      routes/api/v1/convert/convert.go
  83. 2
      routes/api/v1/convert/utils.go
  84. 10
      routes/api/v1/misc/markdown.go
  85. 20
      routes/api/v1/org/org.go
  86. 6
      routes/api/v1/org/team.go
  87. 12
      routes/api/v1/repo/branch.go
  88. 8
      routes/api/v1/repo/collaborators.go
  89. 12
      routes/api/v1/repo/file.go
  90. 16
      routes/api/v1/repo/hook.go
  91. 10
      routes/api/v1/repo/issue.go
  92. 6
      routes/api/v1/repo/issue_comment.go
  93. 8
      routes/api/v1/repo/issue_label.go
  94. 18
      routes/api/v1/repo/key.go
  95. 6
      routes/api/v1/repo/label.go
  96. 6
      routes/api/v1/repo/milestone.go
  97. 26
      routes/api/v1/repo/repo.go
  98. 10
      routes/api/v1/user/app.go
  99. 16
      routes/api/v1/user/email.go
  100. 18
      routes/api/v1/user/follower.go
  101. Some files were not shown because too many files have changed in this diff Show More

4
cmd/admin.go

@ -11,8 +11,8 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var ( var (

4
cmd/backup.go

@ -17,8 +17,8 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var Backup = cli.Command{ var Backup = cli.Command{

18
cmd/hook.go

@ -19,15 +19,15 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/httplib" "github.com/gogs/gogs/pkg/httplib"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/template" "github.com/gogs/gogs/pkg/template"
http "github.com/gogits/gogs/routes/repo" http "github.com/gogs/gogs/routes/repo"
) )
var ( var (

2
cmd/import.go

@ -15,7 +15,7 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var ( var (

4
cmd/restore.go

@ -15,8 +15,8 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var Restore = cli.Command{ var Restore = cli.Command{

8
cmd/serv.go

@ -16,10 +16,10 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
http "github.com/gogits/gogs/routes/repo" http "github.com/gogs/gogs/routes/repo"
) )
const ( const (

28
cmd/web.go

@ -29,20 +29,20 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/bindata" "github.com/gogs/gogs/pkg/bindata"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/template" "github.com/gogs/gogs/pkg/template"
"github.com/gogits/gogs/routes" "github.com/gogs/gogs/routes"
"github.com/gogits/gogs/routes/admin" "github.com/gogs/gogs/routes/admin"
apiv1 "github.com/gogits/gogs/routes/api/v1" apiv1 "github.com/gogs/gogs/routes/api/v1"
"github.com/gogits/gogs/routes/dev" "github.com/gogs/gogs/routes/dev"
"github.com/gogits/gogs/routes/org" "github.com/gogs/gogs/routes/org"
"github.com/gogits/gogs/routes/repo" "github.com/gogs/gogs/routes/repo"
"github.com/gogits/gogs/routes/user" "github.com/gogs/gogs/routes/user"
) )
var Web = cli.Command{ var Web = cli.Command{

6
docker/build.sh

@ -10,9 +10,9 @@ export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin
apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev
# Build Gogs # Build Gogs
mkdir -p ${GOPATH}/src/github.com/gogits/ mkdir -p ${GOPATH}/src/github.com/gogs/
ln -s /app/gogs/build ${GOPATH}/src/github.com/gogits/gogs ln -s /app/gogs/build ${GOPATH}/src/github.com/gogs/gogs
cd ${GOPATH}/src/github.com/gogits/gogs cd ${GOPATH}/src/github.com/gogs/gogs
# Needed since git 2.9.3 or 2.9.4 # Needed since git 2.9.3 or 2.9.4
git config --global http.https://gopkg.in.followRedirects true git config --global http.https://gopkg.in.followRedirects true
make build TAGS="sqlite cert pam" make build TAGS="sqlite cert pam"

4
gogs.go

@ -12,8 +12,8 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/gogits/gogs/cmd" "github.com/gogs/gogs/cmd"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
const APP_VER = "0.11.49.0521" const APP_VER = "0.11.49.0521"

2
models/access.go

@ -9,7 +9,7 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
) )
type AccessMode int type AccessMode int

10
models/action.go

@ -17,12 +17,12 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
type ActionType int type ActionType int

4
models/admin.go

@ -15,8 +15,8 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
type NoticeType int type NoticeType int

2
models/attachment.go

@ -15,7 +15,7 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
gouuid "github.com/satori/go.uuid" gouuid "github.com/satori/go.uuid"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// Attachment represent a attachment of issue/comment/release. // Attachment represent a attachment of issue/comment/release.

6
models/comment.go

@ -13,10 +13,10 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
) )
// CommentType defines whether a comment is just a simple comment, an action (like close) or a reference. // CommentType defines whether a comment is just a simple comment, an action (like close) or a reference.

8
models/git_diff.go

@ -15,11 +15,11 @@ import (
"golang.org/x/net/html/charset" "golang.org/x/net/html/charset"
"golang.org/x/text/transform" "golang.org/x/text/transform"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/template/highlight"
"github.com/gogits/gogs/pkg/template/highlight" "github.com/gogs/gogs/pkg/tool"
) )
type DiffSection struct { type DiffSection struct {

2
models/git_diff_test.go

@ -8,7 +8,7 @@ import (
"html/template" "html/template"
"testing" "testing"
"github.com/gogits/git-module" "github.com/gogs/git-module"
dmp "github.com/sergi/go-diff/diffmatchpatch" dmp "github.com/sergi/go-diff/diffmatchpatch"
) )

8
models/issue.go

@ -13,11 +13,11 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
var ( var (

4
models/issue_label.go

@ -13,9 +13,9 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
var labelColorPattern = regexp.MustCompile("#([a-fA-F0-9]{6})") var labelColorPattern = regexp.MustCompile("#([a-fA-F0-9]{6})")

6
models/issue_mail.go

@ -10,9 +10,9 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func (issue *Issue) MailSubject() string { func (issue *Issue) MailSubject() string {

8
models/login_source.go

@ -23,10 +23,10 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/auth/ldap" "github.com/gogs/gogs/pkg/auth/ldap"
"github.com/gogits/gogs/pkg/auth/pam" "github.com/gogs/gogs/pkg/auth/pam"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type LoginType int type LoginType int

6
models/migrations/migrations.go

@ -13,7 +13,7 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
const _MIN_DB_VER = 10 const _MIN_DB_VER = 10
@ -98,9 +98,9 @@ You can migrate your older database using a previous release, then you can upgra
Please save following instructions to somewhere and start working: Please save following instructions to somewhere and start working:
- If you were using below 0.6.0 (e.g. 0.5.x), download last supported archive from following link: - If you were using below 0.6.0 (e.g. 0.5.x), download last supported archive from following link:
https://github.com/gogits/gogs/releases/tag/v0.7.33 https://github.com/gogs/gogs/releases/tag/v0.7.33
- If you were using below 0.7.0 (e.g. 0.6.x), download last supported archive from following link: - If you were using below 0.7.0 (e.g. 0.6.x), download last supported archive from following link:
https://github.com/gogits/gogs/releases/tag/v0.9.141 https://github.com/gogs/gogs/releases/tag/v0.9.141
Once finished downloading, Once finished downloading,

2
models/migrations/v15.go

@ -15,7 +15,7 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func generateAndMigrateGitHooks(x *xorm.Engine) (err error) { func generateAndMigrateGitHooks(x *xorm.Engine) (err error) {

4
models/migrations/v16.go

@ -12,9 +12,9 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func updateRepositorySizes(x *xorm.Engine) (err error) { func updateRepositorySizes(x *xorm.Engine) (err error) {

4
models/milestone.go

@ -11,9 +11,9 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// Milestone represents a milestone of repository. // Milestone represents a milestone of repository.

10
models/mirror.go

@ -15,12 +15,12 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/sync" "github.com/gogs/gogs/pkg/sync"
) )
var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength) var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)

4
models/models.go

@ -23,8 +23,8 @@ import (
_ "github.com/lib/pq" _ "github.com/lib/pq"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models/migrations" "github.com/gogs/gogs/models/migrations"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// Engine represents a XORM engine or session. // Engine represents a XORM engine or session.

2
models/org_team.go

@ -31,7 +31,7 @@ type Team struct {
func (t *Team) AfterSet(colName string, _ xorm.Cell) { func (t *Team) AfterSet(colName string, _ xorm.Cell) {
switch colName { switch colName {
case "num_repos": case "num_repos":
// LEGACY [1.0]: this is backward compatibility bug fix for https://github.com/gogits/gogs/issues/3671 // LEGACY [1.0]: this is backward compatibility bug fix for https://github.com/gogs/gogs/issues/3671
if t.NumRepos < 0 { if t.NumRepos < 0 {
t.NumRepos = 0 t.NumRepos = 0
} }

12
models/pull.go

@ -15,13 +15,13 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/sync" "github.com/gogs/gogs/pkg/sync"
) )
var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength) var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength)

8
models/release.go

@ -13,11 +13,11 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
) )
// Release represents a release of repository. // Release represents a release of repository.

18
models/repo.go

@ -23,15 +23,15 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
git "github.com/gogits/git-module" git "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/bindata" "github.com/gogs/gogs/pkg/bindata"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/sync" "github.com/gogs/gogs/pkg/sync"
) )
var repoWorkingPool = sync.NewExclusivePool() var repoWorkingPool = sync.NewExclusivePool()

6
models/repo_branch.go

@ -9,10 +9,10 @@ import (
"strings" "strings"
"github.com/Unknwon/com" "github.com/Unknwon/com"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
type Branch struct { type Branch struct {

2
models/repo_collaboration.go

@ -9,7 +9,7 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
) )
// Collaboration represent the relation between an individual and a repository. // Collaboration represent the relation between an individual and a repository.

8
models/repo_editor.go

@ -19,11 +19,11 @@ import (
gouuid "github.com/satori/go.uuid" gouuid "github.com/satori/go.uuid"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
git "github.com/gogits/git-module" git "github.com/gogs/git-module"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// ___________ .___.__ __ ___________.__.__ // ___________ .___.__ __ ___________.__.__

4
models/repo_test.go

@ -5,8 +5,8 @@ import (
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
. "github.com/gogits/gogs/models" . "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
) )
func TestRepo(t *testing.T) { func TestRepo(t *testing.T) {

6
models/ssh_key.go

@ -23,9 +23,9 @@ import (
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
const ( const (

2
models/ssh_key_test.go

@ -11,7 +11,7 @@ import (
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func init() { func init() {

2
models/token.go

@ -10,7 +10,7 @@ import (
"github.com/go-xorm/xorm" "github.com/go-xorm/xorm"
gouuid "github.com/satori/go.uuid" gouuid "github.com/satori/go.uuid"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
// AccessToken represents a personal access token. // AccessToken represents a personal access token.

6
models/two_factor.go

@ -15,9 +15,9 @@ import (
"github.com/pquerna/otp/totp" "github.com/pquerna/otp/totp"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
// TwoFactor represents a two-factor authentication token. // TwoFactor represents a two-factor authentication token.

2
models/update.go

@ -10,7 +10,7 @@ import (
"os/exec" "os/exec"
"strings" "strings"
git "github.com/gogits/git-module" git "github.com/gogs/git-module"
) )
// CommitToPushCommit transforms a git.Commit to PushCommit type. // CommitToPushCommit transforms a git.Commit to PushCommit type.

12
models/user.go

@ -26,13 +26,13 @@ import (
"golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/pbkdf2"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/avatar" "github.com/gogs/gogs/pkg/avatar"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
type UserType int type UserType int

2
models/user_mail.go

@ -8,7 +8,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
) )
// EmailAdresses is the list of all email addresses of a user. Can contain the // EmailAdresses is the list of all email addresses of a user. Can contain the

10
models/webhook.go

@ -19,12 +19,12 @@ import (
gouuid "github.com/satori/go.uuid" gouuid "github.com/satori/go.uuid"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/httplib" "github.com/gogs/gogs/pkg/httplib"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/sync" "github.com/gogs/gogs/pkg/sync"
) )
var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength) var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)

4
models/webhook_dingtalk.go

@ -9,8 +9,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
) )
const ( const (

6
models/webhook_discord.go

@ -10,10 +10,10 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type DiscordEmbedFooterObject struct { type DiscordEmbedFooterObject struct {

6
models/webhook_slack.go

@ -9,10 +9,10 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type SlackMeta struct { type SlackMeta struct {

6
models/wiki.go

@ -15,10 +15,10 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/sync" "github.com/gogs/gogs/pkg/sync"
) )
var wikiWorkingPool = sync.NewExclusivePool() var wikiWorkingPool = sync.NewExclusivePool()

8
pkg/auth/auth.go

@ -13,10 +13,10 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
func IsAPIPath(url string) bool { func IsAPIPath(url string) bool {

6
pkg/context/api.go

@ -12,7 +12,7 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type APIContext struct { type APIContext struct {
@ -20,8 +20,8 @@ type APIContext struct {
Org *APIOrganization Org *APIOrganization
} }
// FIXME: move to github.com/gogits/go-gogs-client // FIXME: move to github.com/gogs/go-gogs-client
const DOC_URL = "https://github.com/gogits/go-gogs-client/wiki" const DOC_URL = "https://github.com/gogs/go-gogs-client/wiki"
// Error responses error message to client with given message. // Error responses error message to client with given message.
// If status is 500, also it prints error to log. // If status is 500, also it prints error to log.

2
pkg/context/api_org.go

@ -5,7 +5,7 @@
package context package context
import ( import (
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
) )
type APIOrganization struct { type APIOrganization struct {

4
pkg/context/auth.go

@ -10,8 +10,8 @@ import (
"github.com/go-macaron/csrf" "github.com/go-macaron/csrf"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/pkg/auth" "github.com/gogs/gogs/pkg/auth"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type ToggleOptions struct { type ToggleOptions struct {

10
pkg/context/context.go

@ -21,11 +21,11 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/auth" "github.com/gogs/gogs/pkg/auth"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// Context represents context of a request. // Context represents context of a request.

6
pkg/context/org.go

@ -9,9 +9,9 @@ import (
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type Organization struct { type Organization struct {

8
pkg/context/repo.go

@ -12,11 +12,11 @@ import (
"gopkg.in/editorconfig/editorconfig-core-go.v1" "gopkg.in/editorconfig/editorconfig-core-go.v1"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type PullRequest struct { type PullRequest struct {

6
pkg/cron/cron.go

@ -9,10 +9,10 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/cron" "github.com/gogs/cron"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var c = cron.New() var c = cron.New()

2
pkg/form/repo.go

@ -12,7 +12,7 @@ import (
"github.com/go-macaron/binding" "github.com/go-macaron/binding"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
) )
// _______________________________________ _________.______________________ _______________.___. // _______________________________________ _________.______________________ _______________.___.

4
pkg/mailer/mail.go

@ -12,8 +12,8 @@ import (
"gopkg.in/gomail.v2" "gopkg.in/gomail.v2"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
const ( const (

2
pkg/mailer/mailer.go

@ -18,7 +18,7 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/gomail.v2" "gopkg.in/gomail.v2"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
type Message struct { type Message struct {

4
pkg/markup/markdown.go

@ -14,8 +14,8 @@ import (
"github.com/russross/blackfriday" "github.com/russross/blackfriday"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
// IsMarkdownFile reports whether name looks like a Markdown file based on its extension. // IsMarkdownFile reports whether name looks like a Markdown file based on its extension.

4
pkg/markup/markdown_test.go

@ -12,8 +12,8 @@ import (
"github.com/russross/blackfriday" "github.com/russross/blackfriday"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
. "github.com/gogits/gogs/pkg/markup" . "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func Test_IsMarkdownFile(t *testing.T) { func Test_IsMarkdownFile(t *testing.T) {

6
pkg/markup/markup.go

@ -14,8 +14,8 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
"golang.org/x/net/html" "golang.org/x/net/html"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
// IsReadmeFile reports whether name looks like a README file based on its extension. // IsReadmeFile reports whether name looks like a README file based on its extension.
@ -49,7 +49,7 @@ var (
// IssueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234 // IssueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
IssueAlphanumericPattern = regexp.MustCompile(`( |^|\(|\[)[A-Z]{1,10}-[1-9][0-9]*\b`) IssueAlphanumericPattern = regexp.MustCompile(`( |^|\(|\[)[A-Z]{1,10}-[1-9][0-9]*\b`)
// CrossReferenceIssueNumericPattern matches string that references a numeric issue in a difference repository // CrossReferenceIssueNumericPattern matches string that references a numeric issue in a difference repository
// e.g. gogits/gogs#12345 // e.g. gogs/gogs#12345
CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`) CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`)
// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae // Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae

4
pkg/markup/markup_test.go

@ -10,8 +10,8 @@ import (
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
. "github.com/gogits/gogs/pkg/markup" . "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func Test_IsReadmeFile(t *testing.T) { func Test_IsReadmeFile(t *testing.T) {

2
pkg/markup/sanitizer.go

@ -10,7 +10,7 @@ import (
"github.com/microcosm-cc/bluemonday" "github.com/microcosm-cc/bluemonday"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// Sanitizer is a protection wrapper of *bluemonday.Policy which does not allow // Sanitizer is a protection wrapper of *bluemonday.Policy which does not allow

2
pkg/markup/sanitizer_test.go

@ -9,7 +9,7 @@ import (
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
. "github.com/gogits/gogs/pkg/markup" . "github.com/gogs/gogs/pkg/markup"
) )
func Test_Sanitizer(t *testing.T) { func Test_Sanitizer(t *testing.T) {

2
pkg/setting/miniwinsvc.go

@ -7,7 +7,7 @@
package setting package setting
import ( import (
_ "github.com/gogits/minwinsvc" _ "github.com/gogs/minwinsvc"
) )
func init() { func init() {

14
pkg/setting/setting.go

@ -25,11 +25,11 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"github.com/gogits/go-libravatar" "github.com/gogs/go-libravatar"
"github.com/gogits/gogs/pkg/bindata" "github.com/gogs/gogs/pkg/bindata"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/user" "github.com/gogs/gogs/pkg/user"
) )
type Scheme string type Scheme string
@ -389,7 +389,7 @@ func getOpenSSHVersion() string {
log.Fatal(2, "Fail to get OpenSSH version: %v - %s", err, stderr) log.Fatal(2, "Fail to get OpenSSH version: %v - %s", err, stderr)
} }
// Trim unused information: https://github.com/gogits/gogs/issues/4507#issuecomment-305150441 // Trim unused information: https://github.com/gogs/gogs/issues/4507#issuecomment-305150441
version := strings.TrimRight(strings.Fields(stderr)[0], ",1234567890") version := strings.TrimRight(strings.Fields(stderr)[0], ",1234567890")
version = strings.TrimSuffix(strings.TrimPrefix(version, "OpenSSH_"), "p") version = strings.TrimSuffix(strings.TrimPrefix(version, "OpenSSH_"), "p")
return version return version
@ -511,7 +511,7 @@ func NewContext() {
} }
// Check if server is eligible for minimum key size check when user choose to enable. // Check if server is eligible for minimum key size check when user choose to enable.
// Windows server and OpenSSH version lower than 5.1 (https://github.com/gogits/gogs/issues/4507) // Windows server and OpenSSH version lower than 5.1 (https://github.com/gogs/gogs/issues/4507)
// are forced to be disabled because the "ssh-keygen" in Windows does not print key type. // are forced to be disabled because the "ssh-keygen" in Windows does not print key type.
if SSH.MinimumKeySizeCheck && if SSH.MinimumKeySizeCheck &&
(IsWindows || version.Compare(getOpenSSHVersion(), "5.1", "<")) { (IsWindows || version.Compare(getOpenSSHVersion(), "5.1", "<")) {
@ -816,7 +816,7 @@ func newSessionService() {
SessionConfig.Provider = Cfg.Section("session").Key("PROVIDER").In("memory", SessionConfig.Provider = Cfg.Section("session").Key("PROVIDER").In("memory",
[]string{"memory", "file", "redis", "mysql"}) []string{"memory", "file", "redis", "mysql"})
SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ") SessionConfig.ProviderConfig = strings.Trim(Cfg.Section("session").Key("PROVIDER_CONFIG").String(), "\" ")
SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogits") SessionConfig.CookieName = Cfg.Section("session").Key("COOKIE_NAME").MustString("i_like_gogs")
SessionConfig.CookiePath = AppSubURL SessionConfig.CookiePath = AppSubURL
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool() SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(3600) SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(3600)

4
pkg/ssh/ssh.go

@ -18,8 +18,8 @@ import (
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func cleanCommand(cmd string) string { func cleanCommand(cmd string) string {

6
pkg/template/highlight/highlight.go

@ -8,7 +8,7 @@ import (
"path" "path"
"strings" "strings"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
var ( var (
@ -21,8 +21,8 @@ var (
// File names that are representing highlight classes. // File names that are representing highlight classes.
highlightFileNames = map[string]bool{ highlightFileNames = map[string]bool{
"cmakelists.txt": true, "cmakelists.txt": true,
"dockerfile": true, "dockerfile": true,
"makefile": true, "makefile": true,
} }
// Extensions that are same as highlight classes. // Extensions that are same as highlight classes.

8
pkg/template/template.go

@ -21,10 +21,10 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"gopkg.in/editorconfig/editorconfig-core-go.v1" "gopkg.in/editorconfig/editorconfig-core-go.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
// TODO: only initialize map once and save to a local variable to reduce copies. // TODO: only initialize map once and save to a local variable to reduce copies.

4
pkg/tool/tool.go

@ -22,9 +22,9 @@ import (
"github.com/Unknwon/i18n" "github.com/Unknwon/i18n"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/chardet" "github.com/gogs/chardet"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// MD5Bytes encodes string to MD5 bytes. // MD5Bytes encodes string to MD5 bytes.

14
routes/admin/admin.go

@ -14,13 +14,13 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/cron" "github.com/gogs/gogs/pkg/cron"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/process" "github.com/gogs/gogs/pkg/process"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/pkg/tool" "github.com/gogs/gogs/pkg/tool"
) )
const ( const (

10
routes/admin/auths.go

@ -11,11 +11,11 @@ import (
"github.com/go-xorm/core" "github.com/go-xorm/core"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/auth/ldap" "github.com/gogs/gogs/pkg/auth/ldap"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
const ( const (

6
routes/admin/notice.go

@ -9,9 +9,9 @@ import (
"github.com/Unknwon/paginater" "github.com/Unknwon/paginater"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
const ( const (

8
routes/admin/orgs.go

@ -5,10 +5,10 @@
package admin package admin
import ( import (
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes" "github.com/gogs/gogs/routes"
) )
const ( const (

6
routes/admin/repos.go

@ -8,9 +8,9 @@ import (
"github.com/Unknwon/paginater" "github.com/Unknwon/paginater"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
const ( const (

12
routes/admin/users.go

@ -10,12 +10,12 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes" "github.com/gogs/gogs/routes"
) )
const ( const (

10
routes/api/v1/admin/org.go

@ -5,14 +5,14 @@
package admin package admin
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/org"
"github.com/gogits/gogs/routes/api/v1/org" "github.com/gogs/gogs/routes/api/v1/user"
) )
// https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization // https://github.com/gogs/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
func CreateOrg(c *context.APIContext, form api.CreateOrgOption) { func CreateOrg(c *context.APIContext, form api.CreateOrgOption) {
org.CreateOrgForUser(c, form, user.GetUserByParams(c)) org.CreateOrgForUser(c, form, user.GetUserByParams(c))
} }

6
routes/api/v1/admin/org_repo.go

@ -5,9 +5,9 @@
package admin package admin
import ( import (
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func GetRepositoryByParams(c *context.APIContext) *models.Repository { func GetRepositoryByParams(c *context.APIContext) *models.Repository {

10
routes/api/v1/admin/org_team.go

@ -5,12 +5,12 @@
package admin package admin
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/user"
) )
func CreateTeam(c *context.APIContext, form api.CreateTeamOption) { func CreateTeam(c *context.APIContext, form api.CreateTeamOption) {

10
routes/api/v1/admin/repo.go

@ -5,14 +5,14 @@
package admin package admin
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/repo" "github.com/gogs/gogs/routes/api/v1/repo"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/user"
) )
// https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository // https://github.com/gogs/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
func CreateRepo(c *context.APIContext, form api.CreateRepoOption) { func CreateRepo(c *context.APIContext, form api.CreateRepoOption) {
owner := user.GetUserByParams(c) owner := user.GetUserByParams(c)
if c.Written() { if c.Written() {

24
routes/api/v1/admin/user.go

@ -7,14 +7,14 @@ package admin
import ( import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/mailer" "github.com/gogs/gogs/pkg/mailer"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/user"
) )
func parseLoginSource(c *context.APIContext, u *models.User, sourceID int64, loginName string) { func parseLoginSource(c *context.APIContext, u *models.User, sourceID int64, loginName string) {
@ -37,7 +37,7 @@ func parseLoginSource(c *context.APIContext, u *models.User, sourceID int64, log
u.LoginName = loginName u.LoginName = loginName
} }
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user // https://github.com/gogs/go-gogs-client/wiki/Administration-Users#create-a-new-user
func CreateUser(c *context.APIContext, form api.CreateUserOption) { func CreateUser(c *context.APIContext, form api.CreateUserOption) {
u := &models.User{ u := &models.User{
Name: form.Username, Name: form.Username,
@ -74,7 +74,7 @@ func CreateUser(c *context.APIContext, form api.CreateUserOption) {
c.JSON(201, u.APIFormat()) c.JSON(201, u.APIFormat())
} }
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user // https://github.com/gogs/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
func EditUser(c *context.APIContext, form api.EditUserOption) { func EditUser(c *context.APIContext, form api.EditUserOption) {
u := user.GetUserByParams(c) u := user.GetUserByParams(c)
if c.Written() { if c.Written() {
@ -130,7 +130,7 @@ func EditUser(c *context.APIContext, form api.EditUserOption) {
c.JSON(200, u.APIFormat()) c.JSON(200, u.APIFormat())
} }
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user // https://github.com/gogs/go-gogs-client/wiki/Administration-Users#delete-a-user
func DeleteUser(c *context.APIContext) { func DeleteUser(c *context.APIContext) {
u := user.GetUserByParams(c) u := user.GetUserByParams(c)
if c.Written() { if c.Written() {
@ -151,7 +151,7 @@ func DeleteUser(c *context.APIContext) {
c.Status(204) c.Status(204)
} }
// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user // https://github.com/gogs/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
func CreatePublicKey(c *context.APIContext, form api.CreateKeyOption) { func CreatePublicKey(c *context.APIContext, form api.CreateKeyOption) {
u := user.GetUserByParams(c) u := user.GetUserByParams(c)
if c.Written() { if c.Written() {

22
routes/api/v1/api.go

@ -10,17 +10,17 @@ import (
"github.com/go-macaron/binding" "github.com/go-macaron/binding"
"gopkg.in/macaron.v1" "gopkg.in/macaron.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/routes/api/v1/admin" "github.com/gogs/gogs/routes/api/v1/admin"
"github.com/gogits/gogs/routes/api/v1/misc" "github.com/gogs/gogs/routes/api/v1/misc"
"github.com/gogits/gogs/routes/api/v1/org" "github.com/gogs/gogs/routes/api/v1/org"
"github.com/gogits/gogs/routes/api/v1/repo" "github.com/gogs/gogs/routes/api/v1/repo"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/user"
) )
func repoAssignment() macaron.Handler { func repoAssignment() macaron.Handler {

6
routes/api/v1/convert/convert.go

@ -9,10 +9,10 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
"github.com/gogits/git-module" "github.com/gogs/git-module"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
) )
func ToEmail(email *models.EmailAddress) *api.Email { func ToEmail(email *models.EmailAddress) *api.Email {

2
routes/api/v1/convert/utils.go

@ -5,7 +5,7 @@
package convert package convert
import ( import (
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
// ToCorrectPageSize makes sure page size is in allowed range. // ToCorrectPageSize makes sure page size is in allowed range.

10
routes/api/v1/misc/markdown.go

@ -5,13 +5,13 @@
package misc package misc
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/markup" "github.com/gogs/gogs/pkg/markup"
) )
// https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document // https://github.com/gogs/go-gogs-client/wiki/Miscellaneous#render-an-arbitrary-markdown-document
func Markdown(c *context.APIContext, form api.MarkdownOption) { func Markdown(c *context.APIContext, form api.MarkdownOption) {
if c.HasApiError() { if c.HasApiError() {
c.Error(422, "", c.GetErrMsg()) c.Error(422, "", c.GetErrMsg())
@ -31,7 +31,7 @@ func Markdown(c *context.APIContext, form api.MarkdownOption) {
} }
} }
// https://github.com/gogits/go-gogs-client/wiki/Miscellaneous#render-a-markdown-document-in-raw-mode // https://github.com/gogs/go-gogs-client/wiki/Miscellaneous#render-a-markdown-document-in-raw-mode
func MarkdownRaw(c *context.APIContext) { func MarkdownRaw(c *context.APIContext) {
body, err := c.Req.Body().Bytes() body, err := c.Req.Body().Bytes()
if err != nil { if err != nil {

20
routes/api/v1/org/org.go

@ -5,12 +5,12 @@
package org package org
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
"github.com/gogits/gogs/routes/api/v1/user" "github.com/gogs/gogs/routes/api/v1/user"
) )
func CreateOrgForUser(c *context.APIContext, apiForm api.CreateOrgOption, user *models.User) { func CreateOrgForUser(c *context.APIContext, apiForm api.CreateOrgOption, user *models.User) {
@ -54,17 +54,17 @@ func listUserOrgs(c *context.APIContext, u *models.User, all bool) {
c.JSON(200, &apiOrgs) c.JSON(200, &apiOrgs)
} }
// https://github.com/gogits/go-gogs-client/wiki/Organizations#list-your-organizations // https://github.com/gogs/go-gogs-client/wiki/Organizations#list-your-organizations
func ListMyOrgs(c *context.APIContext) { func ListMyOrgs(c *context.APIContext) {
listUserOrgs(c, c.User, true) listUserOrgs(c, c.User, true)
} }
// https://github.com/gogits/go-gogs-client/wiki/Organizations#create-your-organization // https://github.com/gogs/go-gogs-client/wiki/Organizations#create-your-organization
func CreateMyOrg(c *context.APIContext, apiForm api.CreateOrgOption) { func CreateMyOrg(c *context.APIContext, apiForm api.CreateOrgOption) {
CreateOrgForUser(c, apiForm, c.User) CreateOrgForUser(c, apiForm, c.User)
} }
// https://github.com/gogits/go-gogs-client/wiki/Organizations#list-user-organizations // https://github.com/gogs/go-gogs-client/wiki/Organizations#list-user-organizations
func ListUserOrgs(c *context.APIContext) { func ListUserOrgs(c *context.APIContext) {
u := user.GetUserByParams(c) u := user.GetUserByParams(c)
if c.Written() { if c.Written() {
@ -73,12 +73,12 @@ func ListUserOrgs(c *context.APIContext) {
listUserOrgs(c, u, false) listUserOrgs(c, u, false)
} }
// https://github.com/gogits/go-gogs-client/wiki/Organizations#get-an-organization // https://github.com/gogs/go-gogs-client/wiki/Organizations#get-an-organization
func Get(c *context.APIContext) { func Get(c *context.APIContext) {
c.JSON(200, convert.ToOrganization(c.Org.Organization)) c.JSON(200, convert.ToOrganization(c.Org.Organization))
} }
// https://github.com/gogits/go-gogs-client/wiki/Organizations#edit-an-organization // https://github.com/gogs/go-gogs-client/wiki/Organizations#edit-an-organization
func Edit(c *context.APIContext, form api.EditOrgOption) { func Edit(c *context.APIContext, form api.EditOrgOption) {
org := c.Org.Organization org := c.Org.Organization
if !org.IsOwnedBy(c.User.ID) { if !org.IsOwnedBy(c.User.ID) {

6
routes/api/v1/org/team.go

@ -5,10 +5,10 @@
package org package org
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
func ListTeams(c *context.APIContext) { func ListTeams(c *context.APIContext) {

12
routes/api/v1/repo/branch.go

@ -5,14 +5,14 @@
package repo package repo
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch // https://github.com/gogs/go-gogs-client/wiki/Repositories#get-branch
func GetBranch(c *context.APIContext) { func GetBranch(c *context.APIContext) {
branch, err := c.Repo.Repository.GetBranch(c.Params("*")) branch, err := c.Repo.Repository.GetBranch(c.Params("*"))
if err != nil { if err != nil {
@ -33,7 +33,7 @@ func GetBranch(c *context.APIContext) {
c.JSON(200, convert.ToBranch(branch, commit)) c.JSON(200, convert.ToBranch(branch, commit))
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-branches // https://github.com/gogs/go-gogs-client/wiki/Repositories#list-branches
func ListBranches(c *context.APIContext) { func ListBranches(c *context.APIContext) {
branches, err := c.Repo.Repository.GetBranches() branches, err := c.Repo.Repository.GetBranches()
if err != nil { if err != nil {

8
routes/api/v1/repo/collaborators.go

@ -5,11 +5,11 @@
package repo package repo
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func ListCollaborators(c *context.APIContext) { func ListCollaborators(c *context.APIContext) {

12
routes/api/v1/repo/file.go

@ -5,14 +5,14 @@
package repo package repo
import ( import (
"github.com/gogits/git-module" "github.com/gogs/git-module"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/repo" "github.com/gogs/gogs/routes/repo"
) )
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-raw-content // https://github.com/gogs/go-gogs-client/wiki/Repositories-Contents#download-raw-content
func GetRawFile(c *context.APIContext) { func GetRawFile(c *context.APIContext) {
if !c.Repo.HasAccess() { if !c.Repo.HasAccess() {
c.Status(404) c.Status(404)
@ -38,7 +38,7 @@ func GetRawFile(c *context.APIContext) {
} }
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-archive // https://github.com/gogs/go-gogs-client/wiki/Repositories-Contents#download-archive
func GetArchive(c *context.APIContext) { func GetArchive(c *context.APIContext) {
repoPath := models.RepoPath(c.Params(":username"), c.Params(":reponame")) repoPath := models.RepoPath(c.Params(":username"), c.Params(":reponame"))
gitRepo, err := git.OpenRepository(repoPath) gitRepo, err := git.OpenRepository(repoPath)

16
routes/api/v1/repo/hook.go

@ -9,15 +9,15 @@ import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks // https://github.com/gogs/go-gogs-client/wiki/Repositories#list-hooks
func ListHooks(c *context.APIContext) { func ListHooks(c *context.APIContext) {
hooks, err := models.GetWebhooksByRepoID(c.Repo.Repository.ID) hooks, err := models.GetWebhooksByRepoID(c.Repo.Repository.ID)
if err != nil { if err != nil {
@ -32,7 +32,7 @@ func ListHooks(c *context.APIContext) {
c.JSON(200, &apiHooks) c.JSON(200, &apiHooks)
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#create-a-hook // https://github.com/gogs/go-gogs-client/wiki/Repositories#create-a-hook
func CreateHook(c *context.APIContext, form api.CreateHookOption) { func CreateHook(c *context.APIContext, form api.CreateHookOption) {
if !models.IsValidHookTaskType(form.Type) { if !models.IsValidHookTaskType(form.Type) {
c.Error(422, "", "Invalid hook type") c.Error(422, "", "Invalid hook type")
@ -103,7 +103,7 @@ func CreateHook(c *context.APIContext, form api.CreateHookOption) {
c.JSON(201, convert.ToHook(c.Repo.RepoLink, w)) c.JSON(201, convert.ToHook(c.Repo.RepoLink, w))
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook // https://github.com/gogs/go-gogs-client/wiki/Repositories#edit-a-hook
func EditHook(c *context.APIContext, form api.EditHookOption) { func EditHook(c *context.APIContext, form api.EditHookOption) {
w, err := models.GetWebhookOfRepoByID(c.Repo.Repository.ID, c.ParamsInt64(":id")) w, err := models.GetWebhookOfRepoByID(c.Repo.Repository.ID, c.ParamsInt64(":id"))
if err != nil { if err != nil {

10
routes/api/v1/repo/issue.go

@ -8,12 +8,12 @@ import (
"fmt" "fmt"
"strings" "strings"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
) )
func listIssues(c *context.APIContext, opts *models.IssuesOptions) { func listIssues(c *context.APIContext, opts *models.IssuesOptions) {

6
routes/api/v1/repo/issue_comment.go

@ -6,10 +6,10 @@ package repo
import ( import (
"time" "time"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func ListIssueComments(c *context.APIContext) { func ListIssueComments(c *context.APIContext) {

8
routes/api/v1/repo/issue_label.go

@ -5,11 +5,11 @@
package repo package repo
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func ListIssueLabels(c *context.APIContext) { func ListIssueLabels(c *context.APIContext) {

18
routes/api/v1/repo/key.go

@ -7,19 +7,19 @@ package repo
import ( import (
"fmt" "fmt"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
func composeDeployKeysAPILink(repoPath string) string { func composeDeployKeysAPILink(repoPath string) string {
return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/" return setting.AppURL + "api/v1/repos/" + repoPath + "/keys/"
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys // https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys
func ListDeployKeys(c *context.APIContext) { func ListDeployKeys(c *context.APIContext) {
keys, err := models.ListDeployKeys(c.Repo.Repository.ID) keys, err := models.ListDeployKeys(c.Repo.Repository.ID)
if err != nil { if err != nil {
@ -40,7 +40,7 @@ func ListDeployKeys(c *context.APIContext) {
c.JSON(200, &apiKeys) c.JSON(200, &apiKeys)
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key // https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key
func GetDeployKey(c *context.APIContext) { func GetDeployKey(c *context.APIContext) {
key, err := models.GetDeployKeyByID(c.ParamsInt64(":id")) key, err := models.GetDeployKeyByID(c.ParamsInt64(":id"))
if err != nil { if err != nil {
@ -80,7 +80,7 @@ func HandleAddKeyError(c *context.APIContext, err error) {
} }
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#add-a-new-deploy-key // https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#add-a-new-deploy-key
func CreateDeployKey(c *context.APIContext, form api.CreateKeyOption) { func CreateDeployKey(c *context.APIContext, form api.CreateKeyOption) {
content, err := models.CheckPublicKeyString(form.Key) content, err := models.CheckPublicKeyString(form.Key)
if err != nil { if err != nil {
@ -99,7 +99,7 @@ func CreateDeployKey(c *context.APIContext, form api.CreateKeyOption) {
c.JSON(201, convert.ToDeployKey(apiLink, key)) c.JSON(201, convert.ToDeployKey(apiLink, key))
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key // https://github.com/gogs/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key
func DeleteDeploykey(c *context.APIContext) { func DeleteDeploykey(c *context.APIContext) {
if err := models.DeleteDeployKey(c.User, c.ParamsInt64(":id")); err != nil { if err := models.DeleteDeployKey(c.User, c.ParamsInt64(":id")); err != nil {
if models.IsErrKeyAccessDenied(err) { if models.IsErrKeyAccessDenied(err) {

6
routes/api/v1/repo/label.go

@ -7,10 +7,10 @@ package repo
import ( import (
"github.com/Unknwon/com" "github.com/Unknwon/com"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func ListLabels(c *context.APIContext) { func ListLabels(c *context.APIContext) {

6
routes/api/v1/repo/milestone.go

@ -7,10 +7,10 @@ package repo
import ( import (
"time" "time"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func ListMilestones(c *context.APIContext) { func ListMilestones(c *context.APIContext) {

26
routes/api/v1/repo/repo.go

@ -9,17 +9,17 @@ import (
log "gopkg.in/clog.v1" log "gopkg.in/clog.v1"
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/models/errors" "github.com/gogs/gogs/models/errors"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/form" "github.com/gogs/gogs/pkg/form"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
// https://github.com/gogits/go-gogs-client/wiki/Repositories#search-repositories // https://github.com/gogs/go-gogs-client/wiki/Repositories#search-repositories
func Search(c *context.APIContext) { func Search(c *context.APIContext) {
opts := &models.SearchRepoOptions{ opts := &models.SearchRepoOptions{
Keyword: path.Base(c.Query("q")), Keyword: path.Base(c.Query("q")),
@ -182,7 +182,7 @@ func CreateUserRepo(c *context.APIContext, owner *models.User, opt api.CreateRep
c.JSON(201, repo.APIFormat(&api.Permission{true, true, true})) c.JSON(201, repo.APIFormat(&api.Permission{true, true, true}))
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#create // https://github.com/gogs/go-gogs-client/wiki/Repositories#create
func Create(c *context.APIContext, opt api.CreateRepoOption) { func Create(c *context.APIContext, opt api.CreateRepoOption) {
// Shouldn't reach this condition, but just in case. // Shouldn't reach this condition, but just in case.
if c.User.IsOrganization() { if c.User.IsOrganization() {
@ -210,7 +210,7 @@ func CreateOrgRepo(c *context.APIContext, opt api.CreateRepoOption) {
CreateUserRepo(c, org, opt) CreateUserRepo(c, org, opt)
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#migrate // https://github.com/gogs/go-gogs-client/wiki/Repositories#migrate
func Migrate(c *context.APIContext, f form.MigrateRepo) { func Migrate(c *context.APIContext, f form.MigrateRepo) {
ctxUser := c.User ctxUser := c.User
// Not equal means context user is an organization, // Not equal means context user is an organization,
@ -314,7 +314,7 @@ func parseOwnerAndRepo(c *context.APIContext) (*models.User, *models.Repository)
return owner, repo return owner, repo
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get // https://github.com/gogs/go-gogs-client/wiki/Repositories#get
func Get(c *context.APIContext) { func Get(c *context.APIContext) {
_, repo := parseOwnerAndRepo(c) _, repo := parseOwnerAndRepo(c)
if c.Written() { if c.Written() {
@ -328,7 +328,7 @@ func Get(c *context.APIContext) {
})) }))
} }
// https://github.com/gogits/go-gogs-client/wiki/Repositories#delete // https://github.com/gogs/go-gogs-client/wiki/Repositories#delete
func Delete(c *context.APIContext) { func Delete(c *context.APIContext) {
owner, repo := parseOwnerAndRepo(c) owner, repo := parseOwnerAndRepo(c)
if c.Written() { if c.Written() {

10
routes/api/v1/user/app.go

@ -5,13 +5,13 @@
package user package user
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
// https://github.com/gogits/go-gogs-client/wiki/Users#list-access-tokens-for-a-user // https://github.com/gogs/go-gogs-client/wiki/Users#list-access-tokens-for-a-user
func ListAccessTokens(c *context.APIContext) { func ListAccessTokens(c *context.APIContext) {
tokens, err := models.ListAccessTokens(c.User.ID) tokens, err := models.ListAccessTokens(c.User.ID)
if err != nil { if err != nil {
@ -26,7 +26,7 @@ func ListAccessTokens(c *context.APIContext) {
c.JSON(200, &apiTokens) c.JSON(200, &apiTokens)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users#create-a-access-token // https://github.com/gogs/go-gogs-client/wiki/Users#create-a-access-token
func CreateAccessToken(c *context.APIContext, form api.CreateAccessTokenOption) { func CreateAccessToken(c *context.APIContext, form api.CreateAccessTokenOption) {
t := &models.AccessToken{ t := &models.AccessToken{
UID: c.User.ID, UID: c.User.ID,

16
routes/api/v1/user/email.go

@ -5,15 +5,15 @@
package user package user
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
"github.com/gogits/gogs/pkg/setting" "github.com/gogs/gogs/pkg/setting"
"github.com/gogits/gogs/routes/api/v1/convert" "github.com/gogs/gogs/routes/api/v1/convert"
) )
// https://github.com/gogits/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user // https://github.com/gogs/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user
func ListEmails(c *context.APIContext) { func ListEmails(c *context.APIContext) {
emails, err := models.GetEmailAddresses(c.User.ID) emails, err := models.GetEmailAddresses(c.User.ID)
if err != nil { if err != nil {
@ -27,7 +27,7 @@ func ListEmails(c *context.APIContext) {
c.JSON(200, &apiEmails) c.JSON(200, &apiEmails)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Emails#add-email-addresses // https://github.com/gogs/go-gogs-client/wiki/Users-Emails#add-email-addresses
func AddEmail(c *context.APIContext, form api.CreateEmailOption) { func AddEmail(c *context.APIContext, form api.CreateEmailOption) {
if len(form.Emails) == 0 { if len(form.Emails) == 0 {
c.Status(422) c.Status(422)
@ -59,7 +59,7 @@ func AddEmail(c *context.APIContext, form api.CreateEmailOption) {
c.JSON(201, &apiEmails) c.JSON(201, &apiEmails)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Emails#delete-email-addresses // https://github.com/gogs/go-gogs-client/wiki/Users-Emails#delete-email-addresses
func DeleteEmail(c *context.APIContext, form api.CreateEmailOption) { func DeleteEmail(c *context.APIContext, form api.CreateEmailOption) {
if len(form.Emails) == 0 { if len(form.Emails) == 0 {
c.Status(204) c.Status(204)

18
routes/api/v1/user/follower.go

@ -5,10 +5,10 @@
package user package user
import ( import (
api "github.com/gogits/go-gogs-client" api "github.com/gogs/go-gogs-client"
"github.com/gogits/gogs/models" "github.com/gogs/gogs/models"
"github.com/gogits/gogs/pkg/context" "github.com/gogs/gogs/pkg/context"
) )
func responseApiUsers(c *context.APIContext, users []*models.User) { func responseApiUsers(c *context.APIContext, users []*models.User) {
@ -32,7 +32,7 @@ func ListMyFollowers(c *context.APIContext) {
listUserFollowers(c, c.User) listUserFollowers(c, c.User)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-followers-of-a-user // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#list-followers-of-a-user
func ListFollowers(c *context.APIContext) { func ListFollowers(c *context.APIContext) {
u := GetUserByParams(c) u := GetUserByParams(c)
if c.Written() { if c.Written() {
@ -54,7 +54,7 @@ func ListMyFollowing(c *context.APIContext) {
listUserFollowing(c, c.User) listUserFollowing(c, c.User)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#list-users-followed-by-another-user // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#list-users-followed-by-another-user
func ListFollowing(c *context.APIContext) { func ListFollowing(c *context.APIContext) {
u := GetUserByParams(c) u := GetUserByParams(c)
if c.Written() { if c.Written() {
@ -71,7 +71,7 @@ func checkUserFollowing(c *context.APIContext, u *models.User, followID int64) {
} }
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-you-are-following-a-user // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#check-if-you-are-following-a-user
func CheckMyFollowing(c *context.APIContext) { func CheckMyFollowing(c *context.APIContext) {
target := GetUserByParams(c) target := GetUserByParams(c)
if c.Written() { if c.Written() {
@ -80,7 +80,7 @@ func CheckMyFollowing(c *context.APIContext) {
checkUserFollowing(c, c.User, target.ID) checkUserFollowing(c, c.User, target.ID)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-one-user-follows-another // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#check-if-one-user-follows-another
func CheckFollowing(c *context.APIContext) { func CheckFollowing(c *context.APIContext) {
u := GetUserByParams(c) u := GetUserByParams(c)
if c.Written() { if c.Written() {
@ -93,7 +93,7 @@ func CheckFollowing(c *context.APIContext) {
checkUserFollowing(c, u, target.ID) checkUserFollowing(c, u, target.ID)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#follow-a-user // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#follow-a-user
func Follow(c *context.APIContext) { func Follow(c *context.APIContext) {
target := GetUserByParams(c) target := GetUserByParams(c)
if c.Written() { if c.Written() {
@ -106,7 +106,7 @@ func Follow(c *context.APIContext) {
c.Status(204) c.Status(204)
} }
// https://github.com/gogits/go-gogs-client/wiki/Users-Followers#unfollow-a-user // https://github.com/gogs/go-gogs-client/wiki/Users-Followers#unfollow-a-user
func Unfollow(c *context.APIContext) { func Unfollow(c *context.APIContext) {
target := GetUserByParams(c) target := GetUserByParams(c)
if c.Written() { if c.Written() {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save