Skip to content

Commit 6312f0d

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Fix incorrect `HookEventType` of pull request review comments (go-gitea#23650) [skip ci] Updated translations via Crowdin Fix codeblocks in the cheat sheet (go-gitea#23664) Drop migration for ForeignReference (go-gitea#23605) Fix new issue/pull request btn margin when it is next to sort (go-gitea#23647) A tool to help to backport locales, changes source strings to fix other broken translations (go-gitea#23633) Fix incorrect `show-modal` and `show-panel` class (go-gitea#23660) Restructure documentation. Now the documentation has installation, administration, usage, development, contributing the 5 main parts (go-gitea#23629) Check LFS/Packages settings in dump and doctor command (go-gitea#23631) Use a general approach to show tooltip, fix temporary tooltip bug (go-gitea#23574) Improve workflow event triggers (go-gitea#23613) Improve `<SvgIcon>` to make it output `svg` node and optimize performance (go-gitea#23570)
2 parents 795e9d1 + 9e04627 commit 6312f0d

File tree

165 files changed

+758
-507
lines changed

Some content is hidden

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

165 files changed

+758
-507
lines changed

Makefile

+2-1
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))
@@ -817,7 +818,7 @@ release-docs: | $(DIST_DIRS) docs
817818
.PHONY: docs
818819
docs:
819820
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
820-
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; \
821+
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; \
821822
fi
822823
cd docs; make trans-copy clean build-offline;
823824

build/backport-locales.go

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
//go:build ignore
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
"os"
8+
"os/exec"
9+
"path/filepath"
10+
"strings"
11+
12+
"gopkg.in/ini.v1"
13+
)
14+
15+
func main() {
16+
if len(os.Args) != 2 {
17+
println("usage: backport-locales <to-ref>")
18+
println("eg: backport-locales release/v1.19")
19+
os.Exit(1)
20+
}
21+
22+
ini.PrettyFormat = false
23+
mustNoErr := func(err error) {
24+
if err != nil {
25+
panic(err)
26+
}
27+
}
28+
collectInis := func(ref string) map[string]*ini.File {
29+
inis := map[string]*ini.File{}
30+
err := filepath.WalkDir("options/locale", func(path string, d os.DirEntry, err error) error {
31+
if err != nil {
32+
return err
33+
}
34+
if d.IsDir() || !strings.HasSuffix(d.Name(), ".ini") {
35+
return nil
36+
}
37+
cfg, err := ini.LoadSources(ini.LoadOptions{
38+
IgnoreInlineComment: true,
39+
UnescapeValueCommentSymbols: true,
40+
}, path)
41+
mustNoErr(err)
42+
inis[path] = cfg
43+
fmt.Printf("collecting: %s @ %s\n", path, ref)
44+
return nil
45+
})
46+
mustNoErr(err)
47+
return inis
48+
}
49+
50+
// collect new locales from current working directory
51+
inisNew := collectInis("HEAD")
52+
53+
// switch to the target ref, and collect the old locales
54+
cmd := exec.Command("git", "checkout", os.Args[1])
55+
cmd.Stdout = os.Stdout
56+
cmd.Stderr = os.Stderr
57+
mustNoErr(cmd.Run())
58+
inisOld := collectInis(os.Args[1])
59+
60+
// use old en-US as the base, and copy the new translations to the old locales
61+
enUsOld := inisOld["options/locale/locale_en-US.ini"]
62+
for path, iniOld := range inisOld {
63+
if iniOld == enUsOld {
64+
continue
65+
}
66+
iniNew := inisNew[path]
67+
if iniNew == nil {
68+
continue
69+
}
70+
for _, secEnUS := range enUsOld.Sections() {
71+
secOld := iniOld.Section(secEnUS.Name())
72+
secNew := iniNew.Section(secEnUS.Name())
73+
for _, keyEnUs := range secEnUS.Keys() {
74+
if secNew.HasKey(keyEnUs.Name()) {
75+
oldStr := secOld.Key(keyEnUs.Name()).String()
76+
newStr := secNew.Key(keyEnUs.Name()).String()
77+
// A bug: many of new translations with ";" are broken in Crowdin (due to last messy restoring)
78+
// As the broken strings are gradually fixed, this workaround check could be removed (in a few months?)
79+
if strings.Contains(oldStr, ";") && !strings.Contains(newStr, ";") {
80+
println("skip potential broken string", path, secEnUS.Name(), keyEnUs.Name())
81+
continue
82+
}
83+
secOld.Key(keyEnUs.Name()).SetValue(newStr)
84+
}
85+
}
86+
}
87+
mustNoErr(iniOld.SaveTo(path))
88+
}
89+
}

cmd/dump.go

