Skip to content

Commit a6741d8

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: [skip ci] Updated translations via Crowdin Update JS deps (go-gitea#23853) Added close/open button to details page of milestone (go-gitea#23877) Check `IsActionsToken` for LFS authentication (go-gitea#23841) Prefill input values in oauth settings as intended (go-gitea#23829) Display image size for multiarch container images (go-gitea#23821) Use clippie module to copy to clipboard (go-gitea#23801) Remove assertion debug code for show/hide refactoring (go-gitea#23576) [skip ci] Updated translations via Crowdin Remove jQuery ready usage (go-gitea#23858) Fix JS error when changing PR's target branch (go-gitea#23862) Improve action log display with control chars (go-gitea#23820) Fix review conversation reply (go-gitea#23846) Improve home page template, fix Sort dropdown menu flash (go-gitea#23856) Make first section on home page full width (go-gitea#23854) [skip ci] Updated translations via Crowdin Fix incorrect CORS failure detection logic (go-gitea#23844)
2 parents 9ada9c1 + f020fc2 commit a6741d8

36 files changed

+801
-474
lines changed

.drone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ steps:
726726

727727
# TODO: We should probably build all dependencies into a test image
728728
- name: test-e2e
729-
image: mcr.microsoft.com/playwright:v1.31.2-focal
729+
image: mcr.microsoft.com/playwright:v1.32.1-focal
730730
commands:
731731
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
732732
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea

.eslintrc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ rules:
164164
jquery/no-parse-html: [2]
165165
jquery/no-prop: [0]
166166
jquery/no-proxy: [2]
167-
jquery/no-ready: [0]
167+
jquery/no-ready: [2]
168168
jquery/no-serialize: [2]
169169
jquery/no-show: [2]
170170
jquery/no-size: [2]

.stylelintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ rules:
8888
no-invalid-position-at-import-rule: null
8989
no-irregular-whitespace: true
9090
no-unknown-animations: null
91+
no-unknown-custom-properties: null
9192
number-max-precision: null
9293
property-allowed-list: null
9394
property-disallowed-list: null

models/migrations/migrations.go

+2
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ var migrations = []Migration{
477477
NewMigration("Add version column to action_runner table", v1_20.AddVersionToActionRunner),
478478
// v249 -> v250
479479
NewMigration("Improve Action table indices v3", v1_20.ImproveActionTableIndices),
480+
// v250 -> v251
481+
NewMigration("Change Container Metadata", v1_20.ChangeContainerMetadataMultiArch),
480482
}
481483

482484
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v250.go

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"strings"
8+
9+
"code.gitea.io/gitea/modules/json"
10+
11+
"xorm.io/xorm"
12+
)
13+
14+
func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
15+
sess := x.NewSession()
16+
defer sess.Close()
17+
18+
if err := sess.Begin(); err != nil {
19+
return err
20+
}
21+
22+
type PackageVersion struct {
23+
ID int64 `xorm:"pk"`
24+
MetadataJSON string `xorm:"metadata_json"`
25+
}
26+
27+
type PackageBlob struct{}
28+
29+
// Get all relevant packages (manifest list images have a container.manifest.reference property)
30+
31+
var pvs []*PackageVersion
32+
err := sess.
33+
Table("package_version").
34+
Select("id, metadata_json").
35+
Where("id IN (SELECT DISTINCT ref_id FROM package_property WHERE ref_type = 0 AND name = 'container.manifest.reference')").
36+
Find(&pvs)
37+
if err != nil {
38+
return err
39+
}
40+
41+
type MetadataOld struct {
42+
Type string `json:"type"`
43+
IsTagged bool `json:"is_tagged"`
44+
Platform string `json:"platform,omitempty"`
45+
Description string `json:"description,omitempty"`
46+
Authors []string `json:"authors,omitempty"`
47+
Licenses string `json:"license,omitempty"`
48+
ProjectURL string `json:"project_url,omitempty"`
49+
RepositoryURL string `json:"repository_url,omitempty"`
50+
DocumentationURL string `json:"documentation_url,omitempty"`
51+
Labels map[string]string `json:"labels,omitempty"`
52+
ImageLayers []string `json:"layer_creation,omitempty"`
53+
MultiArch map[string]string `json:"multiarch,omitempty"`
54+
}
55+
56+
type Manifest struct {
57+
Platform string `json:"platform"`
58+
Digest string `json:"digest"`
59+
Size int64 `json:"size"`
60+
}
61+
62+
type MetadataNew struct {
63+
Type string `json:"type"`
64+
IsTagged bool `json:"is_tagged"`
65+
Platform string `json:"platform,omitempty"`
66+
Description string `json:"description,omitempty"`
67+
Authors []string `json:"authors,omitempty"`
68+
Licenses string `json:"license,omitempty"`
69+
ProjectURL string `json:"project_url,omitempty"`
70+
RepositoryURL string `json:"repository_url,omitempty"`
71+
DocumentationURL string `json:"documentation_url,omitempty"`
72+
Labels map[string]string `json:"labels,omitempty"`
73+
ImageLayers []string `json:"layer_creation,omitempty"`
74+
Manifests []*Manifest `json:"manifests,omitempty"`
75+
}
76+
77+
for _, pv := range pvs {
78+
var old *MetadataOld
79+
if err := json.Unmarshal([]byte(pv.MetadataJSON), &old); err != nil {
80+
return err
81+
}
82+
83+
// Calculate the size of every contained manifest
84+
85+
manifests := make([]*Manifest, 0, len(old.MultiArch))
86+
for platform, digest := range old.MultiArch {
87+
size, err := sess.
88+
Table("package_blob").
89+
Join("INNER", "package_file", "package_blob.id = package_file.blob_id").
90+
Join("INNER", "package_version pv", "pv.id = package_file.version_id").
91+
Join("INNER", "package_version pv2", "pv2.package_id = pv.package_id").
92+
Where("pv.lower_version = ? AND pv2.id = ?", strings.ToLower(digest), pv.ID).
93+
SumInt(new(PackageBlob), "size")
94+
if err != nil {
95+
return err
96+
}
97+
98+
manifests = append(manifests, &Manifest{
99+
Platform: platform,
100+
Digest: digest,
101+
Size: size,
102+
})
103+
}
104+
105+
// Convert to new metadata format
106+
107+
new := &MetadataNew{
108+
Type: old.Type,
109+
IsTagged: old.IsTagged,
110+
Platform: old.Platform,
111+
Description: old.Description,
112+
Authors: old.Authors,
113+
Licenses: old.Licenses,
114+
ProjectURL: old.ProjectURL,
115+
RepositoryURL: old.RepositoryURL,
116+
DocumentationURL: old.DocumentationURL,
117+
Labels: old.Labels,
118+
ImageLayers: old.ImageLayers,
119+
Manifests: manifests,
120+
}
121+
122+
metadataJSON, err := json.Marshal(new)
123+
if err != nil {
124+
return err
125+
}
126+
127+
pv.MetadataJSON = string(metadataJSON)
128+
129+
if _, err := sess.ID(pv.ID).Update(pv); err != nil {
130+
return err
131+
}
132+
}
133+
134+
return sess.Commit()
135+
}

