Skip to content

Commit b1efeae

Browse files
authored
Merge branch 'main' into refactor-commit-list-page-group-by-date
2 parents b9dfd3e + d1a3bd6 commit b1efeae

File tree

142 files changed

+2831
-774
lines changed

Some content is hidden

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

142 files changed

+2831
-774
lines changed

.github/workflows/release-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
uses: docker/build-push-action@v5
100100
with:
101101
context: .
102-
platforms: linux/amd64,linux/arm64
102+
platforms: linux/amd64,linux/arm64,linux/riscv64
103103
push: true
104104
tags: |-
105105
gitea/gitea:${{ steps.clean_name.outputs.branch }}

.github/workflows/release-tag-rc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
uses: docker/build-push-action@v5
105105
with:
106106
context: .
107-
platforms: linux/amd64,linux/arm64
107+
platforms: linux/amd64,linux/arm64,linux/riscv64
108108
push: true
109109
tags: ${{ steps.meta.outputs.tags }}
110110
labels: ${{ steps.meta.outputs.labels }}
@@ -147,7 +147,7 @@ jobs:
147147
uses: docker/build-push-action@v5
148148
with:
149149
context: .
150-
platforms: linux/amd64,linux/arm64
150+
platforms: linux/amd64,linux/arm64,linux/riscv64
151151
push: true
152152
file: Dockerfile.rootless
153153
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/release-tag-version.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
uses: docker/build-push-action@v5
113113
with:
114114
context: .
115-
platforms: linux/amd64,linux/arm64
115+
platforms: linux/amd64,linux/arm64,linux/riscv64
116116
push: true
117117
tags: ${{ steps.meta.outputs.tags }}
118118
labels: ${{ steps.meta.outputs.labels }}
@@ -158,7 +158,7 @@ jobs:
158158
uses: docker/build-push-action@v5
159159
with:
160160
context: .
161-
platforms: linux/amd64,linux/arm64
161+
platforms: linux/amd64,linux/arm64,linux/riscv64
162162
push: true
163163
file: Dockerfile.rootless
164164
tags: ${{ steps.meta.outputs.tags }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ endif
110110

111111
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
112112

113-
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
113+
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64
114114

115115
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/))
116116
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...)

assets/go-licenses.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/admin_user_create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ var microcmdUserCreate = &cli.Command{
8181
Name: "restricted",
8282
Usage: "Make a restricted user account",
8383
},
84+
&cli.StringFlag{
85+
Name: "fullname",
86+
Usage: `The full, human-readable name of the user`,
87+
},
8488
},
8589
}
8690

@@ -191,6 +195,7 @@ func runCreateUser(c *cli.Context) error {
191195
Passwd: password,
192196
MustChangePassword: mustChangePassword,
193197
Visibility: visibility,
198+
FullName: c.String("fullname"),
194199
}
195200

196201
overwriteDefault := &user_model.CreateUserOverwriteOptions{

cmd/admin_user_create_test.go

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ func TestAdminUserCreate(t *testing.T) {
5050
assert.Equal(t, check{IsAdmin: false, MustChangePassword: false}, createCheck("u5", "--must-change-password=false"))
5151
})
5252

