Skip to content

Commit 6fba177

Browse files
committed
Merge commit '82a0c36332824b8ab41efdf6503e86170ce92f08' into main_multiple_projects
2 parents 3d1e916 + 82a0c36 commit 6fba177

File tree

222 files changed

+5507
-2454
lines changed

Some content is hidden

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

222 files changed

+5507
-2454
lines changed

.eslintrc.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,21 @@ rules:
127127
"@stylistic/js/computed-property-spacing": [2, never]
128128
"@stylistic/js/dot-location": [2, property]
129129
"@stylistic/js/eol-last": [2]
130-
"@stylistic/js/function-call-spacing": [2, never]
131130
"@stylistic/js/function-call-argument-newline": [0]
131+
"@stylistic/js/function-call-spacing": [2, never]
132132
"@stylistic/js/function-paren-newline": [0]
133133
"@stylistic/js/generator-star-spacing": [0]
134134
"@stylistic/js/implicit-arrow-linebreak": [0]
135135
"@stylistic/js/indent": [2, 2, {ignoreComments: true, SwitchCase: 1}]
136136
"@stylistic/js/key-spacing": [2]
137137
"@stylistic/js/keyword-spacing": [2]
138+
"@stylistic/js/line-comment-position": [0]
138139
"@stylistic/js/linebreak-style": [2, unix]
139140
"@stylistic/js/lines-around-comment": [0]
140141
"@stylistic/js/lines-between-class-members": [0]
141142
"@stylistic/js/max-len": [0]
142143
"@stylistic/js/max-statements-per-line": [0]
144+
"@stylistic/js/multiline-comment-style": [0]
143145
"@stylistic/js/multiline-ternary": [0]
144146
"@stylistic/js/new-parens": [2]
145147
"@stylistic/js/newline-per-chained-call": [0]
@@ -705,6 +707,7 @@ rules:
705707
unicorn/better-regex: [0]
706708
unicorn/catch-error-name: [0]
707709
unicorn/consistent-destructuring: [2]
710+
unicorn/consistent-empty-array-spread: [2]
708711
unicorn/consistent-function-scoping: [2]
709712
unicorn/custom-error-definition: [0]
710713
unicorn/empty-brace-spaces: [2]
@@ -731,9 +734,11 @@ rules:
731734
unicorn/no-for-loop: [0]
732735
unicorn/no-hex-escape: [0]
733736
unicorn/no-instanceof-array: [0]
737+
unicorn/no-invalid-fetch-options: [2]
734738
unicorn/no-invalid-remove-event-listener: [2]
735739
unicorn/no-keyword-prefix: [0]
736740
unicorn/no-lonely-if: [2]
741+
unicorn/no-magic-array-flat-depth: [0]
737742
unicorn/no-negated-condition: [0]
738743
unicorn/no-nested-ternary: [0]
739744
unicorn/no-new-array: [0]
@@ -799,10 +804,12 @@ rules:
799804
unicorn/prefer-set-has: [0]
800805
unicorn/prefer-set-size: [2]
801806
unicorn/prefer-spread: [0]
807+
unicorn/prefer-string-raw: [0]
802808
unicorn/prefer-string-replace-all: [0]
803809
unicorn/prefer-string-slice: [0]
804810
unicorn/prefer-string-starts-ends-with: [2]
805811
unicorn/prefer-string-trim-start-end: [2]
812+
unicorn/prefer-structured-clone: [2]
806813
unicorn/prefer-switch: [0]
807814
unicorn/prefer-ternary: [0]
808815
unicorn/prefer-text-content: [2]

.golangci.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ run:
2929

3030
output:
3131
sort-results: true
32+
sort-order: [file]
33+
show-stats: true
3234

