Skip to content

Commit 3d61518

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into feature-jwt-asymmetric
2 parents 2531f4b + f088dc4 commit 3d61518

File tree

259 files changed

+4028
-2704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+4028
-2704
lines changed

.golangci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ issues:
7070
- path: modules/log/
7171
linters:
7272
- errcheck
73-
- path: routers/routes/web.go
74-
linters:
75-
- dupl
7673
- path: routers/api/v1/repo/issue_subscription.go
7774
linters:
7875
- dupl
@@ -114,3 +111,4 @@ issues:
114111
linters:
115112
- staticcheck
116113
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
114+

Dockerfile.rootless

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ USER git:git
6060
ENV GITEA_WORK_DIR /var/lib/gitea
6161
ENV GITEA_CUSTOM /var/lib/gitea/custom
6262
ENV GITEA_TEMP /tmp/gitea
63+
ENV TMPDIR /tmp/gitea
64+
6365
#TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
6466
ENV GITEA_APP_INI /etc/gitea/app.ini
6567
ENV HOME "/var/lib/gitea/git"

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ EXTRA_GOFLAGS ?=
6464
MAKE_VERSION := $(shell $(MAKE) -v | head -n 1)
6565
MAKE_EVIDENCE_DIR := .make_evidence
6666

67-
ifneq ($(RACE_ENABLED),)
68-
GOTESTFLAGS ?= -race
67+
ifeq ($(RACE_ENABLED),true)
68+
GOFLAGS += -race
69+
GOTESTFLAGS += -race
6970
endif
7071

7172
STORED_VERSION_FILE := VERSION
@@ -380,7 +381,7 @@ test-check:
380381
.PHONY: test\#%
381382
test\#%:
382383
@echo "Running go test with -tags '$(TEST_TAGS)'..."
383-
@$(GO) test -mod=vendor -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
384+
@$(GO) test -mod=vendor $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
384385

385386
.PHONY: coverage
386387
coverage:

cmd/web.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
1919
"code.gitea.io/gitea/routers"
20-
"code.gitea.io/gitea/routers/routes"
20+
"code.gitea.io/gitea/routers/install"
2121

2222
context2 "github.com/gorilla/context"
2323
"github.com/urfave/cli"
@@ -88,7 +88,7 @@ func runWeb(ctx *cli.Context) error {
8888
}
8989

