Skip to content

Commit 28f689d

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (31 commits) Fix WORK_DIR for docker (root) image (go-gitea#25738) Avoid amending the Rebase and Fast-forward merge if there is no message template (go-gitea#25779) Show edit title button on commits tab of PR, too (go-gitea#25791) Make "install page" respect environment config (go-gitea#25648) Enable H014 and H023 djlint rules (go-gitea#25786) Restructure issue list template, styles (go-gitea#25750) Fix notification list bugs (go-gitea#25781) Revert package access change from go-gitea#23879 (go-gitea#25707) Make route middleware/handler mockable (go-gitea#25766) Update tool dependencies, lock govulncheck and actionlint (go-gitea#25655) Test if container blob is accessible before mounting (go-gitea#22759) Always pass 6-digit hex color to monaco (go-gitea#25780) Fix the wrong default branch name displayed by checkout (go-gitea#25777) Tweak repo topics bar (go-gitea#25769) docs: rootless docker ssh's default port is 2222 (go-gitea#25771) Repository Archived text title center align (go-gitea#25767) Update JS dependencies, misc tweaks (go-gitea#25768) Clarify "text-align" CSS helpers, fix clone button padding (go-gitea#25763) Switch to `vite-string-plugin` (go-gitea#25762) Newly pushed branches hints on repository home page (go-gitea#25715) ...
2 parents 55bdbdd + 5489962 commit 28f689d

File tree

188 files changed

+2828
-1668
lines changed

Some content is hidden

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

188 files changed

+2828
-1668
lines changed

.eslintrc.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins:
2222
- eslint-plugin-wc
2323

2424
env:
25-
es2022: true
25+
es2024: true
2626
node: true
2727

2828
overrides:
@@ -156,7 +156,7 @@ rules:
156156
import/no-restricted-paths: [0]
157157
import/no-self-import: [2]
158158
import/no-unassigned-import: [0]
159-
import/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}]
159+
import/no-unresolved: [2, {commonjs: true, ignore: [\?.+$, ^vitest/]}]
160160
import/no-unused-modules: [2, {unusedExports: true}]
161161
import/no-useless-path-segments: [2, {commonjs: true}]
162162
import/no-webpack-loader-syntax: [2]
@@ -693,7 +693,7 @@ rules:
693693
unicorn/prefer-dom-node-remove: [2]
694694
unicorn/prefer-dom-node-text-content: [2]
695695
unicorn/prefer-event-target: [2]
696-
unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}]
696+
unicorn/prefer-export-from: [0]
697697
unicorn/prefer-includes: [2]
698698
unicorn/prefer-json-parse-buffer: [0]
699699
unicorn/prefer-keyboard-event-key: [2]

.golangci.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ linters-settings:
7777
extra-rules: true
7878
lang-version: "1.20"
7979
depguard:
80-
list-type: denylist
81-
# Check the list against standard lib.
82-
include-go-root: true
83-
packages-with-error-message:
84-
- encoding/json: "use gitea's modules/json instead of encoding/json"
85-
- github.com/unknwon/com: "use gitea's util and replacements"
86-
- io/ioutil: "use os or io instead"
87-
- golang.org/x/exp: "it's experimental and unreliable."
88-
- code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
89-
- gopkg.in/ini.v1: "do not use the ini package, use gitea's config system instead"
80+
rules:
81+
main:
82+
deny:
83+
- pkg: encoding/json
84+
desc: use gitea's modules/json instead of encoding/json
85+
- pkg: github.com/unknwon/com
86+
desc: use gitea's util and replacements
87+
- pkg: io/ioutil
88+
desc: use os or io instead
89+
- pkg: golang.org/x/exp
90+
desc: it's experimental and unreliable
91+
- pkg: code.gitea.io/gitea/modules/git/internal
92+
desc: do not use the internal package, use AddXxx function instead
93+
- pkg: gopkg.in/ini.v1
94+
desc: do not use the ini package, use gitea's config system instead
9095

9196
issues:
9297
max-issues-per-linter: 0

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ wxiaoguang <wxiaoguang@gmail.com> (@wxiaoguang)
5353
Gary Moon <gary@garymoon.net> (@garymoon)
5454
Philip Peterson <philip.c.peterson@gmail.com> (@philip-peterson)
5555
Denys Konovalov <kontakt@denyskon.de> (@denyskon)
56+
Punit Inani <punitinani1@gmail.com> (@puni9869)

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ COMMA := ,
2525

2626
XGO_VERSION := go-1.20.x
2727

28-
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.43.0
28+
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.44.0
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
3030
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.5.0
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
3232
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
3333
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0
37-
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
38-
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest
37+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v0.2.0
38+
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.25
3939

