Skip to content

Commit 60f1152

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-max-concurrent-hashes
2 parents 529f515 + 17be645 commit 60f1152

File tree

276 files changed

+7646
-4067
lines changed

Some content is hidden

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

276 files changed

+7646
-4067
lines changed

.drone.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ trigger:
1515
steps:
1616
- name: deps-frontend
1717
pull: always
18-
image: node:14
18+
image: node:16
1919
commands:
2020
- make node_modules
2121

2222
- name: lint-frontend
23-
image: node:14
23+
image: node:16
2424
commands:
2525
- make lint-frontend
2626
depends_on: [deps-frontend]
@@ -58,7 +58,7 @@ steps:
5858
TAGS: bindata gogit sqlite sqlite_unlock_notify
5959

6060
- name: checks-frontend
61-
image: node:14
61+
image: node:16
6262
commands:
6363
- make checks-frontend
6464
depends_on: [deps-frontend]
@@ -71,13 +71,13 @@ steps:
7171
depends_on: [lint-backend]
7272

7373
- name: test-frontend
74-
image: node:14
74+
image: node:16
7575
commands:
7676
- make test-frontend
7777
depends_on: [lint-frontend]
7878

7979
- name: build-frontend
80-
image: node:14
80+
image: node:16
8181
commands:
8282
- make frontend
8383
depends_on: [test-frontend]
@@ -414,6 +414,7 @@ steps:
414414
settings:
415415
author_email: "[email protected]"
416416
author_name: GiteaBot
417+
branch: main
417418
commit: true
418419
commit_message: "[skip ci] Updated translations via Crowdin"
419420
remote: "[email protected]:go-gitea/gitea.git"
@@ -461,6 +462,7 @@ steps:
461462
settings:
462463
author_email: "[email protected]"
463464
author_name: GiteaBot
465+
branch: main
464466
commit: true
465467
commit_message: "[skip ci] Updated licenses and gitignores "
466468
remote: "[email protected]:go-gitea/gitea.git"
@@ -528,7 +530,7 @@ steps:
528530
image: plugins/s3:1
529531
settings:
530532
acl: public-read
531-
bucket: releases
533+
bucket: gitea-artifacts
532534
endpoint: https://storage.gitea.io
533535
path_style: true
534536
source: "dist/release/*"
@@ -549,7 +551,7 @@ steps:
549551
image: plugins/s3:1
550552
settings:
551553
acl: public-read
552-
bucket: releases
554+
bucket: gitea-artifacts
553555
endpoint: https://storage.gitea.io
554556
path_style: true
555557
source: "dist/release/*"
@@ -624,7 +626,7 @@ steps:
624626
image: plugins/s3:1
625627
settings:
626628
acl: public-read
627-
bucket: releases
629+
bucket: gitea-artifacts
628630
endpoint: https://storage.gitea.io
629631
path_style: true
630632
source: "dist/release/*"

.eslintrc

+4
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ rules:
366366
unicorn/no-array-instanceof: [0]
367367
unicorn/no-array-push-push: [2]
368368
unicorn/no-console-spaces: [0]
369+
unicorn/no-document-cookie: [2]
369370
unicorn/no-fn-reference-in-iterator: [0]
370371
unicorn/no-for-loop: [0]
371372
unicorn/no-hex-escape: [0]
@@ -389,6 +390,7 @@ rules:
389390
unicorn/numeric-separators-style: [0]
390391
unicorn/prefer-add-event-listener: [2]
391392
unicorn/prefer-array-find: [2]
393+
unicorn/prefer-array-flat-map: [2]
392394
unicorn/prefer-array-flat: [2]
393395
unicorn/prefer-array-index-of: [2]
394396
unicorn/prefer-array-some: [2]
@@ -399,8 +401,10 @@ rules:
399401
unicorn/prefer-includes: [2]
400402
unicorn/prefer-math-trunc: [2]
401403
unicorn/prefer-modern-dom-apis: [0]
404+
unicorn/prefer-module: [2]
402405
unicorn/prefer-negative-index: [2]
403406
unicorn/prefer-node-append: [0]
407+
unicorn/prefer-node-protocol: [0]
404408
unicorn/prefer-node-remove: [0]
405409
unicorn/prefer-number-properties: [0]
406410
unicorn/prefer-optional-catch-binding: [2]

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ cpu.out
7676
/integrations/mssql.ini
7777
/node_modules
7878
/yarn.lock
79+
/yarn-error.log
80+
/npm-debug.log*
7981
/public/js
8082
/public/serviceworker.js
8183
/public/css

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ test-backend:
359359
@$(GO) test $(GOTESTFLAGS) -mod=vendor -tags='$(TEST_TAGS)' $(GO_PACKAGES)
360360