9090
// Perform pre-initialization
91-
needsInstall := routers.PreInstallInit(graceful.GetManager().HammerContext())
91+
needsInstall := install.PreloadSettings(graceful.GetManager().HammerContext())
9292
if needsInstall {
9393
// Flag for port number in case first time run conflict
9494
if ctx.IsSet("port") {
@@ -101,7 +101,7 @@ func runWeb(ctx *cli.Context) error {
101101
return err
102102
}
103103
}
104-
c := routes.InstallRoutes()
104+
c := install.Routes()
105105
err := listen(c, false)
106106
select {
107107
case <-graceful.GetManager().IsShutdown():
@@ -134,7 +134,7 @@ func runWeb(ctx *cli.Context) error {
134134
}
135135

136136
// Set up Chi routes
137-
c := routes.NormalRoutes()
137+
c := routers.NormalRoutes()
138138
err := listen(c, true)
139139
<-graceful.GetManager().Done()
140140
log.Info("PID: %d Gitea Web Finished", os.Getpid())

contrib/pr/checkout.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"code.gitea.io/gitea/modules/setting"
3232
"code.gitea.io/gitea/modules/util"
3333
"code.gitea.io/gitea/routers"
34-
"code.gitea.io/gitea/routers/routes"
3534

3635
"github.com/go-git/go-git/v5"
3736
"github.com/go-git/go-git/v5/config"
@@ -116,7 +115,7 @@ func runPR() {
116115
//routers.GlobalInit()
117116
external.RegisterRenderers()
118117
markup.Init()
119-
c := routes.NormalRoutes()
118+
c := routers.NormalRoutes()
120119

121120
log.Printf("[PR] Ready for testing !\n")
122121
log.Printf("[PR] Login with user1, user2, user3, ... with pass: password\n")

docker/root/etc/s6/openssh/setup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ if [ -d /etc/ssh ]; then
4747
SSH_RSA_CERT="${SSH_RSA_CERT:+"HostCertificate "}${SSH_RSA_CERT}" \
4848
SSH_ECDSA_CERT="${SSH_ECDSA_CERT:+"HostCertificate "}${SSH_ECDSA_CERT}" \
4949
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
50+
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
51+
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
5052
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
5153

5254
chmod 0644 /etc/ssh/sshd_config

docker/root/etc/templates/sshd_config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ AddressFamily any
55
ListenAddress 0.0.0.0
66
ListenAddress ::
77

8+
${SSH_MAX_STARTUPS}
9+
${SSH_MAX_SESSIONS}
10+
811
LogLevel INFO
912

1013
HostKey /data/ssh/ssh_host_ed25519_key

integrations/api_admin_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func TestAPIEditUser(t *testing.T) {
195195
assert.EqualValues(t, "email is not allowed to be empty string", errMap["message"].(string))
196196

197197
user2 := models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
198-
assert.Equal(t, false, user2.IsRestricted)
198+
assert.False(t, user2.IsRestricted)
199199
bTrue := true
200200
req = NewRequestWithJSON(t, "PATCH", urlStr, api.EditUserOption{
201201
// required
@@ -206,5 +206,5 @@ func TestAPIEditUser(t *testing.T) {
206206
})
207207
session.MakeRequest(t, req, http.StatusOK)
208208
user2 = models.AssertExistsAndLoadBean(t, &models.User{LoginName: "user2"}).(*models.User)
209-
assert.Equal(t, true, user2.IsRestricted)
209+
assert.True(t, user2.IsRestricted)
210210
}

integrations/api_gpg_keys_test.go

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func TestGPGKeys(t *testing.T) {
3636
}
3737

3838
for _, tc := range tt {
39-
4039
//Basic test on result code
4140
t.Run(tc.name, func(t *testing.T) {
4241
t.Run("ViewOwnGPGKeys", func(t *testing.T) {
@@ -78,42 +77,42 @@ func TestGPGKeys(t *testing.T) {
7877

7978
primaryKey1 := keys[0] //Primary key 1
8079
assert.EqualValues(t, "38EA3BCED732982C", primaryKey1.KeyID)
81-
assert.EqualValues(t, 1, len(primaryKey1.Emails))
80+
assert.Len(t, primaryKey1.Emails, 1)
8281
assert.EqualValues(t, "[email protected]", primaryKey1.Emails[0].Email)
83-
assert.EqualValues(t, true, primaryKey1.Emails[0].Verified)
82+
assert.True(t, primaryKey1.Emails[0].Verified)
8483

8584
subKey := primaryKey1.SubsKey[0] //Subkey of 38EA3BCED732982C
8685
assert.EqualValues(t, "70D7C694D17D03AD", subKey.KeyID)
87-
assert.EqualValues(t, 0, len(subKey.Emails))
86+
assert.Empty(t, subKey.Emails)
8887

8988
primaryKey2 := keys[1] //Primary key 2
90-
assert.EqualValues(t, "FABF39739FE1E927", primaryKey2.KeyID)
91-
assert.EqualValues(t, 1, len(primaryKey2.Emails))
92-
assert.EqualValues(t, "user21@example.com", primaryKey2.Emails[0].Email)
93-
assert.EqualValues(t, false, primaryKey2.Emails[0].Verified)
89+
assert.EqualValues(t, "3CEF46EF40BEFC3E", primaryKey2.KeyID)
90+
assert.Len(t, primaryKey2.Emails, 1)
91+
assert.EqualValues(t, "user2-2@example.com", primaryKey2.Emails[0].Email)
92+
assert.False(t, primaryKey2.Emails[0].Verified)
9493

9594
var key api.GPGKey
9695
req = NewRequest(t, "GET", "/api/v1/user/gpg_keys/"+strconv.FormatInt(primaryKey1.ID, 10)+"?token="+token) //Primary key 1
9796
resp = session.MakeRequest(t, req, http.StatusOK)
9897
DecodeJSON(t, resp, &key)
9998
assert.EqualValues(t, "38EA3BCED732982C", key.KeyID)
100-
assert.EqualValues(t, 1, len(key.Emails))
99+
assert.Len(t, key.Emails, 1)
101100
assert.EqualValues(t, "[email protected]", key.Emails[0].Email)
102-
assert.EqualValues(t, true, key.Emails[0].Verified)
101+
assert.True(t, key.Emails[0].Verified)
103102

104103
req = NewRequest(t, "GET", "/api/v1/user/gpg_keys/"+strconv.FormatInt(subKey.ID, 10)+"?token="+token) //Subkey of 38EA3BCED732982C
105104
resp = session.MakeRequest(t, req, http.StatusOK)
106105
DecodeJSON(t, resp, &key)
107106
assert.EqualValues(t, "70D7C694D17D03AD", key.KeyID)
108-
assert.EqualValues(t, 0, len(key.Emails))
107+
assert.Empty(t, key.Emails)
109108

110109
req = NewRequest(t, "GET", "/api/v1/user/gpg_keys/"+strconv.FormatInt(primaryKey2.ID, 10)+"?token="+token) //Primary key 2
111110
resp = session.MakeRequest(t, req, http.StatusOK)
112111
DecodeJSON(t, resp, &key)
113-
assert.EqualValues(t, "FABF39739FE1E927", key.KeyID)
114-
assert.EqualValues(t, 1, len(key.Emails))
115-
assert.EqualValues(t, "user21@example.com", key.Emails[0].Email)
116-
assert.EqualValues(t, false, key.Emails[0].Verified)
112+
assert.EqualValues(t, "3CEF46EF40BEFC3E", key.KeyID)
113+
assert.Len(t, key.Emails, 1)
114+
assert.EqualValues(t, "user2-2@example.com", key.Emails[0].Email)
115+
assert.False(t, key.Emails[0].Verified)
117116

118117
})
119118

@@ -124,23 +123,23 @@ func TestGPGKeys(t *testing.T) {
124123
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo16/branches/not-signed?token="+token)
125124
resp := session.MakeRequest(t, req, http.StatusOK)
126125
DecodeJSON(t, resp, &branch)
127-
assert.EqualValues(t, false, branch.Commit.Verification.Verified)
126+
assert.False(t, branch.Commit.Verification.Verified)
128127
})
129128

130129
t.Run("SignedWithNotValidatedEmail", func(t *testing.T) {
131130
var branch api.Branch
132131
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo16/branches/good-sign-not-yet-validated?token="+token)
133132
resp := session.MakeRequest(t, req, http.StatusOK)
134133
DecodeJSON(t, resp, &branch)
135-
assert.EqualValues(t, false, branch.Commit.Verification.Verified)
134+
assert.False(t, branch.Commit.Verification.Verified)
136135
})
137136

138137
t.Run("SignedWithValidEmail", func(t *testing.T) {
139138
var branch api.Branch
140139
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo16/branches/good-sign?token="+token)
141140
resp := session.MakeRequest(t, req, http.StatusOK)
142141
DecodeJSON(t, resp, &branch)
143-
assert.EqualValues(t, true, branch.Commit.Verification.Verified)
142+
assert.True(t, branch.Commit.Verification.Verified)
144143
})
145144
})
146145
}
@@ -231,35 +230,46 @@ uy6MA3VSB99SK9ducGmE1Jv8mcziREroz2TEGr0zPs6h
231230
}
232231

233232
func testCreateValidSecondaryEmailGPGKey(t *testing.T, makeRequest makeRequestFunc, token string, expected int) {
234-
//User2 <user21@example.com> //secondary and not activated
233+
//User2 <user2-2@example.com> //secondary and not activated
235234
testCreateGPGKey(t, makeRequest, token, expected, `-----BEGIN PGP PUBLIC KEY BLOCK-----
236235
237-
mQENBFmGWN4BCAC18V4tVGO65VLCV7p14FuXJlUtZ5CuYMvgEkcOqrvRaBSW9ao4
238-
PGESOhJpfWpnW3QgJniYndLzPpsmdHEclEER6aZjiNgReWPOjHD5tykWocZAJqXD
239-
eY1ym59gvVMLcfbV2yQsyR2hbJlc+dJsl16tigSEe3nwxZSw2IsW92pgEzT9JNUr
240-
Q+mC8dw4dqY0tYmFazYUGNxufUc/twgQT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261+
jCSR81M145CgCdmLUR1y0pdkN/WIqjXBhkPIvO2dxEcodMNHb1aUUuUOnww6+xIP
262+
8rGVw+a2DUiALc8Qr5RP21AYKRctfiwhSQh2KODveMtyLI3U9C/eLRPp+QM3XB8A
263+
EQEAAYkBvAQYAQgAJhYhBAf2OAzNwWth/Yl5pTzvRu9Avvw+BQJgtitnAhsMBQkD
264+
wmcAAAoJEDzvRu9Avvw+3FcMAJBwupyJ4zwQFxTJ5BkDlusG3U2FXEf3bDrXhvNd
265+
qi8eS8Vo/vRiH/w/my5JFpz1o2tJToryF71D+uF5DTItalKquhsQ9reAEmXggqOh
266+
9Jd9mWJIEEWcRORiLNDKENKvE8bouw4U4hRaSF0IaGzAe5mO+oOvwal8L97wFxrZ
267+
4leM1GzkopiuNfbkkBBw2KJcMjYBHzzXSCALnVwhjbgkBEWPIg38APT3cr9KfnMM
268+
q8+tvsGLj4piAl3Lww7+GhSsDOUXH8btR41BSAQDrbO5q6oi/h4nuxoNmQIDW/Ug
269+
s+dd5hnY2FtHRjb4FCR9kAjdTE6stc8wzohWfbg1N+12TTA2ylByAumICVXixavH
270+
RJ7l0OiWJk388qw9mqh3k8HcBxL7OfDlFC9oPmCS0iYiIwW/Yc80kBhoxcvl/Xa7
271+
mIMMn8taHIaQO7v9ln2EVQYTzbNCmwTw9ovTM0j/Pbkg2EftfP1TCoxQHvBnsCED
272+
6qgtsUdi5eviONRkBgeZtN3oxA==
273+
=MgDv
264274
-----END PGP PUBLIC KEY BLOCK-----`)
265275
}

integrations/api_issue_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func TestAPICreateIssue(t *testing.T) {
6565
resp := session.MakeRequest(t, req, http.StatusCreated)
6666
var apiIssue api.Issue
6767
DecodeJSON(t, resp, &apiIssue)
68-
assert.Equal(t, apiIssue.Body, body)
69-
assert.Equal(t, apiIssue.Title, title)
68+
assert.Equal(t, body, apiIssue.Body)
69+
assert.Equal(t, title, apiIssue.Title)
7070

7171
models.AssertExistsAndLoadBean(t, &models.Issue{
7272
RepoID: repoBefore.ID,

integrations/api_notification_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ func TestAPINotification(t *testing.T) {
4545

4646
assert.Len(t, apiNL, 3)
4747
assert.EqualValues(t, 4, apiNL[0].ID)
48-
assert.EqualValues(t, true, apiNL[0].Unread)
49-
assert.EqualValues(t, false, apiNL[0].Pinned)
48+
assert.True(t, apiNL[0].Unread)
49+
assert.False(t, apiNL[0].Pinned)
5050
assert.EqualValues(t, 3, apiNL[1].ID)
51-
assert.EqualValues(t, false, apiNL[1].Unread)
52-
assert.EqualValues(t, true, apiNL[1].Pinned)
51+
assert.False(t, apiNL[1].Unread)
52+
assert.True(t, apiNL[1].Pinned)
5353
assert.EqualValues(t, 2, apiNL[2].ID)
54-
assert.EqualValues(t, false, apiNL[2].Unread)
55-
assert.EqualValues(t, false, apiNL[2].Pinned)
54+
assert.False(t, apiNL[2].Unread)
55+
assert.False(t, apiNL[2].Pinned)
5656

5757
// -- GET /repos/{owner}/{repo}/notifications --
5858
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/notifications?status-types=unread&token=%s", user2.Name, repo1.Name, token))
@@ -74,8 +74,8 @@ func TestAPINotification(t *testing.T) {
7474
DecodeJSON(t, resp, &apiN)
7575

7676
assert.EqualValues(t, 5, apiN.ID)
77-
assert.EqualValues(t, false, apiN.Pinned)
78-
assert.EqualValues(t, true, apiN.Unread)
77+
assert.False(t, apiN.Pinned)
78+
assert.True(t, apiN.Unread)
7979
assert.EqualValues(t, "issue4", apiN.Subject.Title)
8080
assert.EqualValues(t, "Issue", apiN.Subject.Type)
8181
assert.EqualValues(t, thread5.Issue.APIURL(), apiN.Subject.URL)

integrations/api_oauth2_apps_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func testAPIGetOAuth2Application(t *testing.T) {
123123
assert.EqualValues(t, existApp.ClientID, expectedApp.ClientID)
124124
assert.Len(t, expectedApp.ClientID, 36)
125125
assert.Empty(t, expectedApp.ClientSecret)
126-
assert.EqualValues(t, len(expectedApp.RedirectURIs), 1)
126+
assert.Len(t, expectedApp.RedirectURIs, 1)
127127
assert.EqualValues(t, existApp.RedirectURIs[0], expectedApp.RedirectURIs[0])
128128
models.AssertExistsAndLoadBean(t, &models.OAuth2Application{ID: expectedApp.ID, Name: expectedApp.Name})
129129
}
@@ -156,7 +156,7 @@ func testAPIUpdateOAuth2Application(t *testing.T) {
156156
DecodeJSON(t, resp, &app)
157157
expectedApp := app
158158

159-
assert.EqualValues(t, len(expectedApp.RedirectURIs), 2)
159+
assert.Len(t, expectedApp.RedirectURIs, 2)
160160
assert.EqualValues(t, expectedApp.RedirectURIs[0], appBody.RedirectURIs[0])
161161
assert.EqualValues(t, expectedApp.RedirectURIs[1], appBody.RedirectURIs[1])
162162
models.AssertExistsAndLoadBean(t, &models.OAuth2Application{ID: expectedApp.ID, Name: expectedApp.Name})

integrations/api_org_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestAPIOrgCreate(t *testing.T) {
6969
// user1 on this org is public
7070
var users []*api.User
7171
DecodeJSON(t, resp, &users)
72-
assert.EqualValues(t, 1, len(users))
72+
assert.Len(t, users, 1)
7373
assert.EqualValues(t, "user1", users[0].UserName)
7474
})
7575
}

0 commit comments

Comments
 (0)