Skip to content

Commit 4bb3382

Browse files
authored
Merge branch 'main' into refactor_just-splitit
2 parents 2cc0e00 + 9cd88ef commit 4bb3382

File tree

310 files changed

+5348
-3078
lines changed

Some content is hidden

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

310 files changed

+5348
-3078
lines changed

Makefile

Lines changed: 63 additions & 119 deletions
Large diffs are not rendered by default.

assets/go-licenses.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/serv.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ func fail(ctx context.Context, userMessage, logMsgFmt string, args ...any) error
104104
// There appears to be a chance to cause a zombie process and failure to read the Exit status
105105
// if nothing is outputted on stdout.
106106
_, _ = fmt.Fprintln(os.Stdout, "")
107-
_, _ = fmt.Fprintln(os.Stderr, "Gitea:", userMessage)
107+
// add extra empty lines to separate our message from other git errors to get more attention
108+
_, _ = fmt.Fprintln(os.Stderr, "error:")
109+
_, _ = fmt.Fprintln(os.Stderr, "error:", userMessage)
110+
_, _ = fmt.Fprintln(os.Stderr, "error:")
108111

109112
if logMsgFmt != "" {
110113
logMsg := fmt.Sprintf(logMsgFmt, args...)

cmd/web.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import (
1818

1919
"code.gitea.io/gitea/modules/container"
2020
"code.gitea.io/gitea/modules/graceful"
21+
"code.gitea.io/gitea/modules/gtprof"
2122
"code.gitea.io/gitea/modules/log"
2223
"code.gitea.io/gitea/modules/process"
2324
"code.gitea.io/gitea/modules/public"
2425
"code.gitea.io/gitea/modules/setting"
26+
"code.gitea.io/gitea/modules/util"
2527
"code.gitea.io/gitea/routers"
2628
"code.gitea.io/gitea/routers/install"
2729

@@ -218,6 +220,8 @@ func serveInstalled(ctx *cli.Context) error {
218220
}
219221
}
220222

223+
gtprof.EnableBuiltinTracer(util.Iif(setting.IsProd, 2000*time.Millisecond, 100*time.Millisecond))
224+
221225
// Set up Chi routes
222226
webRoutes := routers.NormalRoutes()
223227
err := listen(webRoutes, true)

custom/conf/app.example.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,10 +790,13 @@ LEVEL = Info
790790
;; Please note that setting this to false will not disable OAuth Basic or Basic authentication using a token
791791
;ENABLE_BASIC_AUTHENTICATION = true
792792
;;
793-
;; Show the password sign-in form (for password-based login), otherwise, only show OAuth2 login methods.
793+
;; Show the password sign-in form (for password-based login), otherwise, only show OAuth2 or passkey login methods if they are enabled.
794794
;; If you set it to false, maybe it also needs to set ENABLE_BASIC_AUTHENTICATION to false to completely disable password-based authentication.
795795
;ENABLE_PASSWORD_SIGNIN_FORM = true
796796
;;
797+
;; Allow users to sign-in with a passkey
798+
;ENABLE_PASSKEY_AUTHENTICATION = true
799+
;;
797800
;; More detail: https://github.com/gogits/gogs/issues/165
798801
;ENABLE_REVERSE_PROXY_AUTHENTICATION = false
799802
; Enable this to allow reverse proxy authentication for API requests, the reverse proxy is responsible for ensuring that no CSRF is possible.
@@ -1126,6 +1129,9 @@ LEVEL = Info
11261129
;; In default merge messages only include approvers who are official
11271130
;DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY = true
11281131
;;
1132+
;; In default squash-merge messages include the commit message of all commits comprising the pull request.
1133+
;POPULATE_SQUASH_COMMENT_WITH_COMMIT_MESSAGES = false
1134+
;;
11291135
;; Add co-authored-by and co-committed-by trailers if committer does not match author
11301136
;ADD_CO_COMMITTER_TRAILERS = true
11311137
;;

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ require (
7878
github.com/jhillyerd/enmime v1.3.0
7979
github.com/json-iterator/go v1.1.12
8080
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
81-
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
8281
github.com/klauspost/compress v1.17.11
8382
github.com/klauspost/cpuid/v2 v2.2.8
8483
github.com/lib/pq v1.10.9

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,6 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
506506
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
507507
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
508508
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
509-
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 h1:cTxwSmnaqLoo+4tLukHoB9iqHOu3LmLhRmgUxZo6Vp4=
510-
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M=
511509
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
512510
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
513511
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=

models/activities/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ func (at ActionType) String() string {
7272
case ActionRenameRepo:
7373
return "rename_repo"
7474
case ActionStarRepo:
75-
return "star_repo"
75+
return "star_repo" // will not displayed in feeds.tmpl
7676
case ActionWatchRepo:
77-
return "watch_repo"
77+
return "watch_repo" // will not displayed in feeds.tmpl
7878
case ActionCommitRepo:
7979
return "commit_repo"
8080
case ActionCreateIssue:

models/asymkey/gpg_key.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
user_model "code.gitea.io/gitea/models/user"
1414
"code.gitea.io/gitea/modules/timeutil"
1515

16-
"github.com/keybase/go-crypto/openpgp"
17-
"github.com/keybase/go-crypto/openpgp/packet"
16+
"github.com/ProtonMail/go-crypto/openpgp"
17+
"github.com/ProtonMail/go-crypto/openpgp/packet"
1818
"xorm.io/builder"
1919
)
2020

@@ -141,7 +141,11 @@ func parseGPGKey(ctx context.Context, ownerID int64, e *openpgp.Entity, verified
141141
// Parse Subkeys
142142
subkeys := make([]*GPGKey, len(e.Subkeys))
143143
for i, k := range e.Subkeys {
144-
subs, err := parseSubGPGKey(ownerID, pubkey.KeyIdString(), k.PublicKey, expiry)
144+
subkeyExpiry := expiry
145+
if k.Sig.KeyLifetimeSecs != nil {
146+
subkeyExpiry = k.PublicKey.CreationTime.Add(time.Duration(*k.Sig.KeyLifetimeSecs) * time.Second)
147+
}
148+
subs, err := parseSubGPGKey(ownerID, pubkey.KeyIdString(), k.PublicKey, subkeyExpiry)
145149
if err != nil {
146150
return nil, ErrGPGKeyParsing{ParseError: err}
147151
}
@@ -156,7 +160,7 @@ func parseGPGKey(ctx context.Context, ownerID int64, e *openpgp.Entity, verified
156160

157161
emails := make([]*user_model.EmailAddress, 0, len(e.Identities))
158162
for _, ident := range e.Identities {
159-
if ident.Revocation != nil {
163+
if ident.Revoked(time.Now()) {
160164
continue
161165
}
162166
email := strings.ToLower(strings.TrimSpace(ident.UserId.Email))

models/asymkey/gpg_key_add.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"code.gitea.io/gitea/models/db"
1111
"code.gitea.io/gitea/modules/log"
1212

13-
"github.com/keybase/go-crypto/openpgp"
13+
"github.com/ProtonMail/go-crypto/openpgp"
1414
)
1515

1616
// __________________ ________ ____ __.
@@ -83,12 +83,12 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str
8383
verified := false
8484
// Handle provided signature
8585
if signature != "" {
86-
signer, err := openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token), strings.NewReader(signature))
86+
signer, err := openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token), strings.NewReader(signature), nil)
8787
if err != nil {
88-
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\n"), strings.NewReader(signature))
88+
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\n"), strings.NewReader(signature), nil)
8989
}
9090
if err != nil {
91-
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature))
91+
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
9292
}
9393
if err != nil {
9494
log.Error("Unable to validate token signature. Error: %v", err)

0 commit comments

Comments
 (0)