53-
createUser := func(name, args string) error {
54-
return app.Run(strings.Fields(fmt.Sprintf("./gitea admin user create --username %s --email %s@gitea.local %s", name, name, args)))
53+
createUser := func(name string, args ...string) error {
54+
return app.Run(append([]string{"./gitea", "admin", "user", "create", "--username", name, "--email", name + "@gitea.local"}, args...))
5555
}
5656

5757
t.Run("UserType", func(t *testing.T) {
5858
reset()
59-
assert.ErrorContains(t, createUser("u", "--user-type invalid"), "invalid user type")
60-
assert.ErrorContains(t, createUser("u", "--user-type bot --password 123"), "can only be set for individual users")
61-
assert.ErrorContains(t, createUser("u", "--user-type bot --must-change-password"), "can only be set for individual users")
59+
assert.ErrorContains(t, createUser("u", "--user-type", "invalid"), "invalid user type")
60+
assert.ErrorContains(t, createUser("u", "--user-type", "bot", "--password", "123"), "can only be set for individual users")
61+
assert.ErrorContains(t, createUser("u", "--user-type", "bot", "--must-change-password"), "can only be set for individual users")
6262

63-
assert.NoError(t, createUser("u", "--user-type bot"))
63+
assert.NoError(t, createUser("u", "--user-type", "bot"))
6464
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{LowerName: "u"})
6565
assert.Equal(t, user_model.UserTypeBot, u.Type)
6666
assert.Empty(t, u.Passwd)
@@ -75,7 +75,7 @@ func TestAdminUserCreate(t *testing.T) {
7575

7676
// using "--access-token" only means "all" access
7777
reset()
78-
assert.NoError(t, createUser("u", "--random-password --access-token"))
78+
assert.NoError(t, createUser("u", "--random-password", "--access-token"))
7979
assert.Equal(t, 1, unittest.GetCount(t, &user_model.User{}))
8080
assert.Equal(t, 1, unittest.GetCount(t, &auth_model.AccessToken{}))
8181
accessToken := unittest.AssertExistsAndLoadBean(t, &auth_model.AccessToken{Name: "gitea-admin"})
@@ -85,7 +85,7 @@ func TestAdminUserCreate(t *testing.T) {
8585

8686
// using "--access-token" with name & scopes
8787
reset()
88-
assert.NoError(t, createUser("u", "--random-password --access-token --access-token-name new-token-name --access-token-scopes read:issue,read:user"))
88+
assert.NoError(t, createUser("u", "--random-password", "--access-token", "--access-token-name", "new-token-name", "--access-token-scopes", "read:issue,read:user"))
8989
assert.Equal(t, 1, unittest.GetCount(t, &user_model.User{}))
9090
assert.Equal(t, 1, unittest.GetCount(t, &auth_model.AccessToken{}))
9191
accessToken = unittest.AssertExistsAndLoadBean(t, &auth_model.AccessToken{Name: "new-token-name"})
@@ -98,23 +98,38 @@ func TestAdminUserCreate(t *testing.T) {
9898

9999
// using "--access-token-name" without "--access-token"
100100
reset()
101-
err = createUser("u", "--random-password --access-token-name new-token-name")
101+
err = createUser("u", "--random-password", "--access-token-name", "new-token-name")
102102
assert.Equal(t, 0, unittest.GetCount(t, &user_model.User{}))
103103
assert.Equal(t, 0, unittest.GetCount(t, &auth_model.AccessToken{}))
104104
assert.ErrorContains(t, err, "access-token-name and access-token-scopes flags are only valid when access-token flag is set")
105105

106106
// using "--access-token-scopes" without "--access-token"
107107
reset()
108-
err = createUser("u", "--random-password --access-token-scopes read:issue")
108+
err = createUser("u", "--random-password", "--access-token-scopes", "read:issue")
109109
assert.Equal(t, 0, unittest.GetCount(t, &user_model.User{}))
110110
assert.Equal(t, 0, unittest.GetCount(t, &auth_model.AccessToken{}))
111111
assert.ErrorContains(t, err, "access-token-name and access-token-scopes flags are only valid when access-token flag is set")
112112

113113
// empty permission
114114
reset()
115-
err = createUser("u", "--random-password --access-token --access-token-scopes public-only")
115+
err = createUser("u", "--random-password", "--access-token", "--access-token-scopes", "public-only")
116116
assert.Equal(t, 0, unittest.GetCount(t, &user_model.User{}))
117117
assert.Equal(t, 0, unittest.GetCount(t, &auth_model.AccessToken{}))
118118
assert.ErrorContains(t, err, "access token does not have any permission")
119119
})
120+
121+
t.Run("UserFields", func(t *testing.T) {
122+
reset()
123+
assert.NoError(t, createUser("u-FullNameWithSpace", "--random-password", "--fullname", "First O'Middle Last"))
124+
unittest.AssertExistsAndLoadBean(t, &user_model.User{
125+
Name: "u-FullNameWithSpace",
126+
LowerName: "u-fullnamewithspace",
127+
FullName: "First O'Middle Last",
128+
129+
})
130+
131+
assert.NoError(t, createUser("u-FullNameEmpty", "--random-password", "--fullname", ""))
132+
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{LowerName: "u-fullnameempty"})
133+
assert.Empty(t, u.FullName)
134+
})
120135
}

custom/conf/app.example.ini

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,16 @@ RUN_USER = ; git
5959
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6060
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6161
;;
62-
;; The protocol the server listens on. One of 'http', 'https', 'http+unix', 'fcgi' or 'fcgi+unix'. Defaults to 'http'
63-
;; Note: Value must be lowercase.
62+
;; The protocol the server listens on. One of "http", "https", "http+unix", "fcgi" or "fcgi+unix".
6463
;PROTOCOL = http
6564
;;
66-
;; Expect PROXY protocol headers on connections
67-
;USE_PROXY_PROTOCOL = false
68-
;;
69-
;; Use PROXY protocol in TLS Bridging mode
70-
;PROXY_PROTOCOL_TLS_BRIDGING = false
71-
;;
72-
; Timeout to wait for PROXY protocol header (set to 0 to have no timeout)
73-
;PROXY_PROTOCOL_HEADER_TIMEOUT=5s
74-
;;
75-
; Accept PROXY protocol headers with UNKNOWN type
76-
;PROXY_PROTOCOL_ACCEPT_UNKNOWN=false
77-
;;
78-
;; Set the domain for the server
65+
;; Set the domain for the server.
66+
;; Most users should set it to the real website domain of their Gitea instance.
7967
;DOMAIN = localhost
8068
;;
8169
;; The AppURL used by Gitea to generate absolute links, defaults to "{PROTOCOL}://{DOMAIN}:{HTTP_PORT}/".
82-
;; Most users should set it to the real website URL of their Gitea instance.
70+
;; Most users should set it to the real website URL of their Gitea instance when there is a reverse proxy.
71+
;; When it is empty, Gitea will use HTTP "Host" header to generate ROOT_URL, and fall back to the default one if no "Host" header.
8372
;ROOT_URL =
8473
;;
8574
;; For development purpose only. It makes Gitea handle sub-path ("/sub-path/owner/repo/...") directly when debugging without a reverse proxy.
@@ -90,13 +79,25 @@ RUN_USER = ; git
9079
;STATIC_URL_PREFIX =
9180
;;
9281
;; The address to listen on. Either a IPv4/IPv6 address or the path to a unix socket.
93-
;; If PROTOCOL is set to `http+unix` or `fcgi+unix`, this should be the name of the Unix socket file to use.
82+
;; If PROTOCOL is set to "http+unix" or "fcgi+unix", this should be the name of the Unix socket file to use.
9483
;; Relative paths will be made absolute against the _`AppWorkPath`_.
9584
;HTTP_ADDR = 0.0.0.0
9685
;;
97-
;; The port to listen on. Leave empty when using a unix socket.
86+
;; The port to listen on for "http" or "https" protocol. Leave empty when using a unix socket.
9887
;HTTP_PORT = 3000
9988
;;
89+
;; Expect PROXY protocol headers on connections
90+
;USE_PROXY_PROTOCOL = false
91+
;;
92+
;; Use PROXY protocol in TLS Bridging mode
93+
;PROXY_PROTOCOL_TLS_BRIDGING = false
94+
;;
95+
;; Timeout to wait for PROXY protocol header (set to 0 to have no timeout)
96+
;PROXY_PROTOCOL_HEADER_TIMEOUT = 5s
97+
;;
98+
;; Accept PROXY protocol headers with UNKNOWN type
99+
;PROXY_PROTOCOL_ACCEPT_UNKNOWN = false
100+
;;
100101
;; If REDIRECT_OTHER_PORT is true, and PROTOCOL is set to https an http server
101102
;; will be started on PORT_TO_REDIRECT and it will redirect plain, non-secure http requests to the main
102103
;; ROOT_URL. Defaults are false for REDIRECT_OTHER_PORT and 80 for
@@ -940,7 +941,29 @@ LEVEL = Info
940941
;;
941942
;; Disable the code explore page.
942943
;DISABLE_CODE_PAGE = false
944+
945+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
946+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
947+
;[qos]
948+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
949+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
950+
;;
951+
;; Enable request quality of service and overload protection.
952+
; ENABLED = false
943953
;;
954+
;; The maximum number of concurrent requests that the server will
955+
;; process before enqueueing new requests. Default is "CpuNum * 4".
956+
; MAX_INFLIGHT =
957+
;;
958+
;; The maximum number of requests that can be enqueued before new
959+
;; requests will be dropped.
960+
; MAX_WAITING = 100
961+
;;
962+
;; Target maximum wait time a request may be enqueued for. Requests
963+
;; that are enqueued for less than this amount of time will not be
964+
;; dropped. When wait times exceed this amount, a portion of requests
965+
;; will be dropped until wait times have decreased below this amount.
966+
; TARGET_WAIT_TIME = 250ms
944967

945968
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
946969
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1423,7 +1446,6 @@ LEVEL = Info
14231446
;; or use comma separated list: inline-dollar, inline-parentheses, block-dollar, block-square-brackets
14241447
;; Defaults to "inline-dollar,block-dollar" to follow GitHub's behavior.
14251448
;MATH_CODE_BLOCK_DETECTION =
1426-
;;
14271449

14281450
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14291451
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docker/manifest.rootless.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ manifests:
2222
architecture: arm64
2323
os: linux
2424
variant: v8
25+
-
26+
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-riscv64-rootless
27+
platform:
28+
architecture: riscv64
29+
os: linux

docker/manifest.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ manifests:
2222
architecture: arm64
2323
os: linux
2424
variant: v8
25+
-
26+
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-riscv64
27+
platform:
28+
architecture: riscv64
29+
os: linux

0 commit comments

Comments
 (0)