+4
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 {
@@ -364,6 +366,8 @@ func runDump(ctx *cli.Context) error {
364366

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

docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ THEME := themes/gitea
22
PUBLIC := public
33
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

+5
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
+14
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+
---
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
---
+13
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+
---
+13
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

+2-2
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

+1-1
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

+1-1
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

+1-1
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

+4-4
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

+2-2
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

docs/content/doc/advanced/config-cheat-sheet.en-us.md renamed to docs/content/doc/administration/config-cheat-sheet.en-us.md

+13-13
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: "Config Cheat Sheet"
12-
weight: 20
12+
weight: 30
1313
identifier: "config-cheat-sheet"
1414
---
1515

@@ -753,7 +753,7 @@ and
753753
- `FORCE_TRUST_SERVER_CERT`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe. Consider adding the certificate to the system trust store instead.
754754
- `USER`: **\<empty\>**: Username of mailing user (usually the sender's e-mail address).
755755
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
756-
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information.
756+
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/administration/email-setup.en-us.md" >}}) for more information.
757757
- `ENABLE_HELO`: **true**: Enable HELO operation.
758758
- `HELO_HOSTNAME`: **(retrieved from system)**: HELO hostname.
759759
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or the "Name" \<[email protected]\> format.
@@ -994,7 +994,7 @@ Default templates for project boards:
994994

995995
### Extended cron tasks (not enabled by default)
996996

997-
#### Cron - Garbage collect all repositories ('cron.git_gc_repos')
997+
#### Cron - Garbage collect all repositories (`cron.git_gc_repos`)
998998

999999
- `ENABLED`: **false**: Enable service.
10001000
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
@@ -1003,66 +1003,66 @@ Default templates for project boards:
10031003
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10041004
- `ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. The default value is same with [git] -> GC_ARGS
10051005

1006-
#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys ('cron.resync_all_sshkeys')
1006+
#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys (`cron.resync_all_sshkeys`)
10071007

10081008
- `ENABLED`: **false**: Enable service.
10091009
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10101010
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10111011
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10121012

1013-
#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories ('cron.resync_all_hooks')
1013+
#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories (`cron.resync_all_hooks`)
10141014

10151015
- `ENABLED`: **false**: Enable service.
10161016
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10171017
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10181018
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10191019

1020-
#### Cron - Reinitialize all missing Git repositories for which records exist ('cron.reinit_missing_repos')
1020+
#### Cron - Reinitialize all missing Git repositories for which records exist (`cron.reinit_missing_repos`)
10211021

10221022
- `ENABLED`: **false**: Enable service.
10231023
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10241024
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10251025
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10261026

1027-
#### Cron - Delete all repositories missing their Git files ('cron.delete_missing_repos')
1027+
#### Cron - Delete all repositories missing their Git files (`cron.delete_missing_repos`)
10281028

10291029
- `ENABLED`: **false**: Enable service.
10301030
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10311031
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10321032
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10331033

1034-
#### Cron - Delete generated repository avatars ('cron.delete_generated_repository_avatars')
1034+
#### Cron - Delete generated repository avatars (`cron.delete_generated_repository_avatars`)
10351035

10361036
- `ENABLED`: **false**: Enable service.
10371037
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10381038
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10391039
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
10401040

1041-
#### Cron - Delete all old actions from database ('cron.delete_old_actions')
1041+
#### Cron - Delete all old actions from database (`cron.delete_old_actions`)
10421042

10431043
- `ENABLED`: **false**: Enable service.
10441044
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10451045
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
10461046
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
10471047
- `OLDER_THAN`: **@every 8760h**: any action older than this expression will be deleted from database, suggest using `8760h` (1 year) because that's the max length of heatmap.
10481048

1049-
#### Cron - Check for new Gitea versions ('cron.update_checker')
1049+
#### Cron - Check for new Gitea versions (`cron.update_checker`)
10501050

10511051
- `ENABLED`: **true**: Enable service.
10521052
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10531053
- `ENABLE_SUCCESS_NOTICE`: **true**: Set to false to switch off success notices.
10541054
- `SCHEDULE`: **@every 168h**: Cron syntax for scheduling a work, e.g. `@every 168h`.
10551055
- `HTTP_ENDPOINT`: **https://dl.gitea.io/gitea/version.json**: the endpoint that Gitea will check for newer versions
10561056

1057-
#### Cron - Delete all old system notices from database ('cron.delete_old_system_notices')
1057+
#### Cron - Delete all old system notices from database (`cron.delete_old_system_notices`)
10581058

10591059
- `ENABLED`: **false**: Enable service.
10601060
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
10611061
- `NO_SUCCESS_NOTICE`: **false**: Set to true to switch off success notices.
10621062
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
10631063
- `OLDER_THAN`: **@every 8760h**: any system notice older than this expression will be deleted from database.
10641064

1065-
#### Cron - Garbage collect LFS pointers in repositories ('cron.gc_lfs')
1065+
#### Cron - Garbage collect LFS pointers in repositories (`cron.gc_lfs`)
10661066

10671067
- `ENABLED`: **false**: Enable service.
10681068
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).

0 commit comments

Comments
 (0)