ソースを参照

[Rebase] Reconciling changes from upstream

- Using upstream version number
- Import path fixes (gogits/go-gogs-client)
- Small codestyle cleanup (e.g., import order)
Achilleas Koutsou 6 年 前
コミット
dbf4ad57ff

+ 0 - 64
.gopmfile

@@ -1,64 +0,0 @@
-[target]
-path = github.com/G-Node/gogs
-
-[deps]
-github.com/bradfitz/gomemcache = commit:2fafb84
-github.com/urfave/cli = commit:347a988
-github.com/go-macaron/binding = commit:4892016
-github.com/go-macaron/cache = commit:5617353
-github.com/go-macaron/captcha = commit:8aa5919
-github.com/go-macaron/csrf = commit:6a9a7df
-github.com/go-macaron/gzip = commit:cad1c65
-github.com/go-macaron/i18n = commit:ef57533
-github.com/go-macaron/inject = commit:d8a0b86
-github.com/go-macaron/session = commit:66031fc
-github.com/go-macaron/toolbox = commit:82b5115
-github.com/go-sql-driver/mysql = commit:2e00b5c
-github.com/go-xorm/builder = commit:9c35786
-github.com/go-xorm/core = commit:7daacb2
-github.com/go-xorm/xorm = commit:19f6dfc
-github.com/gogits/chardet = commit:2404f77
-github.com/gogits/cron = commit:2fc07a4
-github.com/G-Node/git-module = commit:1b9552b
-github.com/gogits/go-gogs-client = commit:264a3d5
-github.com/gogits/go-libravatar = commit:cd1abbd
-github.com/issue9/identicon = commit:d36b545
-github.com/jaytaylor/html2text = commit:d16d412
-github.com/kardianos/minwinsvc = commit:cad6b2b
-github.com/klauspost/compress = commit:461e8fd
-github.com/klauspost/cpuid = commit:09cded8
-github.com/klauspost/crc32 = commit:cb6bfca
-github.com/lib/pq = commit:67c3f2a
-github.com/mattn/go-colorable = commit:d228849
-github.com/mattn/go-isatty = commit:30a891c
-github.com/mattn/go-sqlite3 = commit:ce9149a
-github.com/mcuadros/go-version = commit:257f7b9
-github.com/microcosm-cc/bluemonday = commit:e797637
-github.com/msteinert/pam = commit:02ccfbf
-github.com/nfnt/resize = commit:891127d
-github.com/russross/blackfriday = commit:5f33e7b
-github.com/satori/go.uuid = commit:b061729
-github.com/sergi/go-diff = commit:24e2351
-github.com/shurcooL/sanitized_anchor_name = commit:1dba4b3
-github.com/Unknwon/cae = commit:c6aac99
-github.com/Unknwon/com = commit:28b053d
-github.com/Unknwon/i18n = commit:e0eb0ce
-github.com/Unknwon/paginater = commit:701c23f
-github.com/fatih/color = commit:42c364b
-golang.org/x/crypto = commit:dc137be
-golang.org/x/net = commit:f249948
-golang.org/x/sys = commit:d75a526
-golang.org/x/text = commit:ece019d
-gopkg.in/alexcesaro/quotedprintable.v3 = commit:2caba25
-gopkg.in/asn1-ber.v1 = commit:4e86f43
-gopkg.in/bufio.v1 = commit:567b2bf
-gopkg.in/clog.v1 = commit:bf4bf4a
-gopkg.in/editorconfig/editorconfig-core-go.v1 = commit:a872f05
-gopkg.in/gomail.v2 = commit:81ebce5
-gopkg.in/ini.v1 = commit:e3c2d47
-gopkg.in/ldap.v2 = commit:8168ee0
-gopkg.in/macaron.v1 = commit:8be5635
-gopkg.in/redis.v2 = commit:e617904
-
-[res]
-include = public|scripts|templates

+ 1 - 1
Makefile

@@ -61,7 +61,7 @@ pkg/bindata/bindata.go: $(DATA_FILES)
 less: public/css/gogs.css
 
 public/css/gogs.css: $(LESS_FILES)