modules/packages/container/metadata.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ type Metadata struct {
6262
DocumentationURL string `json:"documentation_url,omitempty"`
6363
Labels map[string]string `json:"labels,omitempty"`
6464
ImageLayers []string `json:"layer_creation,omitempty"`
65-
MultiArch map[string]string `json:"multiarch,omitempty"`
65+
Manifests []*Manifest `json:"manifests,omitempty"`
66+
}
67+
68+
type Manifest struct {
69+
Platform string `json:"platform"`
70+
Digest string `json:"digest"`
71+
Size int64 `json:"size"`
6672
}
6773

6874
// ParseImageConfig parses the metadata of an image config

modules/packages/container/metadata_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestParseImageConfig(t *testing.T) {
4646
},
4747
metadata.Labels,
4848
)
49-
assert.Empty(t, metadata.MultiArch)
49+
assert.Empty(t, metadata.Manifests)
5050

5151
configHelm := `{"description":"` + description + `", "home": "` + projectURL + `", "sources": ["` + repositoryURL + `"], "maintainers":[{"name":"` + author + `"}]}`
5252

modules/public/public.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
4545
return
4646
}
4747

48-
var corsSent bool
4948
if opts.CorsHandler != nil {
49+
var corsSent bool
5050
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
5151
corsSent = true
5252
})).ServeHTTP(resp, req)
53-
}
54-
// If CORS is not sent, the response must have been written by other handlers
55-
if !corsSent {
56-
return
53+
// If CORS is not sent, the response must have been written by other handlers
54+
if !corsSent {
55+
return
56+
}
5757
}
5858

