Skip to content

Commit e0ce701

Browse files
committed
Merge branch 'main' into lunny/fix_dl_btn
2 parents 9815cf9 + 2b4d43d commit e0ce701

File tree

112 files changed

+1336
-2543
lines changed

Some content is hidden

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

112 files changed

+1336
-2543
lines changed

cmd/doctor.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"code.gitea.io/gitea/models/db"
1515
"code.gitea.io/gitea/models/migrations"
1616
"code.gitea.io/gitea/modules/doctor"
17+
"code.gitea.io/gitea/modules/git"
1718
"code.gitea.io/gitea/modules/log"
1819
"code.gitea.io/gitea/modules/setting"
1920

@@ -124,13 +125,18 @@ func runRecreateTable(ctx *cli.Context) error {
124125
}
125126

126127
func runDoctor(ctx *cli.Context) error {
128+
stdCtx, cancel := installSignals()
129+
defer cancel()
130+
131+
// some doctor sub-commands need to use git command
132+
if err := git.InitFull(stdCtx); err != nil {
133+
return err
134+
}
135+
127136
// Silence the default loggers
128137
log.DelNamedLogger("console")
129138
log.DelNamedLogger(log.DEFAULT)
130139

131-
stdCtx, cancel := installSignals()
132-
defer cancel()
133-
134140
// Now setup our own
135141
logFile := ctx.String("log-file")
136142
if !ctx.IsSet("log-file") {

contrib/pr/checkout.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ func runPR() {
8080
setting.RunUser = curUser.Username
8181

8282
log.Printf("[PR] Loading fixtures data ...\n")
83-
gitea_git.CheckLFSVersion()
8483
//models.LoadConfigs()
8584
/*
8685
setting.Database.Type = "sqlite3"

custom/conf/app.example.ini

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,11 @@ ROUTER = console
698698
;; Enable captcha validation for registration
699699
;ENABLE_CAPTCHA = false
700700
;;
701-
;; Type of captcha you want to use. Options: image, recaptcha, hcaptcha
701+
;; Type of captcha you want to use. Options: image, recaptcha, hcaptcha, mcaptcha.
702702
;CAPTCHA_TYPE = image
703703
;;
704+
;; Change this to use recaptcha.net or other recaptcha service
705+
;RECAPTCHA_URL = https://www.google.com/recaptcha/
704706
;; Enable recaptcha to use Google's recaptcha service
705707
;; Go to https://www.google.com/recaptcha/admin to sign up for a key
706708
;RECAPTCHA_SECRET =
@@ -710,8 +712,13 @@ ROUTER = console
710712
;HCAPTCHA_SECRET =
711713
;HCAPTCHA_SITEKEY =
712714
;;
713-
;; Change this to use recaptcha.net or other recaptcha service
714-
;RECAPTCHA_URL = https://www.google.com/recaptcha/
715+
;; Change this to use demo.mcaptcha.org or your self-hosted mcaptcha.org instance.
716+
;MCAPTCHA_URL = https://demo.mcaptcha.org
717+
;;
718+
;; Go to your configured mCaptcha instance and register a sitekey
719+
;; and use your account's secret.
720+
;MCAPTCHA_SECRET =
721+
;MCAPTCHA_SITEKEY =
715722
;;
716723
;; Default value for KeepEmailPrivate
717724
;; Each new user will get the value of this setting copied into their profile
@@ -1496,6 +1503,11 @@ ROUTER = console
14961503
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14971504
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14981505
;;
1506+
;; NOTICE: this section is for Gitea 1.18 and later. If you are using Gitea 1.17 or older,
1507+
;; please refer to
1508+
;; https://github.com/go-gitea/gitea/blob/release/v1.17/custom/conf/app.example.ini
1509+
;; https://github.com/go-gitea/gitea/blob/release/v1.17/docs/content/doc/advanced/config-cheat-sheet.en-us.md
1510+
;;
14991511
;ENABLED = false
15001512
;;
15011513
;; Buffer length of channel, keep it as it is if you don't know what it is.
@@ -1509,12 +1521,12 @@ ROUTER = console
15091521
;; - dummy: send email messages to the log as a testing phase.
15101522
;; If your provider does not explicitly say which protocol it uses but does provide a port,
15111523
;; you can set SMTP_PORT instead and this will be inferred.
1512-
;; (Before 1.18, this was controlled via MAILER_TYPE and IS_TLS_ENABLED.)
1524+
;; (Before 1.18, see the notice, this was controlled via MAILER_TYPE and IS_TLS_ENABLED.)
15131525
;PROTOCOL =
15141526
;;
15151527
;; Mail server address, e.g. smtp.gmail.com.
15161528
;; For smtp+unix, this should be a path to a unix socket instead.
1517-
;; (Before 1.18, this was combined with SMTP_PORT as HOST.)
1529+
;; (Before 1.18, see the notice, this was combined with SMTP_PORT as HOST.)
15181530
;SMTP_ADDR =
15191531
;;
15201532
;; Mail server port. Common ports are:

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ The following configuration set `Content-Type: application/vnd.android.package-a
296296
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
297297

298298
- `OFFLINE_MODE`: **false**: Disables use of CDN for static files and Gravatar for profile pictures.
299-
- `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). This is ignored if `ENABLE_ACME=true`. From 1.11 paths are relative to `CUSTOM_PATH`.
300-
- `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. This is ignored if `ENABLE_ACME=true`. From 1.11 paths are relative to `CUSTOM_PATH`.
299+
- `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
300+
- `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
301301
- `STATIC_ROOT_PATH`: **./**: Upper level of template and static files path.
302302
- `APP_DATA_PATH`: **data** (**/data/gitea** on docker): Default path for application data.
303303
- `STATIC_CACHE_TIME`: **6h**: Web browser cache time for static resources on `custom/`, `public/` and all uploaded avatars. Note that this cache is disabled when `RUN_MODE` is "dev".
@@ -438,11 +438,11 @@ Configuration at `[queue]` will set defaults for queues with overrides for indiv
438438
- `MAX_ATTEMPTS`: **10**: Maximum number of attempts to create the wrapped queue
439439
- `TIMEOUT`: **GRACEFUL_HAMMER_TIME + 30s**: Timeout the creation of the wrapped queue if it takes longer than this to create.
440440
- Queues by default come with a dynamically scaling worker pool. The following settings configure this:
441-
- `WORKERS`: **0** (v1.14 and before: **1**): Number of initial workers for the queue.
441+
- `WORKERS`: **0**: Number of initial workers for the queue.
442442
- `MAX_WORKERS`: **10**: Maximum number of worker go-routines for the queue.
443443
- `BLOCK_TIMEOUT`: **1s**: If the queue blocks for this time, boost the number of workers - the `BLOCK_TIMEOUT` will then be doubled before boosting again whilst the boost is ongoing.
444444
- `BOOST_TIMEOUT`: **5m**: Boost workers will timeout after this long.
445-
- `BOOST_WORKERS`: **1** (v1.14 and before: **5**): This many workers will be added to the worker pool if there is a boost.
445+
- `BOOST_WORKERS`: **1**: This many workers will be added to the worker pool if there is a boost.
446446

447447
Gitea creates the following non-unique queues:
448448

@@ -579,13 +579,16 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
579579
provided email rather than a generated email.
580580
- `ENABLE_CAPTCHA`: **false**: Enable this to use captcha validation for registration.
581581
- `REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA`: **false**: Enable this to force captcha validation
582-
even for External Accounts (i.e. GitHub, OpenID Connect, etc). You must `ENABLE_CAPTCHA` also.
583-
- `CAPTCHA_TYPE`: **image**: \[image, recaptcha, hcaptcha\]
582+
even for External Accounts (i.e. GitHub, OpenID Connect, etc). You also must enable `ENABLE_CAPTCHA`.
583+
- `CAPTCHA_TYPE`: **image**: \[image, recaptcha, hcaptcha, mcaptcha\]
584584
- `RECAPTCHA_SECRET`: **""**: Go to https://www.google.com/recaptcha/admin to get a secret for recaptcha.
585585
- `RECAPTCHA_SITEKEY`: **""**: Go to https://www.google.com/recaptcha/admin to get a sitekey for recaptcha.
586586
- `RECAPTCHA_URL`: **https://www.google.com/recaptcha/**: Set the recaptcha url - allows the use of recaptcha net.
587587
- `HCAPTCHA_SECRET`: **""**: Sign up at https://www.hcaptcha.com/ to get a secret for hcaptcha.
588588
- `HCAPTCHA_SITEKEY`: **""**: Sign up at https://www.hcaptcha.com/ to get a sitekey for hcaptcha.
589+
- `MCAPTCHA_SECRET`: **""**: Go to your mCaptcha instance to get a secret for mCaptcha.
590+
- `MCAPTCHA_SITEKEY`: **""**: Go to your mCaptcha instance to get a sitekey for mCaptcha.
591+
- `MCAPTCHA_URL` **https://demo.mcaptcha.org/**: Set the mCaptcha URL.
589592
- `DEFAULT_KEEP_EMAIL_PRIVATE`: **false**: By default set users to keep their email address private.
590593
- `DEFAULT_ALLOW_CREATE_ORGANIZATION`: **true**: Allow new users to create organizations by default.
591594
- `DEFAULT_USER_IS_RESTRICTED`: **false**: Give new users restricted permissions by default
@@ -631,7 +634,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
631634

632635
- `QUEUE_LENGTH`: **1000**: Hook task queue length. Use caution when editing this value.
633636
- `DELIVER_TIMEOUT`: **5**: Delivery timeout (sec) for shooting webhooks.
634-
- `ALLOWED_HOST_LIST`: **external**: Since 1.15.7. Default to `*` for 1.15.x, `external` for 1.16 and later. Webhook can only call allowed hosts for security reasons. Comma separated list.
637+
- `ALLOWED_HOST_LIST`: **external**: Webhook can only call allowed hosts for security reasons. Comma separated list.
635638
- Built-in networks:
636639
- `loopback`: 127.0.0.0/8 for IPv4 and ::1/128 for IPv6, localhost is included.
637640
- `private`: RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and RFC 4193 (FC00::/7). Also called LAN/Intranet.
@@ -646,6 +649,12 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
646649

647650
## Mailer (`mailer`)
648651

652+
⚠️ This section is for Gitea 1.18 and later. If you are using Gitea 1.17 or older,
653+
please refer to
654+
[Gitea 1.17 app.ini example](https://github.com/go-gitea/gitea/blob/release/v1.17/custom/conf/app.example.ini)
655+
and
656+
[Gitea 1.17 configuration document](https://github.com/go-gitea/gitea/blob/release/v1.17/docs/content/doc/advanced/config-cheat-sheet.en-us.md)
657+
649658
- `ENABLED`: **false**: Enable to use a mail service.
650659
- `PROTOCOL`: **\<empty\>**: Mail server protocol. One of "smtp", "smtps", "smtp+startls", "smtp+unix", "sendmail", "dummy". _Before 1.18, this was inferred from a combination of `MAILER_TYPE` and `IS_TLS_ENABLED`._
651660
- SMTP family, if your provider does not explicitly say which protocol it uses but does provide a port, you can set SMTP_PORT instead and this will be inferred.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ menu:
1515

1616
# 配置说明
1717

18-
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
18+
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。
19+
所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。
20+
如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。
21+
标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
22+
23+
## ⚠️时效性警告⚠️
24+
25+
此文档的内容可能过于陈旧或者错误,请参考英文文档。
1926

2027
{{< toc >}}
2128

docs/content/doc/developers/api-usage.en-us.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
105105
As mentioned above, the token used is the same one you would use in
106106
the `token=` string in a GET request.
107107
108+
## Pagination
109+
110+
The API supports pagination. The `page` and `limit` parameters are used to specify the page number and the number of items per page. As well, the `Link` header is returned with the next, previous, and last page links if there are more than one pages. The `x-total-count` is also returned to indicate the total number of items.
111+
112+
```sh
113+
curl -v "http://localhost/api/v1/repos/search?limit=1"
114+
...
115+
< link: <http://localhost/api/v1/repos/search?limit=1&page=2>; rel="next",<http://localhost/api/v1/repos/search?limit=1&page=5252>; rel="last"
116+
...
117+
< x-total-count: 5252
118+
```
119+
108120
## API Guide:
109121
110122
API Reference guide is auto-generated by swagger and available on:

docs/content/doc/features/comparison.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ _Symbols used in table:_
122122
| AD / LDAP integration ||||||||
123123
| Multiple LDAP / AD server support ||||||||
124124
| LDAP user synchronization ||||||||
125+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
125126
| OpenId Connect support |||||| ? ||
126127
| OAuth 2.0 integration (external authorization) |||||| ? ||
127128
| Act as OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

docs/content/doc/features/comparison.zh-cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ _表格中的符号含义:_
120120
| 集成 AD / LDAP ||||||||
121121
| 支持多个 LDAP / AD 服务 ||||||||
122122
| LDAP 用户同步 ||||||||
123+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
123124
| 支持 OpenId 连接 |||||| ? ||
124125
| 集成 OAuth 2.0(外部授权) |||||| ? ||
125126
| 作为 OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

docs/content/doc/features/comparison.zh-tw.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ menu:
121121
| 整合 AD / LDAP ||||||||
122122
| 支援多重 LDAP / AD 伺服器 ||||||||
123123
| 同步 LDAP 使用者 ||||||||
124+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
124125
| 支援 OpenId Connect |||||| ? ||
125126
| 整合 OAuth 2.0 (外部驗證) |||||| ? ||
126127
| 成為 OAuth 2.0 提供者 | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

docs/content/doc/packages/generic.en-us.md

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To authenticate to the Package Registry, you need to provide [custom HTTP header
2727
## Publish a package
2828

2929
To publish a generic package perform a HTTP PUT operation with the package content in the request body.
30-
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
30+
You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
3131

3232
```
3333
PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
@@ -36,9 +36,9 @@ PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{packa
3636
| Parameter | Description |
3737
| ----------------- | ----------- |
3838
| `owner` | The owner of the package. |
39-
| `package_name` | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), or underscores (`_`). |
40-
| `package_version` | The package version, a non-empty string. |
41-
| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), or underscores (`_`). |
39+
| `package_name` | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
40+
| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. |
41+
| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
4242

4343
Example request using HTTP Basic authentication:
4444

@@ -55,7 +55,8 @@ The server reponds with the following HTTP Status codes.
5555
| HTTP Status Code | Meaning |
5656
| ----------------- | ------- |
5757
| `201 Created` | The package has been published. |
58-
| `400 Bad Request` | The package name and/or version are invalid or a package with the same name and version already exist. |
58+
| `400 Bad Request` | The package name and/or version and/or file name are invalid. |
59+
| `409 Conflict` | A file with the same name exist already in the package. |
5960

6061
## Download a package
6162

@@ -80,3 +81,67 @@ Example request using HTTP Basic authentication:
8081
curl --user your_username:your_token_or_password \
8182
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
8283
```
84+
85+
The server reponds with the following HTTP Status codes.
86+
87+
| HTTP Status Code | Meaning |
88+
| ----------------- | ------- |
89+
| `200 OK` | Success |
90+
| `404 Not Found` | The package or file was not found. |
91+
92+
## Delete a package
93+
94+
To delete a generic package perform a HTTP DELETE operation. This will delete all files of this version.
95+
96+
```
97+
DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}
98+
```
99+
100+
| Parameter | Description |
101+
| ----------------- | ----------- |
102+
| `owner` | The owner of the package. |
103+
| `package_name` | The package name. |
104+
| `package_version` | The package version. |
105+
106+
Example request using HTTP Basic authentication:
107+
108+
```shell
109+
curl --user your_username:your_token_or_password -X DELETE \
110+
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0
111+
```
112+
113+
The server reponds with the following HTTP Status codes.
114+
115+
| HTTP Status Code | Meaning |
116+
| ----------------- | ------- |
117+
| `204 No Content` | Success |
118+
| `404 Not Found` | The package was not found. |
119+
120+
## Delete a package file
121+
122+
To delete a file of a generic package perform a HTTP DELETE operation. This will delete the package version too if there is no file left.
123+
124+
```
125+
DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{filename}
126+
```
127+
128+
| Parameter | Description |
129+
| ----------------- | ----------- |
130+
| `owner` | The owner of the package. |
131+
| `package_name` | The package name. |
132+
| `package_version` | The package version. |
133+
| `filename` | The filename. |
134+
135+
Example request using HTTP Basic authentication:
136+
137+
```shell
138+
curl --user your_username:your_token_or_password -X DELETE \
139+
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
140+
```
141+
142+
The server reponds with the following HTTP Status codes.
143+
144+
| HTTP Status Code | Meaning |
145+
| ----------------- | ------- |
146+
| `204 No Content` | Success |
147+
| `404 Not Found` | The package or file was not found. |

0 commit comments

Comments
 (0)