361361
.PHONY: test-frontend
362-
test-frontend:
362+
test-frontend: node_modules
363363
@NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color
364364

365365
.PHONY: test-check

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ NOTES:
101101
1. **YOU MUST READ THE [CONTRIBUTORS GUIDE](CONTRIBUTING.md) BEFORE STARTING TO WORK ON A PULL REQUEST.**
102102
2. If you have found a vulnerability in the project, please write privately to **[email protected]**. Thanks!
103103

104+
## Translating
105+
106+
Translations are done through Crowdin. If you want to translate to a new language ask one of the managers in the Crowdin project to add a new language there.
107+
108+
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope fo fill it as questions pop up.
109+
110+
https://docs.gitea.io/en-us/translation-guidelines/
111+
112+
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
113+
104114
## Further information
105115

106116
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.io/en-us/).

README_ZH.md

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ Gitea 的首要目标是创建一个极易安装,运行非常快速,安装
7171

7272
Fork -> Patch -> Push -> Pull Request
7373

74+
## 翻译
75+
76+
多语言翻译是基于Crowdin进行的.
77+
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
78+
7479
## 作者
7580

7681
* [Maintainers](https://github.com/orgs/go-gitea/people)

cmd/restore_repo.go

+11-66
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
package cmd
66

77
import (
8-
"context"
9-
"strings"
8+
"errors"
9+
"net/http"
1010

1111
"code.gitea.io/gitea/modules/log"
12-
"code.gitea.io/gitea/modules/migrations"
13-
"code.gitea.io/gitea/modules/migrations/base"
12+
"code.gitea.io/gitea/modules/private"
1413
"code.gitea.io/gitea/modules/setting"
15-
"code.gitea.io/gitea/modules/storage"
16-
pull_service "code.gitea.io/gitea/services/pull"
1714

1815
"github.com/urfave/cli"
1916
)
@@ -50,70 +47,18 @@ wiki, issues, labels, releases, release_assets, milestones, pull_requests, comme
5047
}
5148

