Skip to content

Commit 04954b4

Browse files
committed
Merge branch 'main' into show-sync-time
2 parents 45b0f8b + b0e6c25 commit 04954b4

File tree

194 files changed

+2963
-1393
lines changed

Some content is hidden

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

194 files changed

+2963
-1393
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ _test
1111
.idea
1212
# Goland's output filename can not be set manually
1313
/go_build_*
14+
/gitea_*
1415

1516
# MS VSCode
1617
.vscode

cmd/admin.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ func runRepoSyncReleases(_ *cli.Context) error {
157157
}
158158

159159
func getReleaseCount(ctx context.Context, id int64) (int64, error) {
160-
return repo_model.GetReleaseCountByRepoID(
160+
return db.Count[repo_model.Release](
161161
ctx,
162-
id,
163162
repo_model.FindReleasesOptions{
163+
RepoID: id,
164164
IncludeTags: true,
165165
},
166166
)

cmd/doctor_convert.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func runDoctorConvert(ctx *cli.Context) error {
3737

3838
switch {
3939
case setting.Database.Type.IsMySQL():
40-
if err := db.ConvertUtf8ToUtf8mb4(); err != nil {
41-
log.Fatal("Failed to convert database from utf8 to utf8mb4: %v", err)
40+
if err := db.ConvertDatabaseTable(); err != nil {
41+
log.Fatal("Failed to convert database & table: %v", err)
4242
return err
4343
}
4444
fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")

contrib/systemd/gitea.service

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ After=network.target
5252
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
5353
# LimitNOFILE=524288:524288
5454
RestartSec=2s
55-
Type=notify
55+
Type=simple
5656
User=git
5757
Group=git
5858
WorkingDirectory=/var/lib/gitea/
@@ -62,7 +62,6 @@ WorkingDirectory=/var/lib/gitea/
6262
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
6363
Restart=always
6464
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
65-
WatchdogSec=30s
6665
# If you install Git to directory prefix other than default PATH (which happens
6766
# for example if you install other versions of Git side-to-side with
6867
# distribution version), uncomment below line and add that prefix to PATH

custom/conf/app.example.ini

+2
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ NAME = gitea
351351
USER = root
352352
;PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password.
353353
;SSL_MODE = false ; either "false" (default), "true", or "skip-verify"
354+
;CHARSET_COLLATION = ; Empty as default, Gitea will try to find a case-sensitive collation. Don't change it unless you clearly know what you need.
354355
;;
355356
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
356357
;;
@@ -382,6 +383,7 @@ USER = root
382383
;NAME = gitea
383384
;USER = SA
384385
;PASSWD = MwantsaSecurePassword1
386+
;CHARSET_COLLATION = ; Empty as default, Gitea will try to find a case-sensitive collation. Don't change it unless you clearly know what you need.
385387
;;
386388
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
387389
;;

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

+1
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
430430
- `NAME`: **gitea**: Database name.
431431
- `USER`: **root**: Database username.
432432
- `PASSWD`: **_empty_**: Database user password. Use \`your password\` or """your password""" for quoting if you use special characters in the password.
433+
- `CHARSET_COLLATION`: **_empty_**: (MySQL/MSSQL only) Gitea expects to use a case-sensitive collation for database. Leave it empty to use the default collation decided by the Gitea. Don't change it unless you clearly know what you need.
433434
- `SCHEMA`: **_empty_**: For PostgreSQL only, schema to use if different from "public". The schema must exist beforehand,
434435
the user must have creation privileges on it, and the user search path must be set to the look into the schema first
435436
(e.g. `ALTER USER user SET SEARCH_PATH = schema_name,"$user",public;`).

docs/content/contributing/guidelines-frontend.en-us.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
4848
10. Avoid mixing different events in one event listener, prefer to use individual event listeners for every event.
4949
11. Custom event names are recommended to use `ce-` prefix.
5050
12. Gitea's tailwind-style CSS classes use `gt-` prefix (`gt-relative`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`).
51+
13. Avoid inline scripts & styles as much as possible, it's recommended to put JS code into JS files and use CSS classes. If inline scripts & styles are unavoidable, explain the reason why it can't be avoided.
5152

5253
### Accessibility / ARIA
5354

5455
In history, Gitea heavily uses Fomantic UI which is not an accessibility-friendly framework.
55-
Gitea uses some patches to make Fomantic UI more accessible (see the `aria.js` and `aria.md`),
56+
Gitea uses some patches to make Fomantic UI more accessible (see `aria.md` and related JS files),
5657
but there are still many problems which need a lot of work and time to fix.
5758

5859
### Framework Usage

docs/content/help/faq.en-us.md

-18
Original file line numberDiff line numberDiff line change
@@ -371,24 +371,6 @@ If you are receiving an error line containing `Error 1071: Specified key was too
371371
then you are attempting to run Gitea on tables which use the ISAM engine. While this may have worked by chance in previous versions of Gitea, it has never been officially supported and
372372
you must use InnoDB. You should run `ALTER TABLE table_name ENGINE=InnoDB;` for each table in the database.
373373

374-
If you are using MySQL 5, another possible fix is
375-
376-
```mysql
377-
SET GLOBAL innodb_file_format=Barracuda;
378-
SET GLOBAL innodb_file_per_table=1;
379-
SET GLOBAL innodb_large_prefix=1;
380-
```
381-
382-
## Why Are Emoji Broken On MySQL
383-
384-
Unfortunately MySQL's `utf8` charset does not completely allow all possible UTF-8 characters, in particular Emoji.
385-
They created a new charset and collation called `utf8mb4` that allows for emoji to be stored but tables which use
386-
the `utf8` charset, and connections which use the `utf8` charset will not use this.
387-
388-
Please run `gitea doctor convert`, or run `ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
389-
for the database_name and run `ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
390-
for each table in the database.
391-
392374
## Why are Emoji displaying only as placeholders or in monochrome
393375

394376
Gitea requires the system or browser to have one of the supported Emoji fonts installed, which are Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji and Twemoji Mozilla. Generally, the operating system should already provide one of these fonts, but especially on Linux, it may be necessary to install them manually.

docs/content/help/faq.zh-cn.md

-19
Original file line numberDiff line numberDiff line change
@@ -375,25 +375,6 @@ Gitea 提供了一个子命令`gitea migrate`来初始化数据库,然后您
375375
的错误行,则表示您正在尝试在使用 ISAM 引擎的表上运行 Gitea。尽管在先前版本的 Gitea 中可能是凑巧能够工作的,但它从未得到官方支持,
376376
您必须使用 InnoDB。您应该对数据库中的每个表运行`ALTER TABLE table_name ENGINE=InnoDB;`
377377

378-
如果您使用的是 MySQL 5,另一个可能的修复方法是:
379-
380-
```mysql
381-
SET GLOBAL innodb_file_format=Barracuda;
382-
SET GLOBAL innodb_file_per_table=1;
383-
SET GLOBAL innodb_large_prefix=1;
384-
```
385-
386-
## 为什么 MySQL 上的 Emoji 显示错误
387-
388-
不幸的是,MySQL 的`utf8`字符集不完全允许所有可能的 UTF-8 字符,特别是 Emoji。
389-
他们创建了一个名为 `utf8mb4`的字符集和校对规则,允许存储 Emoji,但使用
390-
utf8 字符集的表和连接将不会使用它。
391-
392-
请运行 `gitea doctor convert` 或对数据库运行 `ALTER DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
393-
并对每个表运行 `ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
394-
395-
您还需要将`app.ini`文件中的数据库字符集设置为`CHARSET=utf8mb4`
396-
397378
## 为什么 Emoji 只显示占位符或单色图像
398379

399380
Gitea 需要系统或浏览器安装其中一个受支持的 Emoji 字体,例如 Apple Color Emoji、Segoe UI Emoji、Segoe UI Symbol、Noto Color Emoji 和 Twemoji Mozilla。通常,操作系统应该已经提供了其中一个字体,但特别是在 Linux 上,可能需要手动安装它们。

docs/content/installation/database-preparation.en-us.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ Note: All steps below requires that the database engine of your choice is instal
6161

6262
Replace username and password above as appropriate.
6363

64-
4. Create database with UTF-8 charset and collation. Make sure to use `utf8mb4` charset instead of `utf8` as the former supports all Unicode characters (including emojis) beyond _Basic Multilingual Plane_. Also, collation chosen depending on your expected content. When in doubt, use either `unicode_ci` or `general_ci`.
64+
4. Create database with UTF-8 charset and case-sensitive collation.
65+
66+
`utf8mb4_bin` is a common collation for both MySQL/MariaDB.
67+
When Gitea starts, it will try to find a better collation (`utf8mb4_0900_as_cs` or `uca1400_as_cs`) and alter the database if it is possible.
68+
If you would like to use other collation, you can set `[database].CHARSET_COLLATION` in the `app.ini` file.
6569

6670
```sql
67-
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
71+
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
6872
```
6973

7074
Replace database name as appropriate.

docs/content/installation/database-preparation.zh-cn.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ menu:
5959

6060
根据需要替换上述用户名和密码。
6161

62-
4. 使用 UTF-8 字符集和排序规则创建数据库。确保使用 `**utf8mb4**` 字符集,而不是 `utf8`,因为前者支持 _Basic Multilingual Plane_ 之外的所有 Unicode 字符(包括表情符号)。排序规则根据您预期的内容选择。如果不确定,可以使用 `unicode_ci` 或 `general_ci`。
62+
4. 使用 UTF-8 字符集和大小写敏感的排序规则创建数据库。
63+
64+
Gitea 启动后会尝试把数据库修改为更合适的字符集,如果你想指定自己的字符集规则,可以在 app.ini 中设置 `[database].CHARSET_COLLATION`。
6365

6466
```sql
65-
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
67+
CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
6668
```
6769

6870
根据需要替换数据库名称。

docs/content/usage/packages/rpm.en-us.md

+18-15
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ The following examples use `dnf`.
2727
To register the RPM registry add the url to the list of known apt sources:
2828

2929
```shell
30-
dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm.repo
30+
dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm/{group}.repo
3131
```
3232

33-
| Placeholder | Description |
34-
| ----------- | ----------- |
35-
| `owner` | The owner of the package. |
33+
| Placeholder | Description |
34+
| ----------- |----------------------------------------------------|
35+
| `owner` | The owner of the package. |
36+
| `group` | Everything, e.g. `el7`, `rocky/el9` , `test/fc38`.|
3637

3738
If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
3839

3940
```shell
40-
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm.repo
41+
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm/{group}.repo
4142
```
4243

4344
You have to add the credentials to the urls in the `rpm.repo` file in `/etc/yum.repos.d` too.
@@ -47,19 +48,20 @@ You have to add the credentials to the urls in the `rpm.repo` file in `/etc/yum.
4748
To publish a RPM package (`*.rpm`), perform a HTTP PUT operation with the package content in the request body.
4849

4950
```
50-
PUT https://gitea.example.com/api/packages/{owner}/rpm/upload
51+
PUT https://gitea.example.com/api/packages/{owner}/rpm/{group}/upload
5152
```
5253

5354
| Parameter | Description |
5455
| --------- | ----------- |
5556
| `owner` | The owner of the package. |
57+
| `group` | Everything, e.g. `el7`, `rocky/el9` , `test/fc38`.|
5658

5759
Example request using HTTP Basic authentication:
5860

5961
```shell
6062
curl --user your_username:your_password_or_token \
6163
--upload-file path/to/file.rpm \
62-
https://gitea.example.com/api/packages/testuser/rpm/upload
64+
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/upload
6365
```
6466

6567
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
@@ -78,21 +80,22 @@ The server responds with the following HTTP Status codes.
7880
To delete an RPM package perform a HTTP DELETE operation. This will delete the package version too if there is no file left.
7981

8082
```
81-
DELETE https://gitea.example.com/api/packages/{owner}/rpm/{package_name}/{package_version}/{architecture}
83+
DELETE https://gitea.example.com/api/packages/{owner}/rpm/{group}/package/{package_name}/{package_version}/{architecture}
8284
```
8385

84-
| Parameter | Description |
85-
| ----------------- | ----------- |
86-
| `owner` | The owner of the package. |
87-
| `package_name` | The package name. |
88-
| `package_version` | The package version. |
89-
| `architecture` | The package architecture. |
86+
| Parameter | Description |
87+
|-------------------|----------------------------|
88+
| `owner` | The owner of the package. |
89+
| `group` | The package group . |
90+
| `package_name` | The package name. |
91+
| `package_version` | The package version. |
92+
| `architecture` | The package architecture. |
9093

9194
Example request using HTTP Basic authentication:
9295

9396
```shell
9497
curl --user your_username:your_token_or_password -X DELETE \
95-
https://gitea.example.com/api/packages/testuser/rpm/test-package/1.0.0/x86_64
98+
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/package/test-package/1.0.0/x86_64
9699
```
97100

98101
The server responds with the following HTTP Status codes.

docs/content/usage/packages/rpm.zh-cn.md

+14-11
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ menu:
2727
要注册RPM注册表,请将 URL 添加到已知 `apt` 源列表中:
2828

2929
```shell
30-
dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm.repo
30+
dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm/{group}.repo
3131
```
3232

33-
| 占位符 | 描述 |
34-
| ------- | -------------- |
35-
| `owner` | 软件包的所有者 |
33+
| 占位符 | 描述 |
34+
| ------- |--------------------------------------|
35+
| `owner` | 软件包的所有者 |
36+
| `group` | 任何名称,例如 `centos/7``el-7``fc38` |
3637

3738
如果注册表是私有的,请在URL中提供凭据。您可以使用密码或[个人访问令牌](development/api-usage.md#通过-api-认证)
3839

3940
```shell
40-
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm.repo
41+
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm/{group}.repo
4142
```
4243

4344
您还必须将凭据添加到 `/etc/yum.repos.d` 中的 `rpm.repo` 文件中的URL中。
@@ -47,19 +48,20 @@ dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.
4748
要发布RPM软件包(`*.rpm`),请执行带有软件包内容的 HTTP `PUT` 操作。
4849

4950
```
50-
PUT https://gitea.example.com/api/packages/{owner}/rpm/upload
51+
PUT https://gitea.example.com/api/packages/{owner}/rpm/{group}/upload
5152
```
5253

5354
| 参数 | 描述 |
54-
| ------- | -------------- |
55-
| `owner` | 软件包的所有者 |
55+
| ------- |--------------|
56+
| `owner` | 软件包的所有者 |
57+
| `group` | 软件包自定义分组名称 |
5658

5759
使用HTTP基本身份验证的示例请求:
5860

5961
```shell
6062
curl --user your_username:your_password_or_token \
6163
--upload-file path/to/file.rpm \
62-
https://gitea.example.com/api/packages/testuser/rpm/upload
64+
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/version/upload
6365
```
6466

6567
如果您使用 2FA 或 OAuth,请使用[个人访问令牌](development/api-usage.md#通过-api-认证)替代密码。您无法将具有相同名称的文件两次发布到软件包中。您必须先删除现有的软件包版本。
@@ -77,12 +79,13 @@ curl --user your_username:your_password_or_token \
7779
要删除 RPM 软件包,请执行 HTTP `DELETE` 操作。如果没有文件剩余,这也将删除软件包版本。
7880

7981
```
80-
DELETE https://gitea.example.com/api/packages/{owner}/rpm/{package_name}/{package_version}/{architecture}
82+
DELETE https://gitea.example.com/api/packages/{owner}/rpm/{group}/package/{package_name}/{package_version}/{architecture}
8183
```
8284

8385
| 参数 | 描述 |
8486
| ----------------- | -------------- |
8587
| `owner` | 软件包的所有者 |
88+
| `group` | 软件包自定义分组 |
8689
| `package_name` | 软件包名称 |
8790
| `package_version` | 软件包版本 |
8891
| `architecture` | 软件包架构 |
@@ -91,7 +94,7 @@ DELETE https://gitea.example.com/api/packages/{owner}/rpm/{package_name}/{packag
9194

9295
```shell
9396
curl --user your_username:your_token_or_password -X DELETE \
94-
https://gitea.example.com/api/packages/testuser/rpm/test-package/1.0.0/x86_64
97+
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/package/test-package/1.0.0/x86_64
9598
```
9699

97100
服务器将以以下HTTP状态码响应:

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ require (
121121
mvdan.cc/xurls/v2 v2.5.0
122122
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
123123
xorm.io/builder v0.3.13
124-
xorm.io/xorm v1.3.6
124+
xorm.io/xorm v1.3.7-0.20240101024435-4992cba040fe
125125
)
126126

127127
require (
@@ -165,7 +165,7 @@ require (
165165
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
166166
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
167167
github.com/cespare/xxhash/v2 v2.2.0 // indirect
168-
github.com/cloudflare/circl v1.3.6 // indirect
168+
github.com/cloudflare/circl v1.3.7 // indirect
169169
github.com/couchbase/go-couchbase v0.1.1 // indirect
170170
github.com/couchbase/gomemcached v0.3.0 // indirect
171171
github.com/couchbase/goutils v0.1.2 // indirect

0 commit comments

Comments
 (0)