-	lessc $< $@
+	@type lessc >/dev/null 2>&1 && lessc $< >$@ || echo "lessc command not found, skipped."
 
 clean:
 	go clean -i ./...

+ 3 - 1
cmd/hook.go

@@ -22,9 +22,11 @@ import (
 	"github.com/G-Node/git-module"
 
 	"github.com/G-Node/gogs/models"
+	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/httplib"
+	"github.com/G-Node/gogs/pkg/mailer"
 	"github.com/G-Node/gogs/pkg/setting"
-	http "github.com/G-Node/gogs/routes/repo"
+	"github.com/G-Node/gogs/pkg/template"
 )
 
 var (

+ 0 - 1
conf/app.ini

@@ -489,7 +489,6 @@ NAMES = English,简体中文,繁體中文(香港),繁體中文(臺灣),D
 
 ; Used for datetimepicker
 [i18n.datelang]
-[i18n.datelang]
 en-US = en
 zh-CN = zh
 zh-HK = zh-TW

+ 1 - 1
gogs.go

@@ -16,7 +16,7 @@ import (
 	"github.com/G-Node/gogs/pkg/setting"
 )
 
-const APP_VER = "0.1.0.0"
+const APP_VER = "0.11.87.0206"
 
 func init() {
 	setting.AppVer = APP_VER

+ 2 - 2
models/action.go

@@ -14,11 +14,11 @@ import (
 
 	"github.com/Unknwon/com"
 	"github.com/go-xorm/xorm"
-	"github.com/json-iterator/go"
+	jsoniter "github.com/json-iterator/go"
 	log "gopkg.in/clog.v1"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/setting"

+ 3 - 1
models/login_source.go

@@ -20,13 +20,15 @@ import (
 	"github.com/go-macaron/binding"
 	"github.com/go-xorm/core"
 	"github.com/go-xorm/xorm"
-	"github.com/json-iterator/go"
+	jsoniter "github.com/json-iterator/go"
 	log "gopkg.in/clog.v1"
 	"gopkg.in/ini.v1"
 
 	"github.com/G-Node/gogs/models/errors"
+	"github.com/G-Node/gogs/pkg/auth/github"
 	"github.com/G-Node/gogs/pkg/auth/ldap"
 	"github.com/G-Node/gogs/pkg/auth/pam"
+	"github.com/G-Node/gogs/pkg/setting"
 )
 
 type LoginType int

+ 1 - 1
models/org_team.go

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

+ 1 - 1
models/pull.go

@@ -16,7 +16,7 @@ import (
 	log "gopkg.in/clog.v1"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/process"

+ 1 - 1
models/release.go

@@ -14,7 +14,7 @@ import (
 	log "gopkg.in/clog.v1"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/process"

+ 0 - 1
models/ssh_key.go

@@ -25,7 +25,6 @@ import (
 
 	"github.com/G-Node/gogs/pkg/process"
 	"github.com/G-Node/gogs/pkg/setting"
-	"github.com/G-Node/gogs/pkg/tool"
 )
 
 const (

+ 2 - 1
models/webhook_discord.go

@@ -10,7 +10,8 @@ import (
 	"strings"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
+	jsoniter "github.com/json-iterator/go"
 
 	"github.com/G-Node/gogs/pkg/setting"
 )

+ 2 - 1
models/webhook_slack.go

@@ -9,7 +9,8 @@ import (
 	"strings"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
+	jsoniter "github.com/json-iterator/go"
 
 	"github.com/G-Node/gogs/pkg/setting"
 )

+ 1 - 0
pkg/context/auth.go

@@ -14,6 +14,7 @@ import (
 
 	"github.com/G-Node/gogs/pkg/auth"
 	"github.com/G-Node/gogs/pkg/setting"
+	"github.com/G-Node/gogs/pkg/tool"
 )
 
 type ToggleOptions struct {

+ 2 - 1
pkg/context/context.go

@@ -25,6 +25,7 @@ import (
 	"github.com/G-Node/gogs/pkg/auth"
 	"github.com/G-Node/gogs/pkg/form"
 	"github.com/G-Node/gogs/pkg/setting"
+	"github.com/G-Node/gogs/pkg/template"
 )
 
 // Context represents context of a request.
@@ -318,7 +319,7 @@ func Contexter() macaron.Handler {
 		}
 
 		c.Data["CSRFToken"] = x.GetToken()
-		c.Data["CSRFTokenHTML"] = template.HTML(`<input type="hidden" name="_csrf" value="` + x.GetToken() + `">`)
+		c.Data["CSRFTokenHTML"] = template.Safe(`<input type="hidden" name="_csrf" value="` + x.GetToken() + `">`)
 		c.Data["SessionID"] = sess.ID()
 		log.Trace("Session ID: %s", sess.ID())
 		log.Trace("CSRF Token: %v", c.Data["CSRFToken"])

+ 1 - 1
pkg/markup/markdown.go

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

+ 1 - 2
routes/api/v1/admin/org.go

@@ -7,9 +7,8 @@ package admin
 import (
 	api "github.com/gogs/go-gogs-client"
 
-	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/pkg/context"
-	"github.com/G-Node/gogs/routes/api/v1/convert"
+	"github.com/G-Node/gogs/routes/api/v1/org"
 	"github.com/G-Node/gogs/routes/api/v1/user"
 )
 

+ 2 - 1
routes/api/v1/admin/user.go

@@ -7,9 +7,10 @@ package admin
 import (
 	log "gopkg.in/clog.v1"
 
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
+	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/context"
 	"github.com/G-Node/gogs/pkg/mailer"
 	"github.com/G-Node/gogs/pkg/setting"

+ 1 - 1
routes/api/v1/convert/convert.go

@@ -10,7 +10,7 @@ import (
 	"github.com/Unknwon/com"
 
 	"github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
 )

+ 1 - 1
routes/api/v1/repo/branch.go

@@ -7,7 +7,7 @@ package repo
 import (
 	api "github.com/gogs/go-gogs-client"
 
-	"github.com/G-Node/gogs/models"
+	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/context"
 	"github.com/G-Node/gogs/routes/api/v1/convert"
 )

+ 2 - 2
routes/api/v1/repo/repo.go

@@ -9,7 +9,7 @@ import (
 
 	log "gopkg.in/clog.v1"
 
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/models/errors"
@@ -73,7 +73,7 @@ func Search(c *context.APIContext) {
 	for i := range repos {
 		if !repos[i].Unlisted {
 			rep := repos[i].APIFormat(nil)
-			if ! c.IsLogged {
+			if !c.IsLogged {
 				rep.Owner.Email = ""
 			}
 			results[i] = rep

+ 1 - 1
routes/api/v1/user/key.go

@@ -5,7 +5,7 @@
 package user
 
 import (
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/models/errors"

+ 1 - 0
routes/api/v1/user/user.go

@@ -12,6 +12,7 @@ import (
 	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/context"
+	"github.com/G-Node/gogs/pkg/markup"
 )
 
 func Search(c *context.APIContext) {

+ 2 - 0
routes/repo/branch.go

@@ -10,9 +10,11 @@ import (
 	log "gopkg.in/clog.v1"
 
 	"github.com/G-Node/git-module"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/pkg/context"
+	"github.com/G-Node/gogs/pkg/tool"
 )
 
 const (

+ 0 - 11
routes/repo/http.go

@@ -27,17 +27,6 @@ import (
 	"github.com/G-Node/gogs/pkg/tool"
 )
 
-const (
-	ENV_AUTH_USER_ID           = "GOGS_AUTH_USER_ID"
-	ENV_AUTH_USER_NAME         = "GOGS_AUTH_USER_NAME"
-	ENV_AUTH_USER_EMAIL        = "GOGS_AUTH_USER_EMAIL"
-	ENV_REPO_OWNER_NAME        = "GOGS_REPO_OWNER_NAME"
-	ENV_REPO_OWNER_SALT_MD5    = "GOGS_REPO_OWNER_SALT_MD5"
-	ENV_REPO_ID                = "GOGS_REPO_ID"
-	ENV_REPO_NAME              = "GOGS_REPO_NAME"
-	ENV_REPO_CUSTOM_HOOKS_PATH = "GOGS_REPO_CUSTOM_HOOKS_PATH"
-)
-
 type HTTPContext struct {
 	*context.Context
 	OwnerName string

+ 1 - 0
routes/repo/issue.go

@@ -23,6 +23,7 @@ import (
 	"github.com/G-Node/gogs/pkg/form"
 	"github.com/G-Node/gogs/pkg/markup"
 	"github.com/G-Node/gogs/pkg/setting"
+	"github.com/G-Node/gogs/pkg/template"
 	"github.com/G-Node/gogs/pkg/tool"
 )
 

+ 4 - 2
routes/repo/setting.go

@@ -22,7 +22,8 @@ import (
 	"github.com/G-Node/gogs/pkg/form"
 	"github.com/G-Node/gogs/pkg/mailer"
 	"github.com/G-Node/gogs/pkg/setting"
-	"github.com/dustinkirkland/golang-petname"
+	"github.com/G-Node/gogs/pkg/tool"
+	petname "github.com/dustinkirkland/golang-petname"
 )
 
 const (
@@ -421,6 +422,7 @@ func SettingsCollaborationPost(c *context.Context) {
 		}
 		return
 	}
+
 	// Organization is not allowed to be added as a collaborator
 	if u.IsOrganization() {
 		c.Flash.Error(c.Tr("repo.settings.org_not_allowed_to_be_collaborator"))
@@ -428,7 +430,7 @@ func SettingsCollaborationPost(c *context.Context) {
 		return
 	}
 
-	if err := c.Repo.Repository.AddCollaborator(u); err != nil {
+	if err = c.Repo.Repository.AddCollaborator(u); err != nil {
 		c.Handle(500, "AddCollaborator", err)
 		return
 	}

+ 2 - 2
routes/repo/webhook.go

@@ -9,10 +9,10 @@ import (
 	"strings"
 
 	"github.com/Unknwon/com"
-	"github.com/json-iterator/go"
+	jsoniter "github.com/json-iterator/go"
 
 	git "github.com/G-Node/git-module"
-	api "github.com/gogits/go-gogs-client"
+	api "github.com/gogs/go-gogs-client"
 
 	"github.com/G-Node/gogs/models"
 	"github.com/G-Node/gogs/models/errors"

+ 1 - 0
routes/user/auth.go

@@ -17,6 +17,7 @@ import (
 	"github.com/G-Node/gogs/pkg/form"
 	"github.com/G-Node/gogs/pkg/mailer"
 	"github.com/G-Node/gogs/pkg/setting"
+	"github.com/G-Node/gogs/pkg/tool"
 )
 
 const (

+ 1 - 1
routes/user/profile.go

@@ -11,9 +11,9 @@ import (
 	"github.com/Unknwon/paginater"
 
 	"github.com/G-Node/gogs/models"
-	"github.com/G-Node/gogs/models/errors"
 	"github.com/G-Node/gogs/pkg/context"
 	"github.com/G-Node/gogs/pkg/setting"
+	"github.com/G-Node/gogs/pkg/tool"
 	"github.com/G-Node/gogs/routes/repo"
 )
 

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
-0.1.0.0
+0.11.87.0206

+ 1 - 1
templates/mail/issue/comment.tmpl

@@ -10,7 +10,7 @@
 	<p>
 		---
 		<br>
-		<a href="{{.Link}}">View it on Gin</a>.
+		<a href="{{.Link}}">View it on GIN</a>.
 	</p>
 </body>
 </html>

+ 1 - 1
templates/mail/issue/mention.tmpl

@@ -11,7 +11,7 @@
 	<p>
 		---
 		<br>
-		<a href="{{.Link}}">View it on Gin</a>.
+		<a href="{{.Link}}">View it on GIN</a>.
 	</p>
 </body>
 </html>