5249
func runRestoreRepository(ctx *cli.Context) error {
53-
if err := initDB(); err != nil {
54-
return err
55-
}
56-
57-
log.Trace("AppPath: %s", setting.AppPath)
58-
log.Trace("AppWorkPath: %s", setting.AppWorkPath)
59-
log.Trace("Custom path: %s", setting.CustomPath)
60-
log.Trace("Log path: %s", setting.LogRootPath)
61-
setting.InitDBConfig()
62-
63-
if err := storage.Init(); err != nil {
64-
return err
65-
}
66-
67-
if err := pull_service.Init(); err != nil {
68-
return err
69-
}
70-
71-
var opts = base.MigrateOptions{
72-
RepoName: ctx.String("repo_name"),
73-
}
74-
75-
if len(ctx.String("units")) == 0 {
76-
opts.Wiki = true
77-
opts.Issues = true
78-
opts.Milestones = true
79-
opts.Labels = true
80-
opts.Releases = true
81-
opts.Comments = true
82-
opts.PullRequests = true
83-
opts.ReleaseAssets = true
84-
} else {
85-
units := strings.Split(ctx.String("units"), ",")
86-
for _, unit := range units {
87-
switch strings.ToLower(unit) {
88-
case "wiki":
89-
opts.Wiki = true
90-
case "issues":
91-
opts.Issues = true
92-
case "milestones":
93-
opts.Milestones = true
94-
case "labels":
95-
opts.Labels = true
96-
case "releases":
97-
opts.Releases = true
98-
case "release_assets":
99-
opts.ReleaseAssets = true
100-
case "comments":
101-
opts.Comments = true
102-
case "pull_requests":
103-
opts.PullRequests = true
104-
}
105-
}
106-
}
50+
setting.NewContext()
10751

108-
if err := migrations.RestoreRepository(
109-
context.Background(),
52+
statusCode, errStr := private.RestoreRepo(
11053
ctx.String("repo_dir"),
11154
ctx.String("owner_name"),
11255
ctx.String("repo_name"),
113-
); err != nil {
114-
log.Fatal("Failed to restore repository: %v", err)
115-
return err
56+
ctx.StringSlice("units"),
57+
)
58+
if statusCode == http.StatusOK {
59+
return nil
11660
}
11761

118-
return nil
62+
log.Fatal("Failed to restore repository: %v", errStr)
63+
return errors.New(errStr)
11964
}

cmd/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func setPort(port string) error {
175175

176176
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
177177
if err := cfg.SaveTo(setting.CustomConf); err != nil {
178-
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
178+
return fmt.Errorf("Error saving generated LOCAL_ROOT_URL to custom config: %v", err)
179179
}
180180
}
181181
return nil

cmd/web_letsencrypt.go

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66

77
import (
88
"net/http"
9+
"strconv"
910
"strings"
1011

1112
"code.gitea.io/gitea/modules/log"
@@ -22,6 +23,15 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
2223
// TODO: these are placeholders until we add options for each in settings with appropriate warning
2324
enableHTTPChallenge := true
2425
enableTLSALPNChallenge := true
26+
altHTTPPort := 0
27+
altTLSALPNPort := 0
28+
29+
if p, err := strconv.Atoi(setting.PortToRedirect); err == nil {
30+
altHTTPPort = p
31+
}
32+
if p, err := strconv.Atoi(setting.HTTPPort); err == nil {
33+
altTLSALPNPort = p
34+
}
2535

2636
magic := certmagic.NewDefault()
2737
magic.Storage = &certmagic.FileStorage{Path: directory}
@@ -30,6 +40,9 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
3040
Agreed: setting.LetsEncryptTOS,
3141
DisableHTTPChallenge: !enableHTTPChallenge,
3242
DisableTLSALPNChallenge: !enableTLSALPNChallenge,
43+
ListenHost: setting.HTTPAddr,
44+
AltTLSALPNPort: altTLSALPNPort,
45+
AltHTTPPort: altHTTPPort,
3346
})
3447

3548
magic.Issuers = []certmagic.Issuer{myACME}

contrib/environment-to-ini/environment-to-ini.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ func runEnvironmentToIni(c *cli.Context) error {
110110
}
111111
cfg.NameMapper = ini.SnackCase
112112

113+
changed := false
114+
113115
prefix := c.String("prefix") + "__"
114116

115117
for _, kv := range os.Environ() {
@@ -143,15 +145,21 @@ func runEnvironmentToIni(c *cli.Context) error {
143145
continue
144146
}
145147
}
148+
oldValue := key.Value()
149+
if !changed && oldValue != value {
150+
changed = true
151+
}
146152
key.SetValue(value)
147153
}
148154
destination := c.String("out")
149155
if len(destination) == 0 {
150156
destination = setting.CustomConf
151157
}
152-
err = cfg.SaveTo(destination)
153-
if err != nil {
154-
return err
158+
if destination != setting.CustomConf || changed {
159+
err = cfg.SaveTo(destination)
160+
if err != nil {
161+
return err
162+
}
155163
}
156164
if c.Bool("clear") {
157165
for _, kv := range os.Environ() {

contrib/systemd/gitea.service

+15-6
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ Description=Gitea (Git with a cup of tea)
33
After=syslog.target
44
After=network.target
55
###
6-
# Don't forget to add the database service requirements
6+
# Don't forget to add the database service dependencies
77
###
88
#
9-
#Requires=mysql.service
10-
#Requires=mariadb.service
11-
#Requires=postgresql.service
12-
#Requires=memcached.service
13-
#Requires=redis.service
9+
#Wants=mysql.service
10+
#After=mysql.service
11+
#
12+
#Wants=mariadb.service
13+
#After=mariadb.service
14+
#
15+
#Wants=postgresql.service
16+
#After=postgresql.service
17+
#
18+
#Wants=memcached.service
19+
#After=memcached.service
20+
#
21+
#Wants=redis.service
22+
#After=redis.service
1423
#
1524
###
1625
# If using socket activation for main http/s

0 commit comments

Comments
 (0)