3335
linters-settings:
3436
stylecheck:
@@ -40,11 +42,7 @@ linters-settings:
4042
- ifElseChain
4143
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
4244
revive:
43-
ignore-generated-header: false
44-
severity: warning
45-
confidence: 0.8
46-
errorCode: 1
47-
warningCode: 1
45+
severity: error
4846
rules:
4947
- name: atomic
5048
- name: bare-return

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ kerwin612 <[email protected]> (@kerwin612)
6161
Gary Wang <[email protected]> (@BLumia)
6262
Tim-Niclas Oelschläger <[email protected]> (@zokkis)
6363
Yu Liu <[email protected]> (@HEREYUA)
64+
Kemal Zebari <[email protected]> (@kemzeb)

cmd/hook.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ Gitea or set your environment appropriately.`, "")
220220
}
221221
}
222222

223-
supportProcReceive := false
224-
if git.CheckGitVersionAtLeast("2.29") == nil {
225-
supportProcReceive = true
226-
}
223+
supportProcReceive := git.DefaultFeatures().SupportProcReceive
227224

228225
for scanner.Scan() {
229226
// TODO: support news feeds for wiki
@@ -341,6 +338,7 @@ Gitea or set your environment appropriately.`, "")
341338
isWiki, _ := strconv.ParseBool(os.Getenv(repo_module.EnvRepoIsWiki))
342339
repoName := os.Getenv(repo_module.EnvRepoName)
343340
pusherID, _ := strconv.ParseInt(os.Getenv(repo_module.EnvPusherID), 10, 64)
341+
prID, _ := strconv.ParseInt(os.Getenv(repo_module.EnvPRID), 10, 64)
344342
pusherName := os.Getenv(repo_module.EnvPusherName)
345343

346344
hookOptions := private.HookOptions{
@@ -350,6 +348,8 @@ Gitea or set your environment appropriately.`, "")
350348
GitObjectDirectory: os.Getenv(private.GitObjectDirectory),
351349
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
352350
GitPushOptions: pushOptions(),
351+
PullRequestID: prID,
352+
PushTrigger: repo_module.PushTrigger(os.Getenv(repo_module.EnvPushTrigger)),
353353
}
354354
oldCommitIDs := make([]string, hookBatchSize)
355355
newCommitIDs := make([]string, hookBatchSize)
@@ -497,7 +497,7 @@ Gitea or set your environment appropriately.`, "")
497497
return nil
498498
}
499499

500-
if git.CheckGitVersionAtLeast("2.29") != nil {
500+
if !git.DefaultFeatures().SupportProcReceive {
501501
return fail(ctx, "No proc-receive support", "current git version doesn't support proc-receive.")
502502
}
503503

cmd/migrate_storage.go

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var CmdMigrateStorage = &cli.Command{
3434
Name: "type",
3535
Aliases: []string{"t"},
3636
Value: "",
37-
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'",
37+
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log', 'actions-artifacts",
3838
},
3939
&cli.StringFlag{
4040
Name: "storage",
@@ -91,6 +91,11 @@ var CmdMigrateStorage = &cli.Command{
9191
Value: "",
9292
Usage: "Minio checksum algorithm (default/md5)",
9393
},
94+
&cli.StringFlag{
95+
Name: "minio-bucket-lookup-type",
96+
Value: "",
97+
Usage: "Minio bucket lookup type",
98+
},
9499
},
95100
}
96101

@@ -160,6 +165,13 @@ func migrateActionsLog(ctx context.Context, dstStorage storage.ObjectStorage) er
160165
})
161166
}
162167

168+
func migrateActionsArtifacts(ctx context.Context, dstStorage storage.ObjectStorage) error {
169+
return db.Iterate(ctx, nil, func(ctx context.Context, artifact *actions_model.ActionArtifact) error {
170+
_, err := storage.Copy(dstStorage, artifact.ArtifactPath, storage.ActionsArtifacts, artifact.ArtifactPath)
171+
return err
172+
})
173+
}
174+
163175
func runMigrateStorage(ctx *cli.Context) error {
164176
stdCtx, cancel := installSignals()
165177
defer cancel()
@@ -213,6 +225,7 @@ func runMigrateStorage(ctx *cli.Context) error {
213225
UseSSL: ctx.Bool("minio-use-ssl"),
214226
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
215227
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
228+
BucketLookUpType: ctx.String("minio-bucket-lookup-type"),
216229
},
217230
})
218231
default:
@@ -223,13 +236,14 @@ func runMigrateStorage(ctx *cli.Context) error {
223236
}
224237

