Skip to content

Commit aa3428f

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (26 commits) Fix oauth2 builtin application logic (go-gitea#30304) [skip ci] Updated licenses and gitignores Some NuGet package enhancements (go-gitea#30280) Fix and rewrite contrast color calculation, fix project-related bugs (go-gitea#30237) Add `--page-spacing` variable, fix admin dashboard notice (go-gitea#30302) Action view mobile improvements and fixes (go-gitea#30309) Fix checkboxes on mobile view, remove some dead css (go-gitea#30308) Clean up log messages (go-gitea#30313) Fix right-aligned input icons (go-gitea#30301) Refactor startup deprecation messages (go-gitea#30305) [skip ci] Updated translations via Crowdin Remove fomantic list module (go-gitea#30281) Markup color and font size fixes (go-gitea#30282) Fix code block style for code preview (go-gitea#30298) Always use `octicon-eye` on watch button (go-gitea#30288) Fix view commit link (go-gitea#30297) Add gap to commit status details (go-gitea#30284) Update JS dependencies and add new eslint rules (go-gitea#30279) Upgrade `golang.org/x/net` to v0.24.0 (go-gitea#30283) Commit-Dropdown: Show Author of commit if available (go-gitea#30272) ... # Conflicts: # templates/base/footer_content.tmpl
2 parents ceeb71e + 074a3e0 commit aa3428f

File tree

100 files changed

+1431
-1993
lines changed

Some content is hidden

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

100 files changed

+1431
-1993
lines changed

.eslintrc.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ rules:
537537
no-underscore-dangle: [0]
538538
no-unexpected-multiline: [2]
539539
no-unmodified-loop-condition: [2]
540-
no-unneeded-ternary: [0]
540+
no-unneeded-ternary: [2]
541541
no-unreachable-loop: [2]
542542
no-unreachable: [2]
543543
no-unsafe-finally: [2]
@@ -716,12 +716,14 @@ rules:
716716
unicorn/import-style: [0]
717717
unicorn/new-for-builtins: [2]
718718
unicorn/no-abusive-eslint-disable: [0]
719+
unicorn/no-anonymous-default-export: [0]
719720
unicorn/no-array-callback-reference: [0]
720721
unicorn/no-array-for-each: [2]
721722
unicorn/no-array-method-this-argument: [2]
722723
unicorn/no-array-push-push: [2]
723724
unicorn/no-array-reduce: [2]
724725
unicorn/no-await-expression-member: [0]
726+
unicorn/no-await-in-promise-methods: [2]
725727
unicorn/no-console-spaces: [0]
726728
unicorn/no-document-cookie: [2]
727729
unicorn/no-empty-file: [2]
@@ -738,6 +740,7 @@ rules:
738740
unicorn/no-null: [0]
739741
unicorn/no-object-as-default-parameter: [0]
740742
unicorn/no-process-exit: [0]
743+
unicorn/no-single-promise-in-promise-methods: [2]
741744
unicorn/no-static-only-class: [2]
742745
unicorn/no-thenable: [2]
743746
unicorn/no-this-assignment: [2]

cmd/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func showWebStartupMessage(msg string) {
114114
log.Info("* WorkPath: %s", setting.AppWorkPath)
115115
log.Info("* CustomPath: %s", setting.CustomPath)
116116
log.Info("* ConfigFile: %s", setting.CustomConf)
117-
log.Info("%s", msg)
117+
log.Info("%s", msg) // show startup message
118118
}
119119

120120
func serveInstall(ctx *cli.Context) error {

custom/conf/app.example.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,6 +2315,8 @@ LEVEL = Info
23152315
;SHOW_FOOTER_VERSION = true
23162316
;; Show template execution time in the footer
23172317
;SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
2318+
;; Show the "powered by" text in the footer
2319+
;SHOW_FOOTER_POWERED_BY = true
23182320
;; Generate sitemap. Defaults to `true`.
23192321
;ENABLE_SITEMAP = true
23202322
;; Enable/Disable RSS/Atom feed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,5 +1429,6 @@ Like `uses: https://gitea.com/actions/checkout@v4` or `uses: http://your-git-ser
14291429

14301430
- `SHOW_FOOTER_VERSION`: **true**: Show Gitea and Go version information in the footer.
14311431
- `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: Show time of template execution in the footer.
1432+
- `SHOW_FOOTER_POWERED_BY`: **true**: Show the "powered by" text in the footer.
14321433
- `ENABLE_SITEMAP`: **true**: Generate sitemap.
14331434
- `ENABLE_FEED`: **true**: Enable/Disable RSS/Atom feed.

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,5 +1353,6 @@ PROXY_HOSTS = *.github.com
13531353

13541354
- `SHOW_FOOTER_VERSION`: **true**: 在页面底部显示Gitea的版本。
13551355
- `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: 在页脚显示模板执行的时间。
1356+
- `SHOW_FOOTER_POWERED_BY`: **true**: 在页脚显示“由...提供动力”的文本。
13561357
- `ENABLE_SITEMAP`: **true**: 生成sitemap.
13571358
- `ENABLE_FEED`: **true**: 是否启用RSS/Atom

docs/content/installation/with-docker.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ services:
304304
- GITEA__mailer__ENABLED=true
305305
- GITEA__mailer__FROM=${GITEA__mailer__FROM:?GITEA__mailer__FROM not set}
306306
- GITEA__mailer__PROTOCOL=smtps
307-
- GITEA__mailer__HOST=${GITEA__mailer__HOST:?GITEA__mailer__HOST not set}
307+
- GITEA__mailer__SMTP_ADDR=${GITEA__mailer__SMTP_ADDR:?GITEA__mailer__SMTP_ADDR not set}
308+
- GITEA__mailer__SMTP_PORT=${GITEA__mailer__SMTP_PORT:?GITEA__mailer__SMTP_PORT not set}
308309
- GITEA__mailer__USER=${GITEA__mailer__USER:-apikey}
309310
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
310311
```

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ require (
105105
github.com/yuin/goldmark v1.7.0
106106
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
107107
github.com/yuin/goldmark-meta v1.1.0
108-
golang.org/x/crypto v0.21.0
108+
golang.org/x/crypto v0.22.0
109109
golang.org/x/image v0.15.0
110-
golang.org/x/net v0.22.0
110+
golang.org/x/net v0.24.0
111111
golang.org/x/oauth2 v0.18.0
112-
golang.org/x/sys v0.18.0
112+
golang.org/x/sys v0.19.0
113113
golang.org/x/text v0.14.0
114114
golang.org/x/tools v0.19.0
115115
google.golang.org/grpc v1.62.1

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
846846
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
847847
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
848848
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
849-
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
850-
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
849+
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
850+
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
851851
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw=
852852
golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
853853
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
@@ -881,8 +881,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
881881
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
882882
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
883883
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
884-
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
885-
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
884+
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
885+
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
886886
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
887887
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
888888
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -932,8 +932,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
932932
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
933933
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
934934
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
935-
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
936-
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
935+
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
936+
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
937937
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
938938
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
939939
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
@@ -943,8 +943,8 @@ golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
943943
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
944944
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
945945
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
946-
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
947-
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
946+
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
947+
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
948948
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
949949
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
950950
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

models/asymkey/ssh_key_fingerprint.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,14 @@ func calcFingerprintNative(publicKeyContent string) (string, error) {
7676
// CalcFingerprint calculate public key's fingerprint
7777
func CalcFingerprint(publicKeyContent string) (string, error) {
7878
// Call the method based on configuration
79-
var (
80-
fnName, fp string
81-
err error
82-
)
83-
if len(setting.SSH.KeygenPath) == 0 {
84-
fnName = "calcFingerprintNative"
85-
fp, err = calcFingerprintNative(publicKeyContent)
86-
} else {
87-
fnName = "calcFingerprintSSHKeygen"
88-
fp, err = calcFingerprintSSHKeygen(publicKeyContent)
89-
}
79+
useNative := setting.SSH.KeygenPath == ""
80+
calcFn := util.Iif(useNative, calcFingerprintNative, calcFingerprintSSHKeygen)
81+
fp, err := calcFn(publicKeyContent)
9082
if err != nil {
9183
if IsErrKeyUnableVerify(err) {
92-
log.Info("%s", publicKeyContent)
9384
return "", err
9485
}
95-
return "", fmt.Errorf("%s: %w", fnName, err)
86+
return "", fmt.Errorf("CalcFingerprint(%s): %w", util.Iif(useNative, "native", "ssh-keygen"), err)
9687
}
9788
return fp, nil
9889
}

models/db/consistency.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ import (
1010
)
1111

1212
// CountOrphanedObjects count subjects with have no existing refobject anymore
13-
func CountOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) (int64, error) {
13+
func CountOrphanedObjects(ctx context.Context, subject, refObject, joinCond string) (int64, error) {
1414
return GetEngine(ctx).
1515
Table("`"+subject+"`").
16-
Join("LEFT", "`"+refobject+"`", joinCond).
17-
Where(builder.IsNull{"`" + refobject + "`.id"}).
16+
Join("LEFT", "`"+refObject+"`", joinCond).
17+
Where(builder.IsNull{"`" + refObject + "`.id"}).
1818
Select("COUNT(`" + subject + "`.`id`)").
1919
Count()
2020
}
2121

2222
// DeleteOrphanedObjects delete subjects with have no existing refobject anymore
23-
func DeleteOrphanedObjects(ctx context.Context, subject, refobject, joinCond string) error {
23+
func DeleteOrphanedObjects(ctx context.Context, subject, refObject, joinCond string) error {
2424
subQuery := builder.Select("`"+subject+"`.id").
2525
From("`"+subject+"`").
26-
Join("LEFT", "`"+refobject+"`", joinCond).
27-
Where(builder.IsNull{"`" + refobject + "`.id"})
26+
Join("LEFT", "`"+refObject+"`", joinCond).
27+
Where(builder.IsNull{"`" + refObject + "`.id"})
2828
b := builder.Delete(builder.In("id", subQuery)).From("`" + subject + "`")
2929
_, err := GetEngine(ctx).Exec(b)
3030
return err

models/repo/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (repo *Repository) IsDependenciesEnabled(ctx context.Context) bool {
5353
var u *RepoUnit
5454
var err error
5555
if u, err = repo.GetUnit(ctx, unit.TypeIssues); err != nil {
56-
log.Trace("%s", err)
56+
log.Trace("IsDependenciesEnabled: %v", err)
5757
return setting.Service.DefaultEnableDependencies
5858
}
5959
return u.IssuesConfig().EnableDependencies

modules/lfs/filesystem_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (c *FilesystemClient) Download(ctx context.Context, objects []Pointer, call
4444
if err != nil {
4545
return err
4646
}
47-
47+
defer f.Close()
4848
if err := callback(p, f, nil); err != nil {
4949
return err
5050
}
@@ -75,7 +75,7 @@ func (c *FilesystemClient) Upload(ctx context.Context, objects []Pointer, callba
7575
if err != nil {
7676
return err
7777
}
78-
78+
defer f.Close()
7979
_, err = io.Copy(f, content)
8080

8181
return err

modules/markup/sanitizer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func createDefaultPolicy() *bluemonday.Policy {
6565
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^lines-num$`)).OnElements("td")
6666
policy.AllowAttrs("data-line-number").OnElements("span")
6767
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^lines-code chroma$`)).OnElements("td")
68-
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-inner$`)).OnElements("code")
68+
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^code-inner$`)).OnElements("div")
6969

7070
// For code preview (unicode escape)
7171
policy.AllowAttrs("class").Matching(regexp.MustCompile(`^file-view( unicode-escaped)?$`)).OnElements("table")

modules/packages/nuget/metadata.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type Package struct {
5858
type Metadata struct {
5959
Description string `json:"description,omitempty"`
6060
ReleaseNotes string `json:"release_notes,omitempty"`
61+
Readme string `json:"readme,omitempty"`
6162
Authors string `json:"authors,omitempty"`
6263
ProjectURL string `json:"project_url,omitempty"`
6364
RepositoryURL string `json:"repository_url,omitempty"`
@@ -71,6 +72,7 @@ type Dependency struct {
7172
Version string `json:"version"`
7273
}
7374

75+
// https://learn.microsoft.com/en-us/nuget/reference/nuspec
7476
type nuspecPackage struct {
7577
Metadata struct {
7678
ID string `xml:"id"`
@@ -80,6 +82,7 @@ type nuspecPackage struct {
8082
ProjectURL string `xml:"projectUrl"`
8183
Description string `xml:"description"`
8284
ReleaseNotes string `xml:"releaseNotes"`
85+
Readme string `xml:"readme"`
8386
PackageTypes struct {
8487
PackageType []struct {
8588
Name string `xml:"name,attr"`
@@ -89,6 +92,11 @@ type nuspecPackage struct {
8992
URL string `xml:"url,attr"`
9093
} `xml:"repository"`
9194
Dependencies struct {
95+
Dependency []struct {
96+
ID string `xml:"id,attr"`
97+
Version string `xml:"version,attr"`
98+
Exclude string `xml:"exclude,attr"`
99+
} `xml:"dependency"`
92100
Group []struct {
93101
TargetFramework string `xml:"targetFramework,attr"`
94102
Dependency []struct {
@@ -122,14 +130,14 @@ func ParsePackageMetaData(r io.ReaderAt, size int64) (*Package, error) {
122130
}
123131
defer f.Close()
124132

125-
return ParseNuspecMetaData(f)
133+
return ParseNuspecMetaData(archive, f)
126134
}
127135
}
128136
return nil, ErrMissingNuspecFile
129137
}
130138

131139
// ParseNuspecMetaData parses a Nuspec file to retrieve the metadata of a Nuget package
132-
func ParseNuspecMetaData(r io.Reader) (*Package, error) {
140+
func ParseNuspecMetaData(archive *zip.Reader, r io.Reader) (*Package, error) {
133141
var p nuspecPackage
134142
if err := xml.NewDecoder(r).Decode(&p); err != nil {
135143
return nil, err
@@ -166,6 +174,28 @@ func ParseNuspecMetaData(r io.Reader) (*Package, error) {
166174
Dependencies: make(map[string][]Dependency),
167175
}
168176

177+
if p.Metadata.Readme != "" {
178+
f, err := archive.Open(p.Metadata.Readme)
179+
if err == nil {
180+
buf, _ := io.ReadAll(f)
181+
m.Readme = string(buf)
182+
_ = f.Close()
183+
}
184+
}
185+
186+
if len(p.Metadata.Dependencies.Dependency) > 0 {
187+
deps := make([]Dependency, 0, len(p.Metadata.Dependencies.Dependency))
188+
for _, dep := range p.Metadata.Dependencies.Dependency {
189+
if dep.ID == "" || dep.Version == "" {
190+
continue
191+
}
192+
deps = append(deps, Dependency{
193+
ID: dep.ID,
194+
Version: dep.Version,
195+
})
196+
}
197+
m.Dependencies[""] = deps
198+
}
169199
for _, group := range p.Metadata.Dependencies.Group {
170200
deps := make([]Dependency, 0, len(group.Dependency))
171201
for _, dep := range group.Dependency {

0 commit comments

Comments
 (0)