5959
file := req.URL.Path[len(opts.Prefix):]

options/locale/locale_fr-FR.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ issues.add_remove_labels=a ajouté %s et supprimé les étiquettes %s %s
993993
issues.add_milestone_at=`a ajouté cela au jalon <b>%s</b> %s`
994994
issues.add_project_at=`a ajouté au projet <b>%s</b> %s`
995995
issues.change_milestone_at=`a modifié le jalon de <b>%s</b> à <b>%s</b> %s`
996-
issues.change_project_at=`modification du projet de <b>%s</b> à <b>%s</b> %s`
996+
issues.change_project_at=modification du projet de <b>%s</b> à <b>%s</b> %s
997997
issues.remove_milestone_at=`a supprimé cela du jalon <b>%s</b> %s`
998998
issues.remove_project_at=`supprimer du projet <b>%s</b> %s`
999999
issues.deleted_milestone=`(supprimée)`

options/locale/locale_pl-PL.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ issues.del_time=Usuń ten dziennik czasu
12761276
issues.add_time_short=Dodaj czas
12771277
issues.add_time_cancel=Anuluj
12781278
issues.add_time_history=`dodał(-a) spędzony czas %s`
1279-
issues.del_time_history=`usunął(-ęła) spędzony czas %s'
1279+
issues.del_time_history=usunął(-ęła) spędzony czas %s
12801280
issues.add_time_hours=Godziny
12811281
issues.add_time_minutes=Minuty
12821282
issues.add_time_sum_to_small=Czas nie został wprowadzony.

options/locale/locale_pt-PT.ini

+8-4
Original file line numberDiff line numberDiff line change
@@ -2140,10 +2140,10 @@ settings.dismiss_stale_approvals_desc=Quando novos cometimentos que mudam o cont
21402140
settings.require_signed_commits=Exigir cometimentos assinados
21412141
settings.require_signed_commits_desc=Rejeitar envios para este ramo que não estejam assinados ou que não sejam validáveis.
21422142
settings.protect_branch_name_pattern=Padrão do nome do ramo protegido
2143-
settings.protect_protected_file_patterns=`Padrões de ficheiros protegidos (separados com ponto e vírgula ' ;'):`
2144-
settings.protect_protected_file_patterns_desc=`Não é permitido alterar imediatamente ficheiros protegidos, mesmo que o utilizador tenha autorização para adicionar, editar ou eliminar ficheiros neste ramo. Podem ser usados múltiplos padrões separados por ponto e vírgula (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2145-
settings.protect_unprotected_file_patterns=`Padrões de ficheiros desprotegidos (separados com ponto e vírgula ' ;'):`
2146-
settings.protect_unprotected_file_patterns_desc=`Ficheiros desprotegidos que é permitido alterar imediatamente se o utilizador tiver permissão de escrita, passando ao lado da restrição no envio. Podem ser usados múltiplos padrões separados por ponto e vírgula (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2143+
settings.protect_protected_file_patterns=Padrões de ficheiros protegidos (separados com ponto e vírgula ';'):
2144+
settings.protect_protected_file_patterns_desc=Ficheiros protegidos não podem ser modificados imediatamente, mesmo que o utilizador tenha direitos para adicionar, editar ou eliminar ficheiros neste ramo. Múltiplos padrões podem ser separados com ponto e vírgula (';'). Veja a documentação em <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> para ver a sintaxe. Exemplos: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.
2145+
settings.protect_unprotected_file_patterns=Padrões de ficheiros desprotegidos (separados com ponto e vírgula ';'):
2146+
settings.protect_unprotected_file_patterns_desc=Ficheiros desprotegidos que podem ser modificados imediatamente se o utilizador tiver direitos de escrita, contornando a restrição no envio. Múltiplos padrões podem ser separados com ponto e vírgula (';'). Veja a documentação em <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> para ver a sintaxe. Exemplos: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.
21472147
settings.add_protected_branch=Habilitar salvaguarda
21482148
settings.delete_protected_branch=Desabilitar salvaguarda
21492149
settings.update_protect_branch_success=A salvaguarda do ramo '%s' foi modificada.
@@ -2280,6 +2280,8 @@ diff.image.side_by_side=Lado a Lado
22802280
diff.image.swipe=Deslizar
22812281
diff.image.overlay=Sobrepor
22822282
diff.has_escaped=Esta linha tem caracteres unicode escondidos
2283+
diff.show_file_tree=Mostrar árvore de ficheiros
2284+
diff.hide_file_tree=Esconder árvore de ficheiros
22832285

22842286
releases.desc=Acompanhe as versões e as descargas do repositório.
22852287
release.releases=Lançamentos
@@ -2293,6 +2295,7 @@ release.compare=Comparar
22932295
release.edit=editar
22942296
release.ahead.commits=<strong>%d</strong> cometimentos
22952297
release.ahead.target=para %s desde este lançamento
2298+
tag.ahead.target=para o ramo %s desde esta etiqueta
22962299
release.source_code=Código fonte
22972300
release.new_subheader=Lançamentos organizam as versões do trabalho.
22982301
release.edit_subheader=Lançamentos organizam as versões do trabalho.
@@ -3364,6 +3367,7 @@ runners.status.idle=Parada
33643367
runners.status.active=Em funcionamento
33653368
runners.status.offline=Desconectada
33663369
runners.version=Versão
3370+
runners.reset_registration_token_success=O código de incrição do executor foi reposto com sucesso
33673371

33683372
runs.all_workflows=Todas as sequências de trabalho
33693373
runs.open_tab=%d abertas

options/locale/locale_tr-TR.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ issues.add_remove_labels=%s ekleme ve %s kaldırma işlemlerini %s yaptı
12561256
issues.add_milestone_at=`%[2]s <b>%[1]s</b> kilometre taşına ekledi`
12571257
issues.add_project_at=`bunu %s projesine <b>%s</b> ekledi`
12581258
issues.change_milestone_at=`%s kilometre taşını <b>%s</b> iken <b>%s</b> olarak değiştirdi`
1259-
issues.change_project_at=`%s <b>%s</b> olan projeyi <b>%s</b> olarak değiştirdi
1259+
issues.change_project_at=%s <b>%s</b> olan projeyi <b>%s</b> olarak değiştirdi
12601260
issues.remove_milestone_at=`%[2]s <b>%[1]s</b> kilometre taşından kaldırdı`
12611261
issues.remove_project_at=`bunu %s projesinden <b>%s</b> kaldırdı`
12621262
issues.deleted_milestone=`(silindi)`

options/locale/locale_zh-CN.ini

+13-4
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ release=版本发布
10681068
releases=版本发布
10691069
tag=Git标签
10701070
released_this=发布
1071+
tagged_this=已标记
10711072
file.title=%s 位于 %s
10721073
file_raw=原始文件
10731074
file_history=文件历史
@@ -1276,6 +1277,7 @@ issues.choose.blank=默认模板
12761277
issues.choose.blank_about=从默认模板创建一个工单。
12771278
issues.choose.ignore_invalid_templates=已忽略无效模板
12781279
issues.choose.invalid_templates=发现了 %v 个无效模板
1280+
issues.choose.invalid_config=问题配置包含错误:
12791281
issues.no_ref=分支/标记未指定
12801282
issues.create=创建工单
12811283
issues.new_label=创建标签
@@ -1489,6 +1491,9 @@ issues.due_date_invalid=到期日期无效或超出范围。请使用 'yyyy-mm-d
14891491
issues.dependency.title=依赖工单
14901492
issues.dependency.issue_no_dependencies=没有设置依赖项。
14911493
issues.dependency.pr_no_dependencies=没有设置依赖项。
1494+
issues.dependency.no_permission_1=您没有读取 %d 依赖关系的权限
1495+
issues.dependency.no_permission_n=您没有读取 %d 依赖关系的权限
1496+
issues.dependency.no_permission.can_remove=您没有读取此依赖关系的权限,但可以删除此依赖关系
14921497
issues.dependency.add=添加依赖工单...
14931498
issues.dependency.cancel=取消
14941499
issues.dependency.remove=删除
@@ -2135,10 +2140,10 @@ settings.dismiss_stale_approvals_desc=当新的提交更改合并请求内容被
21352140
settings.require_signed_commits=需要签名提交
21362141
settings.require_signed_commits_desc=拒绝推送未签名或无法验证的提交到分支
21372142
settings.protect_branch_name_pattern=受保护的分支名称模式
2138-
settings.protect_protected_file_patterns=`"受保护的文件模式 (使用分号 '\;' 分隔):" ;'):``
2139-
settings.protect_protected_file_patterns_desc=`即使用户有权添加、编辑或删除此分支中的文件,也不允许直接更改受保护的文件。 可以使用分号分隔多个模式(' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2140-
settings.protect_unprotected_file_patterns=`不受保护的文件模式 (使用分号分隔 ' ;'):`
2141-
settings.protect_unprotected_file_patterns_desc=`如果用户有写入权限,则允许直接更改的不受保护的文件,以绕过推送限制。可以使用分号分隔多重模式 (' ;'). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>.`
2143+
settings.protect_protected_file_patterns=受保护的文件模式(使用分号 ';' 分隔):
2144+
settings.protect_protected_file_patterns_desc=即使用户有权添加、编辑或删除此分支中的文件,也不允许直接更改受保护的文件。 可以使用分号 (';') 分隔多个模式。 见<a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a>文档了解模式语法。例如: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>
2145+
settings.protect_unprotected_file_patterns=不受保护的文件模式(使用分号 ';' 分隔):
2146+
settings.protect_unprotected_file_patterns_desc=如果用户有写权限,则允许直接更改的不受保护的文件,以绕过推送限制。可以使用分号分隔多个模式 (';')。 见 <a href='https://pkg.go.dev/github.com/gobwas/glob#Compile'>github.com/gobwas/glob</a> 文档了解模式语法。例如: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>
21422147
settings.add_protected_branch=启用保护
21432148
settings.delete_protected_branch=禁用保护
21442149
settings.update_protect_branch_success=分支 "%s" 的分支保护已更新。
@@ -2275,6 +2280,8 @@ diff.image.side_by_side=双排
22752280
diff.image.swipe=滑动
22762281
diff.image.overlay=叠加
22772282
diff.has_escaped=这一行有隐藏的 Unicode 字符
2283+
diff.show_file_tree=显示文件树
2284+
diff.hide_file_tree=隐藏文件树
22782285

22792286
releases.desc=跟踪项目版本和下载。
22802287
release.releases=版本发布
@@ -2288,6 +2295,7 @@ release.compare=比较
22882295
release.edit=编辑
22892296
release.ahead.commits=<strong>%d</strong> 次提交
22902297
release.ahead.target=在此版本发布后被加入到 %s
2298+
tag.ahead.target=自此标签到 %s
22912299
release.source_code=源代码
22922300
release.new_subheader=版本发布组织项目的版本。
22932301
release.edit_subheader=版本发布组织项目的版本。
@@ -3359,6 +3367,7 @@ runners.status.idle=空闲
33593367
runners.status.active=激活
33603368
runners.status.offline=离线
33613369
runners.version=版本
3370+
runners.reset_registration_token_success=成功重置运行器注册令牌
33623371
33633372
runs.all_workflows=所有工作流
33643373
runs.open_tab=%d 开启中

0 commit comments

Comments
 (0)