4040
DOCKER_IMAGE ?= gitea/gitea
4141
DOCKER_TAG ?= latest

contrib/environment-to-ini/environment-to-ini.go

+1-30
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ package main
55

66
import (
77
"os"
8-
"strings"
98

109
"code.gitea.io/gitea/modules/log"
1110
"code.gitea.io/gitea/modules/setting"
1211

1312
"github.com/urfave/cli"
1413
)
1514

16-
// EnvironmentPrefix environment variables prefixed with this represent ini values to write
17-
const EnvironmentPrefix = "GITEA"
18-
1915
func main() {
2016
app := cli.NewApp()
2117
app.Name = "environment-to-ini"
@@ -70,15 +66,6 @@ func main() {
7066
Value: "",
7167
Usage: "Destination file to write to",
7268
},
73-
cli.BoolFlag{
74-
Name: "clear",
75-
Usage: "Clears the matched variables from the environment",
76-
},
77-
cli.StringFlag{
78-
Name: "prefix, p",
79-
Value: EnvironmentPrefix,
80-
Usage: "Environment prefix to look for - will be suffixed by __ (2 underscores)",
81-
},
8269
}
8370
app.Action = runEnvironmentToIni
8471
err := app.Run(os.Args)
@@ -99,9 +86,7 @@ func runEnvironmentToIni(c *cli.Context) error {
9986
log.Fatal("Failed to load custom conf '%s': %v", setting.CustomConf, err)
10087
}
10188

102-
prefixGitea := c.String("prefix") + "__"
103-
suffixFile := "__FILE"
104-
changed := setting.EnvironmentToConfig(cfg, prefixGitea, suffixFile, os.Environ())
89+
changed := setting.EnvironmentToConfig(cfg, os.Environ())
10590

10691
// try to save the config file
10792
destination := c.String("out")
@@ -116,19 +101,5 @@ func runEnvironmentToIni(c *cli.Context) error {
116101
}
117102
}
118103

119-
// clear Gitea's specific environment variables if requested
120-
if c.Bool("clear") {
121-
for _, kv := range os.Environ() {
122-
idx := strings.IndexByte(kv, '=')
123-
if idx < 0 {
124-
continue
125-
}
126-
eKey := kv[:idx]
127-
if strings.HasPrefix(eKey, prefixGitea) {
128-
_ = os.Unsetenv(eKey)
129-
}
130-
}
131-
}
132-
133104
return nil
134105
}

docker/root/usr/local/bin/gitea

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
# And place the original in /usr/lib/gitea with working files in /data/gitea
1010
GITEA="/app/gitea/gitea"
11-
WORK_DIR="/app/gitea"
11+
WORK_DIR="/data/gitea"
1212
CUSTOM_PATH="/data/gitea"
1313

1414
# Provide docker defaults

docs/content/doc/installation/with-docker-rootless.en-us.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ services:
119119
- /etc/localtime:/etc/localtime:ro
120120
ports:
121121
- "3000:3000"
122-
- "222:22"
122+
- "2222:2222"
123123
+ depends_on:
124124
+ - db
125125
+
@@ -288,7 +288,7 @@ docker-compose up -d
288288

289289
In addition to the environment variables above, any settings in `app.ini` can be set
290290
or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`.
291-
These settings are applied each time the docker container starts.
291+
These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes.
292292
Full information [here](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini).
293293

294294
These environment variables can be passed to the docker container in `docker-compose.yml`.

docs/content/doc/installation/with-docker.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ docker-compose up -d
289289

290290
In addition to the environment variables above, any settings in `app.ini` can be set
291291
or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`.
292-
These settings are applied each time the docker container starts.
292+
These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes.
293293
Full information [here](https://github.com/go-gitea/gitea/tree/master/contrib/environment-to-ini).
294294

295295
These environment variables can be passed to the docker container in `docker-compose.yml`.

models/activities/notification.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func getIssueNotification(ctx context.Context, userID, issueID int64) (*Notifica
343343
// NotificationsForUser returns notifications for a given user and status
344344
func NotificationsForUser(ctx context.Context, user *user_model.User, statuses []NotificationStatus, page, perPage int) (notifications NotificationList, err error) {
345345
if len(statuses) == 0 {
346-
return
346+
return nil, nil
347347
}
348348

349349
sess := db.GetEngine(ctx).
@@ -372,16 +372,16 @@ func CountUnread(ctx context.Context, userID int64) int64 {
372372
// LoadAttributes load Repo Issue User and Comment if not loaded
373373
func (n *Notification) LoadAttributes(ctx context.Context) (err error) {
374374
if err = n.loadRepo(ctx); err != nil {
375-
return
375+
return err
376376
}
377377
if err = n.loadIssue(ctx); err != nil {
378-
return
378+
return err
379379
}
380380
if err = n.loadUser(ctx); err != nil {
381-
return
381+
return err
382382
}
383383
if err = n.loadComment(ctx); err != nil {
384-
return
384+
return err
385385
}
386386
return err
387387
}

models/asymkey/gpg_key_commit_verification.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,9 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
455455

456456
// CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository
457457
// There are several trust models in Gitea
458-
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) (err error) {
458+
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) error {
459459
if !verification.Verified {
460-
return
460+
return nil
461461
}
462462

463463
// In the Committer trust model a signature is trusted if it matches the committer
@@ -475,7 +475,7 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
475475
verification.SigningUser.Email == verification.CommittingUser.Email) {
476476
verification.TrustStatus = "trusted"
477477
}
478-
return
478+
return nil
479479
}
480480

481481
// Now we drop to the more nuanced trust models...
@@ -490,10 +490,11 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
490490
verification.SigningUser.Email != verification.CommittingUser.Email) {
491491
verification.TrustStatus = "untrusted"
492492
}
493-
return
493+
return nil
494494
}
495495

