Skip to content

Commit 0a52a95

Browse files
committed
Merge branch 'release/v1.19' of https://github.com/go-gitea/gitea into backport/23684_to_v1.19
2 parents fe89f58 + d977e7e commit 0a52a95

File tree

471 files changed

+17380
-11756
lines changed

Some content is hidden

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

471 files changed

+17380
-11756
lines changed

.drone.yml

Lines changed: 97 additions & 32 deletions
Large diffs are not rendered by default.

.stylelintrc.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
plugins:
22
- stylelint-declaration-strict-value
33

4+
ignoreFiles:
5+
- "**/*.go"
6+
47
overrides:
5-
- files: ["**/*.less"]
6-
customSyntax: postcss-less
78
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
89
rules:
910
scale-unlimited/declaration-strict-value: null
11+
- files: ["**/chroma/*", "**/codemirror/*"]
12+
rules:
13+
block-no-empty: null
1014

1115
rules:
1216
alpha-value-notation: null

CHANGELOG.md

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ ifeq ($(RACE_ENABLED),true)
7777
endif
7878

7979
STORED_VERSION_FILE := VERSION
80+
HUGO_VERSION ?= 0.111.3
8081

8182
ifneq ($(DRONE_TAG),)
8283
VERSION ?= $(subst v,,$(DRONE_TAG))
@@ -105,7 +106,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
105106

106107
FOMANTIC_WORK_DIR := web_src/fomantic
107108

108-
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
109+
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
109110
WEBPACK_CONFIGS := webpack.config.js
110111
WEBPACK_DEST := public/js/index.js public/css/index.css
111112
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack public/serviceworker.js
@@ -131,7 +132,7 @@ TEST_TAGS ?= sqlite sqlite_unlock_notify
131132
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR)
132133

133134
GO_DIRS := cmd tests models modules routers build services tools
134-
WEB_DIRS := web_src/js web_src/less
135+
WEB_DIRS := web_src/js web_src/css
135136

136137
GO_SOURCES := $(wildcard *.go)
137138
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)
@@ -341,7 +342,7 @@ lint: lint-frontend lint-backend
341342
.PHONY: lint-frontend
342343
lint-frontend: node_modules
343344
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e
344-
npx stylelint --color --max-warnings=0 web_src/less
345+
npx stylelint --color --max-warnings=0 web_src/css
345346
npx spectral lint -q -F hint $(SWAGGER_SPEC)
346347
npx markdownlint docs *.md
347348

@@ -816,7 +817,7 @@ release-docs: | $(DIST_DIRS) docs
816817
.PHONY: docs
817818
docs:
818819
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
819-
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
820+
curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
820821
fi
821822
cd docs; make trans-copy clean build-offline;
822823

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/admin.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package cmd
77
import (
88
"errors"
99
"fmt"
10+
"net/url"
1011
"os"
1112
"strings"
1213
"text/tabwriter"
@@ -469,11 +470,19 @@ func runAddOauth(c *cli.Context) error {
469470
return err
470471
}
471472

473+
config := parseOAuth2Config(c)
474+
if config.Provider == "openidConnect" {
475+
discoveryURL, err := url.Parse(config.OpenIDConnectAutoDiscoveryURL)
476+
if err != nil || (discoveryURL.Scheme != "http" && discoveryURL.Scheme != "https") {
477+
return fmt.Errorf("invalid Auto Discovery URL: %s (this must be a valid URL starting with http:// or https://)", config.OpenIDConnectAutoDiscoveryURL)
478+
}
479+
}
480+
472481
return auth_model.CreateSource(&auth_model.Source{
473482
Type: auth_model.OAuth2,
474483
Name: c.String("name"),
475484
IsActive: true,
476-
Cfg: parseOAuth2Config(c),
485+
Cfg: config,
477486
})
478487
}
479488

