Skip to content

Commit b2d7cf0

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated translations via Crowdin Vertical align avatar at middle (go-gitea#20302) Changed scroll to auto for some UI elements. (go-gitea#20294) Add hint to GNUPGHOME environment variable (go-gitea#20134) Refactor SSH init code, fix directory creation for TrustedUserCAKeys file (go-gitea#20299) [skip ci] Updated translations via Crowdin Use dedicated draft PR icon when possible (go-gitea#20303) Update goldmark (go-gitea#20300) Do not create empty ".ssh" directory when loading config (go-gitea#20289)
2 parents 62c4c96 + cb6c5f8 commit b2d7cf0

23 files changed

+91
-53
lines changed

docs/content/doc/advanced/signing.en-us.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ ideal UI and therefore subject to change.
100100
**Since 1.17**, Gitea runs git in its own home directory `[git].HOME_PATH` (default to `%(APP_DATA_PATH)/home`)
101101
and uses its own config `{[git].HOME_PATH}/.gitconfig`.
102102
If you have your own customized git config for Gitea, you should set these configs in system git config (aka `/etc/gitconfig`)
103-
or the Gitea internal git config `{[git].HOME_PATH}/.gitconfig`.
104-
Related home files for git command (like `.gnupg`) should also be put in Gitea's git home directory `[git].HOME_PATH`.
105-
103+
or the Gitea internal git config `{[git].HOME_PATH}/.gitconfig`.
104+
Related home files for git command (like `.gnupg`) should also be put in Gitea's git home directory `[git].HOME_PATH`.
105+
If you like to keep the `.gnupg` directory outside of `{[git].HOME_PATH}/`, consider setting the `$GNUPGHOME` environment variable to your preferred location.
106106

107107
### `INITIAL_COMMIT`
108108

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ require (
8787
github.com/urfave/cli v1.22.9
8888
github.com/xanzy/go-gitlab v0.64.0
8989
github.com/yohcop/openid-go v1.0.0
90-
github.com/yuin/goldmark v1.4.12
90+
github.com/yuin/goldmark v1.4.13
9191
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594
9292
github.com/yuin/goldmark-meta v1.1.0
9393
go.jolheiser.com/hcaptcha v0.0.4

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1550,8 +1550,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
15501550
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
15511551
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
15521552
github.com/yuin/goldmark v1.4.5/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
1553-
github.com/yuin/goldmark v1.4.12 h1:6hffw6vALvEDqJ19dOJvJKOoAOKe4NDaTqvd2sktGN0=
1554-
github.com/yuin/goldmark v1.4.12/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
1553+
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
1554+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
15551555
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 h1:yHfZyN55+5dp1wG7wDKv8HQ044moxkyGq12KFFMFDxg=
15561556
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594/go.mod h1:U9ihbh+1ZN7fR5Se3daSPoz1CGF9IYtSvWwVQtnzGHU=
15571557
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=

modules/setting/setting.go

+4-19
Original file line numberDiff line numberDiff line change
@@ -840,16 +840,17 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
840840
SSH.StartBuiltinServer = false
841841
}
842842

843-
trustedUserCaKeys := sec.Key("SSH_TRUSTED_USER_CA_KEYS").Strings(",")
844-
for _, caKey := range trustedUserCaKeys {
843+
SSH.TrustedUserCAKeysFile = sec.Key("SSH_TRUSTED_USER_CA_KEYS_FILENAME").MustString(filepath.Join(SSH.RootPath, "gitea-trusted-user-ca-keys.pem"))
844+
845+
for _, caKey := range SSH.TrustedUserCAKeys {
845846
pubKey, _, _, _, err := gossh.ParseAuthorizedKey([]byte(caKey))
846847
if err != nil {
847848
log.Fatal("Failed to parse TrustedUserCaKeys: %s %v", caKey, err)
848849
}
849850

850851
SSH.TrustedUserCAKeysParsed = append(SSH.TrustedUserCAKeysParsed, pubKey)
851852
}
852-
if len(trustedUserCaKeys) > 0 {
853+
if len(SSH.TrustedUserCAKeys) > 0 {
853854
// Set the default as email,username otherwise we can leave it empty
854855
sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").MustString("username,email")
855856
} else {
@@ -858,22 +859,6 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
858859

859860
SSH.AuthorizedPrincipalsAllow, SSH.AuthorizedPrincipalsEnabled = parseAuthorizedPrincipalsAllow(sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").Strings(","))
860861

861-
if !SSH.Disabled && !SSH.StartBuiltinServer {
862-
if err := os.MkdirAll(SSH.RootPath, 0o700); err != nil {
863-
log.Fatal("Failed to create '%s': %v", SSH.RootPath, err)
864-
} else if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
865-
log.Fatal("Failed to create '%s': %v", SSH.KeyTestPath, err)
866-
}
867-
868-
if len(trustedUserCaKeys) > 0 && SSH.AuthorizedPrincipalsEnabled {
869-
fname := sec.Key("SSH_TRUSTED_USER_CA_KEYS_FILENAME").MustString(filepath.Join(SSH.RootPath, "gitea-trusted-user-ca-keys.pem"))
870-
if err := os.WriteFile(fname,
871-
[]byte(strings.Join(trustedUserCaKeys, "\n")), 0o600); err != nil {
872-
log.Fatal("Failed to create '%s': %v", fname, err)
873-
}
874-
}
875-
}
876-
877862
SSH.MinimumKeySizeCheck = sec.Key("MINIMUM_KEY_SIZE_CHECK").MustBool(SSH.MinimumKeySizeCheck)
878863
minimumKeySizes := Cfg.Section("ssh.minimum_key_sizes").Keys()
879864
for _, key := range minimumKeySizes {

modules/ssh/init.go

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2022 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package ssh
6+
7+
import (
8+
"fmt"
9+
"net"
10+
"os"
11+
"path/filepath"
12+
"strconv"
13+
"strings"
14+
15+
"code.gitea.io/gitea/modules/log"
16+
"code.gitea.io/gitea/modules/setting"
17+
)
18+
19+
func Init() error {
20+
if setting.SSH.Disabled {
21+
return nil
22+
}
23+
24+
if setting.SSH.StartBuiltinServer {
25+
Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)
26+
log.Info("SSH server started on %s. Cipher list (%v), key exchange algorithms (%v), MACs (%v)",
27+
net.JoinHostPort(setting.SSH.ListenHost, strconv.Itoa(setting.SSH.ListenPort)),
28+
setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs,
29+
)
30+
return nil
31+
}
32+
33+
builtinUnused()
34+
35+
// FIXME: why 0o644 for a directory .....
36+
if err := os.MkdirAll(setting.SSH.KeyTestPath, 0o644); err != nil {
37+
return fmt.Errorf("failed to create directory %q for ssh key test: %w", setting.SSH.KeyTestPath, err)
38+
}
39+
40+
if len(setting.SSH.TrustedUserCAKeys) > 0 && setting.SSH.AuthorizedPrincipalsEnabled {
41+
caKeysFileName := setting.SSH.TrustedUserCAKeysFile
42+
caKeysFileDir := filepath.Dir(caKeysFileName)
43+
44+
err := os.MkdirAll(caKeysFileDir, 0o700) // SSH.RootPath by default (That is `~/.ssh` in most cases)
45+
if err != nil {
46+
return fmt.Errorf("failed to create directory %q for ssh trusted ca keys: %w", caKeysFileDir, err)
47+
}
48+
49+
if err := os.WriteFile(caKeysFileName, []byte(strings.Join(setting.SSH.TrustedUserCAKeys, "\n")), 0o600); err != nil {
50+
return fmt.Errorf("failed to write ssh trusted ca keys to %q: %w", caKeysFileName, err)
51+
}
52+
}
53+
54+
return nil
55+
}

modules/ssh/ssh_graceful.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func listen(server *ssh.Server) {
2929
log.Info("SSH Listener: %s Closed", server.Addr)
3030
}
3131

32-
// Unused informs our cleanup routine that we will not be using a ssh port
33-
func Unused() {
32+
// builtinUnused informs our cleanup routine that we will not be using a ssh port
33+
func builtinUnused() {
3434
graceful.GetManager().InformCleanup()
3535
}

modules/templates/helper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func SVG(icon string, others ...interface{}) template.HTML {
628628

629629
// Avatar renders user avatars. args: user, size (int), class (string)
630630
func Avatar(item interface{}, others ...interface{}) template.HTML {
631-
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
631+
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image vm", others...)
632632

633633
switch t := item.(type) {
634634
case *user_model.User:

options/locale/locale_de-DE.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=Standardbranch
861861
default_branch_helper=Der default Branch ist der Basisbranch für Pull-Requests und Commits.
862862
mirror_prune=Entfernen
863863
mirror_prune_desc=Entferne veraltete remote-tracking Referenzen
864-
mirror_interval=Mirror-Intervall. Gültige Zeiteinheiten sind 'h', 'm', sowie 's'. 0 deaktiviert die automatische Synchronisierung. (Minimum: %s)
865864
mirror_interval_invalid=Das Spiegel-Intervall ist ungültig.
866865
mirror_address=Klonen via URL
867866
mirror_address_desc=Gib alle erforderlichen Anmeldedaten im Abschnitt "Authentifizierung" ein.

options/locale/locale_el-GR.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=Προεπιλεγμένος Κλάδος
861861
default_branch_helper=Ο προεπιλεγμένος κλάδος είναι ο βασικός κλάδος για pull requests και υποβολές κώδικα.
862862
mirror_prune=Καθαρισμός
863863
mirror_prune_desc=Αφαίρεση παρωχημένων αναφορών απομακρυσμένης-παρακολούθησης
864-
mirror_interval=Διάστημα ανανέωσης ειδώλου (έγκυρες μονάδες ώρας είναι 'h', 'm', 's'). 0 για απενεργοποίηση του αυτόματου συγχρονισμού. (Ελάχιστο διάστημα: %s)
865864
mirror_interval_invalid=Το χρονικό διάστημα του ειδώλου δεν είναι έγκυρο.
866865
mirror_address=Κλωνοποίηση Από Το URL
867866
mirror_address_desc=Τοποθετήστε όλα τα απαιτούμενα διαπιστευτήρια στην ενότητα Εξουσιοδότηση.

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,7 @@ issues.previous = Previous
13031303
issues.next = Next
13041304
issues.open_title = Open
13051305
issues.closed_title = Closed
1306+
issues.draft_title = Draft
13061307
issues.num_comments = %d comments
13071308
issues.commented_at = `commented <a href="#%s">%s</a>`
13081309
issues.delete_comment_confirm = Are you sure you want to delete this comment?

options/locale/locale_es-ES.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,9 @@ default_branch=Rama por defecto
861861
default_branch_helper=La rama por defecto es la rama base para pull requests y commits de código.
862862
mirror_prune=Purgar
863863
mirror_prune_desc=Eliminar referencias de seguimiento de remotes obsoletas
864-
mirror_interval=Intervalo de replicación (las unidades de tiempo válidas son «h», «m» y «s»). 0 desactiva la sincronización automática. (Intervalo mínimo: %s)
864+
mirror_interval=Intervalo de réplica (Las unidades de tiempo válidas son 'h', 'm', 's'). 0 para deshabilitar la sincronización automática. (Intervalo mínimo: %s)
865865
mirror_interval_invalid=El intervalo de réplica no es válido.
866+
mirror_sync_on_commit=Sincronizar cuando los commits sean subidos
866867
mirror_address=Clonar desde URL
867868
mirror_address_desc=Ponga cualquier credencial requerida en la sección de Autorización.
868869
mirror_address_url_invalid=La url proporcionada no es válida. Debe escapar correctamente de todos los componentes de la url.

options/locale/locale_ja-JP.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=デフォルトブランチ
861861
default_branch_helper=デフォルトブランチはプルリクエストとコードコミットのベースブランチとなります。
862862
mirror_prune=Prune
863863
mirror_prune_desc=不要になった古いリモートトラッキング参照を削除
864-
mirror_interval=ミラー間隔 (有効な時間の単位は'h''m''s')。 自動的な同期を無効にする場合は0。(最小間隔: %s)
865864
mirror_interval_invalid=ミラー間隔が不正です。
866865
mirror_address=クローンするURL
867866
mirror_address_desc=必要な資格情報は「認証」セクションに設定してください。

options/locale/locale_lv-LV.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=Noklusējuma atzars
861861
default_branch_helper=Noklusētais atzars nosaka pamata atzaru uz kuru tiks veidoti izmaiņu pieprasījumi un koda revīziju iesūtīšana.
862862
mirror_prune=Izmest
863863
mirror_prune_desc=Izdzēst visas ārējās atsauces, kas ārējā repozitorijā vairs neeksistē
864-
mirror_interval=Spoguļošanas intervāls (derīgas laika vienības ir 'h', 'm', 's'). Norādiet 0, lai atslēgtu automātisku spoguļošanu. (Minimālais intervāls: %s)
865864
mirror_interval_invalid=Nekorekts spoguļošanas intervāls.
866865
mirror_address=Spoguļa adrese
867866
mirror_address_desc=Pieslēgšanās rekvizītus norādiet autorizācijas sadaļā.

options/locale/locale_pt-PT.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -861,8 +861,9 @@ default_branch=Ramo principal
861861
default_branch_helper=O ramo principal é o ramo base para pedidos de integração e cometimentos.
862862
mirror_prune=Podar
863863
mirror_prune_desc=Remover referências obsoletas de seguimento remoto
864-
mirror_interval=Intervalo entre sincronizações (as unidades de tempo válidas são 'h', 'm' e 's'). O valor zero desabilita a sincronização automática. (Intervalo mínimo: %s)
864+
mirror_interval=Intervalo entre sincronizações (as unidades de tempo válidas são 'h', 'm' e 's'). O valor zero desabilita a sincronização periódica. (Intervalo mínimo: %s)
865865
mirror_interval_invalid=O intervalo entre sincronizações não é válido.
866+
mirror_sync_on_commit=Sincronizar quando forem enviados cometimentos
866867
mirror_address=Clonar a partir do URL
867868
mirror_address_desc=Coloque, na secção de Autorização, as credenciais que, eventualmente, sejam necessárias.
868869
mirror_address_url_invalid=O URL fornecido é inválido. Tem que codificar adequadamente todos os componentes do URL.
@@ -1302,6 +1303,7 @@ issues.previous=Anterior
13021303
issues.next=Seguinte
13031304
issues.open_title=Aberta
13041305
issues.closed_title=Fechada
1306+
issues.draft_title=Rascunho
13051307
issues.num_comments=%d comentários
13061308
issues.commented_at=`comentou <a href="#%s">%s</a>`
13071309
issues.delete_comment_confirm=Tem a certeza que quer eliminar este comentário?

options/locale/locale_zh-CN.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=默认分支
861861
default_branch_helper=默认分支是用于合并请求和代码提交的基础分支。
862862
mirror_prune=修剪
863863
mirror_prune_desc=删除过时的远程跟踪引用
864-
mirror_interval=镜像间隔 (有效的时间单位是 'h', 'm', 's')。0 禁用自动同步 (最短间隔: %s)
865864
mirror_interval_invalid=镜像间隔无效。
866865
mirror_address=从URL克隆
867866
mirror_address_desc=在授权框中输入必要的凭据。

options/locale/locale_zh-TW.ini

-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ default_branch=預設分支
861861
default_branch_helper=預設分支是合併請求和提交程式碼的基礎分支。
862862
mirror_prune=裁減
863863
mirror_prune_desc=刪除過時的遠端追蹤參考
864-
mirror_interval=鏡像間隔 (有效時間單位為 'h''m''s'),設為 0 以停用自動同步。(最小間隔: %s)
865864
mirror_interval_invalid=鏡像週期無效
866865
mirror_address=從 URL Clone
867866
mirror_address_desc=在授權資訊中填入必要的資料。

routers/init.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ package routers
66

77
import (
88
"context"
9-
"net"
109
"reflect"
1110
"runtime"
12-
"strconv"
1311

1412
"code.gitea.io/gitea/models"
1513
asymkey_model "code.gitea.io/gitea/models/asymkey"
@@ -158,14 +156,8 @@ func GlobalInitInstalled(ctx context.Context) {
158156

159157
mustInitCtx(ctx, syncAppPathForGit)
160158

161-
if setting.SSH.StartBuiltinServer {
162-
ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)
163-
log.Info("SSH server started on %s. Cipher list (%v), key exchange algorithms (%v), MACs (%v)",
164-
net.JoinHostPort(setting.SSH.ListenHost, strconv.Itoa(setting.SSH.ListenPort)),
165-
setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)
166-
} else {
167-
ssh.Unused()
168-
}
159+
mustInit(ssh.Init)
160+
169161
auth.Init()
170162
svg.Init()
171163
}

templates/repo/issue/view_title.tmpl

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
{{else if .Issue.IsClosed}}
2525
<div class="ui red large label">{{if .Issue.IsPull}}{{svg "octicon-git-pull-request"}}{{else}}{{svg "octicon-issue-closed"}}{{end}} {{.locale.Tr "repo.issues.closed_title"}}</div>
2626
{{else if .Issue.IsPull}}
27-
<div class="ui green large label">{{svg "octicon-git-pull-request"}} {{.locale.Tr "repo.issues.open_title"}}</div>
27+
{{if .IsPullWorkInProgress}}
28+
<div class="ui grey large label">{{svg "octicon-git-pull-request-draft"}} {{.locale.Tr "repo.issues.draft_title"}}</div>
29+
{{else}}
30+
<div class="ui green large label">{{svg "octicon-git-pull-request"}} {{.locale.Tr "repo.issues.open_title"}}</div>
31+
{{end}}
2832
{{else}}
2933
<div class="ui green large label">{{svg "octicon-issue-opened"}} {{.locale.Tr "repo.issues.open_title"}}</div>
3034
{{end}}

templates/shared/issuelist.tmpl

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
{{if .IsClosed}}
1818
{{svg "octicon-git-pull-request" 16 "text red"}}
1919
{{else}}
20-
{{svg "octicon-git-pull-request" 16 "text green"}}
20+
{{if .PullRequest.IsWorkInProgress}}
21+
{{svg "octicon-git-pull-request-draft" 16 "text grey"}}
22+
{{else}}
23+
{{svg "octicon-git-pull-request" 16 "text green"}}
24+
{{end}}
2125
{{end}}
2226
{{end}}
2327
{{else}}

web_src/less/_admin.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.table.segment {
1313
padding: 0;
1414
font-size: 13px;
15-
overflow-x: scroll;
15+
overflow-x: auto;
1616

1717
&:not(.striped) {
1818
thead {

web_src/less/_repository.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,7 @@ td.blob-excerpt {
33523352
.commit-header-row {
33533353
.ui.horizontal.list {
33543354
width: 100%;
3355-
overflow-x: scroll;
3355+
overflow-x: auto;
33563356
margin-top: 2px;
33573357

33583358
.item {
@@ -3401,7 +3401,7 @@ td.blob-excerpt {
34013401
}
34023402

34033403
.commit-table {
3404-
overflow-x: scroll;
3404+
overflow-x: auto;
34053405

34063406
td.sha,
34073407
th.sha {

web_src/less/_user.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,5 @@
170170
}
171171

172172
#notification_div .tab.segment {
173-
overflow-x: scroll;
173+
overflow-x: auto;
174174
}

web_src/less/features/gitgraph.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#git-graph-container {
2-
overflow-x: scroll;
2+
overflow-x: auto;
33
width: 100%;
44
min-height: 350px;
55

0 commit comments

Comments
 (0)