496496
// Check we actually have a GPG SigningKey
497+
var err error
497498
if verification.SigningKey != nil {
498499
var isMember bool
499500
if keyMap != nil {

models/asymkey/gpg_key_common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func populateHash(hashFunc crypto.Hash, msg []byte) (hash.Hash, error) {
111111
func readArmoredSign(r io.Reader) (body io.Reader, err error) {
112112
block, err := armor.Decode(r)
113113
if err != nil {
114-
return
114+
return nil, err
115115
}
116116
if block.Type != openpgp.SignatureType {
117117
return nil, fmt.Errorf("expected '" + openpgp.SignatureType + "', got: " + block.Type)

models/auth/oauth2.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ func (code *OAuth2AuthorizationCode) TableName() string {
306306
}
307307

308308
// GenerateRedirectURI generates a redirect URI for a successful authorization request. State will be used if not empty.
309-
func (code *OAuth2AuthorizationCode) GenerateRedirectURI(state string) (redirect *url.URL, err error) {
310-
if redirect, err = url.Parse(code.RedirectURI); err != nil {
311-
return
309+
func (code *OAuth2AuthorizationCode) GenerateRedirectURI(state string) (*url.URL, error) {
310+
redirect, err := url.Parse(code.RedirectURI)
311+
if err != nil {
312+
return nil, err
312313
}
313314
q := redirect.Query()
314315
if state != "" {

models/fixtures/org_user.yml

+18
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,21 @@
8181
uid: 5
8282
org_id: 23
8383
is_public: false
84+
85+
-
86+
id: 15
87+
uid: 1
88+
org_id: 35
89+
is_public: true
90+
91+
-
92+
id: 16
93+
uid: 1
94+
org_id: 36
95+
is_public: true
96+
97+
-
98+
id: 17
99+
uid: 5
100+
org_id: 36
101+
is_public: true

models/fixtures/team.yml

+33
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,36 @@
184184
num_members: 1
185185
includes_all_repositories: false
186186
can_create_org_repo: true
187+
188+
-
189+
id: 18
190+
org_id: 35
191+
lower_name: owners
192+
name: Owners
193+
authorize: 4 # owner
194+
num_repos: 0
195+
num_members: 1
196+
includes_all_repositories: false
197+
can_create_org_repo: true
198+
199+
-
200+
id: 19
201+
org_id: 36
202+
lower_name: owners
203+
name: Owners
204+
authorize: 4 # owner
205+
num_repos: 0
206+
num_members: 1
207+
includes_all_repositories: false
208+
can_create_org_repo: true
209+
210+
-
211+
id: 20
212+
org_id: 36
213+
lower_name: team20writepackage
214+
name: team20writepackage
215+
authorize: 1
216+
num_repos: 0
217+
num_members: 1
218+
includes_all_repositories: false
219+
can_create_org_repo: true

models/fixtures/team_unit.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,10 @@
273273
id: 46
274274
team_id: 17
275275
type: 9 # package
276-
access_mode: 0
276+
access_mode: 2
277+
278+
-
279+
id: 47
280+
team_id: 20
281+
type: 9 # package
282+
access_mode: 2

models/fixtures/team_user.yml

+18
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,21 @@
105105
org_id: 23
106106
team_id: 17
107107
uid: 5
108+
109+
-
110+
id: 19
111+
org_id: 35
112+
team_id: 18
113+
uid: 1
114+
115+
-
116+
id: 20
117+
org_id: 36
118+
team_id: 19
119+
uid: 1
120+
121+
-
122+
id: 21
123+
org_id: 36
124+
team_id: 20
125+
uid: 5

0 commit comments

Comments
 (0)