225238
migratedMethods := map[string]func(context.Context, storage.ObjectStorage) error{
226-
"attachments": migrateAttachments,
227-
"lfs": migrateLFS,
228-
"avatars": migrateAvatars,
229-
"repo-avatars": migrateRepoAvatars,
230-
"repo-archivers": migrateRepoArchivers,
231-
"packages": migratePackages,
232-
"actions-log": migrateActionsLog,
239+
"attachments": migrateAttachments,
240+
"lfs": migrateLFS,
241+
"avatars": migrateAvatars,
242+
"repo-avatars": migrateRepoAvatars,
243+
"repo-archivers": migrateRepoArchivers,
244+
"packages": migratePackages,
245+
"actions-log": migrateActionsLog,
246+
"actions-artifacts": migrateActionsArtifacts,
233247
}
234248

235249
tp := strings.ToLower(ctx.String("type"))

cmd/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func runServ(c *cli.Context) error {
178178
}
179179

180180
if len(words) < 2 {
181-
if git.CheckGitVersionAtLeast("2.29") == nil {
181+
if git.DefaultFeatures().SupportProcReceive {
182182
// for AGit Flow
183183
if cmd == "ssh_info" {
184184
fmt.Print(`{"type":"gitea","version":1}`)

custom/conf/app.example.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,9 @@ LEVEL = Info
18951895
;;
18961896
;; Minio checksum algorithm: default (for MinIO or AWS S3) or md5 (for Cloudflare or Backblaze)
18971897
;MINIO_CHECKSUM_ALGORITHM = default
1898+
;;
1899+
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1900+
;MINIO_BUCKET_LOOKUP_TYPE = auto
18981901

18991902
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19001903
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2576,6 +2579,9 @@ LEVEL = Info
25762579
;;
25772580
;; Minio skip SSL verification available when STORAGE_TYPE is `minio`
25782581
;MINIO_INSECURE_SKIP_VERIFY = false
2582+
;;
2583+
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
2584+
;MINIO_BUCKET_LOOKUP_TYPE = auto
25792585

25802586
;[proxy]
25812587
;; Enable the proxy, all requests to external via HTTP will be affected

docker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Gitea - Docker
22

3-
Dockerfile is found in root of repository.
3+
Dockerfile is found in the root of the repository.
44

5-
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
5+
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea).
66

7-
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless)
7+
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless).

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ Default templates for project boards:
851851
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when STORAGE_TYPE is `minio`
852852
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
853853
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio checksum algorithm: `default` (for MinIO or AWS S3) or `md5` (for Cloudflare or Backblaze)
854+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
854855

855856
## Log (`log`)
856857

@@ -1272,6 +1273,7 @@ is `data/lfs` and the default of `MINIO_BASE_PATH` is `lfs/`.
12721273
- `MINIO_BASE_PATH`: **lfs/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
12731274
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
12741275
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1276+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
12751277

12761278
## Storage (`storage`)
12771279

@@ -1286,6 +1288,7 @@ Default storage configuration for attachments, lfs, avatars, repo-avatars, repo-
12861288
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
12871289
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
12881290
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1291+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
12891292

12901293
The recommended storage configuration for minio like below:
12911294

@@ -1307,6 +1310,8 @@ MINIO_USE_SSL = false
13071310
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
13081311
MINIO_INSECURE_SKIP_VERIFY = false
13091312
SERVE_DIRECT = true
1313+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1314+
MINIO_BUCKET_LOOKUP_TYPE = auto
13101315
```
13111316

13121317
Defaultly every storage has their default base path like below
@@ -1353,6 +1358,8 @@ MINIO_LOCATION = us-east-1
13531358
MINIO_USE_SSL = false
13541359
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
13551360
MINIO_INSECURE_SKIP_VERIFY = false
1361+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1362+
MINIO_BUCKET_LOOKUP_TYPE = auto
13561363
```
13571364

13581365
## Repository Archive Storage (`storage.repo-archive`)
@@ -1372,6 +1379,7 @@ is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
13721379
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
13731380
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
13741381
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1382+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
13751383

13761384
## Repository Archives (`repo-archive`)
13771385

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ Gitea 创建以下非唯一队列:
796796
- `MINIO_USE_SSL`: **false**: Minio 启用 SSL,仅当 STORAGE_TYPE 为 `minio` 时可用。
797797
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio 跳过 SSL 验证,仅当 STORAGE_TYPE 为 `minio` 时可用。
798798
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio 校验算法:`default`(适用于 MinIO 或 AWS S3)或 `md5`(适用于 Cloudflare 或 Backblaze)
799+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
799800

800801
## 日志 (`log`)
801802

@@ -1201,6 +1202,7 @@ ALLOW_DATA_URI_IMAGES = true
12011202
- `MINIO_BASE_PATH`**lfs/**:桶上的 Minio 基本路径,仅在 `STORAGE_TYPE``minio` 时可用。
12021203
- `MINIO_USE_SSL`**false**:Minio 启用 ssl,仅在 `STORAGE_TYPE``minio` 时可用。
12031204
- `MINIO_INSECURE_SKIP_VERIFY`**false**:Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
1205+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
12041206

12051207
## 存储 (`storage`)
12061208

@@ -1215,6 +1217,7 @@ ALLOW_DATA_URI_IMAGES = true
12151217
- `MINIO_LOCATION`**us-east-1**:创建桶的 Minio 位置,仅在 `STORAGE_TYPE``minio` 时可用。
12161218
- `MINIO_USE_SSL`**false**:Minio 启用 ssl,仅在 `STORAGE_TYPE``minio` 时可用。
12171219
- `MINIO_INSECURE_SKIP_VERIFY`**false**:Minio 跳过 SSL 验证,仅在 `STORAGE_TYPE``minio` 时可用。
1220+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
12181221

12191222
建议的 minio 存储配置如下:
12201223

@@ -1236,6 +1239,8 @@ MINIO_USE_SSL = false
12361239
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
12371240
MINIO_INSECURE_SKIP_VERIFY = false
12381241
SERVE_DIRECT = true
1242+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1243+
MINIO_BUCKET_LOOKUP_TYPE = auto
12391244
```
12401245

12411246
默认情况下,每个存储都有其默认的基本路径,如下所示:
@@ -1282,6 +1287,8 @@ MINIO_LOCATION = us-east-1
12821287
MINIO_USE_SSL = false
12831288
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
12841289
MINIO_INSECURE_SKIP_VERIFY = false
1290+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1291+
MINIO_BUCKET_LOOKUP_TYPE = auto
12851292
```
12861293

12871294
### 存储库归档存储 (`storage.repo-archive`)
@@ -1299,6 +1306,7 @@ MINIO_INSECURE_SKIP_VERIFY = false
12991306
- `MINIO_BASE_PATH`: **repo-archive/**:存储桶上的Minio基本路径,仅在`STORAGE_TYPE``minio`时可用。
13001307
- `MINIO_USE_SSL`: **false**:启用Minio的SSL,仅在`STORAGE_TYPE``minio`时可用。
13011308
- `MINIO_INSECURE_SKIP_VERIFY`: **false**:跳过Minio的SSL验证,仅在`STORAGE_TYPE``minio`时可用。
1309+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio的bucket查找方式默认为`auto`模式,可将其设置为`dns`(虚拟托管样式)或`path`(路径样式),仅当`STORAGE_TYPE``minio`时可用。
13021310

13031311
### 存储库归档 (`repo-archive`)
13041312

0 commit comments

Comments
 (0)