cmd/convert.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func runConvert(ctx *cli.Context) error {
3535
log.Info("Log path: %s", setting.Log.RootPath)
3636
log.Info("Configuration file: %s", setting.CustomConf)
3737

38-
if !setting.Database.UseMySQL {
38+
if !setting.Database.Type.IsMySQL() {
3939
fmt.Println("This command can only be used with a MySQL database")
4040
return nil
4141
}

cmd/dump.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ func runDump(ctx *cli.Context) error {
250250

251251
if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") {
252252
log.Info("Skip dumping LFS data")
253+
} else if !setting.LFS.StartServer {
254+
log.Info("LFS isn't enabled. Skip dumping LFS data")
253255
} else if err := storage.LFS.IterateObjects(func(objPath string, object storage.Object) error {
254256
info, err := object.Stat()
255257
if err != nil {
@@ -272,13 +274,14 @@ func runDump(ctx *cli.Context) error {
272274
fatal("Failed to create tmp file: %v", err)
273275
}
274276
defer func() {
277+
_ = dbDump.Close()
275278
if err := util.Remove(dbDump.Name()); err != nil {
276279
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
277280
}
278281
}()
279282

280283
targetDBType := ctx.String("database")
281-
if len(targetDBType) > 0 && targetDBType != setting.Database.Type {
284+
if len(targetDBType) > 0 && targetDBType != setting.Database.Type.String() {
282285
log.Info("Dumping database %s => %s...", setting.Database.Type, targetDBType)
283286
} else {
284287
log.Info("Dumping database...")
@@ -363,6 +366,8 @@ func runDump(ctx *cli.Context) error {
363366

364367
if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") {
365368
log.Info("Skip dumping package data")
369+
} else if !setting.Packages.Enabled {
370+
log.Info("Packages isn't enabled. Skip dumping package data")
366371
} else if err := storage.Packages.IterateObjects(func(objPath string, object storage.Object) error {
367372
info, err := object.Stat()
368373
if err != nil {

cmd/migrate_storage.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,21 @@ var CmdMigrateStorage = cli.Command{
7272
cli.StringFlag{
7373
Name: "minio-base-path",
7474
Value: "",
75-
Usage: "Minio storage basepath on the bucket",
75+
Usage: "Minio storage base path on the bucket",
7676
},
7777
cli.BoolFlag{
7878
Name: "minio-use-ssl",
7979
Usage: "Enable SSL for minio",
8080
},
81+
cli.BoolFlag{
82+
Name: "minio-insecure-skip-verify",
83+
Usage: "Skip SSL verification",
84+
},
85+
cli.StringFlag{
86+
Name: "minio-checksum-algorithm",
87+
Value: "",
88+
Usage: "Minio checksum algorithm (default/md5)",
89+
},
8190
},
8291
}
8392

@@ -168,13 +177,15 @@ func runMigrateStorage(ctx *cli.Context) error {
168177
dstStorage, err = storage.NewMinioStorage(
169178
stdCtx,
170179
storage.MinioStorageConfig{
171-
Endpoint: ctx.String("minio-endpoint"),
172-
AccessKeyID: ctx.String("minio-access-key-id"),
173-
SecretAccessKey: ctx.String("minio-secret-access-key"),
174-
Bucket: ctx.String("minio-bucket"),
175-
Location: ctx.String("minio-location"),
176-
BasePath: ctx.String("minio-base-path"),
177-
UseSSL: ctx.Bool("minio-use-ssl"),
180+
Endpoint: ctx.String("minio-endpoint"),
181+
AccessKeyID: ctx.String("minio-access-key-id"),
182+
SecretAccessKey: ctx.String("minio-secret-access-key"),
183+
Bucket: ctx.String("minio-bucket"),
184+
Location: ctx.String("minio-location"),
185+
BasePath: ctx.String("minio-base-path"),
186+
UseSSL: ctx.Bool("minio-use-ssl"),
187+
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
188+
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
178189
})
179190
default:
180191
return fmt.Errorf("unsupported storage type: %s", ctx.String("storage"))

custom/conf/app.example.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@ ROUTER = console
18321832
;ENABLED = true
18331833
;;
18341834
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
1835-
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
1835+
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
18361836
;;
18371837
;; Max size of each file. Defaults to 4MB
18381838
;MAX_SIZE = 4
@@ -1874,6 +1874,9 @@ ROUTER = console
18741874
;;
18751875
;; Minio skip SSL verification available when STORAGE_TYPE is `minio`
18761876
;MINIO_INSECURE_SKIP_VERIFY = false
1877+
;;
1878+
;; Minio checksum algorithm: default (for MinIO or AWS S3) or md5 (for Cloudflare or Backblaze)
1879+
;MINIO_CHECKSUM_ALGORITHM = default
18771880

18781881
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18791882
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2256,6 +2259,17 @@ ROUTER = console
22562259
;PULL = 300
22572260
;GC = 60
22582261

2262+
2263+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2264+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2265+
;; Git Reflog timeout in days
2266+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2267+
;[git.reflog]
2268+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2269+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2270+
;ENABLED = true
2271+
;EXPIRATION = 90
2272+
22592273
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22602274
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22612275
;[mirror]

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
THEME := themes/gitea
22
PUBLIC := public
3-
ARCHIVE := https://dl.gitea.io/theme/master.tar.gz
3+
ARCHIVE := https://dl.gitea.com/theme/main.tar.gz
44

5-
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0
5+
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.111.3
66

77
.PHONY: all
88
all: build

docs/config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ params:
2626
repo: "https://github.com/go-gitea/gitea"
2727
docContentPath: "docs/content"
2828

29+
markup:
30+
tableOfContents:
31+
startLevel: 1
32+
endLevel: 9
33+
2934
outputs:
3035
home:
3136
- HTML
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
date: "2016-12-01T16:00:00+02:00"
3+
title: "Administration"
4+
slug: "administration"
5+
weight: 30
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
name: "Administration"
11+
weight: 20
12+
collapse: true
13+
identifier: "administration"
14+
---
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
date: "2017-08-23T09:00:00+02:00"
33
title: "Avancé"
4-
slug: "advanced"
4+
slug: "administration"
55
weight: 30
66
toc: false
77
draft: false
88
menu:
99
sidebar:
1010
name: "Avancé"
11-
weight: 40
12-
identifier: "advanced"
11+
weight: 20
12+
identifier: "administration"
1313
---
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
date: "2016-12-01T16:00:00+02:00"
3+
title: "运维"
4+
slug: "administration"
5+
weight: 30
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
name: "运维"
11+
weight: 20
12+
identifier: "administration"
13+
---
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
date: "2016-12-01T16:00:00+02:00"
3+
title: "運維"
4+
slug: "administration"
5+
weight: 30
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
name: "運維"
11+
weight: 20
12+
identifier: "administration"
13+
---

docs/content/doc/advanced/adding-legal-pages.en-us.md renamed to docs/content/doc/administration/adding-legal-pages.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "advanced"
10+
parent: "administration"
1111
name: "Adding Legal Pages"
1212
identifier: "adding-legal-pages"
13-
weight: 9
13+
weight: 110
1414
---
1515

1616
Some jurisdictions (such as EU), requires certain legal pages (e.g. Privacy Policy) to be added to website. Follow these steps to add them to your Gitea instance.

docs/content/doc/usage/backup-and-restore.en-us.md renamed to docs/content/doc/administration/backup-and-restore.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "usage"
10+
parent: "administration"
1111
name: "Backup and Restore"
1212
weight: 11
1313
identifier: "backup-and-restore"

docs/content/doc/usage/backup-and-restore.zh-cn.md renamed to docs/content/doc/administration/backup-and-restore.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "usage"
10+
parent: "administration"
1111
name: "备份与恢复"
1212
weight: 11
1313
identifier: "backup-and-restore"

docs/content/doc/usage/backup-and-restore.zh-tw.md renamed to docs/content/doc/administration/backup-and-restore.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "usage"
10+
parent: "administration"
1111
name: "備份與還原"
1212
weight: 11
1313
identifier: "backup-and-restore"

docs/content/doc/advanced/cmd-embedded.en-us.md renamed to docs/content/doc/administration/cmd-embedded.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "advanced"
10+
parent: "administration"
1111
name: "Embedded data extraction tool"
12-
weight: 40
12+
weight: 20
1313
identifier: "cmd-embedded"
1414
---
1515

@@ -21,7 +21,7 @@ menu:
2121

2222
Gitea's executable contains all the resources required to run: templates, images, style-sheets
2323
and translations. Any of them can be overridden by placing a replacement in a matching path
24-
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})).
24+
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/administration/customizing-gitea.en-us.md" >}})).
2525

2626
To obtain a copy of the embedded resources ready for editing, the `embedded` command from the CLI
2727
can be used from the OS shell interface.
@@ -85,7 +85,7 @@ The default is the current directory.
8585
The `--custom` flag tells Gitea to extract the files directly into the `custom` directory.
8686
For this to work, the command needs to know the location of the `app.ini` configuration
8787
file (`--config`) and, depending of the configuration, be ran from the directory where
88-
Gitea normally starts. See [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) for details.
88+
Gitea normally starts. See [Customizing Gitea]({{< relref "doc/administration/customizing-gitea.en-us.md" >}}) for details.
8989

9090
The `--overwrite` flag allows any existing files in the destination directory to be overwritten.
9191

docs/content/doc/usage/command-line.en-us.md renamed to docs/content/doc/administration/command-line.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ toc: false
77
draft: false
88
menu:
99
sidebar:
10-
parent: "usage"
10+
parent: "administration"
1111
name: "Command Line"
12-
weight: 10
12+
weight: 1
1313
identifier: "command-line"
1414
---
1515

0 commit